Merge bitcoin/bitcoin#35838: qa: Enable interface_gui.py on macOS

45f5609f2e qa: Enable `interface_gui.py` on macOS (Hennadii Stepanov)

Pull request description:

  This is a follow-up to bitcoin/bitcoin#35551.

  Addresses https://github.com/bitcoin/bitcoin/pull/35551#discussion_r3619539472.

ACKs for top commit:
  maflcko:
    lgtm ACK 45f5609f2e

Tree-SHA512: 2fd8ebd8529d9d2dc0535181995fb126dfc1033e74ed7680e600fa41bf931f047d82095547538a0c94e1254ecd465d72b4a0ff5189663f25425e1477f845863e
This commit is contained in:
merge-script
2026-07-30 12:32:26 +01:00
2 changed files with 8 additions and 5 deletions

View File

@@ -21,11 +21,9 @@ class GuiTest(BitcoinTestFramework):
self.skip_if_no_gui()
# On Windows, bitcoin.exe exits immediately when launching bitcoin-gui.exe,
# causing the test framework's process monitor to see a premature node exit.
# On macOS, bitcoin-qt's Cocoa code assumes NSApp is initialized, but the
# minimal Qt platform plugin skips that, causing crashes.
# Both issues are likely fixable.
if platform.system() in ("Windows", "Darwin"):
raise SkipTest("bitcoin-gui test not supported on Windows or macOS")
# This issue is likely fixable.
if platform.system() == "Windows":
raise SkipTest("bitcoin-gui test not supported on Windows")
def setup_nodes(self):
self.extra_init = [{"use_gui": True}]

View File

@@ -282,6 +282,11 @@ class TestNode():
subp_env = dict(os.environ, LIBC_FATAL_STDERR_="1")
if self.use_gui:
subp_env.setdefault("QT_QPA_PLATFORM", "minimal")
if platform.system() == "Darwin":
# QMacStyle assumes a Cocoa platform window, which the minimal platform
# does not provide. In particular, painting a QGroupBox can make Qt call
# addSubview: on an invalid native object (QTBUG-49686).
subp_env.setdefault("QT_STYLE_OVERRIDE", "fusion")
subp_env.setdefault("LC_ALL", "nl_NL.UTF-8") # Set language to try to trigger translation bugs
if sys.platform.startswith("linux") and "XDG_RUNTIME_DIR" not in subp_env:
# Qt prints warnings to stderr when XDG_RUNTIME_DIR is unset or has wrong