diff options
author | Michael Brasser <michael.brasser@nokia.com> | 2012-03-09 13:09:07 +1000 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-03-12 23:28:31 +0100 |
commit | 31aa6012bfb575dd85a5083353fd10487dcbcdaa (patch) | |
tree | 2dd3cf309fa3908b5a74c6686fc55cede031e7b3 /tests/auto/qml/v4/tst_v4.cpp | |
parent | 5f1ebe4df09a4899aa32a1c19c368e5260b5b246 (diff) |
Add additional v4 tests.
Change-Id: Id33eb50e4a01f3450515f6e666e18cb018f1706e
Reviewed-by: Roberto Raggi <roberto.raggi@nokia.com>
Diffstat (limited to 'tests/auto/qml/v4/tst_v4.cpp')
-rw-r--r-- | tests/auto/qml/v4/tst_v4.cpp | 93 |
1 files changed, 93 insertions, 0 deletions
diff --git a/tests/auto/qml/v4/tst_v4.cpp b/tests/auto/qml/v4/tst_v4.cpp index 041d9ab8e6..f8422ac73c 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; @@ -383,6 +387,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" |