Changeset View
Changeset View
Standalone View
Standalone View
autotests/barcodedecodertest.cpp
Show First 20 Lines • Show All 66 Lines • ▼ Show 20 Line(s) | 65 | #endif | |||
---|---|---|---|---|---|
67 | img.load(QStringLiteral(SOURCE_DIR "/barcodes/uic918-3star.png")); | 67 | img.load(QStringLiteral(SOURCE_DIR "/barcodes/uic918-3star.png")); | ||
68 | QVERIFY(!img.isNull()); | 68 | QVERIFY(!img.isNull()); | ||
69 | #ifdef HAVE_ZXING | 69 | #ifdef HAVE_ZXING | ||
70 | const auto b = BarcodeDecoder::decodeAztecBinary(img); | 70 | const auto b = BarcodeDecoder::decodeAztecBinary(img); | ||
71 | QCOMPARE(b.size(), 351); | 71 | QCOMPARE(b.size(), 351); | ||
72 | QVERIFY(b.startsWith("OTI010080000020")); | 72 | QVERIFY(b.startsWith("OTI010080000020")); | ||
73 | #endif | 73 | #endif | ||
74 | } | 74 | } | ||
75 | | ||||
76 | void testQRCode_data() | ||||
77 | { | ||||
78 | QTest::addColumn<QString>("fileName"); | ||||
79 | QTest::addColumn<QString>("result"); | ||||
80 | | ||||
81 | QTest::newRow("1") << QStringLiteral("qrcode1.png") << QStringLiteral("M$K0YGV0G"); | ||||
82 | QTest::newRow("2") << QStringLiteral("qrcode2.png") << QStringLiteral("KZEXO4HRE"); | ||||
83 | } | ||||
84 | | ||||
85 | void testQRCode() | ||||
86 | { | ||||
87 | QFETCH(QString, fileName); | ||||
88 | QFETCH(QString, result); | ||||
89 | | ||||
90 | QImage img(QStringLiteral(SOURCE_DIR "/barcodes/") + fileName); | ||||
91 | QVERIFY(!img.isNull()); | ||||
92 | | ||||
93 | #ifdef HAVE_ZXING | ||||
94 | QCOMPARE(BarcodeDecoder::decodeQRCode(img), result); | ||||
95 | #endif | ||||
96 | | ||||
97 | } | ||||
75 | }; | 98 | }; | ||
76 | 99 | | |||
77 | QTEST_APPLESS_MAIN(BarcodeDecoderTest) | 100 | QTEST_APPLESS_MAIN(BarcodeDecoderTest) | ||
78 | 101 | | |||
79 | #include "barcodedecodertest.moc" | 102 | #include "barcodedecodertest.moc" |