mirror of
https://github.com/bitcoin/bitcoin.git
synced 2024-11-19 18:09:47 +01:00
refactor, qt: Use std::chrono in ConfirmMessage parameter
This commit is contained in:
parent
33d520ac53
commit
6f0da95811
@ -20,6 +20,8 @@
|
||||
#include <wallet/wallet.h>
|
||||
#include <walletinitinterface.h>
|
||||
|
||||
#include <chrono>
|
||||
|
||||
#include <QApplication>
|
||||
#include <QTimer>
|
||||
#include <QMessageBox>
|
||||
@ -40,7 +42,7 @@ void EditAddressAndSubmit(
|
||||
dialog->findChild<QLineEdit*>("labelEdit")->setText(label);
|
||||
dialog->findChild<QValidatedLineEdit*>("addressEdit")->setText(address);
|
||||
|
||||
ConfirmMessage(&warning_text, 5);
|
||||
ConfirmMessage(&warning_text, 5ms);
|
||||
dialog->accept();
|
||||
QCOMPARE(warning_text, expected_msg);
|
||||
}
|
||||
|
@ -2,6 +2,8 @@
|
||||
// Distributed under the MIT software license, see the accompanying
|
||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
#include <chrono>
|
||||
|
||||
#include <QApplication>
|
||||
#include <QMessageBox>
|
||||
#include <QPushButton>
|
||||
@ -9,7 +11,7 @@
|
||||
#include <QTimer>
|
||||
#include <QWidget>
|
||||
|
||||
void ConfirmMessage(QString* text, int msec)
|
||||
void ConfirmMessage(QString* text, std::chrono::milliseconds msec)
|
||||
{
|
||||
QTimer::singleShot(msec, [text]() {
|
||||
for (QWidget* widget : QApplication::topLevelWidgets()) {
|
||||
|
@ -5,7 +5,11 @@
|
||||
#ifndef BITCOIN_QT_TEST_UTIL_H
|
||||
#define BITCOIN_QT_TEST_UTIL_H
|
||||
|
||||
#include <QString>
|
||||
#include <chrono>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
class QString;
|
||||
QT_END_NAMESPACE
|
||||
|
||||
/**
|
||||
* Press "Ok" button in message box dialog.
|
||||
@ -13,6 +17,6 @@
|
||||
* @param text - Optionally store dialog text.
|
||||
* @param msec - Number of milliseconds to pause before triggering the callback.
|
||||
*/
|
||||
void ConfirmMessage(QString* text = nullptr, int msec = 0);
|
||||
void ConfirmMessage(QString* text, std::chrono::milliseconds msec);
|
||||
|
||||
#endif // BITCOIN_QT_TEST_UTIL_H
|
||||
|
@ -26,6 +26,7 @@
|
||||
#include <qt/recentrequeststablemodel.h>
|
||||
#include <qt/receiverequestdialog.h>
|
||||
|
||||
#include <chrono>
|
||||
#include <memory>
|
||||
|
||||
#include <QAbstractButton>
|
||||
@ -112,7 +113,7 @@ void BumpFee(TransactionView& view, const uint256& txid, bool expectDisabled, st
|
||||
if (expectError.empty()) {
|
||||
ConfirmSend(&text, cancel);
|
||||
} else {
|
||||
ConfirmMessage(&text);
|
||||
ConfirmMessage(&text, 0ms);
|
||||
}
|
||||
action->trigger();
|
||||
QVERIFY(text.indexOf(QString::fromStdString(expectError)) != -1);
|
||||
|
Loading…
Reference in New Issue
Block a user