Changeset View
Changeset View
Standalone View
Standalone View
src/qt/test/wallettests.cpp
Show First 20 Lines • Show All 114 Lines • ▼ Show 20 Lines | |||||
#endif | #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())); | ||||
} | } | ||||
bitdb.MakeMock(); | CWallet wallet(Params(), "mock", CWalletDBWrapper::CreateMock()); | ||||
std::unique_ptr<CWalletDBWrapper> dbw( | |||||
new CWalletDBWrapper(&bitdb, "wallet_test.dat")); | |||||
CWallet wallet(Params(), std::move(dbw)); | |||||
bool firstRun; | bool firstRun; | ||||
wallet.LoadWallet(firstRun); | wallet.LoadWallet(firstRun); | ||||
{ | { | ||||
LOCK(wallet.cs_wallet); | LOCK(wallet.cs_wallet); | ||||
wallet.SetAddressBook(test.coinbaseKey.GetPubKey().GetID(), "", | wallet.SetAddressBook(test.coinbaseKey.GetPubKey().GetID(), "", | ||||
"receive"); | "receive"); | ||||
wallet.AddKeyPubKey(test.coinbaseKey, test.coinbaseKey.GetPubKey()); | wallet.AddKeyPubKey(test.coinbaseKey, test.coinbaseKey.GetPubKey()); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 101 Lines • ▼ Show 20 Lines | #endif | ||||
// Check Remove button | // Check Remove button | ||||
QTableView *table = | QTableView *table = | ||||
receiveCoinsDialog.findChild<QTableView *>("recentRequestsView"); | receiveCoinsDialog.findChild<QTableView *>("recentRequestsView"); | ||||
table->selectRow(currentRowCount - 1); | table->selectRow(currentRowCount - 1); | ||||
QPushButton *removeRequestButton = | QPushButton *removeRequestButton = | ||||
receiveCoinsDialog.findChild<QPushButton *>("removeRequestButton"); | receiveCoinsDialog.findChild<QPushButton *>("removeRequestButton"); | ||||
removeRequestButton->click(); | removeRequestButton->click(); | ||||
QCOMPARE(requestTableModel->rowCount({}), currentRowCount - 1); | QCOMPARE(requestTableModel->rowCount({}), currentRowCount - 1); | ||||
bitdb.Flush(true); | |||||
bitdb.Reset(); | |||||
} | } | ||||
} | } | ||||
void WalletTests::walletTests() { | void WalletTests::walletTests() { | ||||
TestGUI(); | TestGUI(); | ||||
} | } |