v29.4-roots.2 · Commit 5: [PATCH 05/21] product: establish Roots identity and Qt experience
src/qt/test/apptests.cpp
Before: src/qt/test/apptests.cpp · After: src/qt/test/apptests.cpp
File metadata
index 73e04b55c895eabb3878201eb1e5d7cbd4d91b10..a41aa52229796841ffbe367afba0204f5799425b 100644
Download original patch · Release notes
Diff rows 1–52 of 52. 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
|
@@ -10,12 +10,15 @@
|
|
|
10
10
|
#include <qt/bitcoin.h>
|
|
11
11
|
#include <qt/bitcoingui.h>
|
|
12
12
|
#include <qt/networkstyle.h>
|
|
13
|
+
#include <qt/qrimagewidget.h>
|
|
13
14
|
#include <qt/rpcconsole.h>
|
|
14
15
|
#include <test/util/setup_common.h>
|
|
15
16
|
#include <validation.h>
|
|
16
17
|
|
|
17
18
|
#include <QAction>
|
|
19
|
+
#include <QColor>
|
|
18
20
|
#include <QLineEdit>
|
|
21
|
+
#include <QPixmap>
|
|
19
22
|
#include <QRegularExpression>
|
|
20
23
|
#include <QScopedPointer>
|
|
21
24
|
#include <QSignalSpy>
|
|
@@ -49,6 +52,28 @@ void TestRpcCommand(RPCConsole* console)
|
|
|
49
52
|
const QString pattern = QStringLiteral("\"chain\": \"(\\w+)\"");
|
|
50
53
|
QCOMPARE(FindInConsole(output, pattern), QString("regtest"));
|
|
51
54
|
}
|
|
55
|
+
|
|
56
|
+
void TestQrQuietZone()
|
|
57
|
+
{
|
|
58
|
+
#ifdef USE_QRCODE
|
|
59
|
+
QRImageWidget qr;
|
|
60
|
+
QVERIFY(qr.setQR(QStringLiteral("bitcoin:bc1qz0j5w6w8t8d5alw5lp4n4t3g6d7n7ld5cqqqqq")));
|
|
61
|
+
const QImage image{qr.exportImage()};
|
|
62
|
+
QCOMPARE(image.width(), QR_IMAGE_SIZE + 2 * QR_IMAGE_MARGIN);
|
|
63
|
+
QCOMPARE(image.height(), QR_IMAGE_SIZE + 2 * QR_IMAGE_MARGIN);
|
|
64
|
+
// The first matrix pixel remains white only when the four-module quiet zone
|
|
65
|
+
// survives the scale-to-display path.
|
|
66
|
+
QCOMPARE(image.pixelColor(QR_IMAGE_MARGIN, QR_IMAGE_MARGIN), QColor{Qt::white});
|
|
67
|
+
#endif
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
void TestRootsResources()
|
|
71
|
+
{
|
|
72
|
+
const QPixmap splash{QStringLiteral(":/icons/splash")};
|
|
73
|
+
QVERIFY(!splash.isNull());
|
|
74
|
+
const QSize expected_size{960, 960};
|
|
75
|
+
QCOMPARE(splash.size(), expected_size);
|
|
76
|
+
}
|
|
52
77
|
} // namespace
|
|
53
78
|
|
|
54
79
|
//! Entry point for BitcoinApplication tests.
|
|
@@ -66,6 +91,9 @@ void AppTests::appTests()
|
|
|
66
91
|
}
|
|
67
92
|
#endif
|
|
68
93
|
|
|
94
|
+
TestQrQuietZone();
|
|
95
|
+
TestRootsResources();
|
|
96
|
+
|
|
69
97
|
qRegisterMetaType<interfaces::BlockAndHeaderTipInfo>("interfaces::BlockAndHeaderTipInfo");
|
|
70
98
|
m_app.parameterSetup();
|
|
71
99
|
QVERIFY(m_app.createOptionsModel(/*resetSettings=*/true));
|