diff options
Diffstat (limited to 'src/qt/test')
-rw-r--r-- | src/qt/test/apptests.cpp | 4 | ||||
-rw-r--r-- | src/qt/test/optiontests.cpp | 17 | ||||
-rw-r--r-- | src/qt/test/test_main.cpp | 55 | ||||
-rw-r--r-- | src/qt/test/wallettests.cpp | 2 |
4 files changed, 51 insertions, 27 deletions
diff --git a/src/qt/test/apptests.cpp b/src/qt/test/apptests.cpp index 9007b183aa..10abcb00eb 100644 --- a/src/qt/test/apptests.cpp +++ b/src/qt/test/apptests.cpp @@ -14,10 +14,6 @@ #include <test/util/setup_common.h> #include <validation.h> -#if defined(HAVE_CONFIG_H) -#include <config/bitcoin-config.h> -#endif - #include <QAction> #include <QLineEdit> #include <QRegularExpression> diff --git a/src/qt/test/optiontests.cpp b/src/qt/test/optiontests.cpp index e5a5179d87..0f82f65f3e 100644 --- a/src/qt/test/optiontests.cpp +++ b/src/qt/test/optiontests.cpp @@ -2,6 +2,8 @@ // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. +#include <config/bitcoin-config.h> // IWYU pragma: keep + #include <common/args.h> #include <init.h> #include <qt/bitcoin.h> @@ -46,6 +48,17 @@ void OptionTests::migrateSettings() settings.sync(); + QVERIFY(settings.contains("nDatabaseCache")); + QVERIFY(settings.contains("nThreadsScriptVerif")); + QVERIFY(settings.contains("fUseUPnP")); + QVERIFY(settings.contains("fListen")); + QVERIFY(settings.contains("bPrune")); + QVERIFY(settings.contains("nPruneSize")); + QVERIFY(settings.contains("fUseProxy")); + QVERIFY(settings.contains("addrProxy")); + QVERIFY(settings.contains("fUseSeparateProxyTor")); + QVERIFY(settings.contains("addrSeparateProxyTor")); + OptionsModel options{m_node}; bilingual_str error; QVERIFY(options.Init(error)); @@ -61,7 +74,11 @@ void OptionTests::migrateSettings() QVERIFY(!settings.contains("addrSeparateProxyTor")); std::ifstream file(gArgs.GetDataDirNet() / "settings.json"); + std::string default_warning = strprintf("This file is automatically generated and updated by %s. Please do not edit this file while the node " + "is running, as any changes might be ignored or overwritten.", + PACKAGE_NAME); QCOMPARE(std::string(std::istreambuf_iterator<char>(file), std::istreambuf_iterator<char>()).c_str(), "{\n" + " \"_warning_\": \""+ default_warning+"\",\n" " \"dbcache\": \"600\",\n" " \"listen\": false,\n" " \"onion\": \"onion:234\",\n" diff --git a/src/qt/test/test_main.cpp b/src/qt/test/test_main.cpp index e45fc1ced8..f310d0a02b 100644 --- a/src/qt/test/test_main.cpp +++ b/src/qt/test/test_main.cpp @@ -2,13 +2,12 @@ // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. -#if defined(HAVE_CONFIG_H) -#include <config/bitcoin-config.h> -#endif +#include <config/bitcoin-config.h> // IWYU pragma: keep #include <interfaces/init.h> #include <interfaces/node.h> #include <qt/bitcoin.h> +#include <qt/guiconstants.h> #include <qt/test/apptests.h> #include <qt/test/optiontests.h> #include <qt/test/rpcnestedtests.h> @@ -24,6 +23,7 @@ #include <QApplication> #include <QDebug> #include <QObject> +#include <QSettings> #include <QTest> #include <functional> @@ -48,6 +48,8 @@ const std::function<void(const std::string&)> G_TEST_LOG_FUN{}; const std::function<std::vector<const char*>()> G_TEST_COMMAND_LINE_ARGUMENTS{}; +const std::function<std::string()> G_TEST_GET_FULL_NAME{}; + // This is all you need to run all the tests int main(int argc, char* argv[]) { @@ -83,36 +85,45 @@ int main(int argc, char* argv[]) setenv("QT_QPA_PLATFORM", "minimal", 0 /* overwrite */); #endif - BitcoinApplication app; - app.setApplicationName("Bitcoin-Qt-test"); - app.createNode(*init); + + QCoreApplication::setOrganizationName(QAPP_ORG_NAME); + QCoreApplication::setApplicationName(QAPP_APP_NAME_DEFAULT "-test"); int num_test_failures{0}; - AppTests app_tests(app); - num_test_failures += QTest::qExec(&app_tests); + { + BitcoinApplication app; + app.createNode(*init); - OptionTests options_tests(app.node()); - num_test_failures += QTest::qExec(&options_tests); + AppTests app_tests(app); + num_test_failures += QTest::qExec(&app_tests); - URITests test1; - num_test_failures += QTest::qExec(&test1); + OptionTests options_tests(app.node()); + num_test_failures += QTest::qExec(&options_tests); - RPCNestedTests test3(app.node()); - num_test_failures += QTest::qExec(&test3); + URITests test1; + num_test_failures += QTest::qExec(&test1); + + RPCNestedTests test3(app.node()); + num_test_failures += QTest::qExec(&test3); #ifdef ENABLE_WALLET - WalletTests test5(app.node()); - num_test_failures += QTest::qExec(&test5); + WalletTests test5(app.node()); + num_test_failures += QTest::qExec(&test5); - AddressBookTests test6(app.node()); - num_test_failures += QTest::qExec(&test6); + AddressBookTests test6(app.node()); + num_test_failures += QTest::qExec(&test6); #endif - if (num_test_failures) { - qWarning("\nFailed tests: %d\n", num_test_failures); - } else { - qDebug("\nAll tests passed.\n"); + if (num_test_failures) { + qWarning("\nFailed tests: %d\n", num_test_failures); + } else { + qDebug("\nAll tests passed.\n"); + } } + + QSettings settings; + settings.clear(); + return num_test_failures; } diff --git a/src/qt/test/wallettests.cpp b/src/qt/test/wallettests.cpp index f5b86f44a6..603df0b15f 100644 --- a/src/qt/test/wallettests.cpp +++ b/src/qt/test/wallettests.cpp @@ -418,7 +418,7 @@ void TestGUIWatchOnly(interfaces::Node& node, TestChain100Setup& test) timer.setInterval(500); QObject::connect(&timer, &QTimer::timeout, [&](){ for (QWidget* widget : QApplication::topLevelWidgets()) { - if (widget->inherits("QMessageBox")) { + if (widget->inherits("QMessageBox") && widget->objectName().compare("psbt_copied_message") == 0) { QMessageBox* dialog = qobject_cast<QMessageBox*>(widget); QAbstractButton* button = dialog->button(QMessageBox::Discard); button->setEnabled(true); |