diff --git a/tests/system/sys_elements.qtt b/tests/system/sys_elements.qtt new file mode 100644 index 0000000000..1f1fbb7ab2 --- /dev/null +++ b/tests/system/sys_elements.qtt @@ -0,0 +1,413 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of QtUiTest. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +//TESTED_COMPONENT=qtdeclarative +var adv = "Press the Advance button"; +testcase = { + + rectangle: function() + { + // Test Meta-data + testApplication = "Elements: Rectangle"; + testBinary = "tests/testapplications/elements/elements"; + testGoal = "Verify the rectangle element is shown correctly"; + testPreconditions = ""; + testGroups = "BAT"; + + // Test Steps + prompt(twiki('---+++ ' + testApplication + '

+ *Goal:* ' + testGoal + '
+ *Pre-Requisites:* ' + testPreconditions + '
+ *Tested Binary:* ' + testBinary + '
+ | Select the Rectangle list item | Verify that the Rectangle displayed in the center is small, blue, with a thin red angular border | + | '+adv+' | The rectangle should now be twice the size as the previous step | + | '+adv+' | The rectangle should now have rounded corners | + | '+adv+' | The rectangle color should have shifted to green | + | '+adv+' | The rectangle border should have increased significantly | + | '+adv+' | The rectangle border should have now be small, blue, with a thin red angular border |')); + }, + + image: function() + { + // Test Meta-data + testApplication = "Elements: Image"; + testBinary = "tests/testapplications/elements/elements"; + testGoal = "Verify the Image element is shown correctly"; + testPreconditions = ""; + testGroups = "BAT"; + + // Test Steps + prompt(twiki('---+++ ' + testApplication + '

+ *Goal:* ' + testGoal + '
+ *Pre-Requisites:* ' + testPreconditions + '
+ *Tested Binary:* ' + testBinary + '
+ | Select the Image list item | Verify it shows the Nokia logo, large and still slightly stretched | + | '+adv+' | Verify it shows the Nokia logo normally, longer horizontally | + | '+adv+' | Verify it shows the Nokia logo with the sides cut | + | '+adv+' | Verify it shows the Nokia logo repeated both horizontally and vertically | + | '+adv+' | Verify it shows the Nokia logo repeated vertically only | + | '+adv+' | Verify it shows the Nokia logo repeated horizontally only |')); + }, + + animatedimage: function() + { + // Test Meta-data + testApplication = "Elements: AnimatedImage"; + testBinary = "tests/testapplications/elements/elements"; + testGoal = "Verify the AnimatedImage element is shown correctly"; + testPreconditions = ""; + testGroups = "BAT"; + + // Test Steps + prompt(twiki('---+++ ' + testApplication + '

+ *Goal:* ' + testGoal + '
+ *Pre-Requisites:* ' + testPreconditions + '
+ *Tested Binary:* ' + testBinary + '
+ | Select the AnimatedImage list item | Verify it shows a small animated icon, but slightly stretched. | + | '+adv+' | Verify it shows the animated icon, large and still slightly stretched | + | '+adv+' | Verify it shows the animated icon normally, square | + | '+adv+' | Verify it shows the animated icon with the sides cut | + | '+adv+' | Verify it shows the animated icon repeated both horizontally and vertically | + | '+adv+' | Verify it shows the animated icon repeated vertically only | + | '+adv+' | Verify it shows the animated icon repeated horizontally only |')); + }, + + borderimage: function() + { + // Test Meta-data + testApplication = "Elements: BorderImage"; + testBinary = "tests/testapplications/elements/elements"; + testGoal = "Verify the BorderImage element is shown correctly"; + testPreconditions = ""; + testGroups = "BAT"; + + // Test Steps + prompt(twiki('---+++ ' + testApplication + '

+ *Goal:* ' + testGoal + '
+ *Pre-Requisites:* ' + testPreconditions + '
+ *Tested Binary:* ' + testBinary + '
+ | Select the BorderImage list item | Verify it shows a small framed image | + | '+adv+' | Verify it shows the frame, large and each side stretched | + | '+adv+' | Verify it shows the frame with slightly off centere sides | + | '+adv+' | Verify it shows the frame with uniformly repeated sides |')); + }, + + systempalette: function() + { + // Test Meta-data + testApplication = "Elements: SystemPalette"; + testBinary = "tests/testapplications/elements/elements"; + testGoal = "Verify the SystemPalette element is shown correctly"; + testPreconditions = ""; + testGroups = "BAT"; + + // Test Steps + prompt(twiki('---+++ ' + testApplication + '

+ *Goal:* ' + testGoal + '
+ *Pre-Requisites:* ' + testPreconditions + '
+ *Tested Binary:* ' + testBinary + '
+ | Select the SystemPalette list item | Verify it shows a mockup of an application | + | '+adv+' | Verify it shows the colors similar to the system it is running on | + | '+adv+' | Verify it shows the new coloring |')); + }, + + text: function() + { + // Test Meta-data + testApplication = "Elements: Text"; + testBinary = "tests/testapplications/elements/elements"; + testGoal = "Verify the Text element is shown correctly"; + testPreconditions = ""; + testGroups = "BAT"; + + // Test Steps + prompt(twiki('---+++ ' + testApplication + '

+ *Goal:* ' + testGoal + '
+ *Pre-Requisites:* ' + testPreconditions + '
+ *Tested Binary:* ' + testBinary + '
+ | Select the Text list item | Verify it shows a Hello message | + | '+adv+' | Verify it shows the text increased to twice the previous size, and wrapped to two lines | + | '+adv+' | Verify it shows the text smoothly changed color to blue over a second | + | '+adv+' | Verify it shows the text as blue, bolded and in italic | + | '+adv+' | Verify it shows the text as alternating between green and black |')); + }, + + textinput: function() + { + // Test Meta-data + testApplication = "Elements: TextInput"; + testBinary = "tests/testapplications/elements/elements"; + testGoal = "Verify the TextInput element is shown correctly"; + testPreconditions = ""; + testGroups = "BAT"; + + // Test Steps + prompt(twiki('---+++ ' + testApplication + '

+ *Goal:* ' + testGoal + '
+ *Pre-Requisites:* ' + testPreconditions + '
+ *Tested Binary:* ' + testBinary + '
+ | Select the TextInput list item | Verify it shows two fields, the green one displaying a Hello message | + | '+adv+' | Verify it selects the last word - TextInput - of the green field | + | '+adv+' | Verify it animates a copy of the selected text to the gray field | + | '+adv+' | Verify it shows the text as asterisks |')); + }, + + textedit: function() + { + // Test Meta-data + testApplication = "Elements: TextEdit"; + testBinary = "tests/testapplications/elements/elements"; + testGoal = "Verify the TextEdit element is shown correctly"; + testPreconditions = ""; + testGroups = "BAT"; + + // Test Steps + prompt(twiki('---+++ ' + testApplication + '

+ *Goal:* ' + testGoal + '
+ *Pre-Requisites:* ' + testPreconditions + '
+ *Tested Binary:* ' + testBinary + '
+ | Select the TextEdit list item | Verify it shows two large fields | + | '+adv+' | Verify it selects the last word - TextEdit - of the green field | + | '+adv+' | Verify it animates a copy of the selected text to the gray field | + | '+adv+' | Verify it shows more text, with the end disappearing past the right side of the green field | + | '+adv+' | Verify it shows the full text, properly wrapped within the green field |')); + }, + + fontloader: function() + { + // Test Meta-data + testApplication = "Elements: FontLoader"; + testBinary = "tests/testapplications/elements/elements"; + testGoal = "Verify the FontLoader element is shown correctly"; + testPreconditions = ""; + testGroups = "BAT"; + + // Test Steps + prompt(twiki('---+++ ' + testApplication + '

+ *Goal:* ' + testGoal + '
+ *Pre-Requisites:* ' + testPreconditions + '
+ *Tested Binary:* ' + testBinary + '
+ | Select the FontLoader list item | Verify it shows a box with a named font in the center | + | '+adv+' | Verify the font has changed along with the named font text | + | '+adv+' | Verify the font is changing every half second, for at least a few different fonts, without error | + | '+adv+' | Verify the font has changed to a Neon Lights font | + | '+adv+' | Verify the font has reverted to a named system font |')); + }, + + flipable: function() { + // Test Meta-data + testApplication = "Elements: Flipable"; + testBinary = "tests/testapplications/elements/elements"; + testGoal = "Verify the Flipable element is shown correctly"; + testPreconditions = ""; + testGroups = "BAT"; + + // Test Steps + prompt(twiki('---+++ ' + testApplication + '

+ *Goal:* ' + testGoal + '
+ *Pre-Requisites:* ' + testPreconditions + '
+ *Tested Binary:* ' + testBinary + '
+ | Select the Flipable list item | Verify it shows a large green rectangle | + | '+adv+' | Verify it slowly spins horizontally to show a red rectangle on the back | + | '+adv+' | Verify it again slowly spins horizontally to show a green rectangle on the front | + | '+adv+' | Verify it again slowly spins vertically to show a red rectangle on the back | + | '+adv+' | Verify it again slowly spins horizontally to show a green rectangle on the front |')); + }, + + intvalidator: function() + { + // Test Meta-data + testApplication = "Elements: IntValidator"; + testBinary = "tests/testapplications/elements/elements"; + testGoal = "Verify the IntValidator element is shown correctly"; + testPreconditions = ""; + testGroups = "BAT"; + + // Test Steps + prompt(twiki('---+++ ' + testApplication + '

+ *Goal:* ' + testGoal + '
+ *Pre-Requisites:* ' + testPreconditions + '
+ *Tested Binary:* ' + testBinary + '
+ | Select the IntValidator list item | Verify it shows a green field with the number 0. The upper and lower bounds are 30 and -50 | + | '+adv+' | Verify the number is now -80, and the field is now red | + | '+adv+' | Verify the number is now -50, and the field is now green | + | '+adv+' | Verify the number is now 35, and the field is now red | + | '+adv+' | Verify the top value has changed to 35, and the field is now green | + | '+adv+' | Verify the bottom has changed to 36, and the field is now red |')); + }, + + doublevalidator: function() + { + // Test Meta-data + testApplication = "Elements: DoubleValidator"; + testBinary = "tests/testapplications/elements/elements"; + testGoal = "Verify the DoubleValidator element is shown correctly"; + testPreconditions = ""; + testGroups = "BAT"; + + // Test Steps + prompt(twiki('---+++ ' + testApplication + '

+ *Goal:* ' + testGoal + '
+ *Pre-Requisites:* ' + testPreconditions + '
+ *Tested Binary:* ' + testBinary + '
+ | Select the DoubleValidator list item | Verify it shows a green field with the number 0. The upper and lower bounds are 30.06 and 30.02 | + | '+adv+' | Verify the number is now 30.01, and the field is now red | + | '+adv+' | Verify the number is now 30.02, and the field is now green | + | '+adv+' | Verify the number is now 30.08, and the field is now red | + | '+adv+' | Verify the top value has changed to 30.09, and the field is now green | + | '+adv+' | Verify the bottom has changed to 40.05, and the field is now red |')); + }, + + regexpvalidator: function() + { + // Test Meta-data + testApplication = "Elements: RegExpValidator"; + testBinary = "tests/testapplications/elements/elements"; + testGoal = "Verify the RegExpValidator element is shown correctly"; + testPreconditions = ""; + testGroups = "BAT"; + + // Test Steps + prompt(twiki('---+++ ' + testApplication + '

+ *Goal:* ' + testGoal + '
+ *Pre-Requisites:* ' + testPreconditions + '
+ *Tested Binary:* ' + testBinary + '
+ | Select the RegExpValidator list item | Verify it shows a green field with the text abc | + | '+adv+' | Verify the text is now 123, and the field is now red | + | '+adv+' | Verify the number is now aa, and the field is still red | + | '+adv+' | Verify the number is now abcd, and the field is still red | + | '+adv+' | Verify the regex value has changed to allow four characters, and the field is now green |')); + }, + + column: function() + { + // Test Meta-data + testApplication = "Elements: Column"; + testBinary = "tests/testapplications/elements/elements"; + testGoal = "Verify the Column element is shown correctly"; + testPreconditions = ""; + testGroups = "BAT"; + + // Test Steps + prompt(twiki('---+++ ' + testApplication + '

+ *Goal:* ' + testGoal + '
+ *Pre-Requisites:* ' + testPreconditions + '
+ *Tested Binary:* ' + testBinary + '
+ | Select the Column list item | Verify it shows three rectangles - green, red and black | + | '+adv+' | Verify the blue rectangle slid in to place between the red and black rectangles |')); + }, + + row: function() + { + // Test Meta-data + testApplication = "Elements: Row"; + testBinary = "tests/testapplications/elements/elements"; + testGoal = "Verify the Row element is shown correctly"; + testPreconditions = ""; + testGroups = "BAT"; + + // Test Steps + prompt(twiki('---+++ ' + testApplication + '

+ *Goal:* ' + testGoal + '
+ *Pre-Requisites:* ' + testPreconditions + '
+ *Tested Binary:* ' + testBinary + '
+ | Select the Row list item | Verify it shows three rectangles - green, red and black | + | '+adv+' | Verify the blue rectangle slid in to place between the red and black rectangles |')); + }, + + flow: function() + { + // Test Meta-data + testApplication = "Elements: Flow"; + testBinary = "tests/testapplications/elements/elements"; + testGoal = "Verify the Flow element is shown correctly"; + testPreconditions = ""; + testGroups = "BAT"; + + // Test Steps + prompt(twiki('---+++ ' + testApplication + '

+ *Goal:* ' + testGoal + '
+ *Pre-Requisites:* ' + testPreconditions + '
+ *Tested Binary:* ' + testBinary + '
+ | Select the Flow list item | Verify it shows three rectangles - green (1), red (2, to the right of 1) and black (4, below 1) | + | '+adv+' | Verify the blue rectangle appears where the black was, the black sliding to the right | + | '+adv+' | Verify the direction of the numbers is now in two columns | + | '+adv+' | Verify the direction of the numbers has now reversed, still in columns, but progressing from the right to left |')); + }, + + grid: function() + { + // Test Meta-data + testApplication = "Elements: Grid"; + testBinary = "tests/testapplications/elements/elements"; + testGoal = "Verify the Grid element is shown correctly"; + testPreconditions = ""; + testGroups = "BAT"; + + // Test Steps + prompt(twiki('---+++ ' + testApplication + '

+ *Goal:* ' + testGoal + '
+ *Pre-Requisites:* ' + testPreconditions + '
+ *Tested Binary:* ' + testBinary + '
+ | Select the Grid list item | Verify it shows four rectangles - green, a red to the right and a black below | + | '+adv+' | Verify the blue rectangle slid in to place previously held by the black rectangle |')); + }, + + repeater: function() + { + // Test Meta-data + testApplication = "Elements: Repeater"; + testBinary = "tests/testapplications/elements/elements"; + testGoal = "Verify the Repeater element is shown correctly"; + testPreconditions = ""; + testGroups = "BAT"; + + // Test Steps + prompt(twiki('---+++ ' + testApplication + '

+ *Goal:* ' + testGoal + '
+ *Pre-Requisites:* ' + testPreconditions + '
+ *Tested Binary:* ' + testBinary + '
+ | Select the Repeater list item | Verify it shows five blue rectangles with text and a green rectangle at the bottom | + | '+adv+' | Verify the third blue rectangle is now gone and the others bounced up to fill the gap |')); + } +} + + diff --git a/tests/testapplications/elements/content/AnimatedImageElement.qml b/tests/testapplications/elements/content/AnimatedImageElement.qml new file mode 100644 index 0000000000..be772640b2 --- /dev/null +++ b/tests/testapplications/elements/content/AnimatedImageElement.qml @@ -0,0 +1,111 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of QtUiTest. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.0 + +Item { + id: animatedimageelementtest + anchors.fill: parent + property string testtext: "" + + Item { + id: animatedimageelementcontainer + height: 100; width: 100 + anchors.centerIn: parent + AnimatedImage { id: animatedimageelement; anchors.fill: parent; source: "pics/cat.gif" } + Behavior on height { NumberAnimation { duration: 1000 } } + Behavior on width { NumberAnimation { duration: 1000 } } + } + + SystemTestHelp { id: helpbubble; visible: statenum != 0 + anchors { top: parent.top; horizontalCenter: parent.horizontalCenter; topMargin: 50 } + } + BugPanel { id: bugpanel } + + states: [ + State { name: "start"; when: statenum == 1 + PropertyChanges { target: animatedimageelementtest + testtext: "This is an AnimatedImage element. It should be small and showing an animated cat.\n"+ + "Next, it should animatedly increase to twice its size" } + }, + State { name: "large"; when: statenum == 2 + PropertyChanges { target: animatedimageelementcontainer; height: 200; width: 150 } + PropertyChanges { target: animatedimageelementtest + testtext: "It should be large and still showing the cat, but slightly stretched.\n"+ + "Next, let's change it to preserve its aspect ratio" } + }, + State { name: "largefit"; when: statenum == 3 + PropertyChanges { target: animatedimageelementcontainer; height: 200; width: 150 } + PropertyChanges { target: animatedimageelement; fillMode: Image.PreserveAspectFit } + PropertyChanges { target: animatedimageelementtest + testtext: "It should be large and now showing the cat normally (square).\n"+ + "Next, it will change its aspect ratio to fit, but cropping the sides" } + }, + State { name: "largecrop"; when: statenum == 4 + PropertyChanges { target: animatedimageelementcontainer; height: 200; width: 150 } + PropertyChanges { target: animatedimageelement; fillMode: Image.PreserveAspectCrop } + PropertyChanges { target: animatedimageelementtest + testtext: "It should be large and now showing the cat with the sides removed.\n"+ + "Next, let's change the image to tile the square" } + }, + State { name: "largetile"; when: statenum == 5 + PropertyChanges { target: animatedimageelementcontainer; height: 200; width: 150 } + PropertyChanges { target: animatedimageelement; fillMode: Image.Tile; } + PropertyChanges { target: animatedimageelementtest + testtext: "The image should be repeated both horizontally and vertically.\n"+ + "Next, let's change the image to tile the square vertically" } + }, + State { name: "largetilevertical"; when: statenum == 6 + PropertyChanges { target: animatedimageelementcontainer; height: 200; width: 150 } + PropertyChanges { target: animatedimageelement; fillMode: Image.TileVertically; } + PropertyChanges { target: animatedimageelementtest + testtext: "The image should be repeated only vertically.\n"+ + "Next, let's change the image to tile the square horizontally" } + }, + State { name: "largetilehorizontal"; when: statenum == 7 + PropertyChanges { target: animatedimageelementcontainer; height: 200; width: 150 } + PropertyChanges { target: animatedimageelement; fillMode: Image.TileHorizontally; } + PropertyChanges { target: animatedimageelementtest + testtext: "The image should be repeated only horizontally.\n"+ + "The next step will return the image to a small, stretched state" } + } + ] +} \ No newline at end of file diff --git a/tests/testapplications/elements/content/AppContainer.qml b/tests/testapplications/elements/content/AppContainer.qml new file mode 100644 index 0000000000..e1d52609e7 --- /dev/null +++ b/tests/testapplications/elements/content/AppContainer.qml @@ -0,0 +1,71 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.0 + +Rectangle { + + property string qmlfile: "" + height: parent.height *.95; width: parent.width *.95; anchors.centerIn: parent; radius: 5 + + onQmlfileChanged: { qmlapp.source = qmlfile; if (qmlfile != "") { starttimer.start(); } } + + Loader { + id: qmlapp + property int statenum: 0 + property int statecount + statecount: qmlfile != "" ? children[0].states.length : 0 + anchors.fill: parent; focus: true + function advance() { statenum = statenum == statecount ? 1 : ++statenum; } + } + + Timer { id: starttimer; interval: 500; onTriggered: { qmlapp.advance(); } } + + Rectangle { + anchors { top: parent.top; right: parent.right; topMargin: 3; rightMargin: 3 } + height: 30; width: 30; color: "red"; radius: 5 + Text { text: "X"; anchors.centerIn: parent; font.pointSize: 12 } + MouseArea { anchors.fill: parent; onClicked: { elementsapp.qmlfiletoload = "" } } + } + + Text { anchors.centerIn: parent; visible: qmlapp.status == Loader.Error; text: qmlfile+" failed to load.\n"; } + +} \ No newline at end of file diff --git a/tests/testapplications/elements/content/BorderImageElement.qml b/tests/testapplications/elements/content/BorderImageElement.qml new file mode 100644 index 0000000000..89794c27e7 --- /dev/null +++ b/tests/testapplications/elements/content/BorderImageElement.qml @@ -0,0 +1,97 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of QtUiTest. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.0 + +Item { + id: borderimageelementtest + anchors.fill: parent + property int bordervalue: 30 + property string testtext: "" + + BorderImage { + id: borderimageelement + anchors.centerIn: parent + width: 100; height: 100 + source: "pics/qml-borderimage.png" + border { left: bordervalue; top: bordervalue; right: bordervalue; bottom: bordervalue } + Rectangle { + height: parent.height-70; width: parent.width-70; anchors.centerIn: parent + color: "gray"; radius: 5; border.color: "black"; opacity: .5 + } + Behavior on height { NumberAnimation { duration: 1000 } } + Behavior on width { NumberAnimation { duration: 1000 } } + } + + SystemTestHelp { id: helpbubble; visible: statenum != 0 + anchors { top: parent.top; horizontalCenter: parent.horizontalCenter; topMargin: 50 } + } + BugPanel { id: bugpanel } + + states: [ + State { name: "start"; when: statenum == 1 + PropertyChanges { target: borderimageelementtest + testtext: "This is a BorderImage element. It should be small and be showing a frame.\n"+ + "Next, it should animatedly increase to twice its size" } + }, + State { name: "large"; when: statenum == 2 + PropertyChanges { target: borderimageelement; height: 200; width: 200 } + PropertyChanges { target: borderimageelementtest + testtext: "It should be large and still showing the border frame.\n"+ + "Next, it will change the sides repeat mode to tile" } + }, + State { name: "largetile"; when: statenum == 3 + PropertyChanges { target: borderimageelement; height: 200; width: 200; + verticalTileMode: BorderImage.Repeat; horizontalTileMode: BorderImage.Repeat } + PropertyChanges { target: borderimageelementtest + testtext: "The sides of the border should now be repeated.\n"+ + "Next, it will change the sides repeat mode to repeated, but not cropped at the side" } + }, + State { name: "largecrop"; when: statenum == 4 + PropertyChanges { target: borderimageelement; height: 200; width: 200; + verticalTileMode: BorderImage.Round; horizontalTileMode: BorderImage.Round } + PropertyChanges { target: borderimageelementtest + testtext: "It should now show the borders repeated but scaled to fit uniformly.\n"+ + "The next step will show the BorderImage return to the defaults" } + } + ] + +} \ No newline at end of file diff --git a/tests/testapplications/elements/content/BugPanel.qml b/tests/testapplications/elements/content/BugPanel.qml new file mode 100644 index 0000000000..7e60a3f684 --- /dev/null +++ b/tests/testapplications/elements/content/BugPanel.qml @@ -0,0 +1,57 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.0 + +Rectangle { + property string urltext + urltext: "QTBUG-" + bugnumber + "" + property string bugnumber: "" + property string bugreports: "http://bugreports.qt.nokia.com/browse/QTBUG-" + visible: opacity != 0 + opacity: bugnumber == "" ? 0 : 1 + Behavior on opacity { NumberAnimation { duration: 1500 } } + height: buglist.paintedHeight; width: 200; radius: 5; border.color: "lightgray" + anchors { bottom: parent.bottom; left: parent.left; leftMargin: 15; bottomMargin: 15 } + Text { id: buglist; text: urltext; textFormat: Text.RichText; visible: bugnumber != "" + anchors.centerIn: parent; onLinkActivated: { Qt.openUrlExternally(link); } + } +} \ No newline at end of file diff --git a/tests/testapplications/elements/content/ColumnElement.qml b/tests/testapplications/elements/content/ColumnElement.qml new file mode 100644 index 0000000000..daaf391172 --- /dev/null +++ b/tests/testapplications/elements/content/ColumnElement.qml @@ -0,0 +1,85 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of QtUiTest. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.0 + +Item { + id: columnelementtest + anchors.fill: parent + property string testtext: "" + + Column { + id: columnelement + height: 250; width: 200; spacing: 5 + anchors.centerIn: parent + Rectangle { id: gr; color: "green"; height: 50; width: parent.width; border.color: "gray"; border.width: 3; opacity: .9; radius: 5; clip: true } + Rectangle { id: re; color: "red"; height: 50; width: parent.width; border.color: "gray"; border.width: 3; opacity: .9; radius: 5; clip: true } + Rectangle { + id: bl + color: "blue"; height: 50; width: parent.width; border.color: "gray"; border.width: 3; radius: 5; clip: true + opacity: 0; visible: opacity != 0 + } + Rectangle { id: bk; color: "black"; height: 50; width: parent.width; border.color: "gray"; border.width: 3; opacity: .9; radius: 5; clip: true } + + move: Transition { NumberAnimation { properties: "y"; duration: 500; easing.type: Easing.OutBounce } } + add: Transition { NumberAnimation { properties: "y"; duration: 1000; easing.type: Easing.OutBounce } } + + } + + SystemTestHelp { id: helpbubble; visible: statenum != 0 + anchors { top: parent.top; horizontalCenter: parent.horizontalCenter; topMargin: 50 } + } + BugPanel { id: bugpanel } + + states: [ + State { name: "start"; when: statenum == 1 + PropertyChanges { target: columnelementtest + testtext: "This is a Column element. At present it should be showing three rectangles - green, red and black.\n"+ + "Next, let's add a rectangle to the Column - it should drop in from the top and the black rectangle should move to give it space" } + }, + State { name: "back"; when: statenum == 2 + PropertyChanges { target: bl; opacity: .9 } + PropertyChanges { target: columnelementtest + testtext: "Column should now be showing four rectangles - green, red, blue and black.\n"+ + "Advance to restart the test." } + } + ] +} \ No newline at end of file diff --git a/tests/testapplications/elements/content/DoubleValidatorElement.qml b/tests/testapplications/elements/content/DoubleValidatorElement.qml new file mode 100644 index 0000000000..df725b357a --- /dev/null +++ b/tests/testapplications/elements/content/DoubleValidatorElement.qml @@ -0,0 +1,124 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of QtUiTest. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.0 + +Item { + id: doublevalidatorelementtest + anchors.fill: parent + property string testtext: "" + + DoubleValidator { + id: doublevalidatorelement + top: 30.06; bottom: 30.02 + //Behavior on top { NumberAnimation { duration: 1000 } } + } + + Rectangle { + id: doublevalidatorelementbackground + color: doublevalidatorelementinput.acceptableInput ? "green" : "red"; height: 50; width: parent.width *.8 + border.color: "gray"; opacity: 0.7; radius: 5 + anchors.centerIn: parent + + TextInput { + id: doublevalidatorelementinput + font.pointSize: 12; width: parent.width; text: "0"; horizontalAlignment: Text.AlignHCenter; validator: doublevalidatorelement + anchors.centerIn: parent + Behavior on font.pointSize { NumberAnimation { duration: 1000 } } + Behavior on color { ColorAnimation { duration: 1000 } } + } + } + + Text{ + anchors.top: doublevalidatorelementbackground.bottom; anchors.topMargin: 50; anchors.horizontalCenter: parent.horizontalCenter + text: "Top: " + doublevalidatorelement.top + " Bottom: " + doublevalidatorelement.bottom + } + + SystemTestHelp { id: helpbubble; visible: statenum != 0 + anchors { top: parent.top; horizontalCenter: parent.horizontalCenter; topMargin: 50 } + } + BugPanel { id: bugpanel } + + + + states: [ + State { name: "start"; when: statenum == 1 + PropertyChanges { target: doublevalidatorelementinput; text: "30.03" } + PropertyChanges { target: doublevalidatorelementtest + testtext: "This is a TextInput element using an DoubleValidator for input masking. At present it should be indicating 30.03.\n"+ + "Next, let's attempt to enter a number smaller than the lowest allowable value: 30.01" } + }, + State { name: "lowerthan"; when: statenum == 2 + PropertyChanges { target: doublevalidatorelementinput; text: "30.01" } + PropertyChanges { target: doublevalidatorelementtest + testtext: "The TextInput background should be showing red - input is not acceptable.\n"+ + "Next, let's enter a value equal to the lowest allowable value: 30.02." } + }, + State { name: "equaltobottom"; when: statenum == 3 + PropertyChanges { target: doublevalidatorelementinput; text: "30.02" } + PropertyChanges { target: doublevalidatorelementtest + testtext: "The TextInput background should be showing green - input is acceptable.\n"+ + "Next, let's attempt to enter a number greater than the highest allowable value: 30.08" } + }, + State { name: "greaterthan"; when: statenum == 4 + PropertyChanges { target: doublevalidatorelementinput; text: "30.08" } + PropertyChanges { target: doublevalidatorelementtest + testtext: "The TextInput background should be showing red - input is not acceptable.\n"+ + "Next, let's change the value of top to be greater than the entered number." } + }, + State { name: "increasedtop"; when: statenum == 5 + PropertyChanges { target: doublevalidatorelementinput; text: "30.08" } + PropertyChanges { target: doublevalidatorelement; top: 30.09 } + PropertyChanges { target: doublevalidatorelementtest + testtext: "The highest value should have increased to 30.09, thus making the number valid and turning the input background green.\n"+ + "Next, let's change the value of bottom to be greater than the entered number." } + PropertyChanges { target: bugpanel; bugnumber: "19956" } + }, + State { name: "increasedbottom"; when: statenum == 6 + PropertyChanges { target: doublevalidatorelementinput; text: "30.08" } + PropertyChanges { target: doublevalidatorelement; top: 30.09; bottom: 40.05 } + PropertyChanges { target: doublevalidatorelementtest + testtext: "The lowest value should have increased to 36, thus making the validator invalid and turning the input background red.\n"+ + "Press advance to restart the test." } + } + ] + +} \ No newline at end of file diff --git a/tests/testapplications/elements/content/FlickableElement.qml b/tests/testapplications/elements/content/FlickableElement.qml new file mode 100644 index 0000000000..67a4d8102e --- /dev/null +++ b/tests/testapplications/elements/content/FlickableElement.qml @@ -0,0 +1,135 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of QtUiTest. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.0 + +Item { + id: flickableelementtest + anchors.fill: parent + property string testtext: "" + property int sidelength: 1500 + + Rectangle { + id: flickableelementbox + color: "lightgray"; border.color: "gray"; radius: 5; clip: true; opacity: .1 + height: 250; width: parent.width *.8 + anchors.centerIn: parent + + Flickable { + id: flickableelement + anchors.fill: parent + contentHeight: sidelength; contentWidth: sidelength; contentX: (sidelength/2)-125; contentY: (sidelength/2)-125 + onAtYBeginningChanged: { + if (flicking && atYBeginning && statenum == 1) { advance(); } + else if (flicking && atYBeginning && atXBeginning && statenum == 4) { advance(); } + } + onAtXEndChanged: { + if (atYEnd && atXEnd && statenum == 2) { + if (flicking){ advance(); + } else { + testtext = "The view must be flicked into the bottom left corner. Move the grid away slightly and try again" + } + } + } + onAtXBeginningChanged: { + if (atYEnd && atXBeginning && statenum == 3) { + if (!flicking) { advance(); } else { testtext = "Drag - do not flick. Move the grid away slightly and try again" } + } + } + + Row { + width: sidelength; height: sidelength + Repeater { + model: 30 + Column { + Repeater { + id: griprep + height: flickableelement.contentHeight; width: 50; model: 30 + Rectangle { height: 50; width: 50; color: "gray"; border.color: "black" } + } + } + } + } + Text { anchors.centerIn: parent; text: "Center" } + } + } + Text { anchors.left: flickableelementbox.left; anchors.top: flickableelementbox.bottom; anchors.topMargin: 5; + text: "Dragging"; color: !flickableelement.flicking && flickableelement.moving ? "Green" : "Red" + } + Text { anchors.right: flickableelementbox.right; anchors.top: flickableelementbox.bottom; anchors.topMargin: 5; + text: "Flicking"; color: flickableelement.flicking ? "Green" : "Red" + } + + SystemTestHelp { id: helpbubble; visible: statenum != 0 + anchors { top: parent.top; horizontalCenter: parent.horizontalCenter; topMargin: 50 } + } + BugPanel { id: bugpanel } + + states: [ + State { name: "start"; when: statenum == 1 + StateChangeScript { script: { flickableelement.contentX = (sidelength/2)-125; flickableelement.contentY = (sidelength/2)-125 } } + PropertyChanges { target: helpbubble; showadvance: false } + PropertyChanges { target: flickableelementtest + testtext: "This is a Flickable element. At present it should be displaying a grid,\n"+ + "with the center marked and in the center of the view.\n"+ + "Next, please flick the view to the top" } + }, + State { name: "top"; when: statenum == 2 + PropertyChanges { target: helpbubble; showadvance: false } + PropertyChanges { target: flickableelementtest; testtext: "Good. Now flick to the bottom right hand corner." } + }, + State { name: "bottomright"; when: statenum == 3 + PropertyChanges { target: helpbubble; showadvance: false } + PropertyChanges { target: flickableelementtest; testtext: "Great. Now drag, not flick, the view to the bottom left." } + }, + State { name: "bottomleft"; when: statenum == 4 + PropertyChanges { target: helpbubble; showadvance: false } + PropertyChanges { target: flickableelementtest; testtext: "Almost there. Flick to the top left" } + }, + State { name: "sections"; when: statenum == 5 + PropertyChanges { target: helpbubble; showadvance: true } + PropertyChanges { target: flickableelementtest + testtext: "Excellent.\n"+ + "Advance to restart the test." } + } + ] + +} diff --git a/tests/testapplications/elements/content/FlipableElement.qml b/tests/testapplications/elements/content/FlipableElement.qml new file mode 100644 index 0000000000..8c0e80828d --- /dev/null +++ b/tests/testapplications/elements/content/FlipableElement.qml @@ -0,0 +1,105 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of QtUiTest. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.0 + +Item { + id: flipableelementtest + anchors.fill: parent + property string testtext: "" + + Flipable { + id: flipableelement + height: 250; width: 250 + anchors.centerIn: parent + front: Rectangle { color: "green"; anchors.fill: parent; border.color: "gray"; border.width: 3; opacity: .9; radius: 20; clip: true } + back: Rectangle { color: "red"; anchors.fill: parent; border.color: "gray"; border.width: 3; opacity: .9; radius: 20; clip: true } + transform: Rotation { + id: rotation + origin.x: flipableelement.width/2 + origin.y: flipableelement.height/2 + axis.x: 0; axis.y: 1; axis.z: 0 + angle: 0 + } + + } + transitions: Transition { + NumberAnimation { target: rotation; property: "angle"; duration: 2000 } + } + + SystemTestHelp { id: helpbubble; visible: statenum != 0 + anchors { top: parent.top; horizontalCenter: parent.horizontalCenter; topMargin: 50 } + } + BugPanel { id: bugpanel } + + states: [ + State { name: "start"; when: statenum == 1 + PropertyChanges { target: flipableelementtest + testtext: "This is a Flipable element. At present it should be showing a green rectangle.\n"+ + "Next, let's flip the Flipable horizontally to show the back" } + }, + State { name: "back"; when: statenum == 2 + PropertyChanges { target: rotation; angle: 180 } + //FIXED PropertyChanges { target: bugpanel; bugnumber: "19901" } + PropertyChanges { target: flipableelementtest + testtext: "Flipable should now be showing a red rectangle.\n"+ + "Next, let's flip the Flipable to again show the front." } + }, + State { name: "front"; when: statenum == 3 + PropertyChanges { target: flipableelementtest + testtext: "Flipable should have flipped and now be showing a green rectangle.\n"+ + "Next, let's flip vertically." } + }, + State { name: "backvertical"; when: statenum == 4 + PropertyChanges { target: rotation; axis.y: 0; axis.x: 1; angle: 180 } + //FIXED PropertyChanges { target: bugpanel; bugnumber: "19901" } + PropertyChanges { target: flipableelementtest + testtext: "Flipable should have flipped vertically and now be showing a red rectangle.\n"+ + "Next, let's flip back." } + }, + State { name: "frontvertical"; when: statenum == 5 + PropertyChanges { target: rotation; axis.y: 0; axis.x: 1; angle: 0 } + PropertyChanges { target: flipableelementtest + testtext: "Flipable should have flipped vertically and now be showing a green rectangle.\n"+ + "Next, let's restart the test." } + } + ] +} \ No newline at end of file diff --git a/tests/testapplications/elements/content/FlowElement.qml b/tests/testapplications/elements/content/FlowElement.qml new file mode 100644 index 0000000000..eccca1c2ee --- /dev/null +++ b/tests/testapplications/elements/content/FlowElement.qml @@ -0,0 +1,105 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of QtUiTest. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.0 + +Item { + id: flowelementtest + anchors.fill: parent + property string testtext: "" + + Rectangle { anchors.fill: flowelement; color: "lightsteelblue"; radius: 5 } + + Flow { + id: flowelement + height: 150; width: 150; spacing: 5; flow: Flow.LeftToRight + anchors.centerIn: parent + Rectangle { id: gr; color: "green"; height: 50; width: 50; border.color: "gray"; border.width: 3; opacity: .9; radius: 5; clip: true + Text { anchors.centerIn: parent; text: "1" } + } + Rectangle { id: re; color: "red"; height: 50; width: 50; border.color: "gray"; border.width: 3; opacity: .9; radius: 5; clip: true + Text { anchors.centerIn: parent; text: "2" } + } + Rectangle { id: bl; color: "blue"; height: 50; width: 50; border.color: "gray"; border.width: 3; opacity: 0; radius: 5; clip: true + Text { anchors.centerIn: parent; text: "3" } + } + Rectangle { id: bk; color: "black"; height: 50; width: 50; border.color: "gray"; border.width: 3; opacity: .9; radius: 5; clip: true + Text { anchors.centerIn: parent; text: "4"; color: "lightgray" } + } + + move: Transition { NumberAnimation { properties: "x"; duration: 500; easing.type: Easing.OutBounce } } + add: Transition { NumberAnimation { properties: "x"; duration: 500; easing.type: Easing.OutBounce } } + + } + + SystemTestHelp { id: helpbubble; visible: statenum != 0 + anchors { top: parent.top; horizontalCenter: parent.horizontalCenter; topMargin: 50 } + } + BugPanel { id: bugpanel } + + states: [ + State { name: "start"; when: statenum == 1 + PropertyChanges { target: flowelementtest + testtext: "This is a Flow element. At present it should be showing three rectangles - green, red and black.\n"+ + "Next, let's add a rectangle to the Flow - it should slide in from the left and the black rectangle should move to give it space" } + }, + State { name: "added"; when: statenum == 2 + PropertyChanges { target: bl; opacity: .9 } + PropertyChanges { target: flowelementtest + testtext: "Flow should now be showing four rectangles - green, red, blue and black.\n"+ + "Next let's change the direction of the flow to vertical." } + }, + State { name: "vertical"; when: statenum == 3 + PropertyChanges { target: bl; opacity: .9 } + PropertyChanges { target: flowelement; flow: Flow.TopToBottom } + PropertyChanges { target: flowelementtest + testtext: "Flow should now be showing four rectangles - green, blue, red and black.\n"+ + "Next, let's flip the layout direction to RightToLeft." } + }, + State { name: "rtlvertical"; when: statenum == 4 + PropertyChanges { target: bl; opacity: .9 } + PropertyChanges { target: flowelement; flow: Flow.TopToBottom; layoutDirection: Qt.RightToLeft } + PropertyChanges { target: flowelementtest + testtext: "Flow should now be showing the four rectangles aligned to the right and in a column order flowing to the left"+ + "Advance to restart the test." } + } + ] +} \ No newline at end of file diff --git a/tests/testapplications/elements/content/FocusScopeElement.qml b/tests/testapplications/elements/content/FocusScopeElement.qml new file mode 100644 index 0000000000..3f299e8dd2 --- /dev/null +++ b/tests/testapplications/elements/content/FocusScopeElement.qml @@ -0,0 +1,71 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.0 + +Item { + id: focusscopeelementtest + anchors.fill: parent + property string testtext: "" + + FocusScope { + id: firstfocusscopeelement + } + FocusScope { + id: secondfocusscopeelement + } + + BugPanel { id: bugpanel } + + SystemTestHelp { id: helpbubble; visible: statenum != 0 + anchors { top: parent.top; horizontalCenter: parent.horizontalCenter; topMargin: 50 } + } + + states: [ + State { name: "start"; when: statenum == 1 + PropertyChanges { target: focusscopeelementtest + testtext: "This test uses a FocusScope element. There should be two boxes, "+ + "the first showing a red border to represent it having focus.\n"+ + "Next, let's press a key to see which has focus." } + } + ] + +} \ No newline at end of file diff --git a/tests/testapplications/elements/content/FontLoaderElement.qml b/tests/testapplications/elements/content/FontLoaderElement.qml new file mode 100644 index 0000000000..7488ecad90 --- /dev/null +++ b/tests/testapplications/elements/content/FontLoaderElement.qml @@ -0,0 +1,97 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.0 +import "font" + +Item { + id: fontloaderelementtest + anchors.fill: parent + property string testtext: "" + property int currentfont: 0 + property variant availablefonts + Component.onCompleted: { availablefonts = Qt.fontFamilies(); } + + Rectangle { anchors.fill: textitem; color: "lightsteelblue"; radius: 5 } + FontLoader { id: fontloaderelement; name: availablefonts[currentfont] } + + Text { + id: textitem + anchors.centerIn: parent + height: 100; width: 250; text: fontloaderelement.name; font: fontloaderelement.name + horizontalAlignment: Text.AlignHCenter; verticalAlignment: Text.AlignVCenter + } + + SystemTestHelp { id: helpbubble; visible: statenum != 0 + anchors { top: parent.top; horizontalCenter: parent.horizontalCenter; topMargin: 50 } + } + BugPanel { id: bugpanel } + + states: [ + State { name: "start"; when: statenum == 1 + PropertyChanges { target: fontloaderelementtest + testtext: "This is a Text item with the font defined via the FontLoader element.\n"+ + "Presently it should be indicating the font "+fontloaderelement.name+", displayed in said font.\n"+ + "Next, let's change the font to something else." } + }, + State { name: "changefont"; when: statenum == 2 + PropertyChanges { target: fontloaderelementtest + currentfont: 1; + testtext: "FontLoader should now be displaying the text in "+fontloaderelement.name+".\n"+ + "Next let's repeatedly change the font." } + }, + State { name: "switch"; when: statenum == 3 + PropertyChanges { target: fontticker; running: true } + PropertyChanges { target: fontloaderelementtest + testtext: "FontLoader should now be cycling between different fonts available on the system.\n"+ + "Next let's use a locally stored font." } + }, + State { name: "uselocal"; when: statenum == 4 + PropertyChanges { target: fontticker; running: false } + PropertyChanges { target: bugpanel; bugnumber: "20268" } + PropertyChanges { target: fontloaderelement; source: "font/Vera.ttf"; name: "Bitstream Vera Sans"; } + PropertyChanges { target: fontloaderelementtest + testtext: "FontLoader should now be displaying the Bitstream Vera Sans font.\n"+ + "Advance to restart the test." } + } + ] + Timer { id: fontticker; interval: 500; running: false; repeat: true; onTriggered: { currentfont = currentfont == availablefonts.length ? 0 : currentfont+1 } } +} diff --git a/tests/testapplications/elements/content/GradientElement.qml b/tests/testapplications/elements/content/GradientElement.qml new file mode 100644 index 0000000000..b437ea2f8e --- /dev/null +++ b/tests/testapplications/elements/content/GradientElement.qml @@ -0,0 +1,62 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.0 + +Rectangle { + id: gradientelement + property real gradstop: 0.25 + gradient: Gradient { + GradientStop { position: 0.0; color: "red" } + GradientStop { position: gradstop; color: "yellow" } + GradientStop { position: 1.0; color: "green" } + } + MouseArea { anchors.fill: parent; enabled: qmlfiletoload == ""; hoverEnabled: true + onEntered: { helptext = "The gradient should show a trio of colors - red, yellow and green"+ + " - with a slow movement of the yellow up and down the view" } + onExited: { helptext = "" } + } + // Animate the background gradient + SequentialAnimation { id: gradanim; running: true; loops: Animation.Infinite + NumberAnimation { target: gradientelement; property: "gradstop"; to: 0.88; duration: 10000; easing.type: Easing.InOutQuad } + NumberAnimation { target: gradientelement; property: "gradstop"; to: 0.22; duration: 10000; easing.type: Easing.InOutQuad } + } +} \ No newline at end of file diff --git a/tests/testapplications/elements/content/GridElement.qml b/tests/testapplications/elements/content/GridElement.qml new file mode 100644 index 0000000000..544afc3f63 --- /dev/null +++ b/tests/testapplications/elements/content/GridElement.qml @@ -0,0 +1,95 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of QtUiTest. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.0 + +Item { + id: gridelementtest + anchors.fill: parent + property string testtext: "" + + Grid { + id: gridelement + height: 250; width: 120; spacing: 5; columns: 2 + anchors.horizontalCenter: parent.horizontalCenter; anchors.bottom: parent.bottom; anchors.bottomMargin: 100 + + Rectangle { id: gr; color: "green"; height: 50; width: 50; border.color: "gray"; border.width: 3; opacity: .9; radius: 5; clip: true } + Rectangle { id: re; color: "red"; height: 50; width: 50; border.color: "gray"; border.width: 3; opacity: .9; radius: 5; clip: true } + Rectangle { + id: bl + color: "blue"; height: 50; width: 50; border.color: "gray"; border.width: 3; radius: 5; clip: true + opacity: 0; visible: opacity != 0 + } + Rectangle { id: bk; color: "black"; height: 50; width: 50; border.color: "gray"; border.width: 3; opacity: .9; radius: 5; clip: true } + + move: Transition { NumberAnimation { properties: "x,y"; duration: 1000; easing.type: Easing.OutBounce } } + add: Transition { NumberAnimation { properties: "x,y"; duration: 1000; easing.type: Easing.OutBounce } } + + } + + SystemTestHelp { id: helpbubble; visible: statenum != 0 + anchors { top: parent.top; horizontalCenter: parent.horizontalCenter; topMargin: 50 } + } + BugPanel { id: bugpanel } + + states: [ + State { name: "start"; when: statenum == 1 + PropertyChanges { target: gridelementtest + testtext: "This is a Grid element. At present it should be showing three rectangles - green, red and black, two "+ + "in the top row.\n"+ + "Next, let's add a rectangle to the Grid - it should drop in from the top and the black rectangle should move to give it space" } + }, + State { name: "added"; when: statenum == 2 + PropertyChanges { target: bl; opacity: .9 } + PropertyChanges { target: gridelementtest + testtext: "The Grid should now be showing four rectangles - green, red, blue and black.\n"+ + "Next, lets alter the Grid to form a single column" } + }, + State { name: "singlecolumn"; when: statenum == 3 + PropertyChanges { target: bl; opacity: .9 } + PropertyChanges { target: gridelement; columns: 1 } + PropertyChanges { target: gridelementtest + testtext: "The Grid should now be showing four rectangles - green, red, blue and black.\n"+ + "Advance to restart the test." } + } + ] + +} \ No newline at end of file diff --git a/tests/testapplications/elements/content/GridViewElement.qml b/tests/testapplications/elements/content/GridViewElement.qml new file mode 100644 index 0000000000..86aeaddd03 --- /dev/null +++ b/tests/testapplications/elements/content/GridViewElement.qml @@ -0,0 +1,120 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.0 + +Rectangle { + id: gridviewelement; radius: 5; clip: true + property int cellsize + cellsize: Math.floor(elementview.width / 3) + + GridView { + id: elementview + height: parent.height * .98; width: parent.width * .98 + anchors.centerIn: parent + delegate: griddelegate; model: elements; visible: { qmlfiletoload == "" } + highlightFollowsCurrentItem: true; highlightRangeMode: ListView.StrictlyEnforceRange + cellWidth: cellsize; cellHeight: cellsize + } + + // Delegates for the launcher grid + Component { + id: griddelegate + Item { + height: cellsize; width: cellsize + Column { anchors.fill: parent; spacing: 2 + Rectangle { + height: parent.height * .8; width: height + color: "lightgray"; radius: 5; smooth: true + anchors.horizontalCenter: parent.horizontalCenter + Image { + height: parent.height*.75; width: height + anchors.centerIn: parent + source: "pics/logo.png"; fillMode: Image.PreserveAspectFit + } + } + Text { + height: parent.height * .8; width: parent.width + anchors.horizontalCenter: parent.horizontalCenter; text: model.label; elide: Text.ElideRight + horizontalAlignment: Text.AlignHCenter + } + } + MouseArea { + anchors.fill: parent + hoverEnabled: true // For desktop testing + onClicked: { runapp(model.label+"Element.qml"); } + onEntered: { helptext = model.help } + onExited: { helptext = "" } + } + } + } + + // Elements list + ListModel { + id: elements + ListElement { label: "Rectangle"; help: "The Rectangle item provides a filled rectangle with an optional border." } + ListElement { label: "Image"; help: "The Image element displays an image in a declarative user interface" } + ListElement { label: "AnimatedImage"; help: "An image element that supports animations" } + ListElement { label: "BorderImage"; help: "The BorderImage element provides an image that can be used as a border." } + ListElement { label: "SystemPalette"; help: "The SystemPalette element provides access to the Qt palettes." } + ListElement { label: "Text"; help: "The Text item allows you to add formatted text to a scene." } + ListElement { label: "FontLoader"; help: "The FontLoader element allows fonts to be loaded by name or URL." } + ListElement { label: "TextInput"; help: "The TextInput item displays an editable line of text." } + ListElement { label: "TextEdit"; help: "The TextEdit item displays multiple lines of editable formatted text." } + ListElement { label: "ListView"; help: "The ListView item provides a list view of items provided by a model." } + ListElement { label: "Flipable"; help: "The Flipable item provides a surface that can be flipped" } + ListElement { label: "Column"; help: "The Column item arranges its children vertically." } + ListElement { label: "Row"; help: "The Row item arranges its children horizontally." } + ListElement { label: "Grid"; help: "The Grid item positions its children in a grid." } + ListElement { label: "Flow"; help: "The Flow item arranges its children side by side, wrapping as necessary." } + ListElement { label: "Repeater"; help: "The Repeater element allows you to repeat an Item-based component using a model." } + ListElement { label: "IntValidator"; help: "This element provides a validator for integer values." } + ListElement { label: "DoubleValidator"; help: "This element provides a validator for non-integer values." } + ListElement { label: "RegExpValidator"; help: "This element provides a validator, which counts as valid any string which matches a specified regular expression." } + ListElement { label: "Flickable"; help: "The Flickable item provides a surface that can be \"flicked\"." } + ListElement { label: "Keys"; help: "The Keys attached property provides key handling to Items." } + ListElement { label: "MouseArea"; help: "The MouseArea item enables simple mouse handling." } + ListElement { label: "SequentialAnimation"; help: "The SequentialAnimation element allows animations to be run sequentially." } + ListElement { label: "ParallelAnimation"; help: "The ParallelAnimation element allows animations to be run in parallel." } + ListElement { label: "XmlListModel"; help: "The XmlListModel element is used to specify a read-only model using XPath expressions." } + ListElement { label: "Scale"; help: "The Scale element provides a way to scale an Item." } + } +} diff --git a/tests/testapplications/elements/content/Help.qml b/tests/testapplications/elements/content/Help.qml new file mode 100644 index 0000000000..e0b7c026a0 --- /dev/null +++ b/tests/testapplications/elements/content/Help.qml @@ -0,0 +1,52 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.0 + +Item { + anchors.fill: parent + + Text { textFormat: Text.RichText; anchors.fill: parent; anchors.margins: 5; wrapMode: Text.WordWrap + text: "QtQuick 2 System Testing

"+ + "Each system test qml \"application\" provides a basic visual element affected by one or more non-visual (functional) elements.
"+ + "Simply select the element you wish to test, and follow the instructions. Use the arrow to advance the test.
" + } +} \ No newline at end of file diff --git a/tests/testapplications/elements/content/HelpDesk.qml b/tests/testapplications/elements/content/HelpDesk.qml new file mode 100644 index 0000000000..c60b8dee74 --- /dev/null +++ b/tests/testapplications/elements/content/HelpDesk.qml @@ -0,0 +1,58 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.0 + +Item { + + Rectangle { + id: helpbutton; anchors { right: parent.right; bottom: parent.bottom } + height: 30; width: 30; color: "lightgray"; radius: 5; visible: qmlfiletoload == "" + Text { text: "?"; anchors.centerIn: parent; font.pointSize: 12 } + MouseArea { anchors.fill: parent; onClicked: { elementsapp.qmlfiletoload = "Help.qml" } } + } + + Rectangle { + width: parent.width - (20 + helpbutton.width); height: infotext.height; radius: 5; opacity: .7; visible: infotext.text != "" + anchors { right: helpbutton.left; bottom: parent.bottom; rightMargin: 5; bottomMargin: 20 } + Text { id: infotext; text: elementsapp.helptext; width: parent.width - 10; anchors.centerIn: parent; wrapMode: Text.WordWrap } + } +} \ No newline at end of file diff --git a/tests/testapplications/elements/content/ImageElement.qml b/tests/testapplications/elements/content/ImageElement.qml new file mode 100644 index 0000000000..a8811675df --- /dev/null +++ b/tests/testapplications/elements/content/ImageElement.qml @@ -0,0 +1,116 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of QtUiTest. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.0 + +Item { + id: imageelementtest + anchors.fill: parent + property string testtext: "" + + Item { + id: imageelementcontainer + height: 100; width: 100; clip: true + anchors.centerIn: parent + Behavior on height { NumberAnimation { duration: 1000 } } + Behavior on width { NumberAnimation { duration: 1000 } } + Image { + id: imageelement + anchors.fill: parent + source: "pics/nokialogo.gif"; sourceSize.width: 60; sourceSize.height: 80 + } + } + + SystemTestHelp { id: helpbubble; visible: statenum != 0 + anchors { top: parent.top; horizontalCenter: parent.horizontalCenter; topMargin: 50 } + } + BugPanel { id: bugpanel } + + states: [ + State { name: "start"; when: statenum == 1 + PropertyChanges { target: imageelementtest + testtext: "This is an Image element. It should be small and be showing the Nokia logo, but slightly stretched.\n"+ + "Next, it should animatedly increase to twice its size" } + }, + State { name: "large"; when: statenum == 2 + PropertyChanges { target: imageelementcontainer; height: 200; width: 200 } + PropertyChanges { target: imageelementtest + testtext: "It should be large and still showing the slightly stretched Nokia logo.\n"+ + "Next, it will change to preserve its aspect ratio" } + }, + State { name: "largefit"; when: statenum == 3 + PropertyChanges { target: imageelementcontainer; height: 200; width: 200 } + PropertyChanges { target: imageelement; fillMode: Image.PreserveAspectFit } + PropertyChanges { target: imageelementtest + testtext: "It should be large and now showing the Nokia logo normally (longer horizontally).\n"+ + "Next, it will change its aspect ratio to fit, but cropping the sides" } + }, + State { name: "largecrop"; when: statenum == 4 + PropertyChanges { target: imageelementcontainer; height: 200; width: 200 } + PropertyChanges { target: imageelement; fillMode: Image.PreserveAspectCrop } + PropertyChanges { target: imageelementtest + testtext: "It should be large and now showing the Nokia logo with the sides removed.\n"+ + "Next, let's change the image to tile the square" } + }, + State { name: "largetile"; when: statenum == 5 + PropertyChanges { target: imageelementcontainer; height: 200; width: 200 } + PropertyChanges { target: imageelement; fillMode: Image.Tile; } + PropertyChanges { target: imageelementtest + testtext: "The image should be repeated both horizontally and vertically.\n"+ + "Next, let's change the image to tile the square vertically" } + }, + State { name: "largetilevertical"; when: statenum == 6 + PropertyChanges { target: imageelementcontainer; height: 200; width: 200 } + PropertyChanges { target: imageelement; fillMode: Image.TileVertically; } + PropertyChanges { target: imageelementtest + testtext: "The image should be repeated only vertically.\n"+ + "Next, let's change the image to tile the square horizontally" } + }, + State { name: "largetilehorizontal"; when: statenum == 7 + PropertyChanges { target: imageelementcontainer; height: 200; width: 200 } + PropertyChanges { target: imageelement; fillMode: Image.TileHorizontally; } + PropertyChanges { target: imageelementtest + testtext: "The image should be repeated only horizontally.\n"+ + "The next step will return the image to a small, stretched state" } + } + ] + +} \ No newline at end of file diff --git a/tests/testapplications/elements/content/IntValidatorElement.qml b/tests/testapplications/elements/content/IntValidatorElement.qml new file mode 100644 index 0000000000..2b1f80274f --- /dev/null +++ b/tests/testapplications/elements/content/IntValidatorElement.qml @@ -0,0 +1,120 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of QtUiTest. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.0 + +Item { + id: intvalidatorelementtest + anchors.fill: parent + property string testtext: "" + + IntValidator { id: intvalidatorelement; top: 30; bottom: -50 //top: 20; bottom: -50 + //Behavior on top { NumberAnimation { duration: 1000 } } + } + + Rectangle { + id: intvalidatorelementbackground + color: intvalidatorelementinput.acceptableInput ? "green" : "red" + height: 50; width: parent.width *.8; border.color: "gray"; opacity: 0.7; radius: 5 + anchors.centerIn: parent + + TextInput { + id: intvalidatorelementinput + font.pointSize: 12; width: parent.width; text: "0"; horizontalAlignment: Text.AlignHCenter; validator: intvalidatorelement + anchors.centerIn: parent + Behavior on font.pointSize { NumberAnimation { duration: 1000 } } + Behavior on color { ColorAnimation { duration: 1000 } } + } + } + + Text{ + anchors.top: intvalidatorelementbackground.bottom; anchors.topMargin: 50; anchors.horizontalCenter: parent.horizontalCenter + text: "Top: " + intvalidatorelement.top + " Bottom: " + intvalidatorelement.bottom + } + + SystemTestHelp { id: helpbubble; visible: statenum != 0 + anchors { top: parent.top; horizontalCenter: parent.horizontalCenter; topMargin: 50 } + } + BugPanel { id: bugpanel } + + states: [ + State { name: "start"; when: statenum == 1 + PropertyChanges { target: intvalidatorelementinput; text: "0" } + PropertyChanges { target: intvalidatorelementtest + testtext: "This is a TextInput element using an IntValidator for input masking. At present it should be indicating 0.\n"+ + "Next, let's attempt to enter a number smaller than the lowest allowable value: -80" } + }, + State { name: "lowerthan"; when: statenum == 2 + PropertyChanges { target: intvalidatorelementinput; text: "-80" } + PropertyChanges { target: intvalidatorelementtest + testtext: "The TextInput background should be showing red - input is not acceptable.\n"+ + "Next, let's enter a value equal to the lowest allowable value: -50." } + }, + State { name: "equaltobottom"; when: statenum == 3 + PropertyChanges { target: intvalidatorelementinput; text: "-50" } + PropertyChanges { target: intvalidatorelementtest + testtext: "The TextInput background should be showing green - input is acceptable.\n"+ + "Next, let's attempt to enter a number greater than the highest allowable value: 35" } + }, + State { name: "greaterthan"; when: statenum == 4 + PropertyChanges { target: intvalidatorelementinput; text: "35" } + PropertyChanges { target: intvalidatorelementtest + testtext: "The TextInput background should be showing red - input is not acceptable.\n"+ + "Next, let's change the value of top to be greater than the entered number." } + }, + State { name: "increasedtop"; when: statenum == 5 + PropertyChanges { target: intvalidatorelementinput; text: "35" } + PropertyChanges { target: intvalidatorelement; top: 35 } + PropertyChanges { target: intvalidatorelementtest + testtext: "The highest value should have increased to 35, thus making the number valid and turning the input background green.\n"+ + "Next, let's change the value of bottom to be greater than the entered number." } + PropertyChanges { target: bugpanel; bugnumber: "19956" } + }, + State { name: "increasedbottom"; when: statenum == 6 + PropertyChanges { target: intvalidatorelementinput; text: "35" } + PropertyChanges { target: intvalidatorelement; top: 35; bottom: 36 } + PropertyChanges { target: intvalidatorelementtest + testtext: "The lowest value should have increased to 36, thus making the validator invalid and turning the input background red.\n"+ + "Press advance to restart the test." } + } + ] + +} \ No newline at end of file diff --git a/tests/testapplications/elements/content/KeysElement.qml b/tests/testapplications/elements/content/KeysElement.qml new file mode 100644 index 0000000000..c754376dd5 --- /dev/null +++ b/tests/testapplications/elements/content/KeysElement.qml @@ -0,0 +1,114 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of QtUiTest. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.0 + +Item { + id: keyselementtest + anchors.fill: parent + property string testtext: "" + property int sidelength: 1500 + focus: true + + Rectangle { + id: keyselementbox + color: "lightgray"; border.color: "gray"; radius: 5; clip: true; opacity: .7 + height: 250; width: parent.width *.8 + anchors.centerIn: parent + focus: true + Keys.enabled: true + Keys.onLeftPressed: { if (statenum == 2) { advance(); } } + Keys.onRightPressed: { if (statenum == 1) { advance(); } } + Keys.onUpPressed: { if (statenum == 3) { advance(); } } + Keys.onDownPressed: { if (statenum == 4) { advance(); } } + Keys.onPressed: { + if ((event.key == Qt.Key_Space) && (event.modifiers & Qt.ControlModifier) && (event.modifiers & Qt.AltModifier)) { + if (statenum == 5) { advance(); } + } + } + Rectangle { id: leftone; height: 50; width: 50; color: "green"; anchors{ left: parent.left; verticalCenter: parent.verticalCenter } } + Rectangle { id: rightone; height: 50; width: 50; color: "green"; anchors{ right: parent.right; verticalCenter: parent.verticalCenter } } + Rectangle { id: topone; height: 50; width: 50; color: "green"; anchors{ top: parent.top; horizontalCenter: parent.horizontalCenter } } + Rectangle { id: bottomone; height: 50; width: 50; color: "green"; anchors{ bottom: parent.bottom; horizontalCenter: parent.horizontalCenter } } + } + + SystemTestHelp { id: helpbubble; visible: statenum != 0 + anchors { top: parent.top; horizontalCenter: parent.horizontalCenter; topMargin: 50 } + } + BugPanel { id: bugpanel } + + states: [ + State { name: "start"; when: statenum == 1 + PropertyChanges { target: helpbubble; showadvance: false } + PropertyChanges { target: keyselementtest + testtext: "This is a Keys element. At present there should be four squares\n"+ + "Next, please press the right button on the keypad/board" } + }, + State { name: "right"; when: statenum == 2 + PropertyChanges { target: helpbubble; showadvance: false } + PropertyChanges { target: rightone; color: "orange" } + PropertyChanges { target: keyselementtest; testtext: "Good. Now press left." } + }, + State { name: "left"; when: statenum == 3 + PropertyChanges { target: helpbubble; showadvance: false } + PropertyChanges { target: leftone; color: "orange" } + PropertyChanges { target: keyselementtest; testtext: "Press up." } + }, + State { name: "up"; when: statenum == 4 + PropertyChanges { target: helpbubble; showadvance: false } + PropertyChanges { target: topone; color: "orange" } + PropertyChanges { target: keyselementtest; testtext: "And then press down" } + }, + State { name: "down"; when: statenum == 5 + PropertyChanges { target: helpbubble; showadvance: false } + PropertyChanges { target: bottomone; color: "orange" } + PropertyChanges { target: keyselementtest; testtext: "Excellent. Now hold Ctrl+Alt and press Space" } + }, + State { name: "modifiers"; when: statenum == 6 + PropertyChanges { target: helpbubble; showadvance: true } + PropertyChanges { target: keyselementbox; color: "orange" } + PropertyChanges { target: keyselementtest + testtext: "Test has completed\n"+ + "Advance to restart the test." } + } + ] + +} diff --git a/tests/testapplications/elements/content/ListViewElement.qml b/tests/testapplications/elements/content/ListViewElement.qml new file mode 100644 index 0000000000..221c967f14 --- /dev/null +++ b/tests/testapplications/elements/content/ListViewElement.qml @@ -0,0 +1,171 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of QtUiTest. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.0 + +Item { + id: listviewelementtest + anchors.fill: parent + property string testtext: "" + property bool hivis: false + + Rectangle { + id: listviewelementbackground + color: "lightgray"; border.color: "gray"; radius: 5; clip: true; opacity: .1 + height: listviewelement.height + 10; width: listviewelement.width + 10 + anchors.centerIn: listviewelement + } + + ListView { + id: listviewelement + height: 250; width: parent.width *.8; clip: true + anchors.centerIn: parent + model: devices + highlightFollowsCurrentItem: true + highlight: highlightrect + delegate: delegaterect + section.property: "os" + section.delegate: sectiondelegaterect + header: headerrect + footer: footerrect + spacing: 0 + Behavior on spacing { NumberAnimation { duration: 200 } } + } + + Component { id: delegaterect + Item { + width: listviewelement.width - 4; height: 30 + Rectangle { color: "blue"; anchors.fill: parent; radius: 5; border.color: "black"; opacity: .1 } + Text { text: model.name; anchors.centerIn: parent } + } + } + + Component { id: sectiondelegaterect + Item { + width: listviewelement.width - 4; height: 30 + Rectangle { color: "green"; anchors.fill: parent; radius: 5; border.color: "black"; opacity: .5 } + Text { text: section; anchors.verticalCenter: parent.verticalCenter; anchors.left: parent.left; anchors.leftMargin: 5 } + } + } + + Component { id: highlightrect + Rectangle { + id: coloredbox; color: "yellow"; width: listviewelement.width - 4; height: 30; radius: 5; opacity: .5; visible: hivis + SequentialAnimation on color { loops: Animation.Infinite; running: coloredbox.visible + ColorAnimation { to: "green"; duration: 2000 } + ColorAnimation { to: "yellow"; duration: 2000 } + } + } + } + + Component { id: headerrect + Rectangle { id: hdr; color: "brown"; width: listviewelement.width - 4; height: 30; radius: 5; opacity: .5 + Text { anchors.centerIn: parent; text: "Nokia Devices" } + } + } + + Component { id: footerrect + Rectangle { id: ftr; color: "brown"; width: listviewelement.width - 4; height: 30; radius: 5; opacity: .5 + Text { anchors.centerIn: parent; text: "Nokia pty ltd." } + } + } + + SystemTestHelp { id: helpbubble; visible: statenum != 0 + anchors { top: parent.top; horizontalCenter: parent.horizontalCenter; topMargin: 50 } + } + BugPanel { id: bugpanel } + + states: [ + State { name: "start"; when: statenum == 1 + PropertyChanges { target: listviewelementtest + testtext: "This is a ListView element. At present it should be displaying the names of a few Nokia devices, ordered by Operating System.\n"+ + "Next, let's view the end of the list" } + }, + State { name: "end"; when: statenum == 2 + StateChangeScript { script: listviewelement.positionViewAtEnd(); } + PropertyChanges { target: listviewelementtest + testtext: "The end of the list should now be visible.\nNext, let's add a highlight." } + }, + State { name: "highlight"; when: statenum == 3 + PropertyChanges { target: listviewelement; currentIndex: 0 } + StateChangeScript { script: listviewelement.positionViewAtBeginning(); } + PropertyChanges { target: listviewelementtest; hivis: true } + PropertyChanges { target: listviewelementtest + testtext: "The ListView should now be showing a highlight on the first item.\n"+ + "Next, let's move to an item down the list." } + }, + State { name: "highlight7"; when: statenum == 4 + PropertyChanges { target: listviewelement; currentIndex: 6 } + PropertyChanges { target: listviewelementtest; hivis: true } + PropertyChanges { target: listviewelementtest + testtext: "The ListView should now be showing the highlight over item 7 - the N95\n"+ + "Next let's add some space between them." } + }, + State { name: "sections"; when: statenum == 5 + PropertyChanges { target: listviewelement; currentIndex: 6 } + PropertyChanges { target: listviewelement; spacing: 5 } + PropertyChanges { target: listviewelementtest; hivis: true } + PropertyChanges { target: listviewelementtest + testtext: "The ListView should now be showing a space between each list item,\n"+ + "but not after the header and sections, or before the footer.\n"+ + "Advance to restart the test." } + } + ] + + ListModel { + id: devices + ListElement { name: "N900"; os: "Maemo" } + ListElement { name: "N810"; os: "Maemo" } + ListElement { name: "N9"; os: "Meego" } + ListElement { name: "N-Gage QD"; os: "S60 1.2" } + ListElement { name: "E90"; os: "S60 2nd" } + ListElement { name: "E72"; os: "S60 3.2" } + ListElement { name: "N95"; os: "S60 5.0" } + ListElement { name: "X6"; os: "S60 5.0" } + ListElement { name: "N97"; os: "Symbian^1" } + ListElement { name: "5800"; os: "Symbian^1" } + ListElement { name: "E7"; os: "Symbian^3" } + ListElement { name: "N8"; os: "Symbian^3" } + ListElement { name: "C7"; os: "Symbian^3" } + ListElement { name: "X7"; os: "Symbian Anna" } + } + +} diff --git a/tests/testapplications/elements/content/MouseAreaElement.qml b/tests/testapplications/elements/content/MouseAreaElement.qml new file mode 100644 index 0000000000..67399688cf --- /dev/null +++ b/tests/testapplications/elements/content/MouseAreaElement.qml @@ -0,0 +1,153 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of QtUiTest. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.0 + +Item { + id: mouseareaelementtest + anchors.fill: parent + property string testtext: "" + property int sidelength: 1500 + + focus: true + Rectangle { + id: mouseareaelementbox + color: "lightgray"; border.color: "gray"; radius: 5; clip: true; opacity: .7; height: 300; width: 300 + anchors.centerIn: parent + MouseArea { + id: mouseareaelement + hoverEnabled: true + anchors.fill: parent + } + Rectangle { + id: topleft + height: 50; width: 50; color: metopleft.containsMouse ? "green" : "blue" + anchors { top: mouseareaelementbox.top; left: mouseareaelementbox.left; margins: 5 } + MouseArea { + id: metopleft + hoverEnabled: true + anchors.fill: parent + onContainsMouseChanged: { if (containsMouse && statenum == 1) { advance(); } } + } + } + Rectangle { + id: topright + height: 50; width: 50; color: metopright.containsMouse ? "green" : "blue" + anchors { top: mouseareaelementbox.top; right: mouseareaelementbox.right; topMargin: 5; rightMargin: 5 } + MouseArea { + id: metopright + hoverEnabled: true + anchors.fill: parent + onContainsMouseChanged: { if (containsMouse && statenum == 4) { advance(); } } + } + } + Rectangle { + id: bottomleft + height: 50; width: 50; color: mebottomleft.containsMouse ? "green" : "blue" + anchors { bottom: mouseareaelementbox.bottom; left: mouseareaelementbox.left; bottomMargin: 5; leftMargin: 5 } + MouseArea { + id: mebottomleft + hoverEnabled: true + anchors.fill: parent + onContainsMouseChanged: { if (containsMouse && statenum == 3) { advance(); } } + } + } + Rectangle { + id: bottomright + height: 50; width: 50; color: mebottomright.containsMouse ? "green" : "blue" + anchors { bottom: mouseareaelementbox.bottom; right: mouseareaelementbox.right; bottomMargin: 5; rightMargin: 5 } + MouseArea { + id: mebottomright + hoverEnabled: true + anchors.fill: parent + onContainsMouseChanged: { if (containsMouse && statenum == 2) { advance(); } } + } + } + + Rectangle { + height: 10; width: 10; radius: 5; x: mouseareaelement.mouseX; y: mouseareaelement.mouseY; color: "red" + } + + } + + SystemTestHelp { id: helpbubble; visible: statenum != 0 + anchors { top: parent.top; horizontalCenter: parent.horizontalCenter; topMargin: 50 } + } + BugPanel { id: bugpanel } + + states: [ + State { name: "start"; when: statenum == 1 + PropertyChanges { target: helpbubble; showadvance: false } + PropertyChanges { target: mouseareaelementtest + testtext: "This test contains a number of MouseArea elements. At present there should be four rectangles\n"+ + "Next, move the pointer to the top left of the square" } + }, + State { name: "topleft"; when: statenum == 2 + PropertyChanges { target: helpbubble; showadvance: false } + PropertyChanges { target: topleft; color: "yellow" } + PropertyChanges { target: mouseareaelementtest; testtext: "Good. Now move it down to the bottom right." } + }, + State { name: "bottomright"; when: statenum == 3 + PropertyChanges { target: helpbubble; showadvance: false } + PropertyChanges { target: bottomright; color: "yellow" } + PropertyChanges { target: mouseareaelementtest; testtext: "To the bottom left." } + }, + State { name: "bottomleft"; when: statenum == 4 + PropertyChanges { target: helpbubble; showadvance: false } + PropertyChanges { target: bottomleft; color: "yellow" } + PropertyChanges { target: mouseareaelementtest; testtext: "Then to top right" } + }, + State { name: "topright"; when: statenum == 5 + PropertyChanges { target: helpbubble; showadvance: false } + PropertyChanges { target: topright; color: "yellow" } + PropertyChanges { target: mouseareaelementtest + testtext: "Excellent.\n"+ + "Modifiers test not yet defined." } + }, + State { name: "modifiers"; when: statenum == 6 + PropertyChanges { target: helpbubble; showadvance: true } + PropertyChanges { target: mouseareaelementtest + testtext: "Test has completed\n"+ + "Advance to restart the test." } + } + ] + +} diff --git a/tests/testapplications/elements/content/ParallelAnimationElement.qml b/tests/testapplications/elements/content/ParallelAnimationElement.qml new file mode 100644 index 0000000000..eb217da286 --- /dev/null +++ b/tests/testapplications/elements/content/ParallelAnimationElement.qml @@ -0,0 +1,94 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of QtUiTest. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.0 + +Item { + id: parallelanimationelementtest + anchors.fill: parent + property string testtext: "" + property int firstduration: 1000 + property int secondduration: 3000 + ParallelAnimation { + id: parallelanimationelement + running: false + NumberAnimation { id: movement; target: animatedrect; properties: "y"; to: 500; duration: firstduration } + ColorAnimation { id: recolor; target: animatedrect; properties: "color"; to: "green"; duration: secondduration } + } + + Rectangle { + id: animatedrect + width: 50; height: 50; color: "blue"; y: 300 + anchors.horizontalCenter: parent.horizontalCenter + } + + SystemTestHelp { id: helpbubble; visible: statenum != 0 + anchors { top: parent.top; horizontalCenter: parent.horizontalCenter; topMargin: 50 } + } + BugPanel { id: bugpanel } + + states: [ + State { name: "start"; when: statenum == 1 + PropertyChanges { target: animatedrect; color: "blue"; y: 300 } + PropertyChanges { target: parallelanimationelementtest + testtext: "This square will have two properties animated simultaneously.\n"+ + "The next step will see it move quickly down the display, and slowly change its color to green, at the same time"; + } + }, + State { name: "firstchange"; when: statenum == 2 + PropertyChanges { target: parallelanimationelement; running: true } + PropertyChanges { target: parallelanimationelementtest + testtext: "The square should have moved quickly, and recolored slowly\n"+ + "Next, it will recolor quickly and move slowly back to it's original position" + } + }, + State { name: "secondchange"; when: statenum == 3 + StateChangeScript { script: { firstduration = 3000; secondduration = 1000 } } + PropertyChanges { target: movement; to: 300 } + PropertyChanges { target: recolor; to: "blue" } + PropertyChanges { target: parallelanimationelement; running: true } + PropertyChanges { target: parallelanimationelementtest + testtext: "The square should have moved slowly, then recolored quickly, simultaneously\n"+ + "Advance to restart the test" + } + } + ] +} \ No newline at end of file diff --git a/tests/testapplications/elements/content/RectangleElement.qml b/tests/testapplications/elements/content/RectangleElement.qml new file mode 100644 index 0000000000..a34e43b7e9 --- /dev/null +++ b/tests/testapplications/elements/content/RectangleElement.qml @@ -0,0 +1,93 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of QtUiTest. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.0 + +Item { id: rectangleelementtest + anchors.fill: parent + property string testtext: "" + + Rectangle { + id: rectangleelement + height: 100; width: 100; color: "blue"; border.width: 2; border.color: "red"; border.aligned: false; smooth: true + anchors.centerIn: parent + Behavior on height { NumberAnimation { duration: 1000 } } + Behavior on width { NumberAnimation { duration: 1000 } } + Behavior on radius { NumberAnimation { duration: 1000 } } + Behavior on color { ColorAnimation { duration: 1000 } } + Behavior on border.color { ColorAnimation { duration: 1000 } } + Behavior on border.width { NumberAnimation { duration: 1000 } } + } + + SystemTestHelp { id: helpbubble; visible: statenum != 0 + anchors { top: parent.top; horizontalCenter: parent.horizontalCenter; topMargin: 50 } + } + BugPanel { id: bugpanel } + + states: [ + State { name: "start"; when: statenum == 1 + PropertyChanges { target: rectangleelementtest + testtext: "This is a Rectangle element. It should be small and blue, with a thin, red border.\n"+ + "Next, it will animatedly increase to twice its size" } + }, + State { name: "large"; when: statenum == 2 + PropertyChanges { target: rectangleelement; height: 200; width: 200 } + PropertyChanges { target: rectangleelementtest; testtext: "It should now be large and blue, with a thin, red border.\n"+ + "Next, a radius will be added to round the corners" } + }, + State { name: "largerounded"; when: statenum == 3 + PropertyChanges { target: rectangleelement; height: 200; width: 200; radius: 20 } + PropertyChanges { target: rectangleelementtest; testtext: "The borders should now be rounded.\n"+ + "Next, it will change the color to green" } + }, + State { name: "largeroundedgreen"; when: statenum == 4 + PropertyChanges { target: rectangleelement; height: 200; width: 200; radius: 20; color: "green" } + PropertyChanges { target: rectangleelementtest; testtext: "The rectangle should now be green.\n"+ + "Next, the border width will be increased" } + }, + State { name: "largeroundedgreenthick"; when: statenum == 5 + PropertyChanges { target: rectangleelement; height: 200; width: 200; radius: 20; color: "green"; border.width: 10 } + PropertyChanges { target: rectangleelementtest; testtext: "The border width should have increased significantly.\n"+ + "Advance to restart the test - everything should animate at once" } + } + ] + +} diff --git a/tests/testapplications/elements/content/RegExpValidatorElement.qml b/tests/testapplications/elements/content/RegExpValidatorElement.qml new file mode 100644 index 0000000000..4892ca55e7 --- /dev/null +++ b/tests/testapplications/elements/content/RegExpValidatorElement.qml @@ -0,0 +1,113 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of QtUiTest. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.0 + +Item { + id: regexpvalidatorelementtest + anchors.fill: parent + property string testtext: "" + property variant regexp: /[a-z]{3}/ + + RegExpValidator { id: regexpvalidatorelement; regExp: regexp } + + Rectangle { + id: regexpvalidatorelementbackground + color: regexpvalidatorelementinput.acceptableInput ? "green" : "red"; height: 50; width: parent.width *.8 + border.color: "gray"; opacity: 0.7; radius: 5 + anchors.centerIn: parent + + TextInput { + id: regexpvalidatorelementinput + font.pointSize: 12; width: parent.width; text: "0"; horizontalAlignment: Text.AlignHCenter; validator: regexpvalidatorelement + anchors.centerIn: parent + Behavior on font.pointSize { NumberAnimation { duration: 1000 } } + Behavior on color { ColorAnimation { duration: 1000 } } + } + } + + Text{ + anchors.top: regexpvalidatorelementbackground.bottom; anchors.topMargin: 50; anchors.horizontalCenter: parent.horizontalCenter + text: "Regular Expression: " + regexp + } + + SystemTestHelp { id: helpbubble; visible: statenum != 0 + anchors { top: parent.top; horizontalCenter: parent.horizontalCenter; topMargin: 50 } + } + BugPanel { id: bugpanel } + + states: [ + State { name: "start"; when: statenum == 1 + PropertyChanges { target: regexpvalidatorelementinput; text: "abc" } + PropertyChanges { target: regexpvalidatorelementtest + testtext: "This is a TextInput element using an RegExpValidator for input masking. At present it should be indicating abc.\n"+ + "The regExp value will only match to a value that has three alpha characters\n"+ + "Next, let's attempt to enter text that does not match the regular expression: 123" } + }, + State { name: "notmatch"; when: statenum == 2 + PropertyChanges { target: regexpvalidatorelementinput; text: "123" } + PropertyChanges { target: regexpvalidatorelementtest + testtext: "The TextInput background should be showing red - input is not acceptable.\n"+ + "Next, let's enter a word with not enough characters to match: aa." } + }, + State { name: "notenough"; when: statenum == 3 + PropertyChanges { target: regexpvalidatorelementinput; text: "aa" } + PropertyChanges { target: regexpvalidatorelementtest + testtext: "The TextInput background should be showing red - input is not acceptable.\n"+ + "Next, let's attempt to enter a word with too many characters to match: abcd" } + }, + State { name: "toomany"; when: statenum == 4 + PropertyChanges { target: regexpvalidatorelementinput; text: "abcd" } + PropertyChanges { target: regexpvalidatorelementtest + testtext: "The TextInput background should still be showing red - input is not acceptable.\n"+ + "Next, let's change the regex to accept the new value." } + }, + State { name: "changedregex"; when: statenum == 5 + PropertyChanges { target: regexpvalidatorelementinput; text: "abcd" } + PropertyChanges { target: regexpvalidatorelementtest; regexp: /[a-z]{4}/ + testtext: "The regular expression should have changed to match four characters, "+ + "thus making the text valid and turning the input background green.\n"+ + "Press advance to restart the test." } + PropertyChanges { target: bugpanel; bugnumber: "19956" } + } + ] + +} \ No newline at end of file diff --git a/tests/testapplications/elements/content/RepeaterElement.qml b/tests/testapplications/elements/content/RepeaterElement.qml new file mode 100644 index 0000000000..327eb626e3 --- /dev/null +++ b/tests/testapplications/elements/content/RepeaterElement.qml @@ -0,0 +1,96 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of QtUiTest. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.0 + +Item { + id: repeaterelementtest + anchors.fill: parent + property string testtext: "" + property bool showme: true + + Column { + id: container + height: 50; width: 250; spacing: 5 + anchors.centerIn: parent + Repeater { id: repeaterelement; model: repeatermodel } + Rectangle { height: 50; width: 150; color: "green" } + move: Transition { NumberAnimation { properties: "x,y"; duration: 1000; easing.type: Easing.OutBounce } } + add: Transition { NumberAnimation { properties: "x,y"; duration: 1000; easing.type: Easing.OutBounce } } + + } + + VisualItemModel { + id: repeatermodel + Rectangle { color: "blue"; height: 50; width: 150; border.color: "black"; border.width: 3; opacity: .9; radius: 5; clip: true + Text { text: "I am Thing 1"; anchors.centerIn: parent } } + Rectangle { color: "blue"; height: 50; width: 150; border.color: "black"; border.width: 3; opacity: .9; radius: 5; clip: true + Text { text: "I am Thing 2"; anchors.centerIn: parent } } + Rectangle { visible: repeaterelementtest.showme; + color: "blue"; height: 50; width: 150; border.color: "black"; border.width: 3; opacity: .9; radius: 5; clip: true + Text { text: "I am Thing 3"; anchors.centerIn: parent } } + Rectangle { color: "blue"; height: 50; width: 150; border.color: "black"; border.width: 3; opacity: .9; radius: 5; clip: true + Text { text: "I am Thing 4"; anchors.centerIn: parent } } + Rectangle { color: "blue"; height: 50; width: 150; border.color: "black"; border.width: 3; opacity: .9; radius: 5; clip: true + Text { text: "I am Thing 5"; anchors.centerIn: parent } } + } + + SystemTestHelp { id: helpbubble; visible: statenum != 0 + anchors { top: parent.top; horizontalCenter: parent.horizontalCenter; topMargin: 50 } + } + BugPanel { id: bugpanel } + + states: [ + State { name: "start"; when: statenum == 1 + PropertyChanges { target: repeaterelementtest + testtext: "This is a Repeater element. At present it should be showing five blue rectangles in a column, with"+ + "a green rectangle at the bottom.\n"+ + "Next, let's remove one of the rectangles from the column - the column should bounce when they are removed." } + }, + State { name: "back"; when: statenum == 2 + PropertyChanges { target: repeaterelementtest; showme: false } + PropertyChanges { target: repeaterelementtest + testtext: "Repeater should now be showing a total of five rectangles.\n"+ + "Advance to restart the test." } + } + ] + +} \ No newline at end of file diff --git a/tests/testapplications/elements/content/RowElement.qml b/tests/testapplications/elements/content/RowElement.qml new file mode 100644 index 0000000000..dda913a2d6 --- /dev/null +++ b/tests/testapplications/elements/content/RowElement.qml @@ -0,0 +1,86 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of QtUiTest. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.0 + +Item { + id: rowelementtest + anchors.fill: parent + property string testtext: "" + + Row { + id: rowelement + height: 50; width: 250; spacing: 5 + anchors.centerIn: parent + Rectangle { id: gr; color: "green"; height: 50; width: 50; border.color: "gray"; border.width: 3; opacity: .9; radius: 5; clip: true } + Rectangle { id: re; color: "red"; height: 50; width: 50; border.color: "gray"; border.width: 3; opacity: .9; radius: 5; clip: true } + Rectangle { + id: bl + color: "blue"; height: 50; width: 50; border.color: "gray"; border.width: 3; radius: 5; clip: true + opacity: 0; visible: opacity != 0 + } + Rectangle { id: bk; color: "black"; height: 50; width: 50; border.color: "gray"; border.width: 3; opacity: .9; radius: 5; clip: true } + + move: Transition { NumberAnimation { properties: "x"; duration: 500; easing.type: Easing.OutBounce } } + add: Transition { NumberAnimation { properties: "x"; duration: 1000; easing.type: Easing.OutBounce } } + + } + + SystemTestHelp { id: helpbubble; visible: statenum != 0 + anchors { top: parent.top; horizontalCenter: parent.horizontalCenter; topMargin: 50 } + } + BugPanel { id: bugpanel } + + states: [ + State { name: "start"; when: statenum == 1 + PropertyChanges { target: rowelementtest + testtext: "This is a Row element. At present it should be showing three rectangles - green, red and black.\n"+ + "Next, let's add a rectangle to the Row - it should slide in from the left and the black rectangle should move to give it space" } + }, + State { name: "back"; when: statenum == 2 + PropertyChanges { target: bl; opacity: .9 } + PropertyChanges { target: rowelementtest + testtext: "Row should now be showing four rectangles - green, red, blue and black.\n"+ + "Advance to restart the test." } + } + ] + +} \ No newline at end of file diff --git a/tests/testapplications/elements/content/ScaleElement.qml b/tests/testapplications/elements/content/ScaleElement.qml new file mode 100644 index 0000000000..2563f77023 --- /dev/null +++ b/tests/testapplications/elements/content/ScaleElement.qml @@ -0,0 +1,94 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of QtUiTest. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.0 + +Item { + id: scaleelementtest + anchors.fill: parent + property string testtext: "" + + Rectangle { + id: scaletarget + color: "green"; height: 100; width: 100; border.color: "gray"; opacity: 0.7; radius: 5 + anchors.centerIn: parent + transform: Scale { + id: scaleelement + property alias originx: scaleelement.origin.x + property alias originy: scaleelement.origin.y + origin.x: 50; origin.y: 50 + Behavior on xScale { NumberAnimation { duration: 500 } } + Behavior on yScale { NumberAnimation { duration: 500 } } + // QTBUG-20827 Behavior on origin.x { NumberAnimation { duration: 500 } } + // QTBUG-20827 Behavior on origin.y { NumberAnimation { duration: 500 } } + + } + } + + SystemTestHelp { id: helpbubble; visible: statenum != 0 + anchors { top: parent.top; horizontalCenter: parent.horizontalCenter; topMargin: 50 } + } + BugPanel { id: bugpanel } + + states: [ + State { name: "start"; when: statenum == 1 + PropertyChanges { target: scaleelementtest + testtext: "This is a Rectangle that will be transformed using a Scale element.\n"+ + "Next, it will be scaled to 2x size." } + }, + State { name: "scaleup"; when: statenum == 2 + PropertyChanges { target: scaleelement; xScale: 2; yScale: 2 } + PropertyChanges { target: scaleelementtest + testtext: "It should be scaled to 2x.\nNext, it will shift to the right." } + }, + State { name: "shiftright"; when: statenum == 3 + PropertyChanges { target: scaleelement; xScale: 2; yScale: 2; origin.x: 0; origin.y: 50 } + PropertyChanges { target: scaleelementtest + testtext: "It should be on the right, still scaled to 2x.\nNext, it will shift to the left" } + }, + State { name: "shiftleft"; when: statenum == 4 + PropertyChanges { target: scaleelement; xScale: 2; yScale: 2; origin.x: 100; origin.y: 50 } + PropertyChanges { target: scaleelementtest + testtext: "It should be on the left, still scaled to 2x.\nAdvance to restart the test." } + } + ] + +} \ No newline at end of file diff --git a/tests/testapplications/elements/content/SequentialAnimationElement.qml b/tests/testapplications/elements/content/SequentialAnimationElement.qml new file mode 100644 index 0000000000..94531a2184 --- /dev/null +++ b/tests/testapplications/elements/content/SequentialAnimationElement.qml @@ -0,0 +1,94 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of QtUiTest. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.0 + +Item { + id: sequentialanimationelementtest + anchors.fill: parent + property string testtext: "" + property int firstduration: 1000 + property int secondduration: 3000 + SequentialAnimation { + id: sequentialanimationelement + running: false + NumberAnimation { id: movement; target: animatedrect; properties: "y"; to: 500; duration: firstduration } + ColorAnimation { id: recolor; target: animatedrect; properties: "color"; to: "green"; duration: secondduration } + } + + Rectangle { + id: animatedrect + width: 50; height: 50; color: "blue"; y: 300 + anchors.horizontalCenter: parent.horizontalCenter + } + + SystemTestHelp { id: helpbubble; visible: statenum != 0 + anchors { top: parent.top; horizontalCenter: parent.horizontalCenter; topMargin: 50 } + } + BugPanel { id: bugpanel } + + states: [ + State { name: "start"; when: statenum == 1 + PropertyChanges { target: animatedrect; color: "blue"; y: 300 } + PropertyChanges { target: sequentialanimationelementtest + testtext: "This square will be animated in a sequence.\n"+ + "The next step will see it move quickly down the display, then slowly change its color to green"; + } + }, + State { name: "firstchange"; when: statenum == 2 + PropertyChanges { target: sequentialanimationelement; running: true } + PropertyChanges { target: sequentialanimationelementtest + testtext: "The square should have moved quickly and also recolored slowly\n"+ + "Next, it will recolor quickly and move slowly back to it's original position at the same time" + } + }, + State { name: "secondchange"; when: statenum == 3 + StateChangeScript { script: { firstduration = 3000; secondduration = 1000 } } + PropertyChanges { target: movement; to: 300 } + PropertyChanges { target: recolor; to: "blue" } + PropertyChanges { target: sequentialanimationelement; running: true } + PropertyChanges { target: sequentialanimationelementtest + testtext: "The square should have moved slowly and also recolored quickly\n"+ + "Advance to restart the test" + } + } + ] +} \ No newline at end of file diff --git a/tests/testapplications/elements/content/SystemPaletteElement.qml b/tests/testapplications/elements/content/SystemPaletteElement.qml new file mode 100644 index 0000000000..8a0347e104 --- /dev/null +++ b/tests/testapplications/elements/content/SystemPaletteElement.qml @@ -0,0 +1,92 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.0 + +Item { + id: systempaletteelementtest + anchors.fill: parent + property string testtext: "" + + SystemPalette { id: syspal; colorGroup: SystemPalette.Inactive } + Rectangle { + height: parent.height *.8; width: parent.width *.8; border.width: 6; radius: 4 + anchors.centerIn: parent + color: syspal.base; border.color: syspal.window + Rectangle { + height: 20; width: parent.width; border.color: "black"; color: syspal.window; radius: 4 + Text { text: "File"; color: syspal.windowText; font.pointSize: 9 + anchors { left: parent.left; leftMargin: 5; verticalCenter: parent.verticalCenter } + } + Rectangle { + id: shadow + height: button.height; width: button.width; color: syspal.shadow; radius: 5; opacity: .5 + anchors { left: button.left; top: button.top; leftMargin: 2; topMargin: 2 } + } + Rectangle { + id: button + width: 100; height: 30; radius: 5; border.color: "black"; color: clicky.pressed ? syspal.highlight : syspal.button + Behavior on color { ColorAnimation { duration: 500 } } + anchors { left: parent.left; top: parent.top; leftMargin: 10; topMargin: 30 } + Text { anchors.centerIn: parent; text: "Button"; color: syspal.buttonText } + MouseArea { id: clicky; anchors.fill: parent + onPressed: { shadow.anchors.topMargin = 1; shadow.anchors.leftMargin = 1 } + onReleased: { shadow.anchors.topMargin = 2; shadow.anchors.leftMargin = 2 } + } + } + } + } + + SystemTestHelp { id: helpbubble; visible: statenum != 0 + anchors { bottom: parent.bottom; horizontalCenter: parent.horizontalCenter; bottomMargin: 100 } + } + BugPanel { id: bugpanel } + + states: [ + State { name: "start"; when: statenum == 1 + PropertyChanges { target: systempaletteelementtest + testtext: "This is an mock application shaded with the help of the SystemPalette element.\n"+ + "The colors of the menu bar, menu text and button should mimic that of the OS it is running on.\n"+ + "Pressing the lablelled button should shade it to the system highlight color." } + } + ] + +} \ No newline at end of file diff --git a/tests/testapplications/elements/content/SystemTestHelp.qml b/tests/testapplications/elements/content/SystemTestHelp.qml new file mode 100644 index 0000000000..7f3d8c3451 --- /dev/null +++ b/tests/testapplications/elements/content/SystemTestHelp.qml @@ -0,0 +1,74 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.0 + +Rectangle { + id: helpbubble + visible: false + property bool showtext: false + property bool showadvance: true + onShowadvanceChanged: { advancearrow.visible = showadvance; } + + width: 300; radius: 15; color: "white"; border.color: "black"; border.width: 3 + height: showadvance ? bubbletext.height + advancearrow.height + 25 : bubbletext.height + 25 + Behavior on height { + SequentialAnimation { + ScriptAction { script: { bubbletext.visible = false; advancearrow.visible = false } } + NumberAnimation { duration: 200 } + ScriptAction { script: { bubbletext.visible = true; advancearrow.visible = showadvance && true } } + } + } + Behavior on width { + SequentialAnimation { + ScriptAction { script: { bubbletext.visible = false; advancearrow.visible = false } } + NumberAnimation { duration: 200 } + ScriptAction { script: { bubbletext.visible = true; advancearrow.visible = true } } + } + } + Text { id: bubbletext; width: parent.width - 30; text: testtext; wrapMode: Text.WordWrap + anchors { top: parent.top; topMargin: 15; left: parent.left; leftMargin: 20 } + } + Image { id: advancearrow; source: "pics/arrow.png"; height: 30; width: 30; visible: showadvance + anchors { right: parent.right; bottom: parent.bottom; rightMargin: 5; bottomMargin: 5 } + MouseArea { enabled: showadvance; anchors.fill: parent; onClicked: { advance(); } } + } +} \ No newline at end of file diff --git a/tests/testapplications/elements/content/TextEditElement.qml b/tests/testapplications/elements/content/TextEditElement.qml new file mode 100644 index 0000000000..4be0188c7b --- /dev/null +++ b/tests/testapplications/elements/content/TextEditElement.qml @@ -0,0 +1,144 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of QtUiTest. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.0 + +Item { + id: texteditelementtest + anchors.fill: parent + property string testtext: "" + property string wraptext: "Set this property to wrap the text to the TextEdit item's width. The text will only wrap if an explicit width has been set." + + Rectangle { + id: texteditelementbackground + color: "green"; height: 150; width: parent.width *.8; border.color: "gray"; opacity: 0.7; radius: 5; clip: true + anchors.centerIn: parent + + TextEdit { + id: texteditelement + font.pointSize: 12; width: parent.width; text: ""; horizontalAlignment: Text.AlignLeft + anchors.centerIn: parent + Behavior on font.pointSize { NumberAnimation { duration: 1000 } } + Behavior on color { ColorAnimation { duration: 1000 } } + } + } + + Rectangle { + id: secondarybackground + color: "lightgray"; border.color: "gray"; opacity: 0.7; radius: 5; height: 150; width: parent.width *.8 + anchors { top: texteditelementbackground.bottom; topMargin: 50; horizontalCenter: parent.horizontalCenter } + + TextEdit { + id: secondary + property string ignoretext: "Nothing to see here" + font.pointSize: 12; width: parent.width; text: ""; opacity: text == ignoretext ? .3 : 1; horizontalAlignment: Text.AlignLeft + anchors.centerIn: parent + } + } + Rectangle { + id: shadowrect + color: "lightgray"; height: 50; width: parent.width *.8; border.color: "gray"; opacity: 0; radius: 5 + anchors.horizontalCenter: texteditelementbackground.horizontalCenter; + anchors.verticalCenter: texteditelementbackground.verticalCenter; + + Text { + id: shadowtext + font.pointSize: 12; width: parent.width; text: ""; horizontalAlignment: Text.AlignLeft + anchors.centerIn: parent + } + } + transitions: Transition { + AnchorAnimation { targets: shadowrect; duration: 1000 } + } + + SequentialAnimation { id: copypaste + ScriptAction { script: { secondary.text = ""; shadowtext.text = texteditelement.selectedText; texteditelement.copy(); } } + NumberAnimation { target: shadowrect; property: "opacity"; to: 0.5; duration: 100 } + PauseAnimation { duration: 1000 } + ScriptAction { script: { secondary.paste(); } } + NumberAnimation { target: shadowrect; property: "opacity"; to: 0; duration: 100 } + NumberAnimation { target: shadowrect; property: "x"; to: texteditelementbackground.x; duration: 0 } + } + + SystemTestHelp { id: helpbubble; visible: statenum != 0 + anchors { top: parent.top; horizontalCenter: parent.horizontalCenter; topMargin: 50 } + } + BugPanel { id: bugpanel } + + states: [ + State { name: "start"; when: statenum == 1 + StateChangeScript { + script: { + texteditelement.text = "Hello, my name is TextEdit" + secondary.text = "Nothing to see here"; + } + } + PropertyChanges { target: texteditelementtest + testtext: "This is a TextEdit element. At present it should be saying hello.\n"+ + "Next, the TextEdit portion of the displayed text will be selected" } + }, + State { name: "highlight"; when: statenum == 2 + StateChangeScript { script: texteditelement.select(18, 26); } + PropertyChanges { target: texteditelementtest + testtext: "TextEdit should now be highlighted.\nNext, it will be copied this to the other TextEdit." } + }, + State { name: "copypaste"; when: statenum == 3 + PropertyChanges { target: copypaste; running: true } + AnchorChanges { target: shadowrect; anchors.verticalCenter: secondarybackground.verticalCenter } + PropertyChanges { target: texteditelementtest + testtext: "The second TextEdit should now be showing the selected text of the top TextEdit.\n"+ + "Next, a larger amount of text will be entered." } + }, + State { name: "largetextnowrap"; when: statenum == 4 + PropertyChanges { target: texteditelement; text: wraptext } + PropertyChanges { target: texteditelementtest + testtext: "The TextEdit should now be showing a line of text, chopped off by the edge of the rectangle.\n"+ + "Next, the TextEdit will set wrapping to fix that." } + }, + State { name: "largetextwrap"; when: statenum == 5 + PropertyChanges { target: texteditelement; text: wraptext; wrapMode: TextEdit.WordWrap } + PropertyChanges { target: texteditelementtest + testtext: "The TextEdit should now be showing a block of text.\n"+ + "Advance to restart the test." } + } + ] + +} \ No newline at end of file diff --git a/tests/testapplications/elements/content/TextElement.qml b/tests/testapplications/elements/content/TextElement.qml new file mode 100644 index 0000000000..2af1214186 --- /dev/null +++ b/tests/testapplications/elements/content/TextElement.qml @@ -0,0 +1,101 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of QtUiTest. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.0 + +Item { + id: textelementtest + anchors.fill: parent + property string testtext: "" + + Text { + id: textelement + property int pseudopointsize: 12 + anchors.centerIn: parent + height: 200; width: parent.width *.8; wrapMode: Text.WordWrap; font.pointSize: 12 + text: "Hello, my name is Text"; horizontalAlignment: Text.AlignHCenter; textFormat: Text.PlainText + Behavior on font.pointSize { NumberAnimation { duration: 1000 } } + Behavior on color { ColorAnimation { duration: 1000 } } + } + + SystemTestHelp { id: helpbubble; visible: statenum != 0 + anchors { top: parent.top; horizontalCenter: parent.horizontalCenter; topMargin: 50 } + } + BugPanel { id: bugpanel } + + states: [ + State { name: "start"; when: statenum == 1 + PropertyChanges { target: textelementtest + testtext: "This is a Text element. At present it should be saying hello.\n"+ + "Next, it will animatedly increase the text to twice its size" } + }, + State { name: "fontlarge"; when: statenum == 2 + PropertyChanges { target: textelement; font.pointSize: 24 } + PropertyChanges { target: textelementtest + testtext: "The font should have increased in size, and wrapped once too large for the screen width.\n"+ + "Next, let's change the color to blue." } + PropertyChanges { target: bugpanel; bugnumber: "19848" } + }, + State { name: "fontlargeblue"; when: statenum == 3 + PropertyChanges { target: textelement; font.pointSize: 24; color: "blue" } + PropertyChanges { target: textelementtest + testtext: "The font should now be blue.\n"+ + "Next, let's add some formatting." } + }, + State { name: "fontlargeblueitalicsbold"; when: statenum == 4 + PropertyChanges { target: textelement; font.pointSize: 24; color: "blue"; font.bold: true; font.italic: true } + PropertyChanges { target: textelementtest + testtext: "The font should now be blue, bold and italic.\n"+ + "Next, let's use rich text." } + PropertyChanges { target: bugpanel; bugnumber: "19848" } + }, + State { name: "fontlargerichtext"; when: statenum == 5 + PropertyChanges { + target: textelement; font.pointSize: 24; color: "blue"; font.bold: true; font.italic: true + text: "I am now multicolored!"; textFormat: Text.RichText + } + PropertyChanges { target: textelementtest + testtext: "The font should now be bold and italic, and alternating in color.\n"+ + "The test will now return to the start." } + } + ] + +} \ No newline at end of file diff --git a/tests/testapplications/elements/content/TextInputElement.qml b/tests/testapplications/elements/content/TextInputElement.qml new file mode 100644 index 0000000000..14e3203238 --- /dev/null +++ b/tests/testapplications/elements/content/TextInputElement.qml @@ -0,0 +1,139 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of QtUiTest. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.0 + +Item { + id: textinputelementtest + anchors.fill: parent + property string testtext: "" + + Rectangle { + id: textinputelementbackground + color: "green"; height: 50; width: parent.width *.8; border.color: "gray"; opacity: 0.7; radius: 5 + anchors.centerIn: parent + TextInput { + id: textinputelement + font.pointSize: 12; width: parent.width; text: ""; horizontalAlignment: Text.AlignHCenter + anchors.centerIn: parent + Behavior on font.pointSize { NumberAnimation { duration: 1000 } } + Behavior on color { ColorAnimation { duration: 1000 } } + } + } + + Rectangle { + id: secondarybackground + color: "lightgray"; border.color: "gray"; opacity: 0.7; radius: 5; height: 50; width: parent.width *.8 + anchors { top: textinputelementbackground.bottom; topMargin: 100; horizontalCenter: parent.horizontalCenter } + + TextInput { + id: secondary + property string ignoretext: "Nothing to see here" + font.pointSize: 12; text: ""; opacity: text == ignoretext ? .3 : 1; horizontalAlignment: Text.AlignHCenter + anchors.centerIn: parent; width: parent.width + } + } + Rectangle { + id: shadowrect + color: "lightgray"; height: 50; width: parent.width *.8; border.color: "gray"; opacity: 0; radius: 5 + anchors.horizontalCenter: textinputelementbackground.horizontalCenter; + anchors.verticalCenter: textinputelementbackground.verticalCenter; + Text { + id: shadowtext + font.pointSize: 12; width: parent.width; text: ""; horizontalAlignment: Text.AlignHCenter + anchors.centerIn: parent + } + } + transitions: Transition { + AnchorAnimation { targets: shadowrect; duration: 1000 } + } + + SequentialAnimation { id: copypaste + ScriptAction { script: { secondary.text = ""; shadowtext.text = textinputelement.selectedText; textinputelement.copy(); } } + NumberAnimation { target: shadowrect; property: "opacity"; to: 0.5; duration: 100 } + PauseAnimation { duration: 1000 } + ScriptAction { script: { secondary.paste(); } } + NumberAnimation { target: shadowrect; property: "opacity"; to: 0; duration: 100 } + NumberAnimation { target: shadowrect; property: "x"; to: textinputelementbackground.x; duration: 0 } + } + + BugPanel { id: bugpanel } + + SystemTestHelp { id: helpbubble; visible: statenum != 0 + anchors { top: parent.top; horizontalCenter: parent.horizontalCenter; topMargin: 50 } + } + + states: [ + State { name: "start"; when: statenum == 1 + StateChangeScript { + script: { + textinputelement.text = "Hello, my name is TextInput" + secondary.text = "Nothing to see here"; + } + } + PropertyChanges { target: textinputelementtest + testtext: "This is a TextInput element. At present it should be saying hello.\n"+ + "Next, it will select the TextInput portion of the displayed text" } + }, + State { name: "highlight"; when: statenum == 2 + StateChangeScript { script: textinputelement.select(18, 27); } + PropertyChanges { target: textinputelementtest + testtext: "TextInput should now be highlighted.\nNext, copy this to the other TextInput." } + }, + State { name: "copypaste"; when: statenum == 3 + PropertyChanges { target: copypaste; running: true } + AnchorChanges { target: shadowrect; anchors.verticalCenter: secondarybackground.verticalCenter } + PropertyChanges { target: textinputelementtest + testtext: "The second TextInput should now be showing the selected text of the top TextInput.\n"+ + "Next, let's change the way the entered text is displayed." } + }, + State { name: "passwordmode"; when: statenum == 4 + StateChangeScript { script: textinputelement.deselect(); } + PropertyChanges { target: textinputelement; echoMode: TextInput.Password } + PropertyChanges { target: textinputelementtest + testtext: "The TextInput should now be showing asterisks (*) for every character in the top TextInput - all "+ + textinputelement.text.length+" of them.\n"+ + "Next, let's return to the start." } + } + ] + + +} \ No newline at end of file diff --git a/tests/testapplications/elements/content/XmlListModelElement.qml b/tests/testapplications/elements/content/XmlListModelElement.qml new file mode 100644 index 0000000000..3ea0f9cc8a --- /dev/null +++ b/tests/testapplications/elements/content/XmlListModelElement.qml @@ -0,0 +1,154 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.0 + +Item { + id: xmllistmodelelementtest + anchors.fill: parent + property string testtext: "" + property string modelxml: ""+ + ""+ + "Hot chocolate"+ + ""+ + "" + + XmlListModel { id: xmllistmodelelement + source: "cookbook.xml" + query: "/cookbook/recipe" + XmlRole { name: "title"; query: "title/string()" } + XmlRole { name: "xmlid"; query: "@id/string()" } + XmlRole { name: "method"; query: "method/string()" } + XmlRole { name: "time"; query: "time/@quantity/number()" } + } + + ListView { + id: recipeview + model: xmllistmodelelement; height: 300; width: 300; clip: true + anchors.centerIn: parent + delegate: Component { + Rectangle { id: delbox; height: 50; width: 296; color: "orange"; border.color: "black"; state: "closed"; clip: true; radius: 5 + anchors.horizontalCenter: parent.horizontalCenter + Text { + id: recipetitle + text: model.title; font.pointSize: 12; font.bold: true + anchors.horizontalCenter: parent.horizontalCenter; y: 20; + } + + Text { + id: recipetime + width: parent.width; height: 20; text: "Time: " +model.time + " minutes"; visible: opacity != 0 + anchors.horizontalCenter: parent.horizontalCenter; anchors.top: recipetitle.bottom + Behavior on opacity { NumberAnimation { duration: 250 } } + } + + // Sub XmlListModel + XmlListModel { id: subxmllistmodelelement + source: "cookbook.xml" + query: "/cookbook/recipe[@id = '"+model.xmlid+"']/ingredient" + XmlRole { name: "ingredientname"; query: "@name/string()" } + XmlRole { name: "ingredientquantity"; query: "@quantity/string()" } + XmlRole { name: "ingredientunit"; query: "@unit/string()" } + } + + ListView { + id: ingredientlist + model: subxmllistmodelelement + height: 20 * count; width: parent.width + visible: opacity != 0 + Behavior on opacity { NumberAnimation { duration: 250 } } + anchors.horizontalCenter: parent.horizontalCenter; anchors.top: recipetime.bottom; anchors.topMargin: 10 + header: Text { text: "Ingredients:" } + delegate: Text { + text: ingredientquantity + " " + ingredientunit + " of " + ingredientname; height: 20; + } + } + + Text { + id: recipemethod + property string methodtext: "" + width: parent.width; wrapMode: Text.WordWrap; visible: opacity != 0; text: methodtext + anchors.horizontalCenter: parent.horizontalCenter; anchors.top: ingredientlist.bottom + Behavior on opacity { NumberAnimation { duration: 250 } } + Component.onCompleted: { console.log(model.method); methodtext = model.method; console.log(recipemethod.textFormat); } + } + MouseArea { anchors.fill: parent; onClicked: delbox.state = delbox.state == "open" ? "closed" : "open" } + Behavior on height { NumberAnimation { duration: 250 } } + states: [ + State { name: "closed" + PropertyChanges { target: delbox; height: 50 } + PropertyChanges { target: recipemethod; opacity: 0 } + PropertyChanges { target: recipetime; opacity: 0 } + PropertyChanges { target: ingredientlist; opacity: 0 } + }, + State { name: "open" + PropertyChanges { target: delbox; height: recipemethod.height+recipetime.height+ingredientlist.height+50 } + PropertyChanges { target: recipemethod; opacity: 1 } + StateChangeScript { script: { recipeview.positionViewAtIndex(model.index, ListView.Beginning); } } + } + ] + } + } + } + + SystemTestHelp { id: helpbubble; visible: statenum != 0 + anchors { top: parent.top; horizontalCenter: parent.horizontalCenter; topMargin: 50 } + } + BugPanel { id: bugpanel } + + states: [ + State { name: "start"; when: statenum == 1 + PropertyChanges { target: xmllistmodelelementtest + testtext: "This is a ListView populated by an XmlListModel. Clicking on an item will show the recipe details.\n"+ + "Next we will change to source of the model data to a local string" } + }, + State { name: "xmlstring"; when: statenum == 2 + PropertyChanges { target: xmllistmodelelement; source: "" } + PropertyChanges { target: xmllistmodelelement; xml: modelxml } + PropertyChanges { target: xmllistmodelelementtest + testtext: "The list should now only contain a Hot chocolate recipe.\n"+ + "Advance to restart the test." } + } + ] + +} \ No newline at end of file diff --git a/tests/testapplications/elements/content/cookbook.xml b/tests/testapplications/elements/content/cookbook.xml new file mode 100644 index 0000000000..33dd91a5de --- /dev/null +++ b/tests/testapplications/elements/content/cookbook.xml @@ -0,0 +1,62 @@ + + + + Quick and Easy Mushroom Soup + + + + + + + + + + + + Cheese on Toast + + + + diff --git a/tests/testapplications/elements/content/elements.js b/tests/testapplications/elements/content/elements.js new file mode 100644 index 0000000000..fb8cfdec45 --- /dev/null +++ b/tests/testapplications/elements/content/elements.js @@ -0,0 +1,56 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +var newcomponent = Qt.createComponent("AppContainer.qml"); +var appfile; +var demoapp; + + +function setapp(appname,par) { + appfile = appname; + demoapp = newcomponent.createObject(par); + demoapp.qmlfile = appfile; +} + + +function removeApp() { + demoapp.destroy(); +} diff --git a/tests/testapplications/elements/content/font/Vera.ttf b/tests/testapplications/elements/content/font/Vera.ttf new file mode 100644 index 0000000000..58cd6b5e61 Binary files /dev/null and b/tests/testapplications/elements/content/font/Vera.ttf differ diff --git a/tests/testapplications/elements/content/pics/animatednokialogo.gif b/tests/testapplications/elements/content/pics/animatednokialogo.gif new file mode 100644 index 0000000000..7d5df1f3e8 Binary files /dev/null and b/tests/testapplications/elements/content/pics/animatednokialogo.gif differ diff --git a/tests/testapplications/elements/content/pics/arrow.png b/tests/testapplications/elements/content/pics/arrow.png new file mode 100644 index 0000000000..70faf7f9ce Binary files /dev/null and b/tests/testapplications/elements/content/pics/arrow.png differ diff --git a/tests/testapplications/elements/content/pics/cat.gif b/tests/testapplications/elements/content/pics/cat.gif new file mode 100644 index 0000000000..ea9987d0f3 Binary files /dev/null and b/tests/testapplications/elements/content/pics/cat.gif differ diff --git a/tests/testapplications/elements/content/pics/logo.png b/tests/testapplications/elements/content/pics/logo.png new file mode 100644 index 0000000000..d75936b007 Binary files /dev/null and b/tests/testapplications/elements/content/pics/logo.png differ diff --git a/tests/testapplications/elements/content/pics/nokialogo.gif b/tests/testapplications/elements/content/pics/nokialogo.gif new file mode 100644 index 0000000000..7a30f6916b Binary files /dev/null and b/tests/testapplications/elements/content/pics/nokialogo.gif differ diff --git a/tests/testapplications/elements/content/pics/qml-borderimage.png b/tests/testapplications/elements/content/pics/qml-borderimage.png new file mode 100644 index 0000000000..8035c79f37 Binary files /dev/null and b/tests/testapplications/elements/content/pics/qml-borderimage.png differ diff --git a/tests/testapplications/elements/content/pics/speech-bubble.png b/tests/testapplications/elements/content/pics/speech-bubble.png new file mode 100644 index 0000000000..e6811ca899 Binary files /dev/null and b/tests/testapplications/elements/content/pics/speech-bubble.png differ diff --git a/tests/testapplications/elements/elements.qml b/tests/testapplications/elements/elements.qml new file mode 100644 index 0000000000..414d5aaacb --- /dev/null +++ b/tests/testapplications/elements/elements.qml @@ -0,0 +1,72 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of QtUiTest. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.0 +import "content/elements.js" as Elements +import "content" + +Item { + id: elementsapp; height: 640; width: 360 + + property string qmlfiletoload: "" + property string helptext: "" + + GradientElement { anchors.fill: parent } + + GridViewElement { height: parent.height * .95; width: parent.width * .95; anchors.centerIn: parent; } + + HelpDesk { width: parent.width; height: 200; anchors { bottom: parent.bottom; right: parent.right; bottomMargin: 3; rightMargin: 3 } } + + // Start or remove an .qml when the qmlfiletoload property changes + onQmlfiletoloadChanged: { + if (qmlfiletoload == "") { + Elements.removeApp(); + } else { + Elements.setapp(qmlfiletoload,elementsapp); + } + } + + // Set the qmlfiletoload property with a script function + function runapp(qmlfile) { + console.log("Starting ",qmlfile); + qmlfiletoload = qmlfile; + } +} \ No newline at end of file diff --git a/tests/systemtests/declarative/qsgimage/ImageNG.qml b/tests/testapplications/qsgimage/ImageNG.qml similarity index 100% rename from tests/systemtests/declarative/qsgimage/ImageNG.qml rename to tests/testapplications/qsgimage/ImageNG.qml diff --git a/tests/systemtests/declarative/qsgimage/img-align.qml b/tests/testapplications/qsgimage/img-align.qml similarity index 100% rename from tests/systemtests/declarative/qsgimage/img-align.qml rename to tests/testapplications/qsgimage/img-align.qml diff --git a/tests/systemtests/declarative/qsgimage/qt-logo.png b/tests/testapplications/qsgimage/qt-logo.png similarity index 100% rename from tests/systemtests/declarative/qsgimage/qt-logo.png rename to tests/testapplications/qsgimage/qt-logo.png