test: use common setup in gui tests

This commit is contained in:
MarcoFalke 2019-05-28 14:34:50 -04:00
parent fad3d2a624
commit fa4a04a5a9
No known key found for this signature in database
GPG key ID: CE2B75697E69A548
2 changed files with 5 additions and 11 deletions

View file

@ -5,6 +5,7 @@
#include <qt/test/apptests.h> #include <qt/test/apptests.h>
#include <chainparams.h> #include <chainparams.h>
#include <key.h>
#include <qt/bitcoin.h> #include <qt/bitcoin.h>
#include <qt/bitcoingui.h> #include <qt/bitcoingui.h>
#include <qt/networkstyle.h> #include <qt/networkstyle.h>
@ -62,6 +63,7 @@ void AppTests::appTests()
} }
#endif #endif
ECC_Stop(); // Already started by the common test setup, so stop it to avoid interference
m_app.parameterSetup(); m_app.parameterSetup();
m_app.createOptionsModel(true /* reset settings */); m_app.createOptionsModel(true /* reset settings */);
QScopedPointer<const NetworkStyle> style( QScopedPointer<const NetworkStyle> style(

View file

@ -11,9 +11,9 @@
#include <qt/bitcoin.h> #include <qt/bitcoin.h>
#include <qt/test/apptests.h> #include <qt/test/apptests.h>
#include <qt/test/rpcnestedtests.h> #include <qt/test/rpcnestedtests.h>
#include <util/system.h>
#include <qt/test/uritests.h> #include <qt/test/uritests.h>
#include <qt/test/compattests.h> #include <qt/test/compattests.h>
#include <test/setup_common.h>
#ifdef ENABLE_WALLET #ifdef ENABLE_WALLET
#include <qt/test/addressbooktests.h> #include <qt/test/addressbooktests.h>
@ -48,14 +48,8 @@ extern void noui_connect();
// This is all you need to run all the tests // This is all you need to run all the tests
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
SetupEnvironment(); BasicTestingSetup test{CBaseChainParams::REGTEST};
SetupNetworking();
SelectParams(CBaseChainParams::REGTEST);
noui_connect();
ClearDatadirCache();
fs::path pathTemp = fs::temp_directory_path() / strprintf("test_bitcoin-qt_%lu_%i", (unsigned long)GetTime(), (int)GetRand(100000));
fs::create_directories(pathTemp);
gArgs.ForceSetArg("-datadir", pathTemp.string());
auto node = interfaces::MakeNode(); auto node = interfaces::MakeNode();
bool fInvalid = false; bool fInvalid = false;
@ -109,7 +103,5 @@ int main(int argc, char *argv[])
} }
#endif #endif
fs::remove_all(pathTemp);
return fInvalid; return fInvalid;
} }