Changeset View
Changeset View
Standalone View
Standalone View
src/qt/test/wallettests.cpp
Show First 20 Lines • Show All 145 Lines • ▼ Show 20 Lines | void TestGUI(interfaces::Node &node) { | ||||
// Create widgets for sending coins and listing transactions. | // Create widgets for sending coins and listing transactions. | ||||
std::unique_ptr<const PlatformStyle> platformStyle( | std::unique_ptr<const PlatformStyle> platformStyle( | ||||
PlatformStyle::instantiate("other")); | PlatformStyle::instantiate("other")); | ||||
OptionsModel optionsModel(node); | OptionsModel optionsModel(node); | ||||
AddWallet(wallet); | AddWallet(wallet); | ||||
WalletModel walletModel(interfaces::MakeWallet(wallet), node, | WalletModel walletModel(interfaces::MakeWallet(wallet), node, | ||||
platformStyle.get(), &optionsModel); | platformStyle.get(), &optionsModel); | ||||
RemoveWallet(wallet); | RemoveWallet(wallet); | ||||
SendCoinsDialog sendCoinsDialog(platformStyle.get(), &walletModel); | |||||
{ | |||||
// Check balance in send dialog | |||||
QLabel *balanceLabel = | |||||
sendCoinsDialog.findChild<QLabel *>("labelBalance"); | |||||
QString balanceText = balanceLabel->text(); | |||||
int unit = walletModel.getOptionsModel()->getDisplayUnit(); | |||||
Amount balance = walletModel.wallet().getBalance(); | |||||
QString balanceComparison = BitcoinUnits::formatWithUnit( | |||||
unit, balance, false, BitcoinUnits::separatorAlways); | |||||
QCOMPARE(balanceText, balanceComparison); | |||||
} | |||||
// Send two transactions, and verify they are added to transaction list. | // Send two transactions, and verify they are added to transaction list. | ||||
SendCoinsDialog sendCoinsDialog(platformStyle.get(), &walletModel); | |||||
TransactionTableModel *transactionTableModel = | TransactionTableModel *transactionTableModel = | ||||
walletModel.getTransactionTableModel(); | walletModel.getTransactionTableModel(); | ||||
QCOMPARE(transactionTableModel->rowCount({}), 105); | QCOMPARE(transactionTableModel->rowCount({}), 105); | ||||
TxId txid1 = SendCoins(*wallet.get(), sendCoinsDialog, | TxId txid1 = SendCoins(*wallet.get(), sendCoinsDialog, | ||||
CTxDestination(PKHash()), 5 * COIN); | CTxDestination(PKHash()), 5 * COIN); | ||||
TxId txid2 = SendCoins(*wallet.get(), sendCoinsDialog, | TxId txid2 = SendCoins(*wallet.get(), sendCoinsDialog, | ||||
CTxDestination(PKHash()), 10 * COIN); | CTxDestination(PKHash()), 10 * COIN); | ||||
QCOMPARE(transactionTableModel->rowCount({}), 107); | QCOMPARE(transactionTableModel->rowCount({}), 107); | ||||
▲ Show 20 Lines • Show All 98 Lines • Show Last 20 Lines |