summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorJ-P Nurmi <jpnurmi@digia.com>2013-02-22 17:25:25 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-03-20 13:04:00 +0100
commitc0df0b6fc002acd22f40284f8ca5377ae96fa1ce (patch)
tree65809c103291c104d49fa1ca99375eaf1ccfccff /tests
parentbeeb0840b745a29895ee4e9aeac0b07f63998c69 (diff)
downloadqtquickcontrols-c0df0b6fc002acd22f40284f8ca5377ae96fa1ce.tar.gz
Remove the Page control - use attached properties instead
Change-Id: I69599daeea4ba49689fbbbe58c5d4a60fccc8824 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@digia.com> Reviewed-by: Jens Bache-Wiig <jens.bache-wiig@digia.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/controls/data/tst_pagestack.qml2
-rw-r--r--tests/auto/controls/data/tst_stack.qml (renamed from tests/auto/controls/data/tst_page.qml)15
-rw-r--r--tests/manual/PageStack.qml35
3 files changed, 33 insertions, 19 deletions
diff --git a/tests/auto/controls/data/tst_pagestack.qml b/tests/auto/controls/data/tst_pagestack.qml
index e5c56dbd..f0323571 100644
--- a/tests/auto/controls/data/tst_pagestack.qml
+++ b/tests/auto/controls/data/tst_pagestack.qml
@@ -52,7 +52,7 @@ TestCase {
Item { id: anItem }
Component {
id: pageComponent
- Page {}
+ Item {}
}
Component {
diff --git a/tests/auto/controls/data/tst_page.qml b/tests/auto/controls/data/tst_stack.qml
index acb0f627..f51251e9 100644
--- a/tests/auto/controls/data/tst_page.qml
+++ b/tests/auto/controls/data/tst_stack.qml
@@ -43,14 +43,23 @@ import QtTest 1.0
TestCase {
id: testCase
- name: "Tests_Page"
+ name: "Tests_Stack"
when:windowShown
width:400
height:400
- function test_createPage() {
- var page = Qt.createQmlObject('import QtQuick.Controls 1.0; Page {}', testCase, '');
+ function test_index() {
+ var item = Qt.createQmlObject('import QtQuick 2.0; import QtQuick.Controls 1.0; Item { property int index: Stack.index }', testCase, '');
+ compare(item.index, -1);
}
+ function test_status() {
+ var item = Qt.createQmlObject('import QtQuick 2.0; import QtQuick.Controls 1.0; Item { property int status: Stack.status }', testCase, '');
+ compare(item.status, 0); // Stack.Inactive
+ }
+ function test_pageStack() {
+ var item = Qt.createQmlObject('import QtQuick 2.0; import QtQuick.Controls 1.0; Item { property PageStack pageStack: Stack.pageStack }', testCase, '');
+ compare(item.pageStack, null);
+ }
}
diff --git a/tests/manual/PageStack.qml b/tests/manual/PageStack.qml
index 0b3713af..e84b6787 100644
--- a/tests/manual/PageStack.qml
+++ b/tests/manual/PageStack.qml
@@ -133,23 +133,25 @@ Window {
Component {
id: pageComponent
- Page {
+ Item {
id: page
- Component.onDestruction: console.log("destroyed component page: " + index)
+ width: parent.width
+ height: parent.height
+ Component.onDestruction: console.log("destroyed component page: " + Stack.index)
property bool pushFromOnCompleted: false
Component.onCompleted: if (pushFromOnCompleted) pageStack.push(pageComponent)
//pageTransition: rotateTransition
Rectangle {
anchors.fill: parent
- color: index % 2 ? "green" : "yellow"
+ color: page.Stack.index % 2 ? "green" : "yellow"
Column {
Text {
- text: "This is component page: " + page.index
+ text: "This is component page: " + page.Stack.index
}
Text {
- text: "Current status: " + page.status
+ text: "Current status: " + page.Stack.status
}
Text { text:" " }
Button {
@@ -194,11 +196,11 @@ Window {
}
Button {
text: "Search for page 3, and pop down to it"
- onClicked: pageStack.pop(pageStack.find(function(page) { if (page.index === 3) return true }))
+ onClicked: pageStack.pop(pageStack.find(function(page) { if (page.Stack.index === 3) return true }))
}
Button {
text: "Search for page 3, and pop down to it (dontLoad == true)"
- onClicked: pageStack.pop(pageStack.find(function(page) { if (page.index === 3) return true }, true))
+ onClicked: pageStack.pop(pageStack.find(function(page) { if (page.Stack.index === 3) return true }, true))
}
Button {
text: "Clear"
@@ -229,22 +231,25 @@ Window {
}
}
- Page {
+ Item {
id: pageInline
- Component.onDestruction: console.log("destroyed inline page: " + index)
+ visible: false
+ width: parent.width
+ height: parent.height
+ Component.onDestruction: console.log("destroyed inline page: " + Stack.index)
- pageTransition: rotateTransition
+ Stack.pageTransition: rotateTransition
Rectangle {
anchors.fill: parent
- color: pageInline.index % 2 ? "green" : "yellow"
+ color: pageInline.Stack.index % 2 ? "green" : "yellow"
Column {
Text {
- text: "This is inline page: " + pageInline.index
+ text: "This is inline page: " + pageInline.Stack.index
}
Text {
- text: "Current status: " + pageInline.status
+ text: "Current status: " + pageInline.Stack.status
}
Button {
text: "Push component page"
@@ -280,11 +285,11 @@ Window {
}
Button {
text: "Search for page 3, and pop down to it"
- onClicked: pageStack.pop(pageStack.find(function(page) { if (page.index === 3) return true }))
+ onClicked: pageStack.pop(pageStack.find(function(page) { if (pageInline.Stack.index === 3) return true }))
}
Button {
text: "Search for page 3, and pop down to it (dontLoad == true)"
- onClicked: pageStack.pop(pageStack.find(function(page) { if (page.index === 3) return true }, true))
+ onClicked: pageStack.pop(pageStack.find(function(page) { if (pageInline.Stack.index === 3) return true }, true))
}
Button {
text: "Clear"