qt, test: Clean settings after tests

A test suite should not leave any artifacts except for those explicitly
expected.

This change is easy to review with `git diff --ignore-all-space`
command.
This commit is contained in:
Hennadii Stepanov 2024-03-05 07:39:48 +00:00
parent 49cf63522e
commit 0dcbad341b
No known key found for this signature in database
GPG Key ID: 410108112E7EA81F
1 changed files with 28 additions and 20 deletions

View File

@ -85,37 +85,45 @@ int main(int argc, char* argv[])
setenv("QT_QPA_PLATFORM", "minimal", 0 /* overwrite */);
#endif
BitcoinApplication app;
app.setOrganizationName(QAPP_ORG_NAME);
app.setApplicationName(QAPP_APP_NAME_DEFAULT "-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;
}