aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/declarative/qdeclarativeecmascript/data/aliasreset
diff options
context:
space:
mode:
authorGunnar Sletta <gunnar.sletta@nokia.com>2011-08-25 11:47:24 +0200
committerGunnar Sletta <gunnar.sletta@nokia.com>2011-08-25 12:52:15 +0200
commit8e6ecb56e5d61ce661422779c9d9cbf22f081a34 (patch)
tree227aeb360800a49de58472bd39bc5f4c596c1b15 /tests/auto/declarative/qdeclarativeecmascript/data/aliasreset
parentc9224b6cf5cceb7d5314f7504d44bfe72bc66950 (diff)
parent0d84e957297b4ffa6ab5b0b5bcf8b169d567d298 (diff)
Merge branch 'master' into refactor
Conflicts: src/declarative/items/qsgcanvas.cpp src/declarative/items/qsgitem.cpp src/declarative/items/qsgtextnode.cpp tests/auto/declarative/examples/examples.pro tools/qmlviewer/qmlviewer.pro Change-Id: Icbb0ef5dc79b658c62fd2b2c25a66c9bb3cbeb10
Diffstat (limited to 'tests/auto/declarative/qdeclarativeecmascript/data/aliasreset')
-rw-r--r--tests/auto/declarative/qdeclarativeecmascript/data/aliasreset/AliasPropertyComponent.qml17
-rw-r--r--tests/auto/declarative/qdeclarativeecmascript/data/aliasreset/aliasPropertyReset.1.qml23
-rw-r--r--tests/auto/declarative/qdeclarativeecmascript/data/aliasreset/aliasPropertyReset.2.qml23
-rw-r--r--tests/auto/declarative/qdeclarativeecmascript/data/aliasreset/aliasPropertyReset.3.qml31
-rw-r--r--tests/auto/declarative/qdeclarativeecmascript/data/aliasreset/aliasPropertyReset.4.qml26
-rw-r--r--tests/auto/declarative/qdeclarativeecmascript/data/aliasreset/aliasPropertyReset.5.qml14
-rw-r--r--tests/auto/declarative/qdeclarativeecmascript/data/aliasreset/aliasPropertyReset.error.1.qml18
7 files changed, 152 insertions, 0 deletions
diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/aliasreset/AliasPropertyComponent.qml b/tests/auto/declarative/qdeclarativeecmascript/data/aliasreset/AliasPropertyComponent.qml
new file mode 100644
index 0000000000..9135e79469
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativeecmascript/data/aliasreset/AliasPropertyComponent.qml
@@ -0,0 +1,17 @@
+import QtQuick 2.0
+
+Item {
+ id: apc
+ property alias sourceComponent: loader.sourceComponent
+
+ Component {
+ id: redSquare
+ Rectangle { color: "red"; width: 10; height: 10 }
+ }
+
+ Loader {
+ id: loader
+ objectName: "loader"
+ sourceComponent: redSquare
+ }
+}
diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/aliasreset/aliasPropertyReset.1.qml b/tests/auto/declarative/qdeclarativeecmascript/data/aliasreset/aliasPropertyReset.1.qml
new file mode 100644
index 0000000000..a27c16dd2e
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativeecmascript/data/aliasreset/aliasPropertyReset.1.qml
@@ -0,0 +1,23 @@
+import QtQuick 1.0
+import Qt.test 1.0
+
+Item {
+ id: first
+ property bool aliasIsUndefined: false
+ property alias sourceComponentAlias: loader.sourceComponent
+
+ Component {
+ id: redSquare
+ Rectangle { color: "red"; width: 10; height: 10 }
+ }
+
+ Loader {
+ id: loader
+ sourceComponent: redSquare
+ }
+
+ function resetAliased() {
+ loader.sourceComponent = undefined;
+ aliasIsUndefined = (sourceComponentAlias == undefined);
+ }
+}
diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/aliasreset/aliasPropertyReset.2.qml b/tests/auto/declarative/qdeclarativeecmascript/data/aliasreset/aliasPropertyReset.2.qml
new file mode 100644
index 0000000000..fa2bb5eb6d
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativeecmascript/data/aliasreset/aliasPropertyReset.2.qml
@@ -0,0 +1,23 @@
+import QtQuick 1.0
+import Qt.test 1.0
+
+Item {
+ id: first
+ property bool loaderSourceComponentIsUndefined: false
+ property alias sourceComponentAlias: loader.sourceComponent
+
+ Component {
+ id: redSquare
+ Rectangle { color: "red"; width: 10; height: 10 }
+ }
+
+ Loader {
+ id: loader
+ sourceComponent: redSquare
+ }
+
+ function resetAlias() {
+ sourceComponentAlias = undefined;
+ loaderSourceComponentIsUndefined = (loader.sourceComponent == undefined);
+ }
+}
diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/aliasreset/aliasPropertyReset.3.qml b/tests/auto/declarative/qdeclarativeecmascript/data/aliasreset/aliasPropertyReset.3.qml
new file mode 100644
index 0000000000..4fa6861b08
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativeecmascript/data/aliasreset/aliasPropertyReset.3.qml
@@ -0,0 +1,31 @@
+import QtQuick 1.0
+import Qt.test 1.0
+
+Item {
+ id: first
+ property bool loaderTwoSourceComponentIsUndefined: false
+ property bool loaderOneSourceComponentIsUndefined: false
+ property alias sourceComponentAlias: loaderOne.sourceComponent
+
+ Component {
+ id: redSquare
+ Rectangle { color: "red"; width: 10; height: 10 }
+ }
+
+ Loader {
+ id: loaderOne
+ sourceComponent: loaderTwo.sourceComponent
+ }
+
+ Loader {
+ id: loaderTwo
+ sourceComponent: redSquare
+ x: 15
+ }
+
+ function resetAlias() {
+ sourceComponentAlias = undefined; // loaderOne.sourceComponent should be set to undefined instead of l2.sc
+ loaderOneSourceComponentIsUndefined = (loaderOne.sourceComponent == undefined); // should be true
+ loaderTwoSourceComponentIsUndefined = (loaderTwo.sourceComponent == undefined); // should be false
+ }
+}
diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/aliasreset/aliasPropertyReset.4.qml b/tests/auto/declarative/qdeclarativeecmascript/data/aliasreset/aliasPropertyReset.4.qml
new file mode 100644
index 0000000000..56fcc2ec7c
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativeecmascript/data/aliasreset/aliasPropertyReset.4.qml
@@ -0,0 +1,26 @@
+import QtQuick 1.0
+import Qt.test 1.0
+
+Item {
+ id: first
+ property alias sourceComponentAlias: loader.sourceComponent
+
+ Component {
+ id: redSquare
+ Rectangle { color: "red"; width: 10; height: 10 }
+ }
+
+ Loader {
+ id: loader
+ objectName: "loader"
+ sourceComponent: redSquare
+ }
+
+ function resetAlias() {
+ sourceComponentAlias = undefined; // ensure we don't crash after deletion of loader.
+ }
+
+ function setAlias() {
+ sourceComponentAlias = redSquare;
+ }
+}
diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/aliasreset/aliasPropertyReset.5.qml b/tests/auto/declarative/qdeclarativeecmascript/data/aliasreset/aliasPropertyReset.5.qml
new file mode 100644
index 0000000000..a046bbf504
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativeecmascript/data/aliasreset/aliasPropertyReset.5.qml
@@ -0,0 +1,14 @@
+import QtQuick 1.0
+import Qt.test 1.0
+
+Item {
+ id: root
+
+ AliasPropertyComponent {
+ sourceComponent: returnsUndefined()
+ }
+
+ function returnsUndefined() {
+ return undefined;
+ }
+}
diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/aliasreset/aliasPropertyReset.error.1.qml b/tests/auto/declarative/qdeclarativeecmascript/data/aliasreset/aliasPropertyReset.error.1.qml
new file mode 100644
index 0000000000..22311d6bb3
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativeecmascript/data/aliasreset/aliasPropertyReset.error.1.qml
@@ -0,0 +1,18 @@
+import QtQuick 1.0
+import Qt.test 1.0
+
+MyQmlObject {
+ id: first
+ property bool aliasedIntIsUndefined: false
+ property alias intAlias: objprop.intp
+
+ objectProperty: QtObject {
+ id: objprop
+ property int intp: 12
+ }
+
+ function resetAlias() {
+ intAlias = undefined; // should error
+ aliasedIntIsUndefined = (objprop.intp == undefined);
+ }
+}