summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/testlib/qtest_gui.h29
-rw-r--r--tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp33
-rw-r--r--tests/auto/testlib/selftests/expected_cmptest.lightxml24
-rw-r--r--tests/auto/testlib/selftests/expected_cmptest.teamcity9
-rw-r--r--tests/auto/testlib/selftests/expected_cmptest.txt14
-rw-r--r--tests/auto/testlib/selftests/expected_cmptest.xml24
-rw-r--r--tests/auto/testlib/selftests/expected_cmptest.xunitxml17
7 files changed, 148 insertions, 2 deletions
diff --git a/src/testlib/qtest_gui.h b/src/testlib/qtest_gui.h
index d0d56e7bd0..d848f08d55 100644
--- a/src/testlib/qtest_gui.h
+++ b/src/testlib/qtest_gui.h
@@ -59,6 +59,9 @@
#include <QtGui/qpixmap.h>
#include <QtGui/qimage.h>
#include <QtGui/qregion.h>
+#include <QtGui/qvector2d.h>
+#include <QtGui/qvector3d.h>
+#include <QtGui/qvector4d.h>
#ifdef QT_WIDGETS_LIB
#include <QtGui/qicon.h>
@@ -116,6 +119,32 @@ template<> inline char *toString(const QRegion &region)
return qstrdup(result.constData());
}
+#ifndef QT_NO_VECTOR2D
+template<> inline char *toString(const QVector2D &v)
+{
+ QByteArray result = "QVector2D(" + QByteArray::number(v.x()) + ", "
+ + QByteArray::number(v.y()) + ')';
+ return qstrdup(result.constData());
+}
+#endif // !QT_NO_VECTOR2D
+#ifndef QT_NO_VECTOR3D
+template<> inline char *toString(const QVector3D &v)
+{
+ QByteArray result = "QVector3D(" + QByteArray::number(v.x()) + ", "
+ + QByteArray::number(v.y()) + ", " + QByteArray::number(v.z()) + ')';
+ return qstrdup(result.constData());
+}
+#endif // !QT_NO_VECTOR3D
+#ifndef QT_NO_VECTOR4D
+template<> inline char *toString(const QVector4D &v)
+{
+ QByteArray result = "QVector4D(" + QByteArray::number(v.x()) + ", "
+ + QByteArray::number(v.y()) + ", " + QByteArray::number(v.z())
+ + ", " + QByteArray::number(v.w()) + ')';
+ return qstrdup(result.constData());
+}
+#endif // !QT_NO_VECTOR4D
+
inline bool qCompare(QIcon const &t1, QIcon const &t2, const char *actual, const char *expected,
const char *file, int line)
{
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 <QtGui/QColor>
#include <QtGui/QImage>
#include <QtGui/QPixmap>
+#include <QtGui/QVector2D>
+#include <QtGui/QVector3D>
+#include <QtGui/QVector4D>
#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 @@
</Incident>
<Duration msecs="0"/>
</TestFunction>
+<TestFunction name="compareQVector2D">
+<Incident type="fail" file="tst_cmptest.cpp" line="0">
+ <Description><![CDATA[Compared values are not the same
+ Actual (v2a): QVector2D(1, 2)
+ Expected (v2b): QVector2D(1, 3)]]></Description>
+</Incident>
+ <Duration msecs="0"/>
+</TestFunction>
+<TestFunction name="compareQVector3D">
+<Incident type="fail" file="tst_cmptest.cpp" line="0">
+ <Description><![CDATA[Compared values are not the same
+ Actual (v3a): QVector3D(1, 2, 3)
+ Expected (v3b): QVector3D(1, 3, 3)]]></Description>
+</Incident>
+ <Duration msecs="0"/>
+</TestFunction>
+<TestFunction name="compareQVector4D">
+<Incident type="fail" file="tst_cmptest.cpp" line="0">
+ <Description><![CDATA[Compared values are not the same
+ Actual (v4a): QVector4D(1, 2, 3, 4)
+ Expected (v4b): QVector4D(1, 3, 3, 4)]]></Description>
+</Incident>
+ <Duration msecs="0"/>
+</TestFunction>
<TestFunction name="verify">
<Incident type="fail" file="tst_cmptest.cpp" line="467">
<Description><![CDATA['opaqueFunc() < 2' returned FALSE. ()]]></Description>
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 @@
</Incident>
<Duration msecs="0"/>
</TestFunction>
+<TestFunction name="compareQVector2D">
+<Incident type="fail" file="tst_cmptest.cpp" line="0">
+ <Description><![CDATA[Compared values are not the same
+ Actual (v2a): QVector2D(1, 2)
+ Expected (v2b): QVector2D(1, 3)]]></Description>
+</Incident>
+ <Duration msecs="0"/>
+</TestFunction>
+<TestFunction name="compareQVector3D">
+<Incident type="fail" file="tst_cmptest.cpp" line="0">
+ <Description><![CDATA[Compared values are not the same
+ Actual (v3a): QVector3D(1, 2, 3)
+ Expected (v3b): QVector3D(1, 3, 3)]]></Description>
+</Incident>
+ <Duration msecs="0"/>
+</TestFunction>
+<TestFunction name="compareQVector4D">
+<Incident type="fail" file="tst_cmptest.cpp" line="0">
+ <Description><![CDATA[Compared values are not the same
+ Actual (v4a): QVector4D(1, 2, 3, 4)
+ Expected (v4b): QVector4D(1, 3, 3, 4)]]></Description>
+</Incident>
+ <Duration msecs="0"/>
+</TestFunction>
<TestFunction name="verify">
<Incident type="fail" file="tst_cmptest.cpp" line="467">
<Description><![CDATA['opaqueFunc() < 2' returned FALSE. ()]]></Description>
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 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<testsuite errors="0" failures="30" tests="21" name="tst_Cmptest">
+<testsuite errors="0" failures="33" tests="24" name="tst_Cmptest">
<properties>
<property value="@INSERT_QT_VERSION_HERE@" name="QTestVersion"/>
<property value="@INSERT_QT_VERSION_HERE@" name="QtVersion"/>
@@ -103,6 +103,21 @@
Actual (rA): QRegion(200x50+10+10)
Expected (rB): QRegion(2 rectangles, 50x200+100+200, 200x50+10+10)" result="fail"/>
</testcase>
+ <testcase result="fail" name="compareQVector2D">
+ <failure message="Compared values are not the same
+ Actual (v2a): QVector2D(1, 2)
+ Expected (v2b): QVector2D(1, 3)" result="fail"/>
+ </testcase>
+ <testcase result="fail" name="compareQVector3D">
+ <failure message="Compared values are not the same
+ Actual (v3a): QVector3D(1, 2, 3)
+ Expected (v3b): QVector3D(1, 3, 3)" result="fail"/>
+ </testcase>
+ <testcase result="fail" name="compareQVector4D">
+ <failure message="Compared values are not the same
+ Actual (v4a): QVector4D(1, 2, 3, 4)
+ Expected (v4b): QVector4D(1, 3, 3, 4)" result="fail"/>
+ </testcase>
<testcase result="fail" name="verify">
<failure message="&apos;opaqueFunc() &lt; 2&apos; returned FALSE. ()" result="fail"/>
</testcase>