From eb93d7b51773b43e6a3e41961898a6033bcd9479 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Mon, 31 Jul 2017 14:57:02 +0200 Subject: Testlib: Format QVector2/3/4D in QCOMPARE Change-Id: Ia0709e598d2fddd6c2f448633b484749146265f7 Reviewed-by: Edward Welbourne --- .../auto/testlib/selftests/cmptest/tst_cmptest.cpp | 33 ++++++++++++++++++++++ .../testlib/selftests/expected_cmptest.lightxml | 24 ++++++++++++++++ .../testlib/selftests/expected_cmptest.teamcity | 9 ++++++ tests/auto/testlib/selftests/expected_cmptest.txt | 14 ++++++++- tests/auto/testlib/selftests/expected_cmptest.xml | 24 ++++++++++++++++ .../testlib/selftests/expected_cmptest.xunitxml | 17 ++++++++++- 6 files changed, 119 insertions(+), 2 deletions(-) (limited to 'tests') diff --git a/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp b/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp index 97eb19599b..2cfe987f7d 100644 --- a/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp +++ b/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp @@ -33,6 +33,9 @@ #include #include #include +#include +#include +#include #endif /* XPM test data for QPixmap, QImage tests (use drag cursors as example) */ @@ -144,6 +147,9 @@ private slots: void compareQImages_data(); void compareQRegion_data(); void compareQRegion(); + void compareQVector2D(); + void compareQVector3D(); + void compareQVector4D(); #endif void verify(); void verify2(); @@ -454,6 +460,33 @@ void tst_Cmptest::compareQRegion() QCOMPARE(rA, rB); } + +void tst_Cmptest::compareQVector2D() +{ + QVector2D v2a{1, 2}; + QVector2D v2b = v2a; + QCOMPARE(v2a, v2b); + v2b.setY(3); + QCOMPARE(v2a, v2b); +} + +void tst_Cmptest::compareQVector3D() +{ + QVector3D v3a{1, 2, 3}; + QVector3D v3b = v3a; + QCOMPARE(v3a, v3b); + v3b.setY(3); + QCOMPARE(v3a, v3b); +} + +void tst_Cmptest::compareQVector4D() +{ + QVector4D v4a{1, 2, 3, 4}; + QVector4D v4b = v4a; + QCOMPARE(v4a, v4b); + v4b.setY(3); + QCOMPARE(v4a, v4b); +} #endif // QT_GUI_LIB static int opaqueFunc() diff --git a/tests/auto/testlib/selftests/expected_cmptest.lightxml b/tests/auto/testlib/selftests/expected_cmptest.lightxml index 621aceb887..eb11d236d4 100644 --- a/tests/auto/testlib/selftests/expected_cmptest.lightxml +++ b/tests/auto/testlib/selftests/expected_cmptest.lightxml @@ -223,6 +223,30 @@ + + + + + + + + + + + + + + + + + + diff --git a/tests/auto/testlib/selftests/expected_cmptest.teamcity b/tests/auto/testlib/selftests/expected_cmptest.teamcity index f9cb5447d0..c49f5d6b79 100644 --- a/tests/auto/testlib/selftests/expected_cmptest.teamcity +++ b/tests/auto/testlib/selftests/expected_cmptest.teamcity @@ -103,6 +103,15 @@ ##teamcity[testStarted name='compareQRegion(different lists)' flowId='tst_Cmptest'] ##teamcity[testFailed name='compareQRegion(different lists)' message='Failure! |[Loc: tst_cmptest.cpp(455)|]' details='Compared values are not the same|n Actual (rA): QRegion(200x50+10+10)|n Expected (rB): QRegion(2 rectangles, 50x200+100+200, 200x50+10+10)' flowId='tst_Cmptest'] ##teamcity[testFinished name='compareQRegion(different lists)' flowId='tst_Cmptest'] +##teamcity[testStarted name='compareQVector2D()' flowId='tst_Cmptest'] +##teamcity[testFailed name='compareQVector2D()' message='Failure! |[Loc: tst_cmptest.cpp(0)|]' details='Compared values are not the same|n Actual (v2a): QVector2D(1, 2)|n Expected (v2b): QVector2D(1, 3)' flowId='tst_Cmptest'] +##teamcity[testFinished name='compareQVector2D()' flowId='tst_Cmptest'] +##teamcity[testStarted name='compareQVector3D()' flowId='tst_Cmptest'] +##teamcity[testFailed name='compareQVector3D()' message='Failure! |[Loc: tst_cmptest.cpp(0)|]' details='Compared values are not the same|n Actual (v3a): QVector3D(1, 2, 3)|n Expected (v3b): QVector3D(1, 3, 3)' flowId='tst_Cmptest'] +##teamcity[testFinished name='compareQVector3D()' flowId='tst_Cmptest'] +##teamcity[testStarted name='compareQVector4D()' flowId='tst_Cmptest'] +##teamcity[testFailed name='compareQVector4D()' message='Failure! |[Loc: tst_cmptest.cpp(0)|]' details='Compared values are not the same|n Actual (v4a): QVector4D(1, 2, 3, 4)|n Expected (v4b): QVector4D(1, 3, 3, 4)' flowId='tst_Cmptest'] +##teamcity[testFinished name='compareQVector4D()' flowId='tst_Cmptest'] ##teamcity[testStarted name='verify()' flowId='tst_Cmptest'] ##teamcity[testFailed name='verify()' message='Failure! |[Loc: tst_cmptest.cpp(467)|]' details='|'opaqueFunc() < 2|' returned FALSE. ()' flowId='tst_Cmptest'] ##teamcity[testFinished name='verify()' flowId='tst_Cmptest'] diff --git a/tests/auto/testlib/selftests/expected_cmptest.txt b/tests/auto/testlib/selftests/expected_cmptest.txt index 9c7f56e6c3..179136a2c7 100644 --- a/tests/auto/testlib/selftests/expected_cmptest.txt +++ b/tests/auto/testlib/selftests/expected_cmptest.txt @@ -111,6 +111,18 @@ FAIL! : tst_Cmptest::compareQRegion(different lists) Compared values are not th Actual (rA): QRegion(200x50+10+10) Expected (rB): QRegion(2 rectangles, 50x200+100+200, 200x50+10+10) Loc: [tst_cmptest.cpp(455)] +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)] +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)] +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)] FAIL! : tst_Cmptest::verify() 'opaqueFunc() < 2' returned FALSE. () Loc: [tst_cmptest.cpp(467)] FAIL! : tst_Cmptest::verify2() 'opaqueFunc() < 2' returned FALSE. (42) @@ -121,5 +133,5 @@ FAIL! : tst_Cmptest::tryVerify2() 'opaqueFunc() < 2' returned FALSE. (42) Loc: [tst_cmptest.cpp(485)] PASS : tst_Cmptest::verifyExplicitOperatorBool() PASS : tst_Cmptest::cleanupTestCase() -Totals: 15 passed, 30 failed, 0 skipped, 0 blacklisted, 244ms +Totals: 15 passed, 33 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 f64ffe3792..b281b04677 100644 --- a/tests/auto/testlib/selftests/expected_cmptest.xml +++ b/tests/auto/testlib/selftests/expected_cmptest.xml @@ -225,6 +225,30 @@ + + + + + + + + + + + + + + + + + + diff --git a/tests/auto/testlib/selftests/expected_cmptest.xunitxml b/tests/auto/testlib/selftests/expected_cmptest.xunitxml index de47ac97f5..c2c0c86058 100644 --- a/tests/auto/testlib/selftests/expected_cmptest.xunitxml +++ b/tests/auto/testlib/selftests/expected_cmptest.xunitxml @@ -1,5 +1,5 @@ - + @@ -103,6 +103,21 @@ Actual (rA): QRegion(200x50+10+10) Expected (rB): QRegion(2 rectangles, 50x200+100+200, 200x50+10+10)" result="fail"/> + + + + + + + + + -- cgit v1.2.3