QTestlib: Check compared images for device pixel ratio

When accidentally running a test doing screen-grabbing
with High DPI scaling active, sizes of the obtained pixmaps
can differ due to the device pixel ratio. Add a check to make that
clearer.

[ChangeLog][QtTestLib] Comparison of QImage, QPixmap now checks for the
device pixel ratio.

Change-Id: Id8d5187e99c565c44a7bfb8b9cfb09737815fb15
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
This commit is contained in:
Friedemann Kleint 2019-05-29 13:18:14 +02:00
parent e81ece3f8f
commit 9c8d1ca18b
8 changed files with 167 additions and 77 deletions

View File

@ -162,6 +162,14 @@ inline bool qCompare(QImage const &t1, QImage const &t2,
} }
if (t1Null && t2Null) if (t1Null && t2Null)
return compare_helper(true, nullptr, nullptr, nullptr, actual, expected, file, line); return compare_helper(true, nullptr, nullptr, nullptr, actual, expected, file, line);
if (!qFuzzyCompare(t1.devicePixelRatioF(), t2.devicePixelRatioF())) {
qsnprintf(msg, 1024, "Compared QImages differ in device pixel ratio.\n"
" Actual (%s): %g\n"
" Expected (%s): %g",
actual, t1.devicePixelRatioF(),
expected, t2.devicePixelRatioF());
return compare_helper(false, msg, nullptr, nullptr, actual, expected, file, line);
}
if (t1.width() != t2.width() || t1.height() != t2.height()) { if (t1.width() != t2.width() || t1.height() != t2.height()) {
qsnprintf(msg, 1024, "Compared QImages differ in size.\n" qsnprintf(msg, 1024, "Compared QImages differ in size.\n"
" Actual (%s): %dx%d\n" " Actual (%s): %dx%d\n"
@ -196,6 +204,14 @@ inline bool qCompare(QPixmap const &t1, QPixmap const &t2, const char *actual, c
} }
if (t1Null && t2Null) if (t1Null && t2Null)
return compare_helper(true, nullptr, nullptr, nullptr, actual, expected, file, line); return compare_helper(true, nullptr, nullptr, nullptr, actual, expected, file, line);
if (!qFuzzyCompare(t1.devicePixelRatioF(), t2.devicePixelRatioF())) {
qsnprintf(msg, 1024, "Compared QPixmaps differ in device pixel ratio.\n"
" Actual (%s): %g\n"
" Expected (%s): %g",
actual, t1.devicePixelRatioF(),
expected, t2.devicePixelRatioF());
return compare_helper(false, msg, nullptr, nullptr, actual, expected, file, line);
}
if (t1.width() != t2.width() || t1.height() != t2.height()) { if (t1.width() != t2.width() || t1.height() != t2.height()) {
qsnprintf(msg, 1024, "Compared QPixmaps differ in size.\n" qsnprintf(msg, 1024, "Compared QPixmaps differ in size.\n"
" Actual (%s): %dx%d\n" " Actual (%s): %dx%d\n"

View File

@ -466,6 +466,8 @@ void tst_Cmptest::compareQPixmaps_data()
const QPixmap pixmap1(xpmPixmapData1); const QPixmap pixmap1(xpmPixmapData1);
const QPixmap pixmap2(xpmPixmapData2); const QPixmap pixmap2(xpmPixmapData2);
const QPixmap pixmap3(xpmPixmapData3); const QPixmap pixmap3(xpmPixmapData3);
QPixmap pixmapWrongDpr = pixmap1.scaled(2, 2);
pixmapWrongDpr.setDevicePixelRatio(2);
QTest::newRow("both null") << QPixmap() << QPixmap(); QTest::newRow("both null") << QPixmap() << QPixmap();
QTest::newRow("one null") << QPixmap() << pixmap1; QTest::newRow("one null") << QPixmap() << pixmap1;
@ -473,6 +475,7 @@ void tst_Cmptest::compareQPixmaps_data()
QTest::newRow("equal") << pixmap1 << pixmap1; QTest::newRow("equal") << pixmap1 << pixmap1;
QTest::newRow("different size") << pixmap1 << pixmap3; QTest::newRow("different size") << pixmap1 << pixmap3;
QTest::newRow("different pixels") << pixmap1 << pixmap2; QTest::newRow("different pixels") << pixmap1 << pixmap2;
QTest::newRow("different dpr") << pixmap1 << pixmapWrongDpr;
} }
void tst_Cmptest::compareQPixmaps() void tst_Cmptest::compareQPixmaps()
@ -492,6 +495,8 @@ void tst_Cmptest::compareQImages_data()
const QImage image2(QPixmap(xpmPixmapData2).toImage()); const QImage image2(QPixmap(xpmPixmapData2).toImage());
const QImage image1Indexed = image1.convertToFormat(QImage::Format_Indexed8); const QImage image1Indexed = image1.convertToFormat(QImage::Format_Indexed8);
const QImage image3(QPixmap(xpmPixmapData3).toImage()); const QImage image3(QPixmap(xpmPixmapData3).toImage());
QImage imageWrongDpr = image1.scaled(2, 2);
imageWrongDpr.setDevicePixelRatio(2);
QTest::newRow("both null") << QImage() << QImage(); QTest::newRow("both null") << QImage() << QImage();
QTest::newRow("one null") << QImage() << image1; QTest::newRow("one null") << QImage() << image1;
@ -500,6 +505,7 @@ void tst_Cmptest::compareQImages_data()
QTest::newRow("different size") << image1 << image3; QTest::newRow("different size") << image1 << image3;
QTest::newRow("different format") << image1 << image1Indexed; QTest::newRow("different format") << image1 << image1Indexed;
QTest::newRow("different pixels") << image1 << image2; QTest::newRow("different pixels") << image1 << image2;
QTest::newRow("different dpr") << image1 << imageWrongDpr;
} }
void tst_Cmptest::compareQImages() void tst_Cmptest::compareQImages()

View File

@ -208,6 +208,12 @@
<Incident type="fail" file="qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp" line="0"> <Incident type="fail" file="qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp" line="0">
<DataTag><![CDATA[different pixels]]></DataTag> <DataTag><![CDATA[different pixels]]></DataTag>
<Description><![CDATA[Compared values are not the same]]></Description> <Description><![CDATA[Compared values are not the same]]></Description>
</Incident>
<Incident type="fail" file="qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp" line="0">
<DataTag><![CDATA[different dpr]]></DataTag>
<Description><![CDATA[Compared QPixmaps differ in device pixel ratio.
Actual (opA): 1
Expected (opB): 2]]></Description>
</Incident> </Incident>
<Duration msecs="0"/> <Duration msecs="0"/>
</TestFunction> </TestFunction>
@ -245,6 +251,12 @@
<Incident type="fail" file="qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp" line="0"> <Incident type="fail" file="qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp" line="0">
<DataTag><![CDATA[different pixels]]></DataTag> <DataTag><![CDATA[different pixels]]></DataTag>
<Description><![CDATA[Compared values are not the same]]></Description> <Description><![CDATA[Compared values are not the same]]></Description>
</Incident>
<Incident type="fail" file="qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp" line="0">
<DataTag><![CDATA[different dpr]]></DataTag>
<Description><![CDATA[Compared QImages differ in device pixel ratio.
Actual (opA): 1
Expected (opB): 2]]></Description>
</Incident> </Incident>
<Duration msecs="0"/> <Duration msecs="0"/>
</TestFunction> </TestFunction>

View File

@ -245,9 +245,9 @@ not ok 32 - compareQPixmaps(one null)
found: 1 (opA).isNull() found: 1 (opA).isNull()
expected: 0 (opB).isNull() expected: 0 (opB).isNull()
actual: 1 (opA).isNull() actual: 1 (opA).isNull()
at: tst_Cmptest::compareQPixmaps() (qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp:483) at: tst_Cmptest::compareQPixmaps() (qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp:486)
file: qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp file: qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp
line: 483 line: 486
... ...
not ok 33 - compareQPixmaps(other null) not ok 33 - compareQPixmaps(other null)
--- ---
@ -257,9 +257,9 @@ not ok 33 - compareQPixmaps(other null)
found: 0 (opA).isNull() found: 0 (opA).isNull()
expected: 1 (opB).isNull() expected: 1 (opB).isNull()
actual: 0 (opA).isNull() actual: 0 (opA).isNull()
at: tst_Cmptest::compareQPixmaps() (qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp:483) at: tst_Cmptest::compareQPixmaps() (qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp:486)
file: qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp file: qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp
line: 483 line: 486
... ...
ok 34 - compareQPixmaps(equal) ok 34 - compareQPixmaps(equal)
not ok 35 - compareQPixmaps(different size) not ok 35 - compareQPixmaps(different size)
@ -270,19 +270,31 @@ not ok 35 - compareQPixmaps(different size)
found: 11x20 (opA) found: 11x20 (opA)
expected: 20x20 (opB) expected: 20x20 (opB)
actual: 11x20 (opA) actual: 11x20 (opA)
at: tst_Cmptest::compareQPixmaps() (qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp:483) at: tst_Cmptest::compareQPixmaps() (qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp:486)
file: qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp file: qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp
line: 483 line: 486
... ...
not ok 36 - compareQPixmaps(different pixels) not ok 36 - compareQPixmaps(different pixels)
--- ---
# Compared values are not the same # Compared values are not the same
at: tst_Cmptest::compareQPixmaps() (qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp:483) at: tst_Cmptest::compareQPixmaps() (qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp:486)
file: qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp file: qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp
line: 483 line: 486
... ...
ok 37 - compareQImages(both null) not ok 37 - compareQPixmaps(different dpr)
not ok 38 - compareQImages(one null) ---
type: QCOMPARE
message: Compared QPixmaps differ in device pixel ratio.
wanted: 2 (opB)
found: 1 (opA)
expected: 2 (opB)
actual: 1 (opA)
at: tst_Cmptest::compareQPixmaps() (qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp:486)
file: qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp
line: 486
...
ok 38 - compareQImages(both null)
not ok 39 - compareQImages(one null)
--- ---
type: QCOMPARE type: QCOMPARE
message: Compared QImages differ. message: Compared QImages differ.
@ -290,11 +302,11 @@ not ok 38 - compareQImages(one null)
found: 1 (opA).isNull() found: 1 (opA).isNull()
expected: 0 (opB).isNull() expected: 0 (opB).isNull()
actual: 1 (opA).isNull() actual: 1 (opA).isNull()
at: tst_Cmptest::compareQImages() (qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp:510) at: tst_Cmptest::compareQImages() (qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp:516)
file: qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp file: qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp
line: 510 line: 516
... ...
not ok 39 - compareQImages(other null) not ok 40 - compareQImages(other null)
--- ---
type: QCOMPARE type: QCOMPARE
message: Compared QImages differ. message: Compared QImages differ.
@ -302,12 +314,12 @@ not ok 39 - compareQImages(other null)
found: 0 (opA).isNull() found: 0 (opA).isNull()
expected: 1 (opB).isNull() expected: 1 (opB).isNull()
actual: 0 (opA).isNull() actual: 0 (opA).isNull()
at: tst_Cmptest::compareQImages() (qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp:510) at: tst_Cmptest::compareQImages() (qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp:516)
file: qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp file: qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp
line: 510 line: 516
... ...
ok 40 - compareQImages(equal) ok 41 - compareQImages(equal)
not ok 41 - compareQImages(different size) not ok 42 - compareQImages(different size)
--- ---
type: QCOMPARE type: QCOMPARE
message: Compared QImages differ in size. message: Compared QImages differ in size.
@ -315,11 +327,11 @@ not ok 41 - compareQImages(different size)
found: 11x20 (opA) found: 11x20 (opA)
expected: 20x20 (opB) expected: 20x20 (opB)
actual: 11x20 (opA) actual: 11x20 (opA)
at: tst_Cmptest::compareQImages() (qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp:510) at: tst_Cmptest::compareQImages() (qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp:516)
file: qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp file: qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp
line: 510 line: 516
... ...
not ok 42 - compareQImages(different format) not ok 43 - compareQImages(different format)
--- ---
type: QCOMPARE type: QCOMPARE
message: Compared QImages differ in format. message: Compared QImages differ in format.
@ -327,19 +339,31 @@ not ok 42 - compareQImages(different format)
found: 6 (opA) found: 6 (opA)
expected: 3 (opB) expected: 3 (opB)
actual: 6 (opA) actual: 6 (opA)
at: tst_Cmptest::compareQImages() (qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp:510) at: tst_Cmptest::compareQImages() (qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp:516)
file: qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp file: qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp
line: 510 line: 516
... ...
not ok 43 - compareQImages(different pixels) not ok 44 - compareQImages(different pixels)
--- ---
# Compared values are not the same # Compared values are not the same
at: tst_Cmptest::compareQImages() (qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp:510) at: tst_Cmptest::compareQImages() (qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp:516)
file: qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp file: qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp
line: 510 line: 516
... ...
ok 44 - compareQRegion(equal-empty) not ok 45 - compareQImages(different dpr)
not ok 45 - compareQRegion(1-empty) ---
type: QCOMPARE
message: Compared QImages differ in device pixel ratio.
wanted: 2 (opB)
found: 1 (opA)
expected: 2 (opB)
actual: 1 (opA)
at: tst_Cmptest::compareQImages() (qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp:516)
file: qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp
line: 516
...
ok 46 - compareQRegion(equal-empty)
not ok 47 - compareQRegion(1-empty)
--- ---
type: QCOMPARE type: QCOMPARE
message: Compared values are not the same message: Compared values are not the same
@ -347,12 +371,12 @@ not ok 45 - compareQRegion(1-empty)
found: QRegion(200x50+10+10) (rA) found: QRegion(200x50+10+10) (rA)
expected: QRegion(null) (rB) expected: QRegion(null) (rB)
actual: QRegion(200x50+10+10) (rA) actual: QRegion(200x50+10+10) (rA)
at: tst_Cmptest::compareQRegion() (qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp:533) at: tst_Cmptest::compareQRegion() (qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp:539)
file: qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp file: qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp
line: 533 line: 539
... ...
ok 46 - compareQRegion(equal) ok 48 - compareQRegion(equal)
not ok 47 - compareQRegion(different lists) not ok 49 - compareQRegion(different lists)
--- ---
type: QCOMPARE type: QCOMPARE
message: Compared values are not the same message: Compared values are not the same
@ -360,11 +384,11 @@ not ok 47 - compareQRegion(different lists)
found: QRegion(200x50+10+10) (rA) found: QRegion(200x50+10+10) (rA)
expected: QRegion(2 rectangles, 50x200+100+200, 200x50+10+10) (rB) expected: QRegion(2 rectangles, 50x200+100+200, 200x50+10+10) (rB)
actual: QRegion(200x50+10+10) (rA) actual: QRegion(200x50+10+10) (rA)
at: tst_Cmptest::compareQRegion() (qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp:533) at: tst_Cmptest::compareQRegion() (qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp:539)
file: qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp file: qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp
line: 533 line: 539
... ...
not ok 48 - compareQVector2D() not ok 50 - compareQVector2D()
--- ---
type: QCOMPARE type: QCOMPARE
message: Compared values are not the same message: Compared values are not the same
@ -372,11 +396,11 @@ not ok 48 - compareQVector2D()
found: QVector2D(1, 2) (v2a) found: QVector2D(1, 2) (v2a)
expected: QVector2D(1, 3) (v2b) expected: QVector2D(1, 3) (v2b)
actual: QVector2D(1, 2) (v2a) actual: QVector2D(1, 2) (v2a)
at: tst_Cmptest::compareQVector2D() (qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp:542) at: tst_Cmptest::compareQVector2D() (qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp:548)
file: qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp file: qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp
line: 542 line: 548
... ...
not ok 49 - compareQVector3D() not ok 51 - compareQVector3D()
--- ---
type: QCOMPARE type: QCOMPARE
message: Compared values are not the same message: Compared values are not the same
@ -384,11 +408,11 @@ not ok 49 - compareQVector3D()
found: QVector3D(1, 2, 3) (v3a) found: QVector3D(1, 2, 3) (v3a)
expected: QVector3D(1, 3, 3) (v3b) expected: QVector3D(1, 3, 3) (v3b)
actual: QVector3D(1, 2, 3) (v3a) actual: QVector3D(1, 2, 3) (v3a)
at: tst_Cmptest::compareQVector3D() (qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp:551) at: tst_Cmptest::compareQVector3D() (qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp:557)
file: qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp file: qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp
line: 551 line: 557
... ...
not ok 50 - compareQVector4D() not ok 52 - compareQVector4D()
--- ---
type: QCOMPARE type: QCOMPARE
message: Compared values are not the same message: Compared values are not the same
@ -396,11 +420,11 @@ not ok 50 - compareQVector4D()
found: QVector4D(1, 2, 3, 4) (v4a) found: QVector4D(1, 2, 3, 4) (v4a)
expected: QVector4D(1, 3, 3, 4) (v4b) expected: QVector4D(1, 3, 3, 4) (v4b)
actual: QVector4D(1, 2, 3, 4) (v4a) actual: QVector4D(1, 2, 3, 4) (v4a)
at: tst_Cmptest::compareQVector4D() (qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp:560) at: tst_Cmptest::compareQVector4D() (qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp:566)
file: qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp file: qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp
line: 560 line: 566
... ...
not ok 51 - verify() not ok 53 - verify()
--- ---
type: QVERIFY type: QVERIFY
message: Verification failed message: Verification failed
@ -408,35 +432,11 @@ not ok 51 - verify()
found: false (opaqueFunc() < 2) found: false (opaqueFunc() < 2)
expected: true (opaqueFunc() < 2) expected: true (opaqueFunc() < 2)
actual: false (opaqueFunc() < 2) actual: false (opaqueFunc() < 2)
at: tst_Cmptest::verify() (qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp:572) at: tst_Cmptest::verify() (qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp:578)
file: qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp
line: 572
...
not ok 52 - verify2()
---
type: QVERIFY
message: 42
wanted: true (opaqueFunc() < 2)
found: false (opaqueFunc() < 2)
expected: true (opaqueFunc() < 2)
actual: false (opaqueFunc() < 2)
at: tst_Cmptest::verify2() (qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp:578)
file: qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp file: qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp
line: 578 line: 578
... ...
not ok 53 - tryVerify() not ok 54 - verify2()
---
type: QVERIFY
message: Verification failed
wanted: true (opaqueFunc() < 2)
found: false (opaqueFunc() < 2)
expected: true (opaqueFunc() < 2)
actual: false (opaqueFunc() < 2)
at: tst_Cmptest::tryVerify() (qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp:584)
file: qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp
line: 584
...
not ok 54 - tryVerify2()
--- ---
type: QVERIFY type: QVERIFY
message: 42 message: 42
@ -444,13 +444,37 @@ not ok 54 - tryVerify2()
found: false (opaqueFunc() < 2) found: false (opaqueFunc() < 2)
expected: true (opaqueFunc() < 2) expected: true (opaqueFunc() < 2)
actual: false (opaqueFunc() < 2) actual: false (opaqueFunc() < 2)
at: tst_Cmptest::tryVerify2() (qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp:590) at: tst_Cmptest::verify2() (qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp:584)
file: qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp
line: 584
...
not ok 55 - tryVerify()
---
type: QVERIFY
message: Verification failed
wanted: true (opaqueFunc() < 2)
found: false (opaqueFunc() < 2)
expected: true (opaqueFunc() < 2)
actual: false (opaqueFunc() < 2)
at: tst_Cmptest::tryVerify() (qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp:590)
file: qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp file: qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp
line: 590 line: 590
... ...
ok 55 - verifyExplicitOperatorBool() not ok 56 - tryVerify2()
ok 56 - cleanupTestCase() ---
1..56 type: QVERIFY
# tests 56 message: 42
wanted: true (opaqueFunc() < 2)
found: false (opaqueFunc() < 2)
expected: true (opaqueFunc() < 2)
actual: false (opaqueFunc() < 2)
at: tst_Cmptest::tryVerify2() (qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp:596)
file: qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp
line: 596
...
ok 57 - verifyExplicitOperatorBool()
ok 58 - cleanupTestCase()
1..58
# tests 58
# pass 18 # pass 18
# fail 38 # fail 40

View File

@ -95,6 +95,9 @@
##teamcity[testStarted name='compareQPixmaps(different pixels)' flowId='tst_Cmptest'] ##teamcity[testStarted name='compareQPixmaps(different pixels)' flowId='tst_Cmptest']
##teamcity[testFailed name='compareQPixmaps(different pixels)' message='Failure! |[Loc: qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp(0)|]' details='Compared values are not the same' flowId='tst_Cmptest'] ##teamcity[testFailed name='compareQPixmaps(different pixels)' message='Failure! |[Loc: qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp(0)|]' details='Compared values are not the same' flowId='tst_Cmptest']
##teamcity[testFinished name='compareQPixmaps(different pixels)' flowId='tst_Cmptest'] ##teamcity[testFinished name='compareQPixmaps(different pixels)' flowId='tst_Cmptest']
##teamcity[testStarted name='compareQPixmaps(different dpr)' flowId='tst_Cmptest']
##teamcity[testFailed name='compareQPixmaps(different dpr)' message='Failure! |[Loc: qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp(0)|]' details='Compared QPixmaps differ in device pixel ratio.|n Actual (opA): 1|n Expected (opB): 2' flowId='tst_Cmptest']
##teamcity[testFinished name='compareQPixmaps(different dpr)' flowId='tst_Cmptest']
##teamcity[testStarted name='compareQImages(both null)' flowId='tst_Cmptest'] ##teamcity[testStarted name='compareQImages(both null)' flowId='tst_Cmptest']
##teamcity[testFinished name='compareQImages(both null)' flowId='tst_Cmptest'] ##teamcity[testFinished name='compareQImages(both null)' flowId='tst_Cmptest']
##teamcity[testStarted name='compareQImages(one null)' flowId='tst_Cmptest'] ##teamcity[testStarted name='compareQImages(one null)' flowId='tst_Cmptest']
@ -114,6 +117,9 @@
##teamcity[testStarted name='compareQImages(different pixels)' flowId='tst_Cmptest'] ##teamcity[testStarted name='compareQImages(different pixels)' flowId='tst_Cmptest']
##teamcity[testFailed name='compareQImages(different pixels)' message='Failure! |[Loc: qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp(0)|]' details='Compared values are not the same' flowId='tst_Cmptest'] ##teamcity[testFailed name='compareQImages(different pixels)' message='Failure! |[Loc: qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp(0)|]' details='Compared values are not the same' flowId='tst_Cmptest']
##teamcity[testFinished name='compareQImages(different pixels)' flowId='tst_Cmptest'] ##teamcity[testFinished name='compareQImages(different pixels)' flowId='tst_Cmptest']
##teamcity[testStarted name='compareQImages(different dpr)' flowId='tst_Cmptest']
##teamcity[testFailed name='compareQImages(different dpr)' message='Failure! |[Loc: qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp(0)|]' details='Compared QImages differ in device pixel ratio.|n Actual (opA): 1|n Expected (opB): 2' flowId='tst_Cmptest']
##teamcity[testFinished name='compareQImages(different dpr)' flowId='tst_Cmptest']
##teamcity[testStarted name='compareQRegion(equal-empty)' flowId='tst_Cmptest'] ##teamcity[testStarted name='compareQRegion(equal-empty)' flowId='tst_Cmptest']
##teamcity[testFinished name='compareQRegion(equal-empty)' flowId='tst_Cmptest'] ##teamcity[testFinished name='compareQRegion(equal-empty)' flowId='tst_Cmptest']
##teamcity[testStarted name='compareQRegion(1-empty)' flowId='tst_Cmptest'] ##teamcity[testStarted name='compareQRegion(1-empty)' flowId='tst_Cmptest']

View File

@ -104,6 +104,10 @@ FAIL! : tst_Cmptest::compareQPixmaps(different size) Compared QPixmaps differ i
Loc: [qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp(0)] Loc: [qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp(0)]
FAIL! : tst_Cmptest::compareQPixmaps(different pixels) Compared values are not the same FAIL! : tst_Cmptest::compareQPixmaps(different pixels) Compared values are not the same
Loc: [qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp(0)] Loc: [qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp(0)]
FAIL! : tst_Cmptest::compareQPixmaps(different dpr) Compared QPixmaps differ in device pixel ratio.
Actual (opA): 1
Expected (opB): 2
Loc: [qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp(0)]
PASS : tst_Cmptest::compareQImages(both null) PASS : tst_Cmptest::compareQImages(both null)
FAIL! : tst_Cmptest::compareQImages(one null) Compared QImages differ. FAIL! : tst_Cmptest::compareQImages(one null) Compared QImages differ.
Actual (opA).isNull(): 1 Actual (opA).isNull(): 1
@ -124,6 +128,10 @@ FAIL! : tst_Cmptest::compareQImages(different format) Compared QImages differ i
Loc: [qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp(0)] Loc: [qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp(0)]
FAIL! : tst_Cmptest::compareQImages(different pixels) Compared values are not the same FAIL! : tst_Cmptest::compareQImages(different pixels) Compared values are not the same
Loc: [qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp(0)] Loc: [qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp(0)]
FAIL! : tst_Cmptest::compareQImages(different dpr) Compared QImages differ in device pixel ratio.
Actual (opA): 1
Expected (opB): 2
Loc: [qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp(0)]
PASS : tst_Cmptest::compareQRegion(equal-empty) PASS : tst_Cmptest::compareQRegion(equal-empty)
FAIL! : tst_Cmptest::compareQRegion(1-empty) Compared values are not the same FAIL! : tst_Cmptest::compareQRegion(1-empty) Compared values are not the same
Actual (rA): QRegion(200x50+10+10) Actual (rA): QRegion(200x50+10+10)
@ -156,5 +164,5 @@ FAIL! : tst_Cmptest::tryVerify2() 'opaqueFunc() < 2' returned FALSE. (42)
Loc: [qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp(0)] Loc: [qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp(0)]
PASS : tst_Cmptest::verifyExplicitOperatorBool() PASS : tst_Cmptest::verifyExplicitOperatorBool()
PASS : tst_Cmptest::cleanupTestCase() PASS : tst_Cmptest::cleanupTestCase()
Totals: 18 passed, 38 failed, 0 skipped, 0 blacklisted, 0ms Totals: 18 passed, 40 failed, 0 skipped, 0 blacklisted, 0ms
********* Finished testing of tst_Cmptest ********* ********* Finished testing of tst_Cmptest *********

View File

@ -210,6 +210,12 @@
<Incident type="fail" file="qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp" line="0"> <Incident type="fail" file="qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp" line="0">
<DataTag><![CDATA[different pixels]]></DataTag> <DataTag><![CDATA[different pixels]]></DataTag>
<Description><![CDATA[Compared values are not the same]]></Description> <Description><![CDATA[Compared values are not the same]]></Description>
</Incident>
<Incident type="fail" file="qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp" line="0">
<DataTag><![CDATA[different dpr]]></DataTag>
<Description><![CDATA[Compared QPixmaps differ in device pixel ratio.
Actual (opA): 1
Expected (opB): 2]]></Description>
</Incident> </Incident>
<Duration msecs="0"/> <Duration msecs="0"/>
</TestFunction> </TestFunction>
@ -247,6 +253,12 @@
<Incident type="fail" file="qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp" line="0"> <Incident type="fail" file="qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp" line="0">
<DataTag><![CDATA[different pixels]]></DataTag> <DataTag><![CDATA[different pixels]]></DataTag>
<Description><![CDATA[Compared values are not the same]]></Description> <Description><![CDATA[Compared values are not the same]]></Description>
</Incident>
<Incident type="fail" file="qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp" line="0">
<DataTag><![CDATA[different dpr]]></DataTag>
<Description><![CDATA[Compared QImages differ in device pixel ratio.
Actual (opA): 1
Expected (opB): 2]]></Description>
</Incident> </Incident>
<Duration msecs="0"/> <Duration msecs="0"/>
</TestFunction> </TestFunction>

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?> <?xml version="1.0" encoding="UTF-8" ?>
<testsuite errors="0" failures="38" tests="26" name="tst_Cmptest"> <testsuite errors="0" failures="40" tests="26" name="tst_Cmptest">
<properties> <properties>
<property value="@INSERT_QT_VERSION_HERE@" name="QTestVersion"/> <property value="@INSERT_QT_VERSION_HERE@" name="QTestVersion"/>
<property value="@INSERT_QT_VERSION_HERE@" name="QtVersion"/> <property value="@INSERT_QT_VERSION_HERE@" name="QtVersion"/>
@ -98,6 +98,9 @@
Actual (opA): 11x20 Actual (opA): 11x20
Expected (opB): 20x20" result="fail"/> Expected (opB): 20x20" result="fail"/>
<failure tag="different pixels" message="Compared values are not the same" result="fail"/> <failure tag="different pixels" message="Compared values are not the same" result="fail"/>
<failure tag="different dpr" message="Compared QPixmaps differ in device pixel ratio.
Actual (opA): 1
Expected (opB): 2" result="fail"/>
</testcase> </testcase>
<testcase result="fail" name="compareQImages"> <testcase result="fail" name="compareQImages">
<failure tag="one null" message="Compared QImages differ. <failure tag="one null" message="Compared QImages differ.
@ -113,6 +116,9 @@
Actual (opA): 6 Actual (opA): 6
Expected (opB): 3" result="fail"/> Expected (opB): 3" result="fail"/>
<failure tag="different pixels" message="Compared values are not the same" result="fail"/> <failure tag="different pixels" message="Compared values are not the same" result="fail"/>
<failure tag="different dpr" message="Compared QImages differ in device pixel ratio.
Actual (opA): 1
Expected (opB): 2" result="fail"/>
</testcase> </testcase>
<testcase result="fail" name="compareQRegion"> <testcase result="fail" name="compareQRegion">
<failure tag="1&#x002D;empty" message="Compared values are not the same <failure tag="1&#x002D;empty" message="Compared values are not the same