aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/qml
diff options
context:
space:
mode:
authorQt Forward Merge Bot <qt_forward_merge_bot@qt-project.org>2018-12-23 01:00:12 +0100
committerQt Forward Merge Bot <qt_forward_merge_bot@qt-project.org>2018-12-23 01:00:12 +0100
commitdca7fc3e3a0fe428ed97762a44c15e83607e6d28 (patch)
tree97d33fe2bec52dcbb6c991712bfe39411fbddb91 /tests/auto/qml
parent03b084e6397b990c69028dc2bbf3226e7339c4a5 (diff)
parentc57681bc376d1d912d23b044c48932fa8f7816d7 (diff)
Merge remote-tracking branch 'origin/5.12' into dev
Diffstat (limited to 'tests/auto/qml')
-rw-r--r--tests/auto/qml/animation/qsequentialanimationgroupjob/BLACKLIST2
-rw-r--r--tests/auto/qml/qqmlcomponent/tst_qqmlcomponent.cpp91
-rw-r--r--tests/auto/qml/qqmlcontext/data/Drawer.qml6
-rw-r--r--tests/auto/qml/qqmlcontext/data/contextObjectHierarchy.qml6
-rw-r--r--tests/auto/qml/qqmlcontext/tst_qqmlcontext.cpp19
-rw-r--r--tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp3
6 files changed, 82 insertions, 45 deletions
diff --git a/tests/auto/qml/animation/qsequentialanimationgroupjob/BLACKLIST b/tests/auto/qml/animation/qsequentialanimationgroupjob/BLACKLIST
deleted file mode 100644
index 2afe6074d7..0000000000
--- a/tests/auto/qml/animation/qsequentialanimationgroupjob/BLACKLIST
+++ /dev/null
@@ -1,2 +0,0 @@
-[finishWithUncontrolledAnimation]
-*
diff --git a/tests/auto/qml/qqmlcomponent/tst_qqmlcomponent.cpp b/tests/auto/qml/qqmlcomponent/tst_qqmlcomponent.cpp
index efd5bb571b..7c7c7d3bd0 100644
--- a/tests/auto/qml/qqmlcomponent/tst_qqmlcomponent.cpp
+++ b/tests/auto/qml/qqmlcomponent/tst_qqmlcomponent.cpp
@@ -173,8 +173,8 @@ void tst_qqmlcomponent::qmlCreateWindow()
QQmlEngine engine;
QQmlComponent component(&engine);
component.loadUrl(testFileUrl("createWindow.qml"));
- QQuickWindow* window = qobject_cast<QQuickWindow *>(component.create());
- QVERIFY(window);
+ QScopedPointer<QQuickWindow> window(qobject_cast<QQuickWindow *>(component.create()));
+ QVERIFY(!window.isNull());
}
void tst_qqmlcomponent::qmlCreateObjectAutoParent_data()
@@ -192,8 +192,8 @@ void tst_qqmlcomponent::qmlCreateObjectAutoParent()
QQmlEngine engine;
QQmlComponent component(&engine, testFileUrl(testFile));
- QQuickItem *root = qobject_cast<QQuickItem *>(component.create());
- QVERIFY(root);
+ QScopedPointer<QObject> root(qobject_cast<QQuickItem *>(component.create()));
+ QVERIFY(!root.isNull());
QObject *qtobjectParent = root->property("qtobjectParent").value<QObject*>();
QQuickItem *itemParent = qobject_cast<QQuickItem *>(root->property("itemParent").value<QObject*>());
QQuickWindow *windowParent = qobject_cast<QQuickWindow *>(root->property("windowParent").value<QObject*>());
@@ -251,45 +251,52 @@ void tst_qqmlcomponent::qmlCreateObjectWithProperties()
QQmlEngine engine;
QQmlComponent component(&engine, testFileUrl("createObjectWithScript.qml"));
QVERIFY2(component.errorString().isEmpty(), component.errorString().toUtf8());
- QObject *object = component.create();
- QVERIFY(object != nullptr);
+ QScopedPointer<QObject> object(component.create());
+ QVERIFY(!object.isNull());
- QObject *testObject1 = object->property("declarativerectangle").value<QObject*>();
- QVERIFY(testObject1);
- QCOMPARE(testObject1->parent(), object);
- QCOMPARE(testObject1->property("x").value<int>(), 17);
- QCOMPARE(testObject1->property("y").value<int>(), 17);
- QCOMPARE(testObject1->property("color").value<QColor>(), QColor(255,255,255));
- QCOMPARE(QQmlProperty::read(testObject1,"border.width").toInt(), 3);
- QCOMPARE(QQmlProperty::read(testObject1,"innerRect.border.width").toInt(), 20);
- delete testObject1;
-
- QObject *testObject2 = object->property("declarativeitem").value<QObject*>();
- QVERIFY(testObject2);
- QCOMPARE(testObject2->parent(), object);
- //QCOMPARE(testObject2->metaObject()->className(), "QDeclarativeItem_QML_2");
- QCOMPARE(testObject2->property("x").value<int>(), 17);
- QCOMPARE(testObject2->property("y").value<int>(), 17);
- QCOMPARE(testObject2->property("testBool").value<bool>(), true);
- QCOMPARE(testObject2->property("testInt").value<int>(), 17);
- QCOMPARE(testObject2->property("testObject").value<QObject*>(), object);
- delete testObject2;
-
- QObject *testBindingObj = object->property("bindingTestObject").value<QObject*>();
- QVERIFY(testBindingObj);
- QCOMPARE(testBindingObj->parent(), object);
- QCOMPARE(testBindingObj->property("testValue").value<int>(), 300);
- object->setProperty("width", 150);
- QCOMPARE(testBindingObj->property("testValue").value<int>(), 150 * 3);
- delete testBindingObj;
-
- QObject *testBindingThisObj = object->property("bindingThisTestObject").value<QObject*>();
- QVERIFY(testBindingThisObj);
- QCOMPARE(testBindingThisObj->parent(), object);
- QCOMPARE(testBindingThisObj->property("testValue").value<int>(), 900);
- testBindingThisObj->setProperty("width", 200);
- QCOMPARE(testBindingThisObj->property("testValue").value<int>(), 200 * 3);
- delete testBindingThisObj;
+ {
+ QScopedPointer<QObject> testObject1(object->property("declarativerectangle")
+ .value<QObject*>());
+ QVERIFY(testObject1);
+ QCOMPARE(testObject1->parent(), object.data());
+ QCOMPARE(testObject1->property("x").value<int>(), 17);
+ QCOMPARE(testObject1->property("y").value<int>(), 17);
+ QCOMPARE(testObject1->property("color").value<QColor>(), QColor(255,255,255));
+ QCOMPARE(QQmlProperty::read(testObject1.data(),"border.width").toInt(), 3);
+ QCOMPARE(QQmlProperty::read(testObject1.data(),"innerRect.border.width").toInt(), 20);
+ }
+
+ {
+ QScopedPointer<QObject> testObject2(object->property("declarativeitem").value<QObject*>());
+ QVERIFY(testObject2);
+ QCOMPARE(testObject2->parent(), object.data());
+ //QCOMPARE(testObject2->metaObject()->className(), "QDeclarativeItem_QML_2");
+ QCOMPARE(testObject2->property("x").value<int>(), 17);
+ QCOMPARE(testObject2->property("y").value<int>(), 17);
+ QCOMPARE(testObject2->property("testBool").value<bool>(), true);
+ QCOMPARE(testObject2->property("testInt").value<int>(), 17);
+ QCOMPARE(testObject2->property("testObject").value<QObject*>(), object.data());
+ }
+
+ {
+ QScopedPointer<QObject> testBindingObj(object->property("bindingTestObject")
+ .value<QObject*>());
+ QVERIFY(testBindingObj);
+ QCOMPARE(testBindingObj->parent(), object.data());
+ QCOMPARE(testBindingObj->property("testValue").value<int>(), 300);
+ object->setProperty("width", 150);
+ QCOMPARE(testBindingObj->property("testValue").value<int>(), 150 * 3);
+ }
+
+ {
+ QScopedPointer<QObject> testBindingThisObj(object->property("bindingThisTestObject")
+ .value<QObject*>());
+ QVERIFY(testBindingThisObj);
+ QCOMPARE(testBindingThisObj->parent(), object.data());
+ QCOMPARE(testBindingThisObj->property("testValue").value<int>(), 900);
+ testBindingThisObj->setProperty("width", 200);
+ QCOMPARE(testBindingThisObj->property("testValue").value<int>(), 200 * 3);
+ }
}
void tst_qqmlcomponent::qmlCreateParentReference()
diff --git a/tests/auto/qml/qqmlcontext/data/Drawer.qml b/tests/auto/qml/qqmlcontext/data/Drawer.qml
new file mode 100644
index 0000000000..b35d5c8d34
--- /dev/null
+++ b/tests/auto/qml/qqmlcontext/data/Drawer.qml
@@ -0,0 +1,6 @@
+import QtQuick 2.12
+import QtQuick.Window 2.11
+
+Rectangle {
+ parent: Window.contentItem
+}
diff --git a/tests/auto/qml/qqmlcontext/data/contextObjectHierarchy.qml b/tests/auto/qml/qqmlcontext/data/contextObjectHierarchy.qml
new file mode 100644
index 0000000000..91978d98a0
--- /dev/null
+++ b/tests/auto/qml/qqmlcontext/data/contextObjectHierarchy.qml
@@ -0,0 +1,6 @@
+import QtQuick 2.6
+import QtQuick.Window 2.2
+
+Window {
+ Drawer {}
+}
diff --git a/tests/auto/qml/qqmlcontext/tst_qqmlcontext.cpp b/tests/auto/qml/qqmlcontext/tst_qqmlcontext.cpp
index 5838193a6b..89640bc385 100644
--- a/tests/auto/qml/qqmlcontext/tst_qqmlcontext.cpp
+++ b/tests/auto/qml/qqmlcontext/tst_qqmlcontext.cpp
@@ -70,6 +70,7 @@ private slots:
void contextLeak();
void outerContextObject();
+ void contextObjectHierarchy();
private:
QQmlEngine engine;
@@ -873,6 +874,24 @@ void tst_qqmlcontext::outerContextObject()
QTRY_VERIFY(iterations >= 100);
}
+void tst_qqmlcontext::contextObjectHierarchy()
+{
+ QQmlEngine engine;
+ QQmlComponent component(&engine);
+ component.loadUrl(testFileUrl("contextObjectHierarchy.qml"));
+ QVERIFY(component.isReady());
+ QScopedPointer<QObject> root(component.create());
+ QVERIFY(!root.isNull());
+
+ for (const QObject *child : root->children()) {
+ QQmlData *d = QQmlData::get(child);
+ QVERIFY(d->outerContext != nullptr);
+ connect(root.data(), &QObject::destroyed, [&]() {
+ QCOMPARE(d->outerContext, nullptr);
+ });
+ }
+}
+
QTEST_MAIN(tst_qqmlcontext)
#include "tst_qqmlcontext.moc"
diff --git a/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp b/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp
index 254a6bc878..085cd5ffd0 100644
--- a/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp
+++ b/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp
@@ -8464,7 +8464,8 @@ void tst_qqmlecmascript::stringify_qtbug_50592()
QScopedPointer<QObject> obj(component.create());
QVERIFY(obj != nullptr);
- QCOMPARE(obj->property("source").toString(), QString::fromLatin1("http://example.org/some_nonexistant_image.png"));
+ QCOMPARE(obj->property("source").toString(),
+ QString::fromLatin1("\"http://example.org/some_nonexistant_image.png\""));
}
// Tests for the JS-only instanceof. Tests for the QML extensions for