Skip to content
Bitcoin Roots

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. Before is on the left; after is on the right. Unified view fits narrow screens more easily.

src/qt/test/apptests.cpp CHANGED
@@ -10,12 +10,15 @@
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 +52,28 @@ 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 +91,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));
 
10
  #include <qt/bitcoin.h>
11
  #include <qt/bitcoingui.h>
12
  #include <qt/networkstyle.h>
13
+ #include <qt/qrimagewidget.h>
14
  #include <qt/rpcconsole.h>
15
  #include <test/util/setup_common.h>
16
  #include <validation.h>
17
 
18
  #include <QAction>
19
+ #include <QColor>
20
  #include <QLineEdit>
21
+ #include <QPixmap>
22
  #include <QRegularExpression>
23
  #include <QScopedPointer>
24
  #include <QSignalSpy>
 
52
  const QString pattern = QStringLiteral("\"chain\": \"(\\w+)\"");
53
  QCOMPARE(FindInConsole(output, pattern), QString("regtest"));
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
+ }
77
  } // namespace
78
 
79
  //! Entry point for BitcoinApplication tests.
 
91
  }
92
  #endif
93
 
94
+ TestQrQuietZone();
95
+ TestRootsResources();
96
+
97
  qRegisterMetaType<interfaces::BlockAndHeaderTipInfo>("interfaces::BlockAndHeaderTipInfo");
98
  m_app.parameterSetup();
99
  QVERIFY(m_app.createOptionsModel(/*resetSettings=*/true));