mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-02-08 10:31:50 -05:00
Merge bitcoin-core/gui#803: test: Set organization name
0dcbad341b
qt, test: Clean settings after tests (Hennadii Stepanov)49cf63522e
qt, test: Set organization name (Hennadii Stepanov) Pull request description: From Qt [docs](https://doc.qt.io/qt-5/qsettings.html#QSettings-4): > If [`QCoreApplication::setOrganizationName()`](https://doc.qt.io/qt-5/qcoreapplication.html#organizationName-prop) and [`QCoreApplication::setApplicationName()`](https://doc.qt.io/qt-5/qcoreapplication.html#applicationName-prop) has not been previously called, the `QSettings` object will not be able to read or write any settings, and [`status()`](https://doc.qt.io/qt-5/qsettings.html#status) will return [`AccessError`](https://doc.qt.io/qt-5/qsettings.html#Status-enum). Fixes https://github.com/bitcoin-core/gui/issues/799. ACKs for top commit: pablomartin4btc: utACK0dcbad341b
Tree-SHA512: d5ac160f17cc358f0c1b89097193cd5adfd25f5531955c211f3e0994fc084e0a2b8d3aeddebe38f3a8ab5333edef5aa92b18915885c9e58b33f2e5786f31c600
This commit is contained in:
commit
c2c6a7d1dc
2 changed files with 41 additions and 19 deletions
|
@ -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));
|
||||
|
|
|
@ -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>
|
||||
|
@ -24,6 +25,7 @@
|
|||
#include <QApplication>
|
||||
#include <QDebug>
|
||||
#include <QObject>
|
||||
#include <QSettings>
|
||||
#include <QTest>
|
||||
|
||||
#include <functional>
|
||||
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue