aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/qml/v4/tst_v4.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/qml/v4/tst_v4.cpp')
-rw-r--r--tests/auto/qml/v4/tst_v4.cpp94
1 files changed, 93 insertions, 1 deletions
diff --git a/tests/auto/qml/v4/tst_v4.cpp b/tests/auto/qml/v4/tst_v4.cpp
index 041d9ab8e6..91a32268cf 100644
--- a/tests/auto/qml/v4/tst_v4.cpp
+++ b/tests/auto/qml/v4/tst_v4.cpp
@@ -75,6 +75,10 @@ private slots:
void unaryMinus();
void unaryPlus();
void colorType();
+ void mathAbs();
+ void mathCeil();
+ void mathMax();
+ void mathMin();
private:
QQmlEngine engine;
@@ -248,7 +252,6 @@ void tst_v4::nestedObjectAccess()
ResultObject *ro = qobject_cast<ResultObject *>(o);
QVERIFY(ro != 0);
- QEXPECT_FAIL("","QTBUG-24606", Continue);
QCOMPARE(ro->result(), 37);
delete o;
@@ -383,6 +386,95 @@ void tst_v4::colorType()
delete o;
}
+void tst_v4::mathAbs()
+{
+ QQmlComponent component(&engine, testFileUrl("mathAbs.qml"));
+
+ QObject *o = component.create();
+ QVERIFY(o != 0);
+
+ QCOMPARE(o->property("test1").toReal(), qreal(3.7));
+ QCOMPARE(o->property("test2").toReal(), qreal(4.5));
+ QCOMPARE(o->property("test3").toInt(), 18);
+ QCOMPARE(o->property("test4").toInt(), 72);
+ QCOMPARE(o->property("test5").toBool(), true);
+ QCOMPARE(o->property("test6").toBool(), true);
+ QCOMPARE(o->property("test7").toBool(), true);
+ QCOMPARE(o->property("test8").toInt(), 82);
+ QCOMPARE(o->property("test9").toBool(), true);
+ QCOMPARE(o->property("test10").toBool(), true);
+ QCOMPARE(o->property("test11").toInt(), 0);
+ //QCOMPARE(o->property("test12").toBool(), true); //QTBUG-24706
+
+ delete o;
+}
+
+void tst_v4::mathCeil()
+{
+ QQmlComponent component(&engine, testFileUrl("mathCeil.qml"));
+
+ QObject *o = component.create();
+ QVERIFY(o != 0);
+
+ QCOMPARE(o->property("test1").toReal(), qreal(-3));
+ QCOMPARE(o->property("test2").toReal(), qreal(5));
+ QCOMPARE(o->property("test3").toBool(), true);
+ //QCOMPARE(o->property("test4").toBool(), true); //QTBUG-24706
+ QCOMPARE(o->property("test5").toBool(), true);
+ QCOMPARE(o->property("test6").toReal(), qreal(83));
+ //QCOMPARE(o->property("test7").toBool(), true); //QTBUG-24706
+ //QCOMPARE(o->property("test8").toBool(), true); //QTBUG-24706
+ QCOMPARE(o->property("test9").toInt(), 0);
+ //QCOMPARE(o->property("test10").toBool(), true); //QTBUG-24706
+
+ delete o;
+}
+
+void tst_v4::mathMax()
+{
+ QQmlComponent component(&engine, testFileUrl("mathMax.qml"));
+
+ QObject *o = component.create();
+ QVERIFY(o != 0);
+
+ QCOMPARE(o->property("test1").toReal(), qreal(4.4));
+ QCOMPARE(o->property("test2").toReal(), qreal(7));
+ QCOMPARE(o->property("test3").toBool(), true);
+ QCOMPARE(o->property("test4").toBool(), true);
+ QCOMPARE(o->property("test5").toBool(), true);
+ QCOMPARE(o->property("test6").toReal(), qreal(82.6));
+ QCOMPARE(o->property("test7").toReal(), qreal(4.4));
+ QCOMPARE(o->property("test8").toBool(), true);
+ //QCOMPARE(o->property("test9").toBool(), true); //QTBUG-24706
+ QCOMPARE(o->property("test10").toReal(), qreal(0));
+ QCOMPARE(o->property("test11").toReal(), qreal(4.4));
+ QCOMPARE(o->property("test12").toReal(), qreal(7));
+
+ delete o;
+}
+
+void tst_v4::mathMin()
+{
+ QQmlComponent component(&engine, testFileUrl("mathMin.qml"));
+
+ QObject *o = component.create();
+ QVERIFY(o != 0);
+
+ QCOMPARE(o->property("test1").toReal(), qreal(-3.7));
+ QCOMPARE(o->property("test2").toReal(), qreal(4.4));
+ QCOMPARE(o->property("test3").toBool(), true);
+ QCOMPARE(o->property("test4").toBool(), true);
+ QCOMPARE(o->property("test5").toBool(), true);
+ QCOMPARE(o->property("test6").toReal(), qreal(82.6));
+ QCOMPARE(o->property("test7").toBool(), true);
+ QCOMPARE(o->property("test8").toReal(), qreal(4.4));
+ //QCOMPARE(o->property("test9").toBool(), true); //QTBUG-24706
+ QCOMPARE(o->property("test10").toReal(), qreal(-3.7));
+ QCOMPARE(o->property("test11").toReal(), qreal(0));
+ QCOMPARE(o->property("test12").toReal(), qreal(-3.7));
+ delete o;
+}
+
QTEST_MAIN(tst_v4)
#include "tst_v4.moc"