summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDamian Jansen <damian.jansen@nokia.com>2011-03-01 15:10:55 +1000
committerDamian Jansen <damian.jansen@nokia.com>2011-03-01 15:10:55 +1000
commit0c2187c836ba31c083ff33091d3786e4e550c0d8 (patch)
tree08b88a76c15accfeff31c84cce8dfb9ab4e286d2
parent73c02fc3cae192e4a5109987e4d37c6cf78e19c5 (diff)
Textedit tests. Essentially the same as textinput, but with subtle differences in text/cursor behavior.
-rw-r--r--Qt/examples/declarative/textedit/ToggleButton.qml59
-rw-r--r--Qt/examples/declarative/textedit/sys_textedit/sys_textedit.pro2
-rw-r--r--Qt/examples/declarative/textedit/sys_textedit/sys_textedit.qtt115
-rw-r--r--Qt/examples/declarative/textedit/textedit.pro2
-rw-r--r--Qt/examples/declarative/textedit/textedit.qml232
5 files changed, 410 insertions, 0 deletions
diff --git a/Qt/examples/declarative/textedit/ToggleButton.qml b/Qt/examples/declarative/textedit/ToggleButton.qml
new file mode 100644
index 0000000..a771b57
--- /dev/null
+++ b/Qt/examples/declarative/textedit/ToggleButton.qml
@@ -0,0 +1,59 @@
+/****************************************************************************
+**
+** 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$
+** 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 1.1
+
+Rectangle {
+ property bool active: false
+ property string effectname: ""
+ height: 30; width: 100; color: "gray"; radius: 5; border.color: "black"
+ Rectangle {
+ id: status
+ height: 10; width: 10; anchors.top: parent.top; anchors.left: parent.left; anchors.topMargin: 10; anchors.leftMargin: 10
+ color: active ? "green" : "red"
+ }
+ Text {
+ anchors.verticalCenter: parent.verticalCenter; anchors.left: status.right; anchors.leftMargin: 5; text: effectname
+ }
+ MouseArea {
+ anchors.fill: parent; onClicked: { active = !active }
+ }
+} \ No newline at end of file
diff --git a/Qt/examples/declarative/textedit/sys_textedit/sys_textedit.pro b/Qt/examples/declarative/textedit/sys_textedit/sys_textedit.pro
new file mode 100644
index 0000000..30d6d5b
--- /dev/null
+++ b/Qt/examples/declarative/textedit/sys_textedit/sys_textedit.pro
@@ -0,0 +1,2 @@
+CONFIG+=systemtest
+SOURCES=sys_textedit.qtt
diff --git a/Qt/examples/declarative/textedit/sys_textedit/sys_textedit.qtt b/Qt/examples/declarative/textedit/sys_textedit/sys_textedit.qtt
new file mode 100644
index 0000000..e30ba5e
--- /dev/null
+++ b/Qt/examples/declarative/textedit/sys_textedit/sys_textedit.qtt
@@ -0,0 +1,115 @@
+/****************************************************************************
+**
+** 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$
+** 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$
+**
+****************************************************************************/
+
+
+testcase = {
+
+ select_text: function()
+ {
+ prompt(twiki('---++ Text Selection
+
+| *Step* | *Verification* |
+| Execute systemtests/Qt/examples/declarative/textedit/textedit.qml | |
+| Enter Hello World into the green textedit field | Hello World is shown |
+| Press the Select Word button | World is selected |
+| Press the Select All button | Hello World is selected |
+| Press the Select None button | No text is selected |
+| Press the Mouse Select button | The button is highlighted to represent selectByMouse = true |
+| Click and drag over some text | Only that text is selected. On sans-keyboard Symbian, the soft keyboard will show with selected text highlighted |
+| Press the Mouse Select button | The button is un-highlighted to represent selectByMouse = false |
+| Click and drag over some text | No text is selected. On sans-keyboard Symbian, the soft keyboard will show |
+'));
+ },
+
+ cut_copy_and_paste: function()
+ {
+ prompt(twiki('---++ Cut, copy and paste
+
+| *Step* | *Verification* |
+| Execute systemtests/Qt/examples/declarative/textedit/textedit.qml | |
+| Enter Hello World into the green textedit field | Hello World is shown |
+| Press the Select All button | Hello World is selected |
+| Press the Copy Button | |
+| Press the Paste Button | Hello World is copied to the light-blue textedit |
+| Press the Select Word button | World is highlighted |
+| Press the Cut button | World is removed from the green textedit |
+| Press the Paste button | World is added to the light-blue textedit |
+'));
+ },
+
+ styling: function()
+ {
+ prompt(twiki('---++ Text Styling
+
+| *Step* | *Verification* |
+| Execute systemtests/Qt/examples/declarative/textedit/textedit.qml | |
+| Enter Hello World into the green textedit field | Hello World is shown |
+| Press the Bold button | Hello World is now in bold |
+| Press the Italics button | Hello World is now in italics |
+| Press the Strikeout button | Hello World now has a line passing through it |
+| Press the Underline button | Hello World is now underlined | '));
+ },
+
+ cursor_behavior: function()
+ {
+ prompt(twiki('---++ Cursor Behavior
+
+| *Step* | *Verification* |
+| Execute systemtests/Qt/examples/declarative/textedit/textedit.qml | The Cursor button shows enabled (green) |
+| Enter enough text into the field such that it passes beyond the far right | The text wraps to line 2 |
+| Press the Cursor button as to disable it | The cursor disappears |
+| Press the Cursor button as to enable it | The cursor appears | '));
+ },
+
+ capitalization: function()
+ {
+ prompt(twiki('---++ Capitalization
+
+| *Step* | *Verification* |
+| Execute systemtests/Qt/examples/declarative/textedit/textedit.qml | |
+| Enter Hello to this World into the green textedit field | Hello to this World is shown |
+| Press the All Upper button | The text is converted to all upper case |
+| Press the All Lower button | The text is converted to all lower case |
+| Press the Small Caps button | The text is converted to all small sized upper case characters |
+| Press the Capitalize button | The text is shown with each first character of every word capitalized | '));
+ }
+
+}
diff --git a/Qt/examples/declarative/textedit/textedit.pro b/Qt/examples/declarative/textedit/textedit.pro
new file mode 100644
index 0000000..98de15e
--- /dev/null
+++ b/Qt/examples/declarative/textedit/textedit.pro
@@ -0,0 +1,2 @@
+TEMPLATE=subdirs
+SUBDIRS+=sys_textedit
diff --git a/Qt/examples/declarative/textedit/textedit.qml b/Qt/examples/declarative/textedit/textedit.qml
new file mode 100644
index 0000000..771250d
--- /dev/null
+++ b/Qt/examples/declarative/textedit/textedit.qml
@@ -0,0 +1,232 @@
+/****************************************************************************
+**
+** 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$
+** 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 1.1
+
+Rectangle {
+ height: 360; width: 640; color: "gray"
+
+ Rectangle { id: textedit1box; width: 200; height: 30; color: "green"
+ anchors.left: parent.left; anchors.leftMargin: 20; anchors.top: parent.top; anchors.topMargin: 10 }
+
+ Rectangle {
+ id: textedit2box; width: 200; height: 30; color: "lightblue"; clip: true
+ anchors.left: parent.left; anchors.leftMargin: 20; anchors.top: textedit1.bottom; anchors.topMargin: 10 }
+
+ TextEdit {
+ id: textedit1
+ anchors.fill: textedit1box
+ font.bold: bolded.active
+ font.italic: italics.active
+ font.strikeout : strikeouton.active
+ font.underline : underlineon.active
+ smooth: smoothon.active
+ cursorVisible: cursoron.active
+ wrapMode: TextEdit.Wrap
+ onFocusChanged: { if(focus){ cursoron.active = true; } }
+ }
+
+ Column {
+ anchors.left: textedit1.right; anchors.leftMargin: 5; spacing: 2
+ Text {
+ id: texteditinfo
+ text: "Pos: "+ textedit1.cursorPosition +" Sel: "+ textedit1.selectionStart +"-"+ textedit1.selectionEnd +" Lines: "+ textedit1.lineCount
+ }
+
+ Row {
+ id: textcolor
+ Text { text: "Text Color: " }
+ Rectangle { color: "black"; height: 20; width: 20; MouseArea { anchors.fill: parent; onClicked: { textedit1.color = "black" } } }
+ Rectangle { color: "red"; height: 20; width: 20; MouseArea { anchors.fill: parent; onClicked: { textedit1.color = "red" } } }
+ Rectangle { color: "brown"; height: 20; width: 20; MouseArea { anchors.fill: parent; onClicked: { textedit1.color = "brown" } } }
+ }
+ Row {
+ id: selectedcolor
+ Text { text: "Selected Text Color: " }
+ Rectangle { color: "black"; height: 20; width: 20; MouseArea { anchors.fill: parent; onClicked: { textedit1.selectedTextColor = "black" } } }
+ Rectangle { color: "red"; height: 20; width: 20; MouseArea { anchors.fill: parent; onClicked: { textedit1.selectedTextColor = "red" } } }
+ Rectangle { color: "brown"; height: 20; width: 20; MouseArea { anchors.fill: parent; onClicked: { textedit1.selectedTextColor = "brown" } } }
+ }
+ Row {
+ id: selectioncolor
+ Text { text: "Selection Color: " }
+ Rectangle { color: "black"; height: 20; width: 20; MouseArea { anchors.fill: parent; onClicked: { textedit1.selectionColor = "black" } } }
+ Rectangle { color: "red"; height: 20; width: 20; MouseArea { anchors.fill: parent; onClicked: { textedit1.selectionColor = "red" } } }
+ Rectangle { color: "brown"; height: 20; width: 20; MouseArea { anchors.fill: parent; onClicked: { textedit1.selectionColor = "brown" } } }
+ }
+ }
+
+ TextEdit {
+ id: textedit2
+ anchors.fill: textedit2box
+ wrapMode: TextEdit.Wrap
+ }
+
+ Rectangle { anchors.fill: controlsview; color: "transparent"; border.color: "black" }
+ ListView {
+ id: controlsview
+ model: controls
+ height: parent.height - 90; width: parent.width - 10; orientation: ListView.Horizontal
+ anchors.horizontalCenter: parent.horizontalCenter; anchors.bottom: parent.bottom; anchors.bottomMargin: 5
+ }
+
+ VisualItemModel {
+ id: controls
+ // Cut, copy and paste
+ Item {
+ id: cutcopypaste
+ height: controlsview.height; width: 100
+ Column {
+ width: parent.width - 4; height: parent.height - 4; anchors.centerIn: parent
+ Rectangle {
+ id: copybutton
+ height: parent.height/3; width: parent.width; color: "gray"; border.color: "black"; radius: 5
+ Text { anchors.centerIn: parent; text: "Copy" }
+ MouseArea { anchors.fill: parent; onClicked: { textedit1.copy(); } }
+ }
+ Rectangle {
+ id: cutbutton
+ height: parent.height/3; width: parent.width; color: "gray"; border.color: "black"; radius: 5
+ Text { anchors.centerIn: parent; text: "Cut" }
+ MouseArea { anchors.fill: parent; onClicked: { textedit1.cut(); } }
+ }
+ Rectangle {
+ id: pastebutton
+ height: parent.height/3; width: parent.width; color: "gray"; border.color: "black"; radius: 5
+ Text { anchors.centerIn: parent; text: "Paste" }
+ MouseArea { anchors.fill: parent; onClicked: { textedit2.paste(); } }
+ }
+ }
+ }
+
+ // Text selection
+ Item {
+ id: selection
+ height: controlsview.height; width: 100
+ Column {
+ width: parent.width - 4; height: parent.height - 4; anchors.centerIn: parent
+ Rectangle {
+ id: selectallbutton
+ height: parent.height/4; width: parent.width; color: "gray"; border.color: "black"; radius: 5
+ Text { anchors.centerIn: parent; text: "Select All" }
+ MouseArea { anchors.fill: parent; onClicked: { textedit1.selectAll(); } }
+ }
+ Rectangle {
+ id: selectwordbutton
+ height: parent.height/4; width: parent.width; color: "gray"; border.color: "black"; radius: 5
+ Text { anchors.centerIn: parent; text: "Select Word" }
+ MouseArea { anchors.fill: parent; onClicked: { textedit1.selectWord(); } }
+ }
+ Rectangle {
+ id: selectnonebutton
+ height: parent.height/4; width: parent.width; color: "gray"; border.color: "black"; radius: 5
+ Text { anchors.centerIn: parent; text: "Select None" }
+ MouseArea { anchors.fill: parent; onClicked: { textedit1.deselect(); } }
+ }
+ Rectangle {
+ id: mouseselecttoggle
+ height: parent.height/4; width: parent.width; color: textedit1.selectByMouse ? "green" : "gray"; border.color: "black"; radius: 5
+ Text { anchors.centerIn: parent; text: textedit1.selectByMouse ? "Mouse On" : "Mouse Off" }
+ MouseArea { anchors.fill: parent; onClicked: { textedit1.selectByMouse = !textedit1.selectByMouse; } }
+ }
+ }
+ }
+
+ // Text Styling
+ Item {
+ id: styling
+ height: controlsview.height; width: 100
+ Column {
+ id: buttonlist
+ ToggleButton { id: bolded; effectname: "Bold" }
+ ToggleButton { id: italics; effectname: "Italics" }
+ ToggleButton { id: strikeouton; effectname: "Strikeout" }
+ ToggleButton { id: underlineon; effectname: "Underline" }
+ ToggleButton { id: smoothon; effectname: "Smooth" }
+ ToggleButton { id: cursoron; effectname: "Cursor"; active: true }
+ }
+ }
+
+ // Capitalization - MixedCase, AllUppercase, AllLowercase, SmallCaps, Capitalize
+ Item {
+ id: capitals
+ height: controlsview.height; width: 100
+ Column {
+ width: parent.width - 4; height: parent.height - 4; anchors.centerIn: parent
+ Rectangle {
+ id: capsmixedbutton
+ height: parent.height/5; width: parent.width; border.color: "black"; radius: 5
+ color: textedit1.font.capitalization == Font.MixedCase ? "green" : "gray";
+ Text { anchors.centerIn: parent; text: "Mixed" }
+ MouseArea { anchors.fill: parent; onClicked: { textedit1.font.capitalization = Font.MixedCase; } }
+ }
+ Rectangle {
+ id: capsallupperbutton
+ height: parent.height/5; width: parent.width; border.color: "black"; radius: 5
+ color: textedit1.font.capitalization == Font.AllUppercase ? "green" : "gray"
+ Text { anchors.centerIn: parent; text: "All Upper" }
+ MouseArea { anchors.fill: parent; onClicked: { textedit1.font.capitalization = Font.AllUppercase; } }
+ }
+ Rectangle {
+ id: capsalllowerbutton
+ height: parent.height/5; width: parent.width; border.color: "black"; radius: 5
+ color: textedit1.font.capitalization == Font.AllLowercase ? "green" : "gray"
+ Text { anchors.centerIn: parent; text: "All lower" }
+ MouseArea { anchors.fill: parent; onClicked: { textedit1.font.capitalization = Font.AllLowercase; } }
+ }
+ Rectangle {
+ id: capsmallbutton
+ height: parent.height/5; width: parent.width; border.color: "black"; radius: 5
+ color: textedit1.font.capitalization == Font.SmallCaps ? "green" : "gray"
+ Text { anchors.centerIn: parent; text: "Small caps" }
+ MouseArea { anchors.fill: parent; onClicked: { textedit1.font.capitalization = Font.SmallCaps; } }
+ }
+ Rectangle {
+ id: capcapitilizebutton
+ height: parent.height/5; width: parent.width; border.color: "black"; radius: 5
+ color: textedit1.font.capitalization == Font.Capitalize ? "green" : "gray"
+ Text { anchors.centerIn: parent; text: "Capitalize" }
+ MouseArea { anchors.fill: parent; onClicked: { textedit1.font.capitalization = Font.Capitalize; } }
+ }
+ }
+ }
+ }
+} \ No newline at end of file