v30.3-roots.1 · Commit 5: [PATCH 05/68] feat(qt): preserve Roots identity and GUI support on Core 30.3
src/qt/test/apptests.cpp
Before: src/qt/test/apptests.cpp · After: src/qt/test/apptests.cpp
File metadata
index 73e04b55c895eabb3878201eb1e5d7cbd4d91b10..07c118a75418b901ca2cce793c100fbdaa16bb82 100644
Download original patch · Release notes
Diff rows 1–63 of 63. Line numbers refer to the original before/after files.
+ Added− RemovedUnmarked lines are context.
Scroll the code area horizontally to read long lines. Before is on the left; after is on the right. Unified view fits narrow screens more easily.
src/qt/test/apptests.cpp
CHANGED
|
@@ -4,18 +4,22 @@
|
|
| 4 |
|
| 5 |
#include <qt/test/apptests.h>
|
| 6 |
|
|
|
|
| 7 |
#include <chainparams.h>
|
| 8 |
#include <key.h>
|
| 9 |
#include <logging.h>
|
| 10 |
#include <qt/bitcoin.h>
|
| 11 |
#include <qt/bitcoingui.h>
|
| 12 |
#include <qt/networkstyle.h>
|
|
|
|
| 13 |
#include <qt/rpcconsole.h>
|
| 14 |
#include <test/util/setup_common.h>
|
| 15 |
#include <validation.h>
|
| 16 |
|
| 17 |
#include <QAction>
|
|
|
|
| 18 |
#include <QLineEdit>
|
|
|
|
| 19 |
#include <QRegularExpression>
|
| 20 |
#include <QScopedPointer>
|
| 21 |
#include <QSignalSpy>
|
|
@@ -49,6 +53,32 @@ void TestRpcCommand(RPCConsole* console)
|
|
| 49 |
const QString pattern = QStringLiteral("\"chain\": \"(\\w+)\"");
|
| 50 |
QCOMPARE(FindInConsole(output, pattern), QString("regtest"));
|
| 51 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 52 |
} // namespace
|
| 53 |
|
| 54 |
//! Entry point for BitcoinApplication tests.
|
|
@@ -66,6 +96,9 @@ void AppTests::appTests()
|
|
| 66 |
}
|
| 67 |
#endif
|
| 68 |
|
|
|
|
|
|
|
|
|
|
| 69 |
qRegisterMetaType<interfaces::BlockAndHeaderTipInfo>("interfaces::BlockAndHeaderTipInfo");
|
| 70 |
m_app.parameterSetup();
|
| 71 |
QVERIFY(m_app.createOptionsModel(/*resetSettings=*/true));
|
|
|
|
| 4 |
|
| 5 |
#include <qt/test/apptests.h>
|
| 6 |
|
| 7 |
+
#include <bitcoin-build-config.h> // IWYU pragma: keep
|
| 8 |
#include <chainparams.h>
|
| 9 |
#include <key.h>
|
| 10 |
#include <logging.h>
|
| 11 |
#include <qt/bitcoin.h>
|
| 12 |
#include <qt/bitcoingui.h>
|
| 13 |
#include <qt/networkstyle.h>
|
| 14 |
+
#include <qt/qrimagewidget.h>
|
| 15 |
#include <qt/rpcconsole.h>
|
| 16 |
#include <test/util/setup_common.h>
|
| 17 |
#include <validation.h>
|
| 18 |
|
| 19 |
#include <QAction>
|
| 20 |
+
#include <QColor>
|
| 21 |
#include <QLineEdit>
|
| 22 |
+
#include <QPixmap>
|
| 23 |
#include <QRegularExpression>
|
| 24 |
#include <QScopedPointer>
|
| 25 |
#include <QSignalSpy>
|
|
|
|
| 53 |
const QString pattern = QStringLiteral("\"chain\": \"(\\w+)\"");
|
| 54 |
QCOMPARE(FindInConsole(output, pattern), QString("regtest"));
|
| 55 |
}
|
| 56 |
+
|
| 57 |
+
void TestQrQuietZone()
|
| 58 |
+
{
|
| 59 |
+
#ifdef USE_QRCODE
|
| 60 |
+
QRImageWidget qr;
|
| 61 |
+
QVERIFY(qr.setQR(QStringLiteral("bitcoin:bc1qz0j5w6w8t8d5alw5lp4n4t3g6d7n7ld5cqqqqq")));
|
| 62 |
+
const QImage image{qr.exportImage()};
|
| 63 |
+
QCOMPARE(image.width(), QR_IMAGE_SIZE + 2 * QR_IMAGE_MARGIN);
|
| 64 |
+
QCOMPARE(image.height(), QR_IMAGE_SIZE + 2 * QR_IMAGE_MARGIN);
|
| 65 |
+
// The first matrix pixel remains white only when the four-module quiet zone
|
| 66 |
+
// survives the scale-to-display path.
|
| 67 |
+
QCOMPARE(image.pixelColor(QR_IMAGE_MARGIN, QR_IMAGE_MARGIN), QColor{Qt::white});
|
| 68 |
+
#endif
|
| 69 |
+
}
|
| 70 |
+
|
| 71 |
+
void TestRootsResources()
|
| 72 |
+
{
|
| 73 |
+
const QPixmap icon{QStringLiteral(":/icons/bitcoin")};
|
| 74 |
+
QVERIFY(!icon.isNull());
|
| 75 |
+
const QSize expected_icon_size{256, 256};
|
| 76 |
+
QCOMPARE(icon.size(), expected_icon_size);
|
| 77 |
+
const QPixmap splash{QStringLiteral(":/icons/splash")};
|
| 78 |
+
QVERIFY(!splash.isNull());
|
| 79 |
+
const QSize expected_size{960, 960};
|
| 80 |
+
QCOMPARE(splash.size(), expected_size);
|
| 81 |
+
}
|
| 82 |
} // namespace
|
| 83 |
|
| 84 |
//! Entry point for BitcoinApplication tests.
|
|
|
|
| 96 |
}
|
| 97 |
#endif
|
| 98 |
|
| 99 |
+
TestQrQuietZone();
|
| 100 |
+
TestRootsResources();
|
| 101 |
+
|
| 102 |
qRegisterMetaType<interfaces::BlockAndHeaderTipInfo>("interfaces::BlockAndHeaderTipInfo");
|
| 103 |
m_app.parameterSetup();
|
| 104 |
QVERIFY(m_app.createOptionsModel(/*resetSettings=*/true));
|