Changeset View
Changeset View
Standalone View
Standalone View
src/qt/test/wallettests.cpp
Show First 20 Lines • Show All 95 Lines • ▼ Show 20 Lines | |||||
// QEventLoop().exec(); | // QEventLoop().exec(); | ||||
// | // | ||||
// This also requires overriding the default minimal Qt platform: | // This also requires overriding the default minimal Qt platform: | ||||
// | // | ||||
// src/qt/test/test_bitcoin-qt -platform xcb # Linux | // src/qt/test/test_bitcoin-qt -platform xcb # Linux | ||||
// src/qt/test/test_bitcoin-qt -platform windows # Windows | // src/qt/test/test_bitcoin-qt -platform windows # Windows | ||||
// src/qt/test/test_bitcoin-qt -platform cocoa # macOS | // src/qt/test/test_bitcoin-qt -platform cocoa # macOS | ||||
void TestGUI() { | void TestGUI() { | ||||
#ifdef Q_OS_MAC | |||||
if (QApplication::platformName() == "minimal") { | |||||
// Disable for mac on "minimal" platform to avoid crashes inside the Qt | |||||
// framework when it tries to look up unimplemented cocoa functions, | |||||
// and fails to handle returned nulls | |||||
// (https://bugreports.qt.io/browse/QTBUG-49686). | |||||
QWARN("Skipping WalletTests on mac build with 'minimal' platform set " | |||||
"due to Qt bugs. To run AppTests, invoke " | |||||
"with 'test_bitcoin-qt -platform cocoa' on mac, or else use a " | |||||
"linux or windows build."); | |||||
return; | |||||
} | |||||
#endif | |||||
// Set up wallet and chain with 105 blocks (5 mature blocks for spending). | // Set up wallet and chain with 105 blocks (5 mature blocks for spending). | ||||
TestChain100Setup test; | TestChain100Setup test; | ||||
for (int i = 0; i < 5; ++i) { | for (int i = 0; i < 5; ++i) { | ||||
test.CreateAndProcessBlock( | test.CreateAndProcessBlock( | ||||
{}, GetScriptForRawPubKey(test.coinbaseKey.GetPubKey())); | {}, GetScriptForRawPubKey(test.coinbaseKey.GetPubKey())); | ||||
} | } | ||||
CWallet wallet(Params(), "mock", WalletDatabase::CreateMock()); | CWallet wallet(Params(), "mock", WalletDatabase::CreateMock()); | ||||
bool firstRun; | bool firstRun; | ||||
▲ Show 20 Lines • Show All 113 Lines • ▼ Show 20 Lines | QPushButton *removeRequestButton = | ||||
receiveCoinsDialog.findChild<QPushButton *>("removeRequestButton"); | receiveCoinsDialog.findChild<QPushButton *>("removeRequestButton"); | ||||
removeRequestButton->click(); | removeRequestButton->click(); | ||||
QCOMPARE(requestTableModel->rowCount({}), currentRowCount - 1); | QCOMPARE(requestTableModel->rowCount({}), currentRowCount - 1); | ||||
} | } | ||||
} // namespace | } // namespace | ||||
void WalletTests::walletTests() { | void WalletTests::walletTests() { | ||||
#ifdef Q_OS_MAC | |||||
if (QApplication::platformName() == "minimal") { | |||||
// Disable for mac on "minimal" platform to avoid crashes inside the Qt | |||||
// framework when it tries to look up unimplemented cocoa functions, | |||||
// and fails to handle returned nulls | |||||
// (https://bugreports.qt.io/browse/QTBUG-49686). | |||||
QWARN("Skipping WalletTests on mac build with 'minimal' platform set " | |||||
"due to Qt bugs. To run AppTests, invoke with 'test_bitcoin-qt " | |||||
"-platform cocoa' on mac, or else use a linux or windows build."); | |||||
return; | |||||
} | |||||
#endif | |||||
TestGUI(); | TestGUI(); | ||||
} | } |