Skip to content
Bitcoin Roots

v31.1-roots.1 · Commit 8: [PATCH 08/17] chore(roots): integrate v31 identity and maintenance tooling

src/qt/test/apptests.cpp

Before: src/qt/test/apptests.cpp · After: src/qt/test/apptests.cpp

File metadata
index 9ec8aa0a19d79762ef432f8476795808a0aed605..059703943d0882a9f7c45e73854587a0c57ccf50 100644

Download original patch · Release notes

Diff rows 1–55 of 55. 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,6 +10,9 @@
10
  #include <qt/bitcoin.h>
11
  #include <qt/bitcoingui.h>
12
  #include <qt/networkstyle.h>
 
 
 
13
  #include <qt/rpcconsole.h>
14
  #include <qt/peertablemodel.h>
15
  #include <QLabel>
@@ -207,6 +210,38 @@ void TestLivePeerView(RPCConsole* console, interfaces::Node& node)
207
  QTRY_VERIFY_WITH_TIMEOUT((model->refresh(), model->rowCount() == endpoints.size() - 1), 10000);
208
  QVERIFY(table->selectionModel()->selectedRows().isEmpty());
209
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
210
  } // namespace
211
 
212
  //! Entry point for BitcoinApplication tests.
@@ -262,6 +297,8 @@ void AppTests::guiTests(BitcoinGUI* window)
262
  void AppTests::consoleTests(RPCConsole* console)
263
  {
264
  HandleCallback callback{"consoleTests", *this};
 
 
265
  TestRpcCommand(console);
266
  TestPeerRefreshState(console);
267
  TestLivePeerView(console, m_app.node());
 
10
  #include <qt/bitcoin.h>
11
  #include <qt/bitcoingui.h>
12
  #include <qt/networkstyle.h>
13
+ #include <qt/qrimagewidget.h>
14
+ #include <QClipboard>
15
+ #include <QTemporaryDir>
16
  #include <qt/rpcconsole.h>
17
  #include <qt/peertablemodel.h>
18
  #include <QLabel>
 
210
  QTRY_VERIFY_WITH_TIMEOUT((model->refresh(), model->rowCount() == endpoints.size() - 1), 10000);
211
  QVERIFY(table->selectionModel()->selectedRows().isEmpty());
212
  }
213
+ void TestQrQuietZone()
214
+ {
215
+ #if defined(ENABLE_WALLET) && defined(USE_QRCODE)
216
+ QRImageWidget qr;
217
+ QVERIFY(qr.setQR(QStringLiteral("bitcoin:bc1qz0j5w6w8t8d5alw5lp4n4t3g6d7n7ld5cqqqqq")));
218
+ const QImage image{qr.exportImage()};
219
+ QTemporaryDir directory;
220
+ QVERIFY(directory.isValid());
221
+ const QString path{directory.filePath("qr.png")};
222
+ QVERIFY(image.save(path, "PNG"));
223
+ QCOMPARE(QImage{path}, image);
224
+ qr.copyImage();
225
+ QCOMPARE(QApplication::clipboard()->image(), image);
226
+ QCOMPARE(image.width(), QR_IMAGE_SIZE + 2 * QR_IMAGE_MARGIN);
227
+ QCOMPARE(image.height(), QR_IMAGE_SIZE + 2 * QR_IMAGE_MARGIN);
228
+ // The first matrix pixel remains white only when the four-module quiet zone
229
+ // survives the scale-to-display path.
230
+ QCOMPARE(image.pixelColor(QR_IMAGE_MARGIN, QR_IMAGE_MARGIN), QColor{Qt::white});
231
+ #endif
232
+ }
233
+
234
+ void TestRootsResources()
235
+ {
236
+ const QPixmap icon{QStringLiteral(":/icons/bitcoin")};
237
+ QVERIFY(!icon.isNull());
238
+ const QSize expected_icon_size{256, 256};
239
+ QCOMPARE(icon.size(), expected_icon_size);
240
+ const QPixmap splash{QStringLiteral(":/icons/splash")};
241
+ QVERIFY(!splash.isNull());
242
+ const QSize expected_size{960, 960};
243
+ QCOMPARE(splash.size(), expected_size);
244
+ }
245
  } // namespace
246
 
247
  //! Entry point for BitcoinApplication tests.
 
297
  void AppTests::consoleTests(RPCConsole* console)
298
  {
299
  HandleCallback callback{"consoleTests", *this};
300
+ TestQrQuietZone();
301
+ TestRootsResources();
302
  TestRpcCommand(console);
303
  TestPeerRefreshState(console);
304
  TestLivePeerView(console, m_app.node());