aboutsummaryrefslogtreecommitdiffstats
path: root/tests/reparenting.qml
diff options
context:
space:
mode:
authorAntti Hoelttae <ahoelttae@luxoft.com>2019-03-11 08:45:16 -0700
committerAntti Hölttä <AHoelttae@luxoft.com>2019-03-18 16:43:04 +0100
commit4b5670aad31bd066abfbc62354a8b91796d7183a (patch)
tree8892cdf34f332959f453307bee0e210c520e5537 /tests/reparenting.qml
parent13427797da2464f60412b80b2ad2c4559fc63711 (diff)
Reparenting test
Diffstat (limited to 'tests/reparenting.qml')
-rw-r--r--tests/reparenting.qml104
1 files changed, 104 insertions, 0 deletions
diff --git a/tests/reparenting.qml b/tests/reparenting.qml
new file mode 100644
index 0000000..070a6ff
--- /dev/null
+++ b/tests/reparenting.qml
@@ -0,0 +1,104 @@
+import QtQuick 2.12
+import QtQuick.Controls 2.5
+import QtQuick.Window 2.12
+import CursorNavigation 1.0
+
+Window {
+ id: window0
+ objectName: "window0"
+ width: 100
+ height: 100
+
+ CNRect {
+ id: cn0
+ objectName: "win0Item0"
+ CursorNavigation.objectName: "win0Item0Attached"
+ x: 10
+ y: 10
+ }
+
+ CNRect {
+ id: cn1
+ objectName: "movedItem0"
+ CursorNavigation.objectName: "movedItem0Attached"
+ x: 40
+ y: 10
+ }
+
+ CNRect {
+ id: cn2
+ objectName: "movedItem1"
+ x: 70
+ y: 10
+ }
+
+ function reparent() {
+ cn1.parent = window1.contentItem;
+ cn2.parent = window1.contentItem;
+ }
+
+ Button {
+ x: 30
+ y: 30
+ onClicked: {
+ window0.reparent();
+ }
+ }
+
+ //window that already has CursorNavigation initialized
+ Window {
+ id: window1
+ objectName: "window1"
+ width: 100
+ height: 100
+ visible: true
+
+ CNRect {
+ id: cn1_0
+ objectName: "win1Item0"
+ CursorNavigation.objectName: "win1Item0Attached"
+ x: 10
+ y: 10
+ }
+
+ function reparent() {
+ cn1.parent = window2.contentItem;
+ cn2.parent = window2.contentItem;
+ }
+
+ Button {
+ x: 30
+ y: 30
+ onClicked: {
+ window1.reparent();
+ }
+ }
+
+ }
+
+ //window that does not have CursorNavigation initialized
+ Window {
+ id: window2
+ objectName: "window2"
+ width: 100
+ height: 100
+ visible: true
+
+ function reparent() {
+ cn1.parent = window0.contentItem;
+ cn2.parent = window0.contentItem;
+ }
+
+ Button {
+ x: 30
+ y: 30
+ onClicked: {
+ window2.reparent();
+ }
+ }
+
+ }
+
+}
+
+