Changeset View
Changeset View
Standalone View
Standalone View
src/qt/test/apptests.cpp
Show First 20 Lines • Show All 70 Lines • ▼ Show 20 Lines | if (QApplication::platformName() == "minimal") { | ||||
"test_bitcoin-qt' on mac, or else use a linux or windows build."); | "test_bitcoin-qt' on mac, or else use a linux or windows build."); | ||||
return; | return; | ||||
} | } | ||||
#endif | #endif | ||||
Config &config = const_cast<Config &>(GetConfig()); | Config &config = const_cast<Config &>(GetConfig()); | ||||
// Create a temp data directory to backup the gui settings to | // Create a temp data directory to backup the gui settings to | ||||
fs::create_directories([] { | |||||
BasicTestingSetup test{CBaseChainParams::REGTEST}; | BasicTestingSetup test{CBaseChainParams::REGTEST}; | ||||
// Already started by the common test setup, so stop it to avoid | return GetDataDir() / "blocks"; | ||||
// interference | }()); | ||||
ECC_Stop(); | |||||
LogInstance().DisconnectTestLogger(); | |||||
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( | ||||
NetworkStyle::instantiate(Params().NetworkIDString())); | NetworkStyle::instantiate(Params().NetworkIDString())); | ||||
m_app.setupPlatformStyle(); | m_app.setupPlatformStyle(); | ||||
m_app.createWindow(&config, style.data()); | m_app.createWindow(&config, style.data()); | ||||
connect(&m_app, &BitcoinApplication::windowShown, this, | connect(&m_app, &BitcoinApplication::windowShown, this, | ||||
&AppTests::guiTests); | &AppTests::guiTests); | ||||
expectCallback("guiTests"); | expectCallback("guiTests"); | ||||
m_app.baseInitialize(config); | m_app.baseInitialize(config); | ||||
RPCServer rpcServer; | RPCServer rpcServer; | ||||
util::Ref context{test.m_node}; | util::Ref context; | ||||
HTTPRPCRequestProcessor httpRPCRequestProcessor(config, rpcServer, context); | HTTPRPCRequestProcessor httpRPCRequestProcessor(config, rpcServer, context); | ||||
m_app.requestInitialize(config, rpcServer, httpRPCRequestProcessor); | m_app.requestInitialize(config, rpcServer, httpRPCRequestProcessor); | ||||
m_app.exec(); | m_app.exec(); | ||||
m_app.requestShutdown(config); | m_app.requestShutdown(config); | ||||
m_app.exec(); | m_app.exec(); | ||||
// Reset global state to avoid interfering with later tests. | // Reset global state to avoid interfering with later tests. | ||||
LogInstance().DisconnectTestLogger(); | |||||
AbortShutdown(); | AbortShutdown(); | ||||
UnloadBlockIndex(); | UnloadBlockIndex(); | ||||
WITH_LOCK(::cs_main, g_chainman.Reset()); | WITH_LOCK(::cs_main, g_chainman.Reset()); | ||||
} | } | ||||
//! Entry point for BitcoinGUI tests. | //! Entry point for BitcoinGUI tests. | ||||
void AppTests::guiTests(BitcoinGUI *window) { | void AppTests::guiTests(BitcoinGUI *window) { | ||||
HandleCallback callback{"guiTests", *this}; | HandleCallback callback{"guiTests", *this}; | ||||
Show All 22 Lines |