aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/quick/qquickloader/data
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/quick/qquickloader/data')
-rw-r--r--tests/auto/quick/qquickloader/data/RedRect.qml8
-rw-r--r--tests/auto/quick/qquickloader/data/loadedSignal.2.qml31
-rw-r--r--tests/auto/quick/qquickloader/data/loadedSignal.qml48
3 files changed, 87 insertions, 0 deletions
diff --git a/tests/auto/quick/qquickloader/data/RedRect.qml b/tests/auto/quick/qquickloader/data/RedRect.qml
new file mode 100644
index 0000000000..0eec9b56b7
--- /dev/null
+++ b/tests/auto/quick/qquickloader/data/RedRect.qml
@@ -0,0 +1,8 @@
+import QtQuick 2.0
+
+Rectangle {
+ objectName: "red"
+ width: 100
+ height: 100
+ color: "red"
+}
diff --git a/tests/auto/quick/qquickloader/data/loadedSignal.2.qml b/tests/auto/quick/qquickloader/data/loadedSignal.2.qml
new file mode 100644
index 0000000000..a4a663c71f
--- /dev/null
+++ b/tests/auto/quick/qquickloader/data/loadedSignal.2.qml
@@ -0,0 +1,31 @@
+import QtQuick 2.0
+
+Item {
+ id: root
+
+ width: 200
+ height: 200
+
+ property bool success: true
+ property int loadCount: 0
+
+ Loader {
+ id: loader
+ anchors.fill: parent
+ asynchronous: true
+ active: false
+ source: "TestComponent.qml"
+ onLoaded: {
+ if (status !== Loader.Ready) {
+ root.success = false;
+ }
+ root.loadCount++;
+ }
+ }
+
+ function triggerLoading() {
+ // we set source to a valid path (but which is an invalid / erroneous component)
+ // we should not get onLoaded, since the status should not be Ready.
+ loader.source = "GreenRect.qml" // causes reference error.
+ }
+}
diff --git a/tests/auto/quick/qquickloader/data/loadedSignal.qml b/tests/auto/quick/qquickloader/data/loadedSignal.qml
new file mode 100644
index 0000000000..7cc0fed001
--- /dev/null
+++ b/tests/auto/quick/qquickloader/data/loadedSignal.qml
@@ -0,0 +1,48 @@
+import QtQuick 2.0
+
+Item {
+ id: root
+
+ width: 200
+ height: 200
+
+ property bool success: true
+ property int loadCount: 0
+
+ Loader {
+ id: loader
+ anchors.fill: parent
+ asynchronous: true
+ active: false
+ source: "TestComponent.qml"
+ onLoaded: {
+ if (status !== Loader.Ready) {
+ root.success = false;
+ }
+ root.loadCount++;
+ }
+ }
+
+ function triggerLoading() {
+ // we set active to true, which triggers loading.
+ // we then immediately set active to false.
+ // this should clear the incubator and stop loading.
+ loader.active = true;
+ loader.active = false;
+ }
+
+ function activate() {
+ loader.active = true;
+ }
+
+ function deactivate() {
+ loader.active = false;
+ }
+
+ function triggerMultipleLoad() {
+ loader.active = false; // deactivate as a precondition.
+ loader.source = "BlueRect.qml"
+ loader.active = true; // should trigger loading to begin
+ loader.source = "RedRect.qml"; // should clear the incubator and restart loading
+ }
+}