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,13 +85,16 @@ int main(int argc, char* argv[])
setenv("QT_QPA_PLATFORM", "minimal", 0 /* overwrite */); setenv("QT_QPA_PLATFORM", "minimal", 0 /* overwrite */);
#endif #endif
BitcoinApplication app;
app.setOrganizationName(QAPP_ORG_NAME); QCoreApplication::setOrganizationName(QAPP_ORG_NAME);
app.setApplicationName(QAPP_APP_NAME_DEFAULT "-test"); QCoreApplication::setApplicationName(QAPP_APP_NAME_DEFAULT "-test");
app.createNode(*init);
int num_test_failures{0}; int num_test_failures{0};
{
BitcoinApplication app;
app.createNode(*init);
AppTests app_tests(app); AppTests app_tests(app);
num_test_failures += QTest::qExec(&app_tests); num_test_failures += QTest::qExec(&app_tests);
@ -117,5 +120,10 @@ int main(int argc, char* argv[])
} else { } else {
qDebug("\nAll tests passed.\n"); qDebug("\nAll tests passed.\n");
} }
}
QSettings settings;
settings.clear();
return num_test_failures; return num_test_failures;
} }