Merge #10142: Run bitcoin_test-qt under minimal QPA platform

bf10264 Run bitcoin_test-qt under minimal QPA platform (Russell Yanofsky)

Tree-SHA512: 35782f0d7e4dcdc27d991d5a10fcffbd2d201139293fe7917ef6f7cd7ae4d3a162ebc21f83266d821ae3bad86f62d947b047bb317f6c5899df4d6bcb4c957157
This commit is contained in:
Wladimir J. van der Laan 2017-04-10 08:57:26 +02:00
commit ed09dd3f5a
No known key found for this signature in database
GPG Key ID: 74810B012346C9A6
3 changed files with 22 additions and 0 deletions

View File

@ -130,6 +130,8 @@ AC_DEFUN([BITCOIN_QT_CONFIGURE],[
if test "x$bitcoin_cv_need_acc_widget" = "xyes"; then if test "x$bitcoin_cv_need_acc_widget" = "xyes"; then
_BITCOIN_QT_CHECK_STATIC_PLUGINS([Q_IMPORT_PLUGIN(AccessibleFactory)], [-lqtaccessiblewidgets]) _BITCOIN_QT_CHECK_STATIC_PLUGINS([Q_IMPORT_PLUGIN(AccessibleFactory)], [-lqtaccessiblewidgets])
fi fi
_BITCOIN_QT_CHECK_STATIC_PLUGINS([Q_IMPORT_PLUGIN(QMinimalIntegrationPlugin)],[-lqminimal])
AC_DEFINE(QT_QPA_PLATFORM_MINIMAL, 1, [Define this symbol if the minimal qt platform exists])
if test x$TARGET_OS = xwindows; then if test x$TARGET_OS = xwindows; then
_BITCOIN_QT_CHECK_STATIC_PLUGINS([Q_IMPORT_PLUGIN(QWindowsIntegrationPlugin)],[-lqwindows]) _BITCOIN_QT_CHECK_STATIC_PLUGINS([Q_IMPORT_PLUGIN(QWindowsIntegrationPlugin)],[-lqwindows])
AC_DEFINE(QT_QPA_PLATFORM_WINDOWS, 1, [Define this symbol if the qt platform is windows]) AC_DEFINE(QT_QPA_PLATFORM_WINDOWS, 1, [Define this symbol if the qt platform is windows])

View File

@ -31,6 +31,9 @@ Q_IMPORT_PLUGIN(qjpcodecs)
Q_IMPORT_PLUGIN(qtwcodecs) Q_IMPORT_PLUGIN(qtwcodecs)
Q_IMPORT_PLUGIN(qkrcodecs) Q_IMPORT_PLUGIN(qkrcodecs)
#else #else
#if defined(QT_QPA_PLATFORM_MINIMAL)
Q_IMPORT_PLUGIN(QMinimalIntegrationPlugin);
#endif
#if defined(QT_QPA_PLATFORM_XCB) #if defined(QT_QPA_PLATFORM_XCB)
Q_IMPORT_PLUGIN(QXcbIntegrationPlugin); Q_IMPORT_PLUGIN(QXcbIntegrationPlugin);
#elif defined(QT_QPA_PLATFORM_WINDOWS) #elif defined(QT_QPA_PLATFORM_WINDOWS)
@ -53,6 +56,11 @@ int main(int argc, char *argv[])
bool fInvalid = false; bool fInvalid = false;
// Prefer the "minimal" platform for the test instead of the normal default
// platform ("xcb", "windows", or "cocoa") so tests can't unintentially
// interfere with any background GUIs and don't require extra resources.
setenv("QT_QPA_PLATFORM", "minimal", 0);
// Don't remove this, it's needed to access // Don't remove this, it's needed to access
// QApplication:: and QCoreApplication:: in the tests // QApplication:: and QCoreApplication:: in the tests
QApplication app(argc, argv); QApplication app(argc, argv);

View File

@ -68,6 +68,18 @@ QModelIndex FindTx(const QAbstractItemModel& model, const uint256& txid)
} }
//! Simple qt wallet tests. //! Simple qt wallet tests.
//
// Test widgets can be debugged interactively calling show() on them and
// manually running the event loop, e.g.:
//
// sendCoinsDialog.show();
// QEventLoop().exec();
//
// This also requires overriding the default minimal Qt platform:
//
// src/qt/test/test_bitcoin-qt -platform xcb # Linux
// src/qt/test/test_bitcoin-qt -platform windows # Windows
// src/qt/test/test_bitcoin-qt -platform cocoa # macOS
void WalletTests::walletTests() void WalletTests::walletTests()
{ {
// Set up wallet and chain with 101 blocks (1 mature block for spending). // Set up wallet and chain with 101 blocks (1 mature block for spending).