aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorAaron Kennedy <aaron.kennedy@nokia.com>2011-10-14 11:45:09 +1000
committerQt by Nokia <qt-info@nokia.com>2011-10-14 04:43:49 +0200
commit5774a1c6c3e85290ed634427c9bef444c543190b (patch)
tree975064fbad97a56723fb24e7d19729c5974dc1dc /tests
parent279ecc31ea551387589362035a0e4365f8179358 (diff)
QDeclarativeIncubator wasn't calling statusChanged() for nested cases
Change-Id: I1811951bdcdd69d4ad1643ed54a8ea097fa718b5 Reviewed-on: http://codereview.qt-project.org/6638 Reviewed-by: Martin Jones <martin.jones@nokia.com> Reviewed-by: Aaron Kennedy <aaron.kennedy@nokia.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/declarative/qdeclarativeincubator/data/statusChanged.nested.qml12
-rw-r--r--tests/auto/declarative/qdeclarativeincubator/tst_qdeclarativeincubator.cpp28
2 files changed, 39 insertions, 1 deletions
diff --git a/tests/auto/declarative/qdeclarativeincubator/data/statusChanged.nested.qml b/tests/auto/declarative/qdeclarativeincubator/data/statusChanged.nested.qml
new file mode 100644
index 0000000000..3a496ea6fe
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativeincubator/data/statusChanged.nested.qml
@@ -0,0 +1,12 @@
+import QtQuick 2.0
+
+QtObject {
+ id: root
+
+ property bool test: false
+
+ Component.onCompleted: {
+ var c = Qt.createComponent("statusChanged.qml");
+ c.incubateObject(root, null, Qt.Synchronous);
+ }
+}
diff --git a/tests/auto/declarative/qdeclarativeincubator/tst_qdeclarativeincubator.cpp b/tests/auto/declarative/qdeclarativeincubator/tst_qdeclarativeincubator.cpp
index 224426e2ec..672387ece2 100644
--- a/tests/auto/declarative/qdeclarativeincubator/tst_qdeclarativeincubator.cpp
+++ b/tests/auto/declarative/qdeclarativeincubator/tst_qdeclarativeincubator.cpp
@@ -488,10 +488,10 @@ void tst_qdeclarativeincubator::statusChanged()
virtual void setInitialState(QObject *) { statuses << -1; }
};
+ {
QDeclarativeComponent component(&engine, TEST_FILE("statusChanged.qml"));
QVERIFY(component.isReady());
- {
MyIncubator incubator(QDeclarativeIncubator::Synchronous);
component.create(incubator);
QVERIFY(incubator.isReady());
@@ -503,6 +503,9 @@ void tst_qdeclarativeincubator::statusChanged()
}
{
+ QDeclarativeComponent component(&engine, TEST_FILE("statusChanged.qml"));
+ QVERIFY(component.isReady());
+
MyIncubator incubator(QDeclarativeIncubator::Asynchronous);
component.create(incubator);
QVERIFY(incubator.isLoading());
@@ -520,6 +523,29 @@ void tst_qdeclarativeincubator::statusChanged()
QCOMPARE(incubator.statuses.at(2), int(QDeclarativeIncubator::Ready));
delete incubator.object();
}
+
+ {
+ QDeclarativeComponent component2(&engine, TEST_FILE("statusChanged.nested.qml"));
+ QVERIFY(component2.isReady());
+
+ MyIncubator incubator(QDeclarativeIncubator::Asynchronous);
+ component2.create(incubator);
+ QVERIFY(incubator.isLoading());
+ QCOMPARE(incubator.statuses.count(), 1);
+ QCOMPARE(incubator.statuses.at(0), int(QDeclarativeIncubator::Loading));
+
+ {
+ bool b = true;
+ controller.incubateWhile(&b);
+ }
+
+ QVERIFY(incubator.isReady());
+ QCOMPARE(incubator.statuses.count(), 3);
+ QCOMPARE(incubator.statuses.at(0), int(QDeclarativeIncubator::Loading));
+ QCOMPARE(incubator.statuses.at(1), -1);
+ QCOMPARE(incubator.statuses.at(2), int(QDeclarativeIncubator::Ready));
+ delete incubator.object();
+ }
}
void tst_qdeclarativeincubator::asynchronousIfNested()