Changeset View
Changeset View
Standalone View
Standalone View
src/qt/test/test_main.cpp
Show First 20 Lines • Show All 62 Lines • ▼ Show 20 Lines | int main(int argc, char *argv[]) { | ||||
// Prefer the "minimal" platform for the test instead of the normal default | // Prefer the "minimal" platform for the test instead of the normal default | ||||
// platform ("xcb", "windows", or "cocoa") so tests can't unintentionally | // platform ("xcb", "windows", or "cocoa") so tests can't unintentionally | ||||
// interfere with any background GUIs and don't require extra resources. | // interfere with any background GUIs and don't require extra resources. | ||||
setenv("QT_QPA_PLATFORM", "minimal", /* overwrite */ 0); | setenv("QT_QPA_PLATFORM", "minimal", /* overwrite */ 0); | ||||
// Don't remove this, it's needed to access | // Don't remove this, it's needed to access | ||||
// QApplication:: and QCoreApplication:: in the tests | // QApplication:: and QCoreApplication:: in the tests | ||||
BitcoinApplication app(*node); | BitcoinApplication app; | ||||
app.setNode(*node); | |||||
app.setApplicationName("BitcoinABC-Qt-test"); | app.setApplicationName("BitcoinABC-Qt-test"); | ||||
// Make gArgs available in the NodeContext | // Make gArgs available in the NodeContext | ||||
node->context()->args = &gArgs; | app.node().context()->args = &gArgs; | ||||
AppTests app_tests(app); | AppTests app_tests(app); | ||||
if (QTest::qExec(&app_tests) != 0) { | if (QTest::qExec(&app_tests) != 0) { | ||||
fInvalid = true; | fInvalid = true; | ||||
} | } | ||||
URITests test1; | URITests test1; | ||||
if (QTest::qExec(&test1) != 0) { | if (QTest::qExec(&test1) != 0) { | ||||
fInvalid = true; | fInvalid = true; | ||||
} | } | ||||
#if defined(ENABLE_WALLET) && defined(ENABLE_BIP70) | #if defined(ENABLE_WALLET) && defined(ENABLE_BIP70) | ||||
PaymentServerTests test2; | PaymentServerTests test2; | ||||
if (QTest::qExec(&test2) != 0) { | if (QTest::qExec(&test2) != 0) { | ||||
fInvalid = true; | fInvalid = true; | ||||
} | } | ||||
#endif | #endif | ||||
RPCNestedTests test3(*node); | RPCNestedTests test3(app.node()); | ||||
if (QTest::qExec(&test3) != 0) { | if (QTest::qExec(&test3) != 0) { | ||||
fInvalid = true; | fInvalid = true; | ||||
} | } | ||||
CompatTests test4; | CompatTests test4; | ||||
if (QTest::qExec(&test4) != 0) { | if (QTest::qExec(&test4) != 0) { | ||||
fInvalid = true; | fInvalid = true; | ||||
} | } | ||||
GUIUtilTests test5; | GUIUtilTests test5; | ||||
if (QTest::qExec(&test5) != 0) { | if (QTest::qExec(&test5) != 0) { | ||||
fInvalid = true; | fInvalid = true; | ||||
} | } | ||||
BitcoinAddressValidatorTests test6; | BitcoinAddressValidatorTests test6; | ||||
if (QTest::qExec(&test6) != 0) { | if (QTest::qExec(&test6) != 0) { | ||||
fInvalid = true; | fInvalid = true; | ||||
} | } | ||||
#ifdef ENABLE_WALLET | #ifdef ENABLE_WALLET | ||||
WalletTests test7(*node); | WalletTests test7(app.node()); | ||||
if (QTest::qExec(&test7) != 0) { | if (QTest::qExec(&test7) != 0) { | ||||
fInvalid = true; | fInvalid = true; | ||||
} | } | ||||
AddressBookTests test8(*node); | AddressBookTests test8(app.node()); | ||||
if (QTest::qExec(&test8) != 0) { | if (QTest::qExec(&test8) != 0) { | ||||
fInvalid = true; | fInvalid = true; | ||||
} | } | ||||
#endif | #endif | ||||
return fInvalid; | return fInvalid; | ||||
} | } |