From 2121de6d8762ec2fc90a07e207824090e8447291 Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Mon, 4 Aug 2014 15:27:24 +0200 Subject: Fix Qt.include with cached compilation units and resources Similar to the worker scripts we also need to do a lookup for cached scripts here. Added also a test to ensure that Qt.include works correctly from Qt resources. Change-Id: Idb67af3da4b0cc91edbd3d2746d074fd68ed8bf0 Reviewed-by: Lars Knoll --- tests/auto/qml/qqmlecmascript/qqmlecmascript.pro | 2 ++ tests/auto/qml/qqmlecmascript/qqmlecmascript.qrc | 8 ++++++++ tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp | 17 +++++++++++++++++ 3 files changed, 27 insertions(+) create mode 100644 tests/auto/qml/qqmlecmascript/qqmlecmascript.qrc (limited to 'tests/auto/qml') diff --git a/tests/auto/qml/qqmlecmascript/qqmlecmascript.pro b/tests/auto/qml/qqmlecmascript/qqmlecmascript.pro index 6193ee7c88..6f3f765aba 100644 --- a/tests/auto/qml/qqmlecmascript/qqmlecmascript.pro +++ b/tests/auto/qml/qqmlecmascript/qqmlecmascript.pro @@ -9,6 +9,8 @@ HEADERS += testtypes.h \ ../../shared/testhttpserver.h INCLUDEPATH += ../../shared +RESOURCES += qqmlecmascript.qrc + include (../../shared/util.pri) # QMAKE_CXXFLAGS = -fprofile-arcs -ftest-coverage diff --git a/tests/auto/qml/qqmlecmascript/qqmlecmascript.qrc b/tests/auto/qml/qqmlecmascript/qqmlecmascript.qrc new file mode 100644 index 0000000000..e0e29ad4a5 --- /dev/null +++ b/tests/auto/qml/qqmlecmascript/qqmlecmascript.qrc @@ -0,0 +1,8 @@ + + +data/include.qml +data/include.js +data/js/include2.js +data/js/include3.js + + diff --git a/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp b/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp index a9486a8e63..34413b23de 100644 --- a/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp +++ b/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp @@ -6016,6 +6016,23 @@ void tst_qqmlecmascript::include() delete o; } + + // include from resources + { + QQmlComponent component(&engine, QUrl("qrc:///data/include.qml")); + QObject *o = component.create(); + QVERIFY(o != 0); + + QCOMPARE(o->property("test0").toInt(), 99); + QCOMPARE(o->property("test1").toBool(), true); + QCOMPARE(o->property("test2").toBool(), true); + QCOMPARE(o->property("test2_1").toBool(), true); + QCOMPARE(o->property("test3").toBool(), true); + QCOMPARE(o->property("test3_1").toBool(), true); + + delete o; + } + } void tst_qqmlecmascript::includeRemoteSuccess() -- cgit v1.2.3 From f14f713c2fd42e94abe55b8fc1b4dabffaa15fda Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Fri, 1 Aug 2014 10:13:06 +0200 Subject: Fix crash when loading invalid QML with behavior on invalid group property MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Behaviors require the creation of a meta-object. However when trying to create a behavior on a non-existent group property, we don't have a base meta-object to base the "new" meta-object on, therefore this patch adds a null pointer check. The error in the QML file itself will be caught later on. The added test ensures that as well as that it doesn't crash of course. Change-Id: If73116053464e7e69b02ef59e8387060835083c8 Task-number: QTBUG-40369 Reviewed-by: Sérgio Martins Reviewed-by: Lars Knoll --- tests/auto/qml/qqmllanguage/data/nonexistantProperty.8.errors.txt | 1 + tests/auto/qml/qqmllanguage/data/nonexistantProperty.8.qml | 5 +++++ tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp | 1 + 3 files changed, 7 insertions(+) create mode 100644 tests/auto/qml/qqmllanguage/data/nonexistantProperty.8.errors.txt create mode 100644 tests/auto/qml/qqmllanguage/data/nonexistantProperty.8.qml (limited to 'tests/auto/qml') diff --git a/tests/auto/qml/qqmllanguage/data/nonexistantProperty.8.errors.txt b/tests/auto/qml/qqmllanguage/data/nonexistantProperty.8.errors.txt new file mode 100644 index 0000000000..b60b59b111 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/nonexistantProperty.8.errors.txt @@ -0,0 +1 @@ +4:24:Cannot assign to non-existent property "root" diff --git a/tests/auto/qml/qqmllanguage/data/nonexistantProperty.8.qml b/tests/auto/qml/qqmllanguage/data/nonexistantProperty.8.qml new file mode 100644 index 0000000000..86c5f3bd7d --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/nonexistantProperty.8.qml @@ -0,0 +1,5 @@ +import QtQuick 2.0 +Item { + id: root + NumberAnimation on root.opacity { duration: 1000 } +} diff --git a/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp b/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp index 95d6eb9262..7976987b58 100644 --- a/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp +++ b/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp @@ -347,6 +347,7 @@ void tst_qqmllanguage::errors_data() QTest::newRow("nonexistantProperty.5") << "nonexistantProperty.5.qml" << "nonexistantProperty.5.errors.txt" << false; QTest::newRow("nonexistantProperty.6") << "nonexistantProperty.6.qml" << "nonexistantProperty.6.errors.txt" << false; QTest::newRow("nonexistantProperty.7") << "nonexistantProperty.7.qml" << "nonexistantProperty.7.errors.txt" << false; + QTest::newRow("nonexistantProperty.8") << "nonexistantProperty.8.qml" << "nonexistantProperty.8.errors.txt" << false; QTest::newRow("wrongType (string for int)") << "wrongType.1.qml" << "wrongType.1.errors.txt" << false; QTest::newRow("wrongType (int for bool)") << "wrongType.2.qml" << "wrongType.2.errors.txt" << false; -- cgit v1.2.3 From 01c6af3fc940378e8eee41a9fb8273420ef5a7e1 Mon Sep 17 00:00:00 2001 From: Martin Jones Date: Sat, 9 Aug 2014 22:01:08 +1000 Subject: Avoid double deletion when deleting an incubating component. The guard in QQmlIncubatorPrivate::clear() was invalidated by clearing the guards in QQmlIncubatorPrivate::incubate() when a deletion was detected. If we detect a deletion, leave the guards in place, to be handled in QQmlIncubatorPrivate::clear(). Task-number: QTBUG-40685 Change-Id: I1bf7422fda97745f1f7a3b42285a399244c09a1f Reviewed-by: Alan Alpert Reviewed-by: Robin Burchell Reviewed-by: Simon Hausmann --- tests/auto/qml/qqmlincubator/tst_qqmlincubator.cpp | 4 ---- 1 file changed, 4 deletions(-) (limited to 'tests/auto/qml') diff --git a/tests/auto/qml/qqmlincubator/tst_qqmlincubator.cpp b/tests/auto/qml/qqmlincubator/tst_qqmlincubator.cpp index 0b9872f94c..75b10ed804 100644 --- a/tests/auto/qml/qqmlincubator/tst_qqmlincubator.cpp +++ b/tests/auto/qml/qqmlincubator/tst_qqmlincubator.cpp @@ -171,10 +171,6 @@ void tst_qqmlincubator::objectDeleted() controller.incubateWhile(&b); } - // We have to cheat and manually remove it from the creator->allCreatedObjects - // otherwise we will do a double delete - QQmlIncubatorPrivate *incubatorPriv = QQmlIncubatorPrivate::get(&incubator); - incubatorPriv->creator->allCreatedObjects().pop(); delete SelfRegisteringType::me(); { -- cgit v1.2.3