mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-07-23 06:39:58 +02:00
Merge bitcoin-core/gui#951: test: Nudge toward QT_STYLE_OVERRIDE=fusion on macOS
fa0c8337a8test: Nudge toward QT_STYLE_OVERRIDE=fusion on macOS (MarcoFalke)faa50c08b1refactor: Run clang-format on qt test_main.cpp (MarcoFalke) Pull request description: Fixes https://github.com/bitcoin/bitcoin/issues/35771 Using the Fusion style works around QTBUG-49686. Otherwise, there could be an invalid call under the QMacStyle. Can be tested via: ``` QT_STYLE_OVERRIDE=macOS build/bin/test_bitcoin-qt # fails QT_STYLE_OVERRIDE=fusion build/bin/test_bitcoin-qt # passes ``` ACKs for top commit: hebasto: ACKfa0c8337a8, tested on macOS Tahoe 26.5.2 (Intel). Tree-SHA512: 3fd4e65f708ce5acd5243747661b76a5cf25e6810b49586dee5971f5f8bad13a907ee27d6830124c8c6d2b7e807661a59404f387ff59c1feeacfaa4b276bf270
This commit is contained in:
@@ -60,12 +60,18 @@ int main(int argc, char* argv[])
|
||||
// Prefer the "minimal" platform for the test instead of the normal default
|
||||
// platform ("xcb", "windows", or "cocoa") so tests can't unintentionally
|
||||
// interfere with any background GUIs and don't require extra resources.
|
||||
#if defined(WIN32)
|
||||
if (getenv("QT_QPA_PLATFORM") == nullptr) _putenv_s("QT_QPA_PLATFORM", "minimal");
|
||||
#else
|
||||
setenv("QT_QPA_PLATFORM", "minimal", 0 /* overwrite */);
|
||||
#endif
|
||||
#if defined(WIN32)
|
||||
if (getenv("QT_QPA_PLATFORM") == nullptr) _putenv_s("QT_QPA_PLATFORM", "minimal");
|
||||
#else
|
||||
setenv("QT_QPA_PLATFORM", "minimal", 0 /* overwrite */);
|
||||
#endif
|
||||
|
||||
#ifdef Q_OS_MACOS
|
||||
// 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).
|
||||
setenv("QT_STYLE_OVERRIDE", "fusion", 0 /* overwrite */);
|
||||
#endif
|
||||
|
||||
QCoreApplication::setOrganizationName(QAPP_ORG_NAME);
|
||||
QCoreApplication::setApplicationName(QAPP_APP_NAME_DEFAULT "-test");
|
||||
|
||||
Reference in New Issue
Block a user