aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/qml
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/qml')
-rw-r--r--tests/auto/qml/debugger/qqmlinspector/app/app.pro2
-rw-r--r--tests/auto/qml/qqmlincubator/qqmlincubator.pro2
-rw-r--r--tests/auto/qml/qqmlinfo/qqmlinfo.pro2
-rw-r--r--tests/auto/qml/qqmlmetatype/qqmlmetatype.pro2
-rw-r--r--tests/auto/qml/qqmlproperty/qqmlproperty.pro2
-rw-r--r--tests/auto/qml/qqmlproperty/tst_qqmlproperty.cpp2
-rw-r--r--tests/auto/qml/qquickconnection/qquickconnection.pro2
-rw-r--r--tests/auto/qml/qquicklistmodel/qquicklistmodel.pro2
-rw-r--r--tests/auto/qml/qquicklistmodel/tst_qquicklistmodel.cpp10
-rw-r--r--tests/auto/qml/v4/data/mathAbs.qml42
-rw-r--r--tests/auto/qml/v4/data/mathCeil.qml37
-rw-r--r--tests/auto/qml/v4/data/mathMax.qml41
-rw-r--r--tests/auto/qml/v4/data/mathMin.qml41
-rw-r--r--tests/auto/qml/v4/tst_v4.cpp94
14 files changed, 271 insertions, 10 deletions
diff --git a/tests/auto/qml/debugger/qqmlinspector/app/app.pro b/tests/auto/qml/debugger/qqmlinspector/app/app.pro
index f6ef983735..9c7574a97e 100644
--- a/tests/auto/qml/debugger/qqmlinspector/app/app.pro
+++ b/tests/auto/qml/debugger/qqmlinspector/app/app.pro
@@ -1,5 +1,5 @@
TARGET = app
-QT += qml quick widgets
+QT += qml quick
CONFIG += declarative_debug
macx:CONFIG -= app_bundle
diff --git a/tests/auto/qml/qqmlincubator/qqmlincubator.pro b/tests/auto/qml/qqmlincubator/qqmlincubator.pro
index b6ce22d4cf..6c4692db96 100644
--- a/tests/auto/qml/qqmlincubator/qqmlincubator.pro
+++ b/tests/auto/qml/qqmlincubator/qqmlincubator.pro
@@ -13,4 +13,4 @@ TESTDATA = data/*
CONFIG += parallel_test
-QT += core-private gui-private v8-private qml-private network widgets testlib
+QT += core-private gui-private v8-private qml-private network testlib
diff --git a/tests/auto/qml/qqmlinfo/qqmlinfo.pro b/tests/auto/qml/qqmlinfo/qqmlinfo.pro
index 050bad68a1..891e698aeb 100644
--- a/tests/auto/qml/qqmlinfo/qqmlinfo.pro
+++ b/tests/auto/qml/qqmlinfo/qqmlinfo.pro
@@ -9,4 +9,4 @@ include (../../shared/util.pri)
TESTDATA = data/*
CONFIG += parallel_test
-QT += core-private gui-private qml-private widgets testlib
+QT += core-private gui-private qml-private testlib
diff --git a/tests/auto/qml/qqmlmetatype/qqmlmetatype.pro b/tests/auto/qml/qqmlmetatype/qqmlmetatype.pro
index 7c781dd9db..d723907024 100644
--- a/tests/auto/qml/qqmlmetatype/qqmlmetatype.pro
+++ b/tests/auto/qml/qqmlmetatype/qqmlmetatype.pro
@@ -4,4 +4,4 @@ SOURCES += tst_qqmlmetatype.cpp
macx:CONFIG -= app_bundle
CONFIG += parallel_test
-QT += core-private gui-private qml-private widgets testlib
+QT += core-private gui-private qml-private testlib
diff --git a/tests/auto/qml/qqmlproperty/qqmlproperty.pro b/tests/auto/qml/qqmlproperty/qqmlproperty.pro
index 6d878902ff..c32545dc77 100644
--- a/tests/auto/qml/qqmlproperty/qqmlproperty.pro
+++ b/tests/auto/qml/qqmlproperty/qqmlproperty.pro
@@ -10,4 +10,4 @@ TESTDATA = data/*
CONFIG += parallel_test
-QT += core-private gui-private v8-private qml-private widgets testlib
+QT += core-private gui-private v8-private qml-private testlib
diff --git a/tests/auto/qml/qqmlproperty/tst_qqmlproperty.cpp b/tests/auto/qml/qqmlproperty/tst_qqmlproperty.cpp
index ae300900c9..13ea1abd73 100644
--- a/tests/auto/qml/qqmlproperty/tst_qqmlproperty.cpp
+++ b/tests/auto/qml/qqmlproperty/tst_qqmlproperty.cpp
@@ -1553,6 +1553,8 @@ void tst_qqmlproperty::crashOnValueProperty()
delete engine;
engine = 0;
+ QSKIP("QTBUG-24734: test accesses deleted QML engine from QQmlProperty::propertyTypeName()");
+
QCOMPARE(p.propertyTypeName(), "int");
QCOMPARE(p.read(), QVariant(10));
p.write(QVariant(20));
diff --git a/tests/auto/qml/qquickconnection/qquickconnection.pro b/tests/auto/qml/qquickconnection/qquickconnection.pro
index baef334459..46f7971df1 100644
--- a/tests/auto/qml/qquickconnection/qquickconnection.pro
+++ b/tests/auto/qml/qquickconnection/qquickconnection.pro
@@ -10,4 +10,4 @@ TESTDATA = data/*
CONFIG += parallel_test
-QT += core-private gui-private v8-private qml-private quick-private opengl-private testlib
+QT += core-private gui-private v8-private qml-private quick-private testlib
diff --git a/tests/auto/qml/qquicklistmodel/qquicklistmodel.pro b/tests/auto/qml/qquicklistmodel/qquicklistmodel.pro
index 25b28bbe4c..6f558a7e51 100644
--- a/tests/auto/qml/qquicklistmodel/qquicklistmodel.pro
+++ b/tests/auto/qml/qquicklistmodel/qquicklistmodel.pro
@@ -10,4 +10,4 @@ TESTDATA = data/*
CONFIG += parallel_test
-QT += core-private gui-private v8-private qml-private quick-private opengl-private testlib
+QT += core-private gui-private v8-private qml-private quick-private testlib
diff --git a/tests/auto/qml/qquicklistmodel/tst_qquicklistmodel.cpp b/tests/auto/qml/qquicklistmodel/tst_qquicklistmodel.cpp
index 69a8d2ecd8..bf26452f0e 100644
--- a/tests/auto/qml/qquicklistmodel/tst_qquicklistmodel.cpp
+++ b/tests/auto/qml/qquicklistmodel/tst_qquicklistmodel.cpp
@@ -216,17 +216,21 @@ QQuickItem *tst_qquicklistmodel::createWorkerTest(QQmlEngine *eng, QQmlComponent
void tst_qquicklistmodel::waitForWorker(QQuickItem *item)
{
+ QQmlProperty prop(item, "done");
+ QVERIFY(prop.isValid());
+ if (prop.read().toBool())
+ return; // already finished
+
QEventLoop loop;
QTimer timer;
timer.setSingleShot(true);
connect(&timer, SIGNAL(timeout()), &loop, SLOT(quit()));
- QQmlProperty prop(item, "done");
- QVERIFY(prop.isValid());
QVERIFY(prop.connectNotifySignal(&loop, SLOT(quit())));
timer.start(10000);
loop.exec();
QVERIFY(timer.isActive());
+ QVERIFY(prop.read().toBool());
}
void tst_qquicklistmodel::static_types_data()
@@ -986,6 +990,8 @@ void tst_qquicklistmodel::get_worker()
QCOMPARE(spyResult.at(0).toInt(), index);
QCOMPARE(spyResult.at(1).toInt(), 1); // only 1 item is modified at a time
QVERIFY(spyResult.at(2).value<QList<int> >().contains(role));
+
+ delete item;
}
void tst_qquicklistmodel::get_worker_data()
diff --git a/tests/auto/qml/v4/data/mathAbs.qml b/tests/auto/qml/v4/data/mathAbs.qml
new file mode 100644
index 0000000000..eb504ae4d8
--- /dev/null
+++ b/tests/auto/qml/v4/data/mathAbs.qml
@@ -0,0 +1,42 @@
+import QtQuick 2.0
+
+Item {
+ property real test1: Math.abs(i1.p1)
+ property real test2: Math.abs(i1.p2)
+
+ property int test3: Math.abs(i1.p3)
+ property int test4: Math.abs(i1.p4)
+
+ property real subtest5: Math.abs()
+ property real subtest6: Math.abs(i1.p6)
+ property bool test5: isNaN(subtest5)
+ property bool test6: isNaN(subtest6)
+
+ property real subtest7: Math.abs(i1.p7)
+ property bool test7: isNaN(subtest7)
+ property int test8: Math.abs(i1.p8)
+
+ property real subtest9: Math.abs(i1.p9)
+ property real subtest10: Math.abs(i1.p10)
+ property bool test9: subtest9 === Number.POSITIVE_INFINITY
+ property bool test10: subtest10 === Number.POSITIVE_INFINITY
+
+ property int test11: Math.abs(i1.p11)
+ property real subtest12: Math.abs(i1.p12)
+ property bool test12: subtest12 === 0 && (1/subtest12) === Infinity
+
+ QtObject {
+ id: i1
+ property real p1: -3.7
+ property real p2: 4.5
+ property int p3: 18
+ property int p4: -72
+ property real p6: Number.NaN
+ property string p7: "hello world"
+ property string p8: "82"
+ property real p9: Number.NEGATIVE_INFINITY
+ property real p10: Number.POSITIVE_INFINITY
+ property real p11: 0
+ property real p12: -0
+ }
+ }
diff --git a/tests/auto/qml/v4/data/mathCeil.qml b/tests/auto/qml/v4/data/mathCeil.qml
new file mode 100644
index 0000000000..f67838a445
--- /dev/null
+++ b/tests/auto/qml/v4/data/mathCeil.qml
@@ -0,0 +1,37 @@
+import QtQuick 2.0
+
+Item {
+ property real test1: Math.ceil(i1.p1)
+ property real test2: Math.ceil(i1.p2)
+
+ property real subtest3: Math.ceil()
+ property real subtest4: Math.ceil(i1.p4)
+ property bool test3: isNaN(subtest3)
+ property bool test4: isNaN(subtest4)
+
+ property real subtest5: Math.ceil(i1.p5)
+ property bool test5: isNaN(subtest5)
+ property real test6: Math.ceil(i1.p6)
+
+ property real subtest7: Math.ceil(i1.p7)
+ property real subtest8: Math.ceil(i1.p8)
+ property bool test7: subtest7 === Number.NEGATIVE_INFINITY
+ property bool test8: subtest8 === Number.POSITIVE_INFINITY
+
+ property real test9: Math.ceil(i1.p9)
+ property real subtest10: Math.ceil(i1.p10)
+ property bool test10: subtest10 === 0 && (1/subtest10) === -Infinity
+
+ QtObject {
+ id: i1
+ property real p1: -3.7
+ property real p2: 4.4
+ property real p4: Number.NaN
+ property string p5: "hello world"
+ property string p6: "82.6"
+ property real p7: Number.NEGATIVE_INFINITY
+ property real p8: Number.POSITIVE_INFINITY
+ property real p9: 0
+ property real p10: -0
+ }
+ }
diff --git a/tests/auto/qml/v4/data/mathMax.qml b/tests/auto/qml/v4/data/mathMax.qml
new file mode 100644
index 0000000000..543b4994aa
--- /dev/null
+++ b/tests/auto/qml/v4/data/mathMax.qml
@@ -0,0 +1,41 @@
+import QtQuick 2.0
+
+Item {
+ property real test1: Math.max(i1.p1, i1.p2)
+ property real test2: Math.max(i1.p2, i1.p3)
+
+ property real subtest3: Math.max()
+ property real subtest4: Math.max(i1.p4)
+ property bool test3: subtest3 === -Infinity
+ property bool test4: isNaN(subtest4)
+
+ property real subtest5: Math.max(i1.p5, i1.p1)
+ property bool test5: isNaN(subtest5)
+ property real test6: Math.max(i1.p6, i1.p3)
+
+ property real test7: Math.max(i1.p7, i1.p2)
+ property real subtest8: Math.max(i1.p8, i1.p2)
+ property bool test8: subtest8 === Number.POSITIVE_INFINITY
+
+ property real subtest9: Math.max(i1.p10, i1.p9)
+ property bool test9: subtest9 === 0 && (1/subtest9) === Infinity
+
+ property real test10: Math.max(i1.p11, i1.p1)
+ property real test11: Math.max(i1.p11, i1.p2)
+ property real test12: Math.max(i1.p1, i1.p2, i1.p3)
+
+ QtObject {
+ id: i1
+ property real p1: -3.7
+ property real p2: 4.4
+ property int p3: 7
+ property real p4: Number.NaN
+ property string p5: "hello world"
+ property string p6: "82.6"
+ property real p7: Number.NEGATIVE_INFINITY
+ property real p8: Number.POSITIVE_INFINITY
+ property real p9: 0
+ property real p10: -0
+ property var p11: null
+ }
+ }
diff --git a/tests/auto/qml/v4/data/mathMin.qml b/tests/auto/qml/v4/data/mathMin.qml
new file mode 100644
index 0000000000..7d2a561623
--- /dev/null
+++ b/tests/auto/qml/v4/data/mathMin.qml
@@ -0,0 +1,41 @@
+import QtQuick 2.0
+
+Item {
+ property real test1: Math.min(i1.p1, i1.p2)
+ property real test2: Math.min(i1.p2, i1.p3)
+
+ property real subtest3: Math.min()
+ property real subtest4: Math.min(i1.p4)
+ property bool test3: subtest3 === Infinity
+ property bool test4: isNaN(subtest4)
+
+ property real subtest5: Math.min(i1.p5, i1.p1)
+ property bool test5: isNaN(subtest5)
+ property real test6: Math.min(i1.p6, i1.p3)
+
+ property real subtest7: Math.min(i1.p7, i1.p2)
+ property bool test7: subtest7 === Number.NEGATIVE_INFINITY
+ property real test8: Math.min(i1.p8, i1.p2)
+
+ property real subtest9: Math.min(i1.p10, i1.p9)
+ property bool test9: subtest9 === 0 && (1/subtest9) === -Infinity
+
+ property real test10: Math.min(i1.p11, i1.p1)
+ property real test11: Math.min(i1.p11, i1.p2)
+ property real test12: Math.min(i1.p1, i1.p2, i1.p3)
+
+ QtObject {
+ id: i1
+ property real p1: -3.7
+ property real p2: 4.4
+ property int p3: 95
+ property real p4: Number.NaN
+ property string p5: "hello world"
+ property string p6: "82.6"
+ property real p7: Number.NEGATIVE_INFINITY
+ property real p8: Number.POSITIVE_INFINITY
+ property real p9: 0
+ property real p10: -0
+ property var p11: null
+ }
+ }
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"