summaryrefslogtreecommitdiffstats
path: root/tests/auto/declarative/qmlqt
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/declarative/qmlqt')
-rw-r--r--tests/auto/declarative/qmlqt/data/closestangle.qml12
-rw-r--r--tests/auto/declarative/qmlqt/tst_qmlqt.cpp18
2 files changed, 30 insertions, 0 deletions
diff --git a/tests/auto/declarative/qmlqt/data/closestangle.qml b/tests/auto/declarative/qmlqt/data/closestangle.qml
new file mode 100644
index 0000000..8f999e3
--- /dev/null
+++ b/tests/auto/declarative/qmlqt/data/closestangle.qml
@@ -0,0 +1,12 @@
+import Qt 4.6
+
+Object {
+ property var testSame: Qt.closestAngle(0,1)
+ property var testLess: Qt.closestAngle(0,-359)
+ property var testMore: Qt.closestAngle(0,361)
+ property var testFail: Qt.closestAngle(0)
+ property var test5: Qt.closestAngle(0,1,2)
+ property var test6: Qt.closestAngle(123.45465768,1.11)
+ property var test7: Qt.closestAngle(-3.1415,1.11)
+}
+
diff --git a/tests/auto/declarative/qmlqt/tst_qmlqt.cpp b/tests/auto/declarative/qmlqt/tst_qmlqt.cpp
index 10402ae..cc9b94d 100644
--- a/tests/auto/declarative/qmlqt/tst_qmlqt.cpp
+++ b/tests/auto/declarative/qmlqt/tst_qmlqt.cpp
@@ -64,6 +64,7 @@ private slots:
void lighter();
void darker();
void tint();
+ void closestAngle();
void playSound();
void openUrlExternally();
@@ -249,6 +250,23 @@ void tst_qmlqt::tint()
delete object;
}
+void tst_qmlqt::closestAngle()
+{
+ QmlComponent component(&engine, TEST_FILE("closestangle.qml"));
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+
+ QCOMPARE(qvariant_cast<qreal>(object->property("testSame")), 1.0);
+ QCOMPARE(qvariant_cast<qreal>(object->property("testLess")), 1.0);
+ QCOMPARE(qvariant_cast<qreal>(object->property("testMore")), 1.0);
+ QCOMPARE(qvariant_cast<qreal>(object->property("testFail")), 0.0);
+ QCOMPARE(qvariant_cast<qreal>(object->property("test5")), 1.0);
+ QCOMPARE(qvariant_cast<qreal>(object->property("test6")), 1.11);
+ QCOMPARE(qvariant_cast<qreal>(object->property("test7")), 1.11);
+
+ delete object;
+}
+
void tst_qmlqt::playSound()
{
QEXPECT_FAIL("", "How do we test this?", Abort);