From d25589e0529732996e405aaff8d6c46b012e1601 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Fri, 10 Jul 2020 11:41:33 +0200 Subject: QTestlib: Enable comparing QList against initializer lists/arrays MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It is unnecessary to create a QList container just for comparison. Split out helpers for comparing sequence sizes and sequences from qCompare(QList) and add a template for an array with a non-type template parameter for the size. One can then write something like: const int expected[] = {10, 12,...}; QCOMPARE(QFontDatabase.pointSizes(...), expected) Unfortunately, any commas in such an array will be misread by macro expansion as macro argument separators, so any expected array with more than one entry needs an extra macro expanding __VA_ARGS__. Change-Id: Ie7c8dc20bf669bbb25f6d7f8562455f8d03968c8 Reviewed-by: Qt CI Bot Reviewed-by: Tor Arne Vestbø --- .../auto/testlib/selftests/cmptest/tst_cmptest.cpp | 48 +++- .../testlib/selftests/expected_cmptest.junitxml | 27 +- .../testlib/selftests/expected_cmptest.lightxml | 50 +++- tests/auto/testlib/selftests/expected_cmptest.tap | 296 ++++++++++++--------- .../testlib/selftests/expected_cmptest.teamcity | 27 +- tests/auto/testlib/selftests/expected_cmptest.txt | 31 ++- tests/auto/testlib/selftests/expected_cmptest.xml | 50 +++- 7 files changed, 390 insertions(+), 139 deletions(-) (limited to 'tests/auto/testlib/selftests') diff --git a/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp b/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp index ff6375292f..fca49c9e07 100644 --- a/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp +++ b/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp @@ -141,7 +141,12 @@ private slots: void compare_tostring_data(); void compareQStringLists(); void compareQStringLists_data(); + void compareQListInt_data(); void compareQListInt(); + void compareQListIntToArray_data(); + void compareQListIntToArray(); + void compareQListIntToInitializerList_data(); + void compareQListIntToInitializerList(); void compareQListDouble(); #ifdef QT_GUI_LIB void compareQColor_data(); @@ -425,11 +430,48 @@ void tst_Cmptest::compareQStringLists() QCOMPARE(opA, opB); } +using IntList = QList; + +void tst_Cmptest::compareQListInt_data() +{ + QTest::addColumn("actual"); + + QTest::newRow("match") << IntList{1, 2, 3}; + QTest::newRow("size mismatch") << IntList{1, 2}; + QTest::newRow("value mismatch") << IntList{1, 2, 4}; +} + void tst_Cmptest::compareQListInt() { - QList int1; int1 << 1 << 2 << 3; - QList int2; int2 << 1 << 2 << 4; - QCOMPARE(int1, int2); + QFETCH(IntList, actual); + const QList expected{1, 2, 3}; + QCOMPARE(actual, expected); +} + +void tst_Cmptest::compareQListIntToArray_data() +{ + compareQListInt_data(); +} + +void tst_Cmptest::compareQListIntToArray() +{ + QFETCH(IntList, actual); + const int expected[] = {1, 2, 3}; + QCOMPARE(actual, expected); +} + +void tst_Cmptest::compareQListIntToInitializerList_data() +{ + compareQListInt_data(); +} + +void tst_Cmptest::compareQListIntToInitializerList() +{ + QFETCH(IntList, actual); + // Protect ',' in the list +#define ARG(...) __VA_ARGS__ + QCOMPARE(actual, ARG({1, 2, 3})); +#undef ARG } void tst_Cmptest::compareQListDouble() diff --git a/tests/auto/testlib/selftests/expected_cmptest.junitxml b/tests/auto/testlib/selftests/expected_cmptest.junitxml index 397db4c3e4..937003466e 100644 --- a/tests/auto/testlib/selftests/expected_cmptest.junitxml +++ b/tests/auto/testlib/selftests/expected_cmptest.junitxml @@ -1,5 +1,5 @@ - + @@ -70,9 +70,28 @@ Expected (opB) size: 12" result="fail"/> - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Actual (actual): 4 + Expected (ARG({1, 2, 3})): 3]]> diff --git a/tests/auto/testlib/selftests/expected_cmptest.tap b/tests/auto/testlib/selftests/expected_cmptest.tap index dc9cb5c950..68cf4f80d2 100644 --- a/tests/auto/testlib/selftests/expected_cmptest.tap +++ b/tests/auto/testlib/selftests/expected_cmptest.tap @@ -4,9 +4,9 @@ ok 1 - initTestCase() not ok 2 - compare_unregistered_enums() --- # Compared values are not the same - at: tst_Cmptest::compare_unregistered_enums() (qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp:171) + at: tst_Cmptest::compare_unregistered_enums() (qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp:176) file: qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp - line: 171 + line: 176 ... not ok 3 - compare_registered_enums() --- @@ -16,9 +16,9 @@ not ok 3 - compare_registered_enums() found: Monday (Qt::Monday) expected: Sunday (Qt::Sunday) actual: Monday (Qt::Monday) - at: tst_Cmptest::compare_registered_enums() (qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp:178) + at: tst_Cmptest::compare_registered_enums() (qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp:183) file: qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp - line: 178 + line: 183 ... not ok 4 - compare_class_enums() --- @@ -28,9 +28,9 @@ not ok 4 - compare_class_enums() found: MyClassEnumValue1 (MyClassEnum::MyClassEnumValue1) expected: MyClassEnumValue2 (MyClassEnum::MyClassEnumValue2) actual: MyClassEnumValue1 (MyClassEnum::MyClassEnumValue1) - at: tst_Cmptest::compare_class_enums() (qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp:184) + at: tst_Cmptest::compare_class_enums() (qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp:189) file: qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp - line: 184 + line: 189 ... ok 5 - test_windowflags(pass) not ok 6 - test_windowflags(fail1) @@ -41,9 +41,9 @@ not ok 6 - test_windowflags(fail1) found: Window|WindowSystemMenuHint|WindowStaysOnBottomHint (actualWindowFlags) expected: Window|FramelessWindowHint|WindowSystemMenuHint|WindowStaysOnBottomHint (expectedWindowFlags) actual: Window|WindowSystemMenuHint|WindowStaysOnBottomHint (actualWindowFlags) - at: tst_Cmptest::test_windowflags() (qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp:209) + at: tst_Cmptest::test_windowflags() (qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp:214) file: qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp - line: 209 + line: 214 ... not ok 7 - test_windowflags(fail2) --- @@ -53,9 +53,9 @@ not ok 7 - test_windowflags(fail2) found: Window (actualWindowFlags) expected: Window|FramelessWindowHint (expectedWindowFlags) actual: Window (actualWindowFlags) - at: tst_Cmptest::test_windowflags() (qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp:209) + at: tst_Cmptest::test_windowflags() (qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp:214) file: qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp - line: 209 + line: 214 ... ok 8 - test_unregistered_flags(pass) not ok 9 - test_unregistered_flags(fail1) @@ -66,9 +66,9 @@ not ok 9 - test_unregistered_flags(fail1) found: 0x3 (actualFlags) expected: 0x5 (expectedFlags) actual: 0x3 (actualFlags) - at: tst_Cmptest::test_unregistered_flags() (qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp:242) + at: tst_Cmptest::test_unregistered_flags() (qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp:247) file: qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp - line: 242 + line: 247 ... not ok 10 - test_unregistered_flags(fail2) --- @@ -78,9 +78,9 @@ not ok 10 - test_unregistered_flags(fail2) found: 0x1 (actualFlags) expected: 0x5 (expectedFlags) actual: 0x1 (actualFlags) - at: tst_Cmptest::test_unregistered_flags() (qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp:242) + at: tst_Cmptest::test_unregistered_flags() (qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp:247) file: qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp - line: 242 + line: 247 ... ok 11 - compare_boolfuncs() ok 12 - compare_to_nullptr() @@ -93,9 +93,9 @@ not ok 14 - compare_tostring(int, string) found: QVariant(int,123) (actual) expected: QVariant(QString,hi) (expected) actual: QVariant(int,123) (actual) - at: tst_Cmptest::compare_tostring() (qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp:331) + at: tst_Cmptest::compare_tostring() (qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp:336) file: qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp - line: 331 + line: 336 ... ok 15 - compare_tostring(both invalid) not ok 16 - compare_tostring(null hash, invalid) @@ -106,9 +106,9 @@ not ok 16 - compare_tostring(null hash, invalid) found: QVariant(QVariantHash) (actual) expected: QVariant() (expected) actual: QVariant(QVariantHash) (actual) - at: tst_Cmptest::compare_tostring() (qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp:331) + at: tst_Cmptest::compare_tostring() (qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp:336) file: qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp - line: 331 + line: 336 ... not ok 17 - compare_tostring(string, null user type) --- @@ -118,9 +118,9 @@ not ok 17 - compare_tostring(string, null user type) found: QVariant(QString,A simple string) (actual) expected: QVariant(PhonyClass) (expected) actual: QVariant(QString,A simple string) (actual) - at: tst_Cmptest::compare_tostring() (qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp:331) + at: tst_Cmptest::compare_tostring() (qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp:336) file: qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp - line: 331 + line: 336 ... not ok 18 - compare_tostring(both non-null user type) --- @@ -130,9 +130,9 @@ not ok 18 - compare_tostring(both non-null user type) found: QVariant(PhonyClass,) (actual) expected: QVariant(PhonyClass,) (expected) actual: QVariant(PhonyClass,) (actual) - at: tst_Cmptest::compare_tostring() (qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp:331) + at: tst_Cmptest::compare_tostring() (qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp:336) file: qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp - line: 331 + line: 336 ... ok 19 - compareQStringLists(empty lists) ok 20 - compareQStringLists(equal lists) @@ -144,9 +144,9 @@ not ok 21 - compareQStringLists(last item different) found: "string3" (opA) expected: "DIFFERS" (opB) actual: "string3" (opA) - at: tst_Cmptest::compareQStringLists() (qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp:425) + at: tst_Cmptest::compareQStringLists() (qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp:430) file: qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp - line: 425 + line: 430 ... not ok 22 - compareQStringLists(second-last item different) --- @@ -156,50 +156,104 @@ not ok 22 - compareQStringLists(second-last item different) found: "string3" (opA) expected: "DIFFERS" (opB) actual: "string3" (opA) - at: tst_Cmptest::compareQStringLists() (qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp:425) + at: tst_Cmptest::compareQStringLists() (qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp:430) file: qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp - line: 425 + line: 430 ... not ok 23 - compareQStringLists(prefix) --- # Compared lists have different sizes. Actual (opA) size: 2 Expected (opB) size: 1 - at: tst_Cmptest::compareQStringLists() (qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp:425) + at: tst_Cmptest::compareQStringLists() (qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp:430) file: qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp - line: 425 + line: 430 ... not ok 24 - compareQStringLists(short list second) --- # Compared lists have different sizes. Actual (opA) size: 12 Expected (opB) size: 1 - at: tst_Cmptest::compareQStringLists() (qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp:425) + at: tst_Cmptest::compareQStringLists() (qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp:430) file: qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp - line: 425 + line: 430 ... not ok 25 - compareQStringLists(short list first) --- # Compared lists have different sizes. Actual (opA) size: 1 Expected (opB) size: 12 - at: tst_Cmptest::compareQStringLists() (qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp:425) + at: tst_Cmptest::compareQStringLists() (qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp:430) file: qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp - line: 425 + line: 430 ... -not ok 26 - compareQListInt() +ok 26 - compareQListInt(match) +not ok 27 - compareQListInt(size mismatch) + --- + # Compared lists have different sizes. + Actual (actual) size: 2 + Expected (expected) size: 3 + at: tst_Cmptest::compareQListInt() (qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp:448) + file: qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp + line: 448 + ... +not ok 28 - compareQListInt(value mismatch) + --- + type: QCOMPARE + message: Compared lists differ at index 2. + wanted: 3 (expected) + found: 4 (actual) + expected: 3 (expected) + actual: 4 (actual) + at: tst_Cmptest::compareQListInt() (qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp:448) + file: qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp + line: 448 + ... +ok 29 - compareQListIntToArray(match) +not ok 30 - compareQListIntToArray(size mismatch) + --- + # Compared lists have different sizes. + Actual (actual) size: 2 + Expected (expected) size: 3 + at: tst_Cmptest::compareQListIntToArray() (qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp:460) + file: qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp + line: 460 + ... +not ok 31 - compareQListIntToArray(value mismatch) + --- + type: QCOMPARE + message: Compared lists differ at index 2. + wanted: 3 (expected) + found: 4 (actual) + expected: 3 (expected) + actual: 4 (actual) + at: tst_Cmptest::compareQListIntToArray() (qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp:460) + file: qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp + line: 460 + ... +ok 32 - compareQListIntToInitializerList(match) +not ok 33 - compareQListIntToInitializerList(size mismatch) + --- + # Compared lists have different sizes. + Actual (actual) size: 2 + Expected (ARG({1, 2, 3})) size: 3 + at: tst_Cmptest::compareQListIntToInitializerList() (qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp:473) + file: qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp + line: 473 + ... +not ok 34 - compareQListIntToInitializerList(value mismatch) --- type: QCOMPARE message: Compared lists differ at index 2. - wanted: 4 (int2) - found: 3 (int1) - expected: 4 (int2) - actual: 3 (int1) - at: tst_Cmptest::compareQListInt() (qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp:432) + wanted: 3 (ARG({1, 2, 3})) + found: 4 (actual) + expected: 3 (ARG({1, 2, 3})) + actual: 4 (actual) + at: tst_Cmptest::compareQListIntToInitializerList() (qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp:473) file: qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp - line: 432 + line: 473 ... -not ok 27 - compareQListDouble() +not ok 35 - compareQListDouble() --- type: QCOMPARE message: Compared lists differ at index 0. @@ -207,12 +261,12 @@ not ok 27 - compareQListDouble() found: 1.5 (double1) expected: 1 (double2) actual: 1.5 (double1) - at: tst_Cmptest::compareQListDouble() (qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp:439) + at: tst_Cmptest::compareQListDouble() (qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp:481) file: qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp - line: 439 + line: 481 ... -ok 28 - compareQColor(Qt::yellow vs "yellow") -not ok 29 - compareQColor(Qt::yellow vs Qt::green) +ok 36 - compareQColor(Qt::yellow vs "yellow") +not ok 37 - compareQColor(Qt::yellow vs Qt::green) --- type: QCOMPARE message: Compared values are not the same @@ -220,11 +274,11 @@ not ok 29 - compareQColor(Qt::yellow vs Qt::green) found: #ffffff00 (colorA) expected: #ff00ff00 (colorB) actual: #ffffff00 (colorA) - at: tst_Cmptest::compareQColor() (qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp:458) + at: tst_Cmptest::compareQColor() (qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp:500) file: qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp - line: 458 + line: 500 ... -not ok 30 - compareQColor(0x88ff0000 vs 0xffff0000) +not ok 38 - compareQColor(0x88ff0000 vs 0xffff0000) --- type: QCOMPARE message: Compared values are not the same @@ -232,12 +286,12 @@ not ok 30 - compareQColor(0x88ff0000 vs 0xffff0000) found: #88ff0000 (colorA) expected: #ffff0000 (colorB) actual: #88ff0000 (colorA) - at: tst_Cmptest::compareQColor() (qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp:458) + at: tst_Cmptest::compareQColor() (qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp:500) file: qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp - line: 458 + line: 500 ... -ok 31 - compareQPixmaps(both null) -not ok 32 - compareQPixmaps(one null) +ok 39 - compareQPixmaps(both null) +not ok 40 - compareQPixmaps(one null) --- type: QCOMPARE message: Compared QPixmaps differ. @@ -245,11 +299,11 @@ not ok 32 - compareQPixmaps(one null) found: 1 (opA).isNull() expected: 0 (opB).isNull() actual: 1 (opA).isNull() - at: tst_Cmptest::compareQPixmaps() (qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp:486) + at: tst_Cmptest::compareQPixmaps() (qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp:528) file: qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp - line: 486 + line: 528 ... -not ok 33 - compareQPixmaps(other null) +not ok 41 - compareQPixmaps(other null) --- type: QCOMPARE message: Compared QPixmaps differ. @@ -257,12 +311,12 @@ not ok 33 - compareQPixmaps(other null) found: 0 (opA).isNull() expected: 1 (opB).isNull() actual: 0 (opA).isNull() - at: tst_Cmptest::compareQPixmaps() (qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp:486) + at: tst_Cmptest::compareQPixmaps() (qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp:528) file: qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp - line: 486 + line: 528 ... -ok 34 - compareQPixmaps(equal) -not ok 35 - compareQPixmaps(different size) +ok 42 - compareQPixmaps(equal) +not ok 43 - compareQPixmaps(different size) --- type: QCOMPARE message: Compared QPixmaps differ in size. @@ -270,18 +324,18 @@ not ok 35 - compareQPixmaps(different size) found: 11x20 (opA) expected: 20x20 (opB) actual: 11x20 (opA) - at: tst_Cmptest::compareQPixmaps() (qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp:486) + at: tst_Cmptest::compareQPixmaps() (qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp:528) file: qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp - line: 486 + line: 528 ... -not ok 36 - compareQPixmaps(different pixels) +not ok 44 - compareQPixmaps(different pixels) --- # Compared values are not the same - at: tst_Cmptest::compareQPixmaps() (qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp:486) + at: tst_Cmptest::compareQPixmaps() (qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp:528) file: qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp - line: 486 + line: 528 ... -not ok 37 - compareQPixmaps(different dpr) +not ok 45 - compareQPixmaps(different dpr) --- type: QCOMPARE message: Compared QPixmaps differ in device pixel ratio. @@ -289,12 +343,12 @@ not ok 37 - compareQPixmaps(different dpr) found: 1 (opA) expected: 2 (opB) actual: 1 (opA) - at: tst_Cmptest::compareQPixmaps() (qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp:486) + at: tst_Cmptest::compareQPixmaps() (qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp:528) file: qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp - line: 486 + line: 528 ... -ok 38 - compareQImages(both null) -not ok 39 - compareQImages(one null) +ok 46 - compareQImages(both null) +not ok 47 - compareQImages(one null) --- type: QCOMPARE message: Compared QImages differ. @@ -302,11 +356,11 @@ not ok 39 - compareQImages(one null) found: 1 (opA).isNull() expected: 0 (opB).isNull() actual: 1 (opA).isNull() - at: tst_Cmptest::compareQImages() (qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp:516) + at: tst_Cmptest::compareQImages() (qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp:558) file: qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp - line: 516 + line: 558 ... -not ok 40 - compareQImages(other null) +not ok 48 - compareQImages(other null) --- type: QCOMPARE message: Compared QImages differ. @@ -314,12 +368,12 @@ not ok 40 - compareQImages(other null) found: 0 (opA).isNull() expected: 1 (opB).isNull() actual: 0 (opA).isNull() - at: tst_Cmptest::compareQImages() (qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp:516) + at: tst_Cmptest::compareQImages() (qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp:558) file: qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp - line: 516 + line: 558 ... -ok 41 - compareQImages(equal) -not ok 42 - compareQImages(different size) +ok 49 - compareQImages(equal) +not ok 50 - compareQImages(different size) --- type: QCOMPARE message: Compared QImages differ in size. @@ -327,11 +381,11 @@ not ok 42 - compareQImages(different size) found: 11x20 (opA) expected: 20x20 (opB) actual: 11x20 (opA) - at: tst_Cmptest::compareQImages() (qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp:516) + at: tst_Cmptest::compareQImages() (qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp:558) file: qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp - line: 516 + line: 558 ... -not ok 43 - compareQImages(different format) +not ok 51 - compareQImages(different format) --- type: QCOMPARE message: Compared QImages differ in format. @@ -339,18 +393,18 @@ not ok 43 - compareQImages(different format) found: 6 (opA) expected: 3 (opB) actual: 6 (opA) - at: tst_Cmptest::compareQImages() (qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp:516) + at: tst_Cmptest::compareQImages() (qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp:558) file: qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp - line: 516 + line: 558 ... -not ok 44 - compareQImages(different pixels) +not ok 52 - compareQImages(different pixels) --- # Compared values are not the same - at: tst_Cmptest::compareQImages() (qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp:516) + at: tst_Cmptest::compareQImages() (qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp:558) file: qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp - line: 516 + line: 558 ... -not ok 45 - compareQImages(different dpr) +not ok 53 - compareQImages(different dpr) --- type: QCOMPARE message: Compared QImages differ in device pixel ratio. @@ -358,12 +412,12 @@ not ok 45 - compareQImages(different dpr) found: 1 (opA) expected: 2 (opB) actual: 1 (opA) - at: tst_Cmptest::compareQImages() (qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp:516) + at: tst_Cmptest::compareQImages() (qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp:558) file: qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp - line: 516 + line: 558 ... -ok 46 - compareQRegion(equal-empty) -not ok 47 - compareQRegion(1-empty) +ok 54 - compareQRegion(equal-empty) +not ok 55 - compareQRegion(1-empty) --- type: QCOMPARE message: Compared values are not the same @@ -371,12 +425,12 @@ not ok 47 - compareQRegion(1-empty) found: QRegion(200x50+10+10) (rA) expected: QRegion(null) (rB) actual: QRegion(200x50+10+10) (rA) - at: tst_Cmptest::compareQRegion() (qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp:539) + at: tst_Cmptest::compareQRegion() (qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp:581) file: qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp - line: 539 + line: 581 ... -ok 48 - compareQRegion(equal) -not ok 49 - compareQRegion(different lists) +ok 56 - compareQRegion(equal) +not ok 57 - compareQRegion(different lists) --- type: QCOMPARE message: Compared values are not the same @@ -384,11 +438,11 @@ not ok 49 - compareQRegion(different lists) found: QRegion(200x50+10+10) (rA) expected: QRegion(2 rectangles, 50x200+100+200, 200x50+10+10) (rB) actual: QRegion(200x50+10+10) (rA) - at: tst_Cmptest::compareQRegion() (qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp:539) + at: tst_Cmptest::compareQRegion() (qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp:581) file: qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp - line: 539 + line: 581 ... -not ok 50 - compareQVector2D() +not ok 58 - compareQVector2D() --- type: QCOMPARE message: Compared values are not the same @@ -396,11 +450,11 @@ not ok 50 - compareQVector2D() found: QVector2D(1, 2) (v2a) expected: QVector2D(1, 3) (v2b) actual: QVector2D(1, 2) (v2a) - at: tst_Cmptest::compareQVector2D() (qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp:548) + at: tst_Cmptest::compareQVector2D() (qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp:590) file: qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp - line: 548 + line: 590 ... -not ok 51 - compareQVector3D() +not ok 59 - compareQVector3D() --- type: QCOMPARE message: Compared values are not the same @@ -408,11 +462,11 @@ not ok 51 - compareQVector3D() found: QVector3D(1, 2, 3) (v3a) expected: QVector3D(1, 3, 3) (v3b) actual: QVector3D(1, 2, 3) (v3a) - at: tst_Cmptest::compareQVector3D() (qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp:557) + at: tst_Cmptest::compareQVector3D() (qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp:599) file: qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp - line: 557 + line: 599 ... -not ok 52 - compareQVector4D() +not ok 60 - compareQVector4D() --- type: QCOMPARE message: Compared values are not the same @@ -420,11 +474,11 @@ not ok 52 - compareQVector4D() found: QVector4D(1, 2, 3, 4) (v4a) expected: QVector4D(1, 3, 3, 4) (v4b) actual: QVector4D(1, 2, 3, 4) (v4a) - at: tst_Cmptest::compareQVector4D() (qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp:566) + at: tst_Cmptest::compareQVector4D() (qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp:608) file: qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp - line: 566 + line: 608 ... -not ok 53 - verify() +not ok 61 - verify() --- type: QVERIFY message: Verification failed @@ -432,11 +486,11 @@ not ok 53 - verify() found: false (opaqueFunc() < 2) expected: true (opaqueFunc() < 2) actual: false (opaqueFunc() < 2) - at: tst_Cmptest::verify() (qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp:578) + at: tst_Cmptest::verify() (qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp:620) file: qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp - line: 578 + line: 620 ... -not ok 54 - verify2() +not ok 62 - verify2() --- type: QVERIFY message: 42 @@ -444,11 +498,11 @@ not ok 54 - verify2() 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:584) + at: tst_Cmptest::verify2() (qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp:626) file: qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp - line: 584 + line: 626 ... -not ok 55 - tryVerify() +not ok 63 - tryVerify() --- type: QVERIFY message: Verification failed @@ -456,11 +510,11 @@ not ok 55 - tryVerify() 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) + at: tst_Cmptest::tryVerify() (qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp:632) file: qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp - line: 590 + line: 632 ... -not ok 56 - tryVerify2() +not ok 64 - tryVerify2() --- type: QVERIFY message: 42 @@ -468,13 +522,13 @@ not ok 56 - tryVerify2() 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) + at: tst_Cmptest::tryVerify2() (qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp:638) file: qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp - line: 596 + line: 638 ... -ok 57 - verifyExplicitOperatorBool() -ok 58 - cleanupTestCase() -1..58 -# tests 58 -# pass 18 -# fail 40 +ok 65 - verifyExplicitOperatorBool() +ok 66 - cleanupTestCase() +1..66 +# tests 66 +# pass 21 +# fail 45 diff --git a/tests/auto/testlib/selftests/expected_cmptest.teamcity b/tests/auto/testlib/selftests/expected_cmptest.teamcity index 426fddb20f..e971f2fd4b 100644 --- a/tests/auto/testlib/selftests/expected_cmptest.teamcity +++ b/tests/auto/testlib/selftests/expected_cmptest.teamcity @@ -65,9 +65,30 @@ ##teamcity[testStarted name='compareQStringLists(short list first)' flowId='tst_Cmptest'] ##teamcity[testFailed name='compareQStringLists(short list first)' message='Failure! |[Loc: qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp(0)|]' details='Compared lists have different sizes.|n Actual (opA) size: 1|n Expected (opB) size: 12' flowId='tst_Cmptest'] ##teamcity[testFinished name='compareQStringLists(short list first)' flowId='tst_Cmptest'] -##teamcity[testStarted name='compareQListInt()' flowId='tst_Cmptest'] -##teamcity[testFailed name='compareQListInt()' message='Failure! |[Loc: qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp(0)|]' details='Compared lists differ at index 2.|n Actual (int1): 3|n Expected (int2): 4' flowId='tst_Cmptest'] -##teamcity[testFinished name='compareQListInt()' flowId='tst_Cmptest'] +##teamcity[testStarted name='compareQListInt(match)' flowId='tst_Cmptest'] +##teamcity[testFinished name='compareQListInt(match)' flowId='tst_Cmptest'] +##teamcity[testStarted name='compareQListInt(size mismatch)' flowId='tst_Cmptest'] +##teamcity[testFailed name='compareQListInt(size mismatch)' message='Failure! |[Loc: qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp(0)|]' details='Compared lists have different sizes.|n Actual (actual) size: 2|n Expected (expected) size: 3' flowId='tst_Cmptest'] +##teamcity[testFinished name='compareQListInt(size mismatch)' flowId='tst_Cmptest'] +##teamcity[testStarted name='compareQListInt(value mismatch)' flowId='tst_Cmptest'] +##teamcity[testFailed name='compareQListInt(value mismatch)' message='Failure! |[Loc: qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp(0)|]' details='Compared lists differ at index 2.|n Actual (actual): 4|n Expected (expected): 3' flowId='tst_Cmptest'] +##teamcity[testFinished name='compareQListInt(value mismatch)' flowId='tst_Cmptest'] +##teamcity[testStarted name='compareQListIntToArray(match)' flowId='tst_Cmptest'] +##teamcity[testFinished name='compareQListIntToArray(match)' flowId='tst_Cmptest'] +##teamcity[testStarted name='compareQListIntToArray(size mismatch)' flowId='tst_Cmptest'] +##teamcity[testFailed name='compareQListIntToArray(size mismatch)' message='Failure! |[Loc: qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp(0)|]' details='Compared lists have different sizes.|n Actual (actual) size: 2|n Expected (expected) size: 3' flowId='tst_Cmptest'] +##teamcity[testFinished name='compareQListIntToArray(size mismatch)' flowId='tst_Cmptest'] +##teamcity[testStarted name='compareQListIntToArray(value mismatch)' flowId='tst_Cmptest'] +##teamcity[testFailed name='compareQListIntToArray(value mismatch)' message='Failure! |[Loc: qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp(0)|]' details='Compared lists differ at index 2.|n Actual (actual): 4|n Expected (expected): 3' flowId='tst_Cmptest'] +##teamcity[testFinished name='compareQListIntToArray(value mismatch)' flowId='tst_Cmptest'] +##teamcity[testStarted name='compareQListIntToInitializerList(match)' flowId='tst_Cmptest'] +##teamcity[testFinished name='compareQListIntToInitializerList(match)' flowId='tst_Cmptest'] +##teamcity[testStarted name='compareQListIntToInitializerList(size mismatch)' flowId='tst_Cmptest'] +##teamcity[testFailed name='compareQListIntToInitializerList(size mismatch)' message='Failure! |[Loc: qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp(0)|]' details='Compared lists have different sizes.|n Actual (actual) size: 2|n Expected (ARG({1, 2, 3})) size: 3' flowId='tst_Cmptest'] +##teamcity[testFinished name='compareQListIntToInitializerList(size mismatch)' flowId='tst_Cmptest'] +##teamcity[testStarted name='compareQListIntToInitializerList(value mismatch)' flowId='tst_Cmptest'] +##teamcity[testFailed name='compareQListIntToInitializerList(value mismatch)' message='Failure! |[Loc: qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp(0)|]' details='Compared lists differ at index 2.|n Actual (actual): 4|n Expected (ARG({1, 2, 3})): 3' flowId='tst_Cmptest'] +##teamcity[testFinished name='compareQListIntToInitializerList(value mismatch)' flowId='tst_Cmptest'] ##teamcity[testStarted name='compareQListDouble()' flowId='tst_Cmptest'] ##teamcity[testFailed name='compareQListDouble()' message='Failure! |[Loc: qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp(0)|]' details='Compared lists differ at index 0.|n Actual (double1): 1.5|n Expected (double2): 1' flowId='tst_Cmptest'] ##teamcity[testFinished name='compareQListDouble()' flowId='tst_Cmptest'] diff --git a/tests/auto/testlib/selftests/expected_cmptest.txt b/tests/auto/testlib/selftests/expected_cmptest.txt index 08877ef74d..527ec991bb 100644 --- a/tests/auto/testlib/selftests/expected_cmptest.txt +++ b/tests/auto/testlib/selftests/expected_cmptest.txt @@ -71,9 +71,32 @@ FAIL! : tst_Cmptest::compareQStringLists(short list first) Compared lists have Actual (opA) size: 1 Expected (opB) size: 12 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 +PASS : tst_Cmptest::compareQListInt(match) +FAIL! : tst_Cmptest::compareQListInt(size mismatch) Compared lists have different sizes. + Actual (actual) size: 2 + Expected (expected) size: 3 + Loc: [qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp(0)] +FAIL! : tst_Cmptest::compareQListInt(value mismatch) Compared lists differ at index 2. + Actual (actual): 4 + Expected (expected): 3 + Loc: [qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp(0)] +PASS : tst_Cmptest::compareQListIntToArray(match) +FAIL! : tst_Cmptest::compareQListIntToArray(size mismatch) Compared lists have different sizes. + Actual (actual) size: 2 + Expected (expected) size: 3 + Loc: [qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp(0)] +FAIL! : tst_Cmptest::compareQListIntToArray(value mismatch) Compared lists differ at index 2. + Actual (actual): 4 + Expected (expected): 3 + Loc: [qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp(0)] +PASS : tst_Cmptest::compareQListIntToInitializerList(match) +FAIL! : tst_Cmptest::compareQListIntToInitializerList(size mismatch) Compared lists have different sizes. + Actual (actual) size: 2 + Expected (ARG({1, 2, 3})) size: 3 + Loc: [qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp(0)] +FAIL! : tst_Cmptest::compareQListIntToInitializerList(value mismatch) Compared lists differ at index 2. + Actual (actual): 4 + Expected (ARG({1, 2, 3})): 3 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 @@ -164,5 +187,5 @@ FAIL! : tst_Cmptest::tryVerify2() 'opaqueFunc() < 2' returned FALSE. (42) Loc: [qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp(0)] PASS : tst_Cmptest::verifyExplicitOperatorBool() PASS : tst_Cmptest::cleanupTestCase() -Totals: 18 passed, 40 failed, 0 skipped, 0 blacklisted, 0ms +Totals: 21 passed, 45 failed, 0 skipped, 0 blacklisted, 0ms ********* Finished testing of tst_Cmptest ********* diff --git a/tests/auto/testlib/selftests/expected_cmptest.xml b/tests/auto/testlib/selftests/expected_cmptest.xml index daf2560f1b..c89f177a13 100644 --- a/tests/auto/testlib/selftests/expected_cmptest.xml +++ b/tests/auto/testlib/selftests/expected_cmptest.xml @@ -149,10 +149,56 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Actual (actual): 4 + Expected (ARG({1, 2, 3})): 3]]> -- cgit v1.2.3