From a49bbb4d158a64bf516a29784be55866a5b7a8ef Mon Sep 17 00:00:00 2001
From: Thomas Hartmann <Thomas.Hartmann@nokia.com>
Date: Thu, 27 May 2010 11:59:59 +0200
Subject: [PATCH] QmlDesigner.test: adding qml files

---
 .../qml/qmldesigner/data/fx/TabWidget.qml     | 57 ++++++++++++++++++
 tests/auto/qml/qmldesigner/data/fx/tabs.qml   | 59 +++++++++++++++++++
 2 files changed, 116 insertions(+)
 create mode 100644 tests/auto/qml/qmldesigner/data/fx/TabWidget.qml
 create mode 100644 tests/auto/qml/qmldesigner/data/fx/tabs.qml

diff --git a/tests/auto/qml/qmldesigner/data/fx/TabWidget.qml b/tests/auto/qml/qmldesigner/data/fx/TabWidget.qml
new file mode 100644
index 00000000000..26d25b47b58
--- /dev/null
+++ b/tests/auto/qml/qmldesigner/data/fx/TabWidget.qml
@@ -0,0 +1,57 @@
+import Qt 4.7
+
+Item {
+    id: tabWidget
+
+    property int current: 0
+    default property alias content: stack.children
+
+    onCurrentChanged: setOpacities()
+    Component.onCompleted: setOpacities()
+
+    function setOpacities()
+    {
+        for (var i = 0; i < stack.children.length; ++i) {
+            stack.children[i].opacity = i == current ? 1 : 0
+        }
+    }
+
+    Row {
+        id: header
+        Repeater {
+            delegate: Rectangle {
+                width: tabWidget.width / stack.children.length; height: 36
+
+                Rectangle {
+                    width: parent.width; height: 1
+                    anchors { bottom: parent.bottom; bottomMargin: 1 }
+                    color: "#acb2c2"
+                }
+                BorderImage {
+                    anchors { fill: parent; leftMargin: 2; topMargin: 5; rightMargin: 1 }
+                    border { left: 7; right: 7 }
+                    source: "tab.png"
+                    visible: tabWidget.current == index
+                }
+                Text {
+                    horizontalAlignment: Qt.AlignHCenter; verticalAlignment: Qt.AlignVCenter
+                    anchors.fill: parent
+                    text: stack.children[index].title
+                    elide: Text.ElideRight
+                    font.bold: tabWidget.current == index
+                }
+                MouseArea {
+                    anchors.fill: parent
+                    onClicked: tabWidget.current = index
+                }
+            }
+            model: stack.children.length
+        }
+    }
+
+    Item {
+        id: stack
+        width: tabWidget.width
+        anchors.top: header.bottom; anchors.bottom: tabWidget.bottom
+    }
+}
diff --git a/tests/auto/qml/qmldesigner/data/fx/tabs.qml b/tests/auto/qml/qmldesigner/data/fx/tabs.qml
new file mode 100644
index 00000000000..fba203cc249
--- /dev/null
+++ b/tests/auto/qml/qmldesigner/data/fx/tabs.qml
@@ -0,0 +1,59 @@
+import Qt 4.7
+
+TabWidget {
+    id: tabs
+    width: 640; height: 480
+
+    Rectangle {
+        property string title: "Red"
+        anchors.fill: parent
+        color: "#e3e3e3"
+
+        Rectangle {
+            anchors { fill: parent; topMargin: 20; leftMargin: 20; rightMargin: 20; bottomMargin: 20 }
+            color: "#ff7f7f"
+            Text {
+                width: parent.width - 20
+                anchors.centerIn: parent; horizontalAlignment: Qt.AlignHCenter
+                text: "Roses are red"
+                font.pixelSize: 20
+                wrapMode: Text.WordWrap
+            }
+        }
+    }
+
+    Rectangle {
+        property string title: "Green"
+        anchors.fill: parent
+        color: "#e3e3e3"
+
+        Rectangle {
+            anchors { fill: parent; topMargin: 20; leftMargin: 20; rightMargin: 20; bottomMargin: 20 }
+            color: "#7fff7f"
+            Text {
+                width: parent.width - 20
+                anchors.centerIn: parent; horizontalAlignment: Qt.AlignHCenter
+                text: "Flower stems are green"
+                font.pixelSize: 20
+                wrapMode: Text.WordWrap
+            }
+        }
+    }
+
+    Rectangle {
+        property string title: "Blue"
+        anchors.fill: parent; color: "#e3e3e3"
+
+        Rectangle {
+            anchors { fill: parent; topMargin: 20; leftMargin: 20; rightMargin: 20; bottomMargin: 20 }
+            color: "#7f7fff"
+            Text {
+                width: parent.width - 20
+                anchors.centerIn: parent; horizontalAlignment: Qt.AlignHCenter
+                text: "Violets are blue"
+                font.pixelSize: 20
+                wrapMode: Text.WordWrap
+            }
+        }
+    }
+}
-- 
GitLab