Skip to content

Commit ed09dd3

Browse files
committed
Merge #10142: Run bitcoin_test-qt under minimal QPA platform
bf10264 Run bitcoin_test-qt under minimal QPA platform (Russell Yanofsky) Tree-SHA512: 35782f0d7e4dcdc27d991d5a10fcffbd2d201139293fe7917ef6f7cd7ae4d3a162ebc21f83266d821ae3bad86f62d947b047bb317f6c5899df4d6bcb4c957157
2 parents 7032021 + bf10264 commit ed09dd3

File tree

3 files changed

+22
-0
lines changed

3 files changed

+22
-0
lines changed

build-aux/m4/bitcoin_qt.m4

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,8 @@ AC_DEFUN([BITCOIN_QT_CONFIGURE],[
130130
if test "x$bitcoin_cv_need_acc_widget" = "xyes"; then
131131
_BITCOIN_QT_CHECK_STATIC_PLUGINS([Q_IMPORT_PLUGIN(AccessibleFactory)], [-lqtaccessiblewidgets])
132132
fi
133+
_BITCOIN_QT_CHECK_STATIC_PLUGINS([Q_IMPORT_PLUGIN(QMinimalIntegrationPlugin)],[-lqminimal])
134+
AC_DEFINE(QT_QPA_PLATFORM_MINIMAL, 1, [Define this symbol if the minimal qt platform exists])
133135
if test x$TARGET_OS = xwindows; then
134136
_BITCOIN_QT_CHECK_STATIC_PLUGINS([Q_IMPORT_PLUGIN(QWindowsIntegrationPlugin)],[-lqwindows])
135137
AC_DEFINE(QT_QPA_PLATFORM_WINDOWS, 1, [Define this symbol if the qt platform is windows])

src/qt/test/test_main.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@ Q_IMPORT_PLUGIN(qjpcodecs)
3131
Q_IMPORT_PLUGIN(qtwcodecs)
3232
Q_IMPORT_PLUGIN(qkrcodecs)
3333
#else
34+
#if defined(QT_QPA_PLATFORM_MINIMAL)
35+
Q_IMPORT_PLUGIN(QMinimalIntegrationPlugin);
36+
#endif
3437
#if defined(QT_QPA_PLATFORM_XCB)
3538
Q_IMPORT_PLUGIN(QXcbIntegrationPlugin);
3639
#elif defined(QT_QPA_PLATFORM_WINDOWS)
@@ -53,6 +56,11 @@ int main(int argc, char *argv[])
5356

5457
bool fInvalid = false;
5558

59+
// Prefer the "minimal" platform for the test instead of the normal default
60+
// platform ("xcb", "windows", or "cocoa") so tests can't unintentially
61+
// interfere with any background GUIs and don't require extra resources.
62+
setenv("QT_QPA_PLATFORM", "minimal", 0);
63+
5664
// Don't remove this, it's needed to access
5765
// QApplication:: and QCoreApplication:: in the tests
5866
QApplication app(argc, argv);

src/qt/test/wallettests.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,18 @@ QModelIndex FindTx(const QAbstractItemModel& model, const uint256& txid)
6868
}
6969

7070
//! Simple qt wallet tests.
71+
//
72+
// Test widgets can be debugged interactively calling show() on them and
73+
// manually running the event loop, e.g.:
74+
//
75+
// sendCoinsDialog.show();
76+
// QEventLoop().exec();
77+
//
78+
// This also requires overriding the default minimal Qt platform:
79+
//
80+
// src/qt/test/test_bitcoin-qt -platform xcb # Linux
81+
// src/qt/test/test_bitcoin-qt -platform windows # Windows
82+
// src/qt/test/test_bitcoin-qt -platform cocoa # macOS
7183
void WalletTests::walletTests()
7284
{
7385
// Set up wallet and chain with 101 blocks (1 mature block for spending).

0 commit comments

Comments
 (0)