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. The two line-number columns refer to before and after.
src/qt/test/apptests.cpp
CHANGED
|
@@ -4,18 +4,22 @@
|
|
|
4
4
|
|
|
5
5
|
#include <qt/test/apptests.h>
|
|
6
6
|
|
|
7
|
+
#include <bitcoin-build-config.h> // IWYU pragma: keep
|
|
7
8
|
#include <chainparams.h>
|
|
8
9
|
#include <key.h>
|
|
9
10
|
#include <logging.h>
|
|
10
11
|
#include <qt/bitcoin.h>
|
|
11
12
|
#include <qt/bitcoingui.h>
|
|
12
13
|
#include <qt/networkstyle.h>
|
|
14
|
+
#include <qt/qrimagewidget.h>
|
|
13
15
|
#include <qt/rpcconsole.h>
|
|
14
16
|
#include <test/util/setup_common.h>
|
|
15
17
|
#include <validation.h>
|
|
16
18
|
|
|
17
19
|
#include <QAction>
|
|
20
|
+
#include <QColor>
|
|
18
21
|
#include <QLineEdit>
|
|
22
|
+
#include <QPixmap>
|
|
19
23
|
#include <QRegularExpression>
|
|
20
24
|
#include <QScopedPointer>
|
|
21
25
|
#include <QSignalSpy>
|
|
@@ -49,6 +53,32 @@ void TestRpcCommand(RPCConsole* console)
|
|
|
49
53
|
const QString pattern = QStringLiteral("\"chain\": \"(\\w+)\"");
|
|
50
54
|
QCOMPARE(FindInConsole(output, pattern), QString("regtest"));
|
|
51
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
|
+
}
|
|
52
82
|
} // namespace
|
|
53
83
|
|
|
54
84
|
//! Entry point for BitcoinApplication tests.
|
|
@@ -66,6 +96,9 @@ void AppTests::appTests()
|
|
|
66
96
|
}
|
|
67
97
|
#endif
|
|
68
98
|
|
|
99
|
+
TestQrQuietZone();
|
|
100
|
+
TestRootsResources();
|
|
101
|
+
|
|
69
102
|
qRegisterMetaType<interfaces::BlockAndHeaderTipInfo>("interfaces::BlockAndHeaderTipInfo");
|
|
70
103
|
m_app.parameterSetup();
|
|
71
104
|
QVERIFY(m_app.createOptionsModel(/*resetSettings=*/true));
|