Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions src/qt/test/optiontests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,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));
Expand Down
49 changes: 30 additions & 19 deletions src/qt/test/test_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#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>
Expand All @@ -24,6 +25,7 @@
#include <QApplication>
#include <QDebug>
#include <QObject>
#include <QSettings>
#include <QTest>

#include <functional>
Expand Down Expand Up @@ -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;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In commit "qt, test: Clean settings after tests" (0dcbad3)

It seems reasonable to move the BitcoinApplication app into a nested scope, so BitcoinApplication is fully destroyed before settings.clear() is called. But I don't understand if this was a required change, or just cleanup, since I would expect the settings.clear() call to work in practice either way.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was a required change because ~BitcoinApplication calls ~BitcoinGUI, which in turn saves the window geometry to the settings.

app.createNode(*init);

AppTests app_tests(app);
num_test_failures += QTest::qExec(&app_tests);

OptionTests options_tests(app.node());
num_test_failures += QTest::qExec(&options_tests);
OptionTests options_tests(app.node());
num_test_failures += QTest::qExec(&options_tests);

URITests test1;
num_test_failures += QTest::qExec(&test1);
URITests test1;
num_test_failures += QTest::qExec(&test1);

RPCNestedTests test3(app.node());
num_test_failures += QTest::qExec(&test3);
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;
}