From 39d8429b22d71786214e2b1ed7972f22d96fdfd1 Mon Sep 17 00:00:00 2001 From: Warwick Allison Date: Tue, 27 Oct 2009 15:43:19 +1000 Subject: Fix remote content loading for absolute URLs (the test is pending...) --- src/declarative/qml/qmlcomponent.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/declarative/qml/qmlcomponent.cpp b/src/declarative/qml/qmlcomponent.cpp index 0894758..02c9b10 100644 --- a/src/declarative/qml/qmlcomponent.cpp +++ b/src/declarative/qml/qmlcomponent.cpp @@ -368,8 +368,9 @@ void QmlComponent::setData(const QByteArray &data, const QUrl &url) QmlCompositeTypeData *typeData = QmlEnginePrivate::get(d->engine)->typeManager.getImmediate(data, url); - if (typeData->status == QmlCompositeTypeData::Waiting) { - + if (typeData->status == QmlCompositeTypeData::Waiting + || typeData->status == QmlCompositeTypeData::WaitingResources) + { d->typeData = typeData; d->typeData->addWaiter(d); @@ -414,7 +415,9 @@ void QmlComponent::loadUrl(const QUrl &url) QmlCompositeTypeData *data = QmlEnginePrivate::get(d->engine)->typeManager.get(d->url); - if (data->status == QmlCompositeTypeData::Waiting) { + if (data->status == QmlCompositeTypeData::Waiting + || data->status == QmlCompositeTypeData::WaitingResources) + { d->typeData = data; d->typeData->addWaiter(d); d->progress = data->progress; -- cgit v0.12 From fc4dd3eab91fc1959e216a754620a96cf05932d7 Mon Sep 17 00:00:00 2001 From: Warwick Allison Date: Tue, 27 Oct 2009 16:29:16 +1000 Subject: Test remote QML content (test data will appear on qt-test-server.qt-test-net shortly) --- .../declarative/qmllanguage/tst_qmllanguage.cpp | 28 ++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/tests/auto/declarative/qmllanguage/tst_qmllanguage.cpp b/tests/auto/declarative/qmllanguage/tst_qmllanguage.cpp index d51bbcc..1544312 100644 --- a/tests/auto/declarative/qmllanguage/tst_qmllanguage.cpp +++ b/tests/auto/declarative/qmllanguage/tst_qmllanguage.cpp @@ -7,6 +7,9 @@ #include #include "testtypes.h" +#include "../../../shared/util.h" +#include "../../network-settings.h" + /* This test case covers QML language issues. This covers everything that does involve evaluating ECMAScript expressions and bindings. @@ -69,6 +72,8 @@ private slots: void importsBuiltin(); void importsLocal_data(); void importsLocal(); + void importsRemote_data(); + void importsRemote(); void importsInstalled_data(); void importsInstalled(); void importsOrder_data(); @@ -773,6 +778,8 @@ void tst_qmllanguage::testType(const QString& qml, const QString& type) { QmlComponent component(&engine, qml.toUtf8(), TEST_FILE("empty.qml")); // just a file for relative local imports + QTRY_VERIFY(!component.isLoading()); + if (type.isEmpty()) { QVERIFY(component.isError()); } else { @@ -927,6 +934,27 @@ void tst_qmllanguage::importsLocal() testType(qml,type); } +void tst_qmllanguage::importsRemote_data() +{ + QTest::addColumn("qml"); + QTest::addColumn("type"); + + QString serverdir = "http://" + + QtNetworkSettings::serverName() + + "/qtest/declarative/qmllanguage"; + + QTest::newRow("remote import") << "import \""+serverdir+"\"\nTest {}" << "QFxRect"; + QTest::newRow("remote import with subdir") << "import \""+serverdir+"\"\nTestSubDir {}" << "QFxText"; + QTest::newRow("remote import with local") << "import \""+serverdir+"\"\nTestLocal {}" << "QFxImage"; +} + +void tst_qmllanguage::importsRemote() +{ + QFETCH(QString, qml); + QFETCH(QString, type); + testType(qml,type); +} + void tst_qmllanguage::importsInstalled_data() { QTest::addColumn("qml"); -- cgit v0.12 From cbc205d5b1fada56e2de82fa7c971ac7cefdf3fe Mon Sep 17 00:00:00 2001 From: Warwick Allison Date: Wed, 28 Oct 2009 15:13:31 +1000 Subject: Test visibility. Add refs back to JIRA items. --- .../data/lib/com/nokia/installedtest/PrivateType.qml | 2 ++ tests/auto/declarative/qmllanguage/tst_qmllanguage.cpp | 18 ++++++++++++++---- 2 files changed, 16 insertions(+), 4 deletions(-) create mode 100644 tests/auto/declarative/qmllanguage/data/lib/com/nokia/installedtest/PrivateType.qml diff --git a/tests/auto/declarative/qmllanguage/data/lib/com/nokia/installedtest/PrivateType.qml b/tests/auto/declarative/qmllanguage/data/lib/com/nokia/installedtest/PrivateType.qml new file mode 100644 index 0000000..93c7630 --- /dev/null +++ b/tests/auto/declarative/qmllanguage/data/lib/com/nokia/installedtest/PrivateType.qml @@ -0,0 +1,2 @@ +import Qt 4.6 +Image {} diff --git a/tests/auto/declarative/qmllanguage/tst_qmllanguage.cpp b/tests/auto/declarative/qmllanguage/tst_qmllanguage.cpp index 78c66ad..6494c40 100644 --- a/tests/auto/declarative/qmllanguage/tst_qmllanguage.cpp +++ b/tests/auto/declarative/qmllanguage/tst_qmllanguage.cpp @@ -831,8 +831,12 @@ QML_DEFINE_TYPE(com.nokia.Test, 1, 8, 9, Test, TestType2) QML_DEFINE_TYPE(com.nokia.Test, 1, 12, 13, Test, TestType2) QML_DEFINE_TYPE(com.nokia.Test, 1, 9, 11, OldTest, TestType) +// Import tests (QT-558) + void tst_qmllanguage::importsBuiltin_data() { + // QT-610 + QTest::addColumn("qml"); QTest::addColumn("type"); @@ -849,7 +853,7 @@ void tst_qmllanguage::importsBuiltin_data() "Test {}" << "TestType"; QTest::newRow("qualified wrong") - << "import com.nokia.Test 1.0 as T\n" + << "import com.nokia.Test 1.0 as T\n" // QT-610 "Test {}" << ""; QTest::newRow("qualified right") @@ -941,7 +945,7 @@ void tst_qmllanguage::importsLocal_data() // import locals QTest::newRow("local import") - << "import \"subdir\"\n" + << "import \"subdir\"\n" // QT-613 "Test {}" << "QFxRect"; QTest::newRow("local import as") @@ -989,18 +993,24 @@ void tst_qmllanguage::importsRemote() void tst_qmllanguage::importsInstalled_data() { + // QT-610 + QTest::addColumn("qml"); QTest::addColumn("type"); // import installed - QTest::newRow("installed import") + QTest::newRow("installed import 1") << "import com.nokia.installedtest 1.0\n" "InstalledTest {}" << "QFxRect"; - QTest::newRow("installed import") + QTest::newRow("installed import 2") << "import com.nokia.installedtest 1.4\n" "InstalledTest {}" << "QFxText"; + QTest::newRow("installed import visibility") // QT-614 + << "import com.nokia.installedtest 1.4\n" + "PrivateType {}" + << ""; } void tst_qmllanguage::importsInstalled() -- cgit v0.12 From 6aacf78c1e22597553a2b237fb595a37e4fb8d00 Mon Sep 17 00:00:00 2001 From: Warwick Allison Date: Wed, 28 Oct 2009 16:31:10 +1000 Subject: Incorporate latest optical theory. --- examples/declarative/dynamic/PerspectiveItem.qml | 12 ++++++++++++ examples/declarative/dynamic/dynamic.qml | 6 +++--- 2 files changed, 15 insertions(+), 3 deletions(-) create mode 100644 examples/declarative/dynamic/PerspectiveItem.qml diff --git a/examples/declarative/dynamic/PerspectiveItem.qml b/examples/declarative/dynamic/PerspectiveItem.qml new file mode 100644 index 0000000..9e09dd2 --- /dev/null +++ b/examples/declarative/dynamic/PerspectiveItem.qml @@ -0,0 +1,12 @@ +import Qt 4.6 + +Image { + id: tree + property bool created: false + opacity: y+height > window.height/2 ? 1 : 0.25 + onCreatedChanged: if (created && y+height<=window.height/2) { tree.destroy() } + scale: y+height > window.height/2 ? (y+height-250)*0.01 : 1 + transformOrigin: "Center" + source: image; + z: y +} diff --git a/examples/declarative/dynamic/dynamic.qml b/examples/declarative/dynamic/dynamic.qml index 885e037..ea4e0cd 100644 --- a/examples/declarative/dynamic/dynamic.qml +++ b/examples/declarative/dynamic/dynamic.qml @@ -79,17 +79,17 @@ Item { } PaletteItem{ anchors.verticalCenter: parent.verticalCenter - file: "GenericItem.qml" + file: "PerspectiveItem.qml" image: "images/tree_s.png" } PaletteItem{ anchors.verticalCenter: parent.verticalCenter - file: "GenericItem.qml" + file: "PerspectiveItem.qml" image: "images/rabbit_brown.png" } PaletteItem{ anchors.verticalCenter: parent.verticalCenter - file: "GenericItem.qml" + file: "PerspectiveItem.qml" image: "images/rabbit_bw.png" } } -- cgit v0.12