7#include <chainparams.h>
15#include <validation.h>
19#include <QRegularExpression>
20#include <QScopedPointer>
26#include <QtTest/QtTestWidgets>
27#include <QtTest/QtTestGui>
31QString FindInConsole(
const QString& output,
const QString& pattern)
33 const QRegularExpression re(pattern);
34 return re.match(output).captured(1);
40 QTextEdit* messagesWidget = console->findChild<QTextEdit*>(
"messagesWidget");
41 QLineEdit* lineEdit = console->findChild<QLineEdit*>(
"lineEdit");
42 QSignalSpy mw_spy(messagesWidget, &QTextEdit::textChanged);
43 QVERIFY(mw_spy.isValid());
44 QTest::keyClicks(lineEdit,
"getblockchaininfo");
45 QTest::keyClick(lineEdit, Qt::Key_Return);
46 QVERIFY(mw_spy.wait(1000));
47 QCOMPARE(mw_spy.count(), 4);
48 const QString output = messagesWidget->toPlainText();
49 const QString pattern = QStringLiteral(
"\"chain\": \"(\\w+)\"");
50 QCOMPARE(FindInConsole(output, pattern), QString(
"regtest"));
58 if (QApplication::platformName() ==
"minimal") {
63 qWarning() <<
"Skipping AppTests on mac build with 'minimal' platform set due to Qt bugs. To run AppTests, invoke "
64 "with 'QT_QPA_PLATFORM=cocoa test_bitcoin-qt' on mac, or else use a linux or windows build.";
69 qRegisterMetaType<interfaces::BlockAndHeaderTipInfo>(
"interfaces::BlockAndHeaderTipInfo");
93 QAction* action = window->findChild<QAction*>(
"openRPCConsoleAction");
94 action->activate(QAction::Trigger);
101 TestRpcCommand(console);
109 assert(it != callbacks.end());
111 if (callbacks.empty()) {
const CChainParams & Params()
Return the currently selected parameters.
void expectCallback(std::string callback)
Add expected callback name to list of pending callbacks.
void guiTests(BitcoinGUI *window)
Entry point for BitcoinGUI tests.
BitcoinApplication & m_app
Bitcoin application.
std::multiset< std::string > m_callbacks
Set of pending callback names.
void appTests()
Entry point for BitcoinApplication tests.
void consoleTests(RPCConsole *console)
Entry point for RPCConsole tests.
void DisconnectTestLogger() EXCLUSIVE_LOCKS_REQUIRED(!m_cs)
Only for testing.
bool createOptionsModel(bool resetSettings)
Create options model.
void requestShutdown()
Request core shutdown.
void windowShown(BitcoinGUI *window)
bool baseInitialize()
Basic initialization, before starting initialization/shutdown thread. Return true on success.
void createWindow(const NetworkStyle *networkStyle)
Create main window.
void parameterSetup()
parameter interaction/setup based on rules
void setupPlatformStyle()
Setup platform style.
void requestInitialize()
Request core initialization.
void consoleShown(RPCConsole *console)
Signal raised when RPC console shown.
static const NetworkStyle * instantiate(const ChainType networkId)
Get style associated with provided network id, or 0 if not known.
Local Bitcoin RPC console.
BCLog::Logger & LogInstance()
RAII helper to remove no-longer-pending callback.
~HandleCallback()
Destructor to shut down after the last expected callback completes.