From c988a8a28214914d20f4b8858e7f314a51b27507 Mon Sep 17 00:00:00 2001 From: Mitch Curtis Date: Tue, 3 Oct 2017 10:10:46 +0200 Subject: Make QCOMPARE print QColor alpha values on failure Currently, when two colors are equal except for their alpha values, QCOMPARE produces the following failure message: FAIL! : tst_Test::test() Compared values are not the same Actual (colorA): #ff0000 Expected (colorB): #ff0000 By using the HexArgb format instead of the default HexRgb, we can see the full hex string, with alpha values included: FAIL! : tst_Test::test() Compared values are not the same Actual (colorA): #88ff0000 Expected (colorB): #ffff0000 Task-number: QTBUG-55574 Change-Id: Id82c60a1b473ac6025a6f6ac560fce95a910d782 Reviewed-by: Friedemann Kleint Reviewed-by: Edward Welbourne --- tests/auto/testlib/selftests/expected_cmptest.txt | 79 ++++++++++++----------- 1 file changed, 42 insertions(+), 37 deletions(-) (limited to 'tests/auto/testlib/selftests/expected_cmptest.txt') diff --git a/tests/auto/testlib/selftests/expected_cmptest.txt b/tests/auto/testlib/selftests/expected_cmptest.txt index 179136a2c7..78df990dea 100644 --- a/tests/auto/testlib/selftests/expected_cmptest.txt +++ b/tests/auto/testlib/selftests/expected_cmptest.txt @@ -2,136 +2,141 @@ Config: Using QtTest library PASS : tst_Cmptest::initTestCase() FAIL! : tst_Cmptest::compare_unregistered_enums() Compared values are not the same - Loc: [tst_cmptest.cpp(160)] + Loc: [qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp(0)] FAIL! : tst_Cmptest::compare_registered_enums() Compared values are not the same Actual (Qt::Monday): Monday Expected (Qt::Sunday): Sunday - Loc: [tst_cmptest.cpp(167)] + Loc: [qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp(0)] FAIL! : tst_Cmptest::compare_class_enums() Compared values are not the same Actual (MyClassEnum::MyClassEnumValue1): MyClassEnumValue1 Expected (MyClassEnum::MyClassEnumValue2): MyClassEnumValue2 - Loc: [tst_cmptest.cpp(173)] + Loc: [qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp(0)] PASS : tst_Cmptest::compare_boolfuncs() PASS : tst_Cmptest::compare_to_nullptr() PASS : tst_Cmptest::compare_pointerfuncs() FAIL! : tst_Cmptest::compare_tostring(int, string) Compared values are not the same Actual (actual) : QVariant(int,123) Expected (expected): QVariant(QString,hi) - Loc: [tst_cmptest.cpp(262)] + Loc: [qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp(0)] PASS : tst_Cmptest::compare_tostring(both invalid) FAIL! : tst_Cmptest::compare_tostring(null hash, invalid) Compared values are not the same Actual (actual) : QVariant(QVariantHash) Expected (expected): QVariant() - Loc: [tst_cmptest.cpp(262)] + Loc: [qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp(0)] FAIL! : tst_Cmptest::compare_tostring(string, null user type) Compared values are not the same Actual (actual) : QVariant(QString,A simple string) Expected (expected): QVariant(PhonyClass) - Loc: [tst_cmptest.cpp(262)] + Loc: [qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp(0)] FAIL! : tst_Cmptest::compare_tostring(both non-null user type) Compared values are not the same Actual (actual) : QVariant(PhonyClass,) Expected (expected): QVariant(PhonyClass,) - Loc: [tst_cmptest.cpp(262)] + Loc: [qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp(0)] PASS : tst_Cmptest::compareQStringLists(empty lists) PASS : tst_Cmptest::compareQStringLists(equal lists) FAIL! : tst_Cmptest::compareQStringLists(last item different) Compared lists differ at index 2. Actual (opA): "string3" Expected (opB): "DIFFERS" - Loc: [tst_cmptest.cpp(356)] + Loc: [qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp(0)] FAIL! : tst_Cmptest::compareQStringLists(second-last item different) Compared lists differ at index 2. Actual (opA): "string3" Expected (opB): "DIFFERS" - Loc: [tst_cmptest.cpp(356)] + Loc: [qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp(0)] FAIL! : tst_Cmptest::compareQStringLists(prefix) Compared lists have different sizes. Actual (opA) size: 2 Expected (opB) size: 1 - Loc: [tst_cmptest.cpp(356)] + Loc: [qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp(0)] FAIL! : tst_Cmptest::compareQStringLists(short list second) Compared lists have different sizes. Actual (opA) size: 12 Expected (opB) size: 1 - Loc: [tst_cmptest.cpp(356)] + Loc: [qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp(0)] FAIL! : tst_Cmptest::compareQStringLists(short list first) Compared lists have different sizes. Actual (opA) size: 1 Expected (opB) size: 12 - Loc: [tst_cmptest.cpp(356)] + Loc: [qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp(0)] FAIL! : tst_Cmptest::compareQListInt() Compared lists differ at index 2. Actual (int1): 3 Expected (int2): 4 - Loc: [tst_cmptest.cpp(363)] + Loc: [qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp(0)] FAIL! : tst_Cmptest::compareQListDouble() Compared lists differ at index 0. Actual (double1): 1.5 Expected (double2): 1 - Loc: [tst_cmptest.cpp(370)] -FAIL! : tst_Cmptest::compareQColor() Compared values are not the same - Actual (yellow): #ffff00 - Expected (green) : #00ff00 - Loc: [tst_cmptest.cpp(380)] + Loc: [qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp(0)] +PASS : tst_Cmptest::compareQColor(Qt::yellow vs "yellow") +FAIL! : tst_Cmptest::compareQColor(Qt::yellow vs Qt::green) Compared values are not the same + Actual (colorA): #ffffff00 + Expected (colorB): #ff00ff00 + Loc: [qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp(0)] +FAIL! : tst_Cmptest::compareQColor(0x88ff0000 vs 0xffff0000) Compared values are not the same + Actual (colorA): #88ff0000 + Expected (colorB): #ffff0000 + Loc: [qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp(0)] PASS : tst_Cmptest::compareQPixmaps(both null) FAIL! : tst_Cmptest::compareQPixmaps(one null) Compared QPixmaps differ. Actual (opA).isNull(): 1 Expected (opB).isNull(): 0 - Loc: [tst_cmptest.cpp(405)] + Loc: [qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp(0)] FAIL! : tst_Cmptest::compareQPixmaps(other null) Compared QPixmaps differ. Actual (opA).isNull(): 0 Expected (opB).isNull(): 1 - Loc: [tst_cmptest.cpp(405)] + Loc: [qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp(0)] PASS : tst_Cmptest::compareQPixmaps(equal) FAIL! : tst_Cmptest::compareQPixmaps(different size) Compared QPixmaps differ in size. Actual (opA): 11x20 Expected (opB): 20x20 - Loc: [tst_cmptest.cpp(405)] + Loc: [qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp(0)] FAIL! : tst_Cmptest::compareQPixmaps(different pixels) Compared values are not the same - Loc: [tst_cmptest.cpp(405)] + Loc: [qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp(0)] PASS : tst_Cmptest::compareQImages(both null) FAIL! : tst_Cmptest::compareQImages(one null) Compared QImages differ. Actual (opA).isNull(): 1 Expected (opB).isNull(): 0 - Loc: [tst_cmptest.cpp(432)] + Loc: [qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp(0)] FAIL! : tst_Cmptest::compareQImages(other null) Compared QImages differ. Actual (opA).isNull(): 0 Expected (opB).isNull(): 1 - Loc: [tst_cmptest.cpp(432)] + Loc: [qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp(0)] PASS : tst_Cmptest::compareQImages(equal) FAIL! : tst_Cmptest::compareQImages(different size) Compared QImages differ in size. Actual (opA): 11x20 Expected (opB): 20x20 - Loc: [tst_cmptest.cpp(432)] + Loc: [qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp(0)] FAIL! : tst_Cmptest::compareQImages(different format) Compared QImages differ in format. Actual (opA): 6 Expected (opB): 3 - Loc: [tst_cmptest.cpp(432)] + Loc: [qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp(0)] FAIL! : tst_Cmptest::compareQImages(different pixels) Compared values are not the same - Loc: [tst_cmptest.cpp(432)] + Loc: [qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp(0)] PASS : tst_Cmptest::compareQRegion(equal-empty) FAIL! : tst_Cmptest::compareQRegion(1-empty) Compared values are not the same Actual (rA): QRegion(200x50+10+10) Expected (rB): QRegion(null) - Loc: [tst_cmptest.cpp(455)] + Loc: [qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp(0)] PASS : tst_Cmptest::compareQRegion(equal) FAIL! : tst_Cmptest::compareQRegion(different lists) Compared values are not the same Actual (rA): QRegion(200x50+10+10) Expected (rB): QRegion(2 rectangles, 50x200+100+200, 200x50+10+10) - Loc: [tst_cmptest.cpp(455)] + Loc: [qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp(0)] FAIL! : tst_Cmptest::compareQVector2D() Compared values are not the same Actual (v2a): QVector2D(1, 2) Expected (v2b): QVector2D(1, 3) - Loc: [tst_cmptest.cpp(0)] + Loc: [qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp(0)] FAIL! : tst_Cmptest::compareQVector3D() Compared values are not the same Actual (v3a): QVector3D(1, 2, 3) Expected (v3b): QVector3D(1, 3, 3) - Loc: [tst_cmptest.cpp(0)] + Loc: [qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp(0)] FAIL! : tst_Cmptest::compareQVector4D() Compared values are not the same Actual (v4a): QVector4D(1, 2, 3, 4) Expected (v4b): QVector4D(1, 3, 3, 4) - Loc: [tst_cmptest.cpp(0)] + Loc: [qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp(0)] FAIL! : tst_Cmptest::verify() 'opaqueFunc() < 2' returned FALSE. () - Loc: [tst_cmptest.cpp(467)] + Loc: [qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp(0)] FAIL! : tst_Cmptest::verify2() 'opaqueFunc() < 2' returned FALSE. (42) - Loc: [tst_cmptest.cpp(473)] + Loc: [qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp(0)] FAIL! : tst_Cmptest::tryVerify() 'opaqueFunc() < 2' returned FALSE. () - Loc: [tst_cmptest.cpp(479)] + Loc: [qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp(0)] FAIL! : tst_Cmptest::tryVerify2() 'opaqueFunc() < 2' returned FALSE. (42) - Loc: [tst_cmptest.cpp(485)] + Loc: [qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp(0)] PASS : tst_Cmptest::verifyExplicitOperatorBool() PASS : tst_Cmptest::cleanupTestCase() -Totals: 15 passed, 33 failed, 0 skipped, 0 blacklisted, 0ms +Totals: 16 passed, 34 failed, 0 skipped, 0 blacklisted, 0ms ********* Finished testing of tst_Cmptest ********* -- cgit v1.2.3