diff options
author | Damian Jansen <damian.jansen@nokia.com> | 2011-05-09 14:09:16 +1000 |
---|---|---|
committer | Damian Jansen <damian.jansen@nokia.com> | 2011-05-09 14:09:16 +1000 |
commit | 15579ec2cc81ec7cff3f6b1fd17434b0c4554f20 (patch) | |
tree | 2a00f1addf79c42527d713169322158a35c8a1d9 | |
parent | bc6972573124585b4ac43dad2a5c51e898621a88 (diff) |
New test for textedit selection, improvements to various tests
-rw-r--r-- | Qt/examples/declarative/rtl/rtltext.qml | 5 | ||||
-rw-r--r-- | Qt/examples/declarative/rtl/rtltexteditselection.qml | 134 | ||||
-rw-r--r-- | Qt/examples/declarative/rtl/sys_rtl/sys_rtl.qtt | 30 | ||||
-rw-r--r-- | Qt/examples/declarative/textedit/sys_textedit/sys_textedit.qtt | 7 |
4 files changed, 160 insertions, 16 deletions
diff --git a/Qt/examples/declarative/rtl/rtltext.qml b/Qt/examples/declarative/rtl/rtltext.qml index c517671..e573b66 100644 --- a/Qt/examples/declarative/rtl/rtltext.qml +++ b/Qt/examples/declarative/rtl/rtltext.qml @@ -89,6 +89,7 @@ Flickable { } } } + Text { text: "Default application\ndirection is " + (Qt.application.layoutDirection == Qt.RightToLeft ? "Right-to-left" : "Left-to-right") horizontalAlignment: Text.AlignHCenter @@ -102,7 +103,7 @@ Flickable { Text { text: { if (root.horizontalAlignment == undefined) - return "Implict alignment"; + return "Implicit alignment"; switch (root.horizontalAlignment) { case Text.AlignLeft: return "Left alignment"; @@ -229,6 +230,8 @@ Flickable { anchors.fill: parent color: Qt.rgba(0.5, 0.5, 0.2, 0.3) } + onSelectedTextChanged: { copy(); } + selectByMouse: true Text { text: root.description[index] color: Qt.rgba(1,1,1,1.0) diff --git a/Qt/examples/declarative/rtl/rtltexteditselection.qml b/Qt/examples/declarative/rtl/rtltexteditselection.qml new file mode 100644 index 0000000..d1d4945 --- /dev/null +++ b/Qt/examples/declarative/rtl/rtltexteditselection.qml @@ -0,0 +1,134 @@ +/**************************************************************************** +** +** 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 + +Flickable { + height: 640; width: 360; contentHeight: root.height; contentWidth: 360; boundsBehavior: Flickable.StopAtBounds + Rectangle { + id: root + width: 300; height: 600; anchors.centerIn: parent + color: "white" + property string text: "مرحبا العالم" + property string pastetext + property variant horizontalAlignment: undefined + Column { + id: containerColumn + spacing: 10 + width: parent.width + anchors.top: parent.top + anchors.topMargin: 5 + TextEdit { + id: tedit + wrapMode: TextEdit.Wrap + width: parent.width + height: 250 + text: root.text + font.pixelSize: 30 + horizontalAlignment: root.horizontalAlignment + selectByMouse: true + Rectangle { + z: -1 + anchors.fill: parent + color: Qt.rgba(0.5, 0.5, 0.2, 0.3) + } + onSelectedTextChanged: { if(selectedText != ""){ copy(); root.pastetext = selectedText; } } + Text { + color: "white" + text: { + if (tedit.horizontalAlignment == undefined) + return "I"; + switch (tedit.horizontalAlignment) { + case Text.AlignLeft: + return "L"; + case Text.AlignRight: + return "R"; + case Text.AlignHCenter: + return "C"; + case Text.AlignJustify: + return "J"; + } + } + anchors{ top: parent.top; right: parent.right; margins: 2 } + } + } + Rectangle { + height: 50; width: parent.width; color: Qt.rgba(0.5, 0.5, 0.2, 0.3); radius: 10; border.color: "gray" + MouseArea { anchors.fill: parent; onClicked: { tedit.paste(); } } + Text { + height: 25; width: parent.width - 10; anchors.centerIn: parent; font.pixelSize: 20 + text: "Paste: " + root.pastetext + } + } + Rectangle { + height: 50; width: parent.width; color: Qt.rgba(0.5, 0.5, 0.2, 0.3); radius: 10; border.color: "gray" + MouseArea { anchors.fill: parent + property int index: 0 + onClicked: { + if (index < 0) { + root.horizontalAlignment = undefined; + } else { + root.horizontalAlignment = Math.pow(2, index); + } + index = (index + 2) % 5 - 1; + } + } + Text { + height: 25; width: parent.width - 10; anchors.centerIn: parent; font.pixelSize: 20 + text: { + if (root.horizontalAlignment == undefined) + return "Implicit alignment"; + switch (tedit.horizontalAlignment) { + case Text.AlignLeft: + return "Left alignment"; + case Text.AlignRight: + return "Right alignment"; + case Text.AlignHCenter: + return "Center alignment"; + case Text.AlignJustify: + return "Justify alignment"; + } + } + } + } + } + } +}
\ No newline at end of file diff --git a/Qt/examples/declarative/rtl/sys_rtl/sys_rtl.qtt b/Qt/examples/declarative/rtl/sys_rtl/sys_rtl.qtt index e0b8377..43bb38f 100644 --- a/Qt/examples/declarative/rtl/sys_rtl/sys_rtl.qtt +++ b/Qt/examples/declarative/rtl/sys_rtl/sys_rtl.qtt @@ -49,10 +49,6 @@ Note: Empty/whitepace text has no direction, thus TextEdits will still show the | *Step* | *Verification* | | Execute systemtests/Qt/examples/declarative/rtl/rtltext.qml | Verify that the indicator at the bottom shows Implicit alignment | | Observe the three different element types - Text, TextInput, TextEdit | Verify that for each case where the text box shows right-to-left text, the text is aligned to the right | -| (Skip this on devices with no Home/End key) In the right-to-left TextInput, press Home, then End | Verify the cursor moves fully to the right, and fully to the left respectively | -| In the TextEdit field, copy some of the Arabic text | | -| At the leftmost position of the text, press Enter | | -| Paste the copied text | The text is pasted into the box, also right aligned |')); }, left_center_and_right_text_alignment_data: @@ -70,10 +66,6 @@ Note: Empty/whitepace text has no direction, thus TextEdits will still show the | Execute systemtests/Qt/examples/declarative/rtl/rtltext.qml | Verify that the indicator at the bottom shows Implicit alignment | | Press the indicator until '+name+' alignment shows | Verify that the indicator at the bottom shows '+name+' alignment | | Observe the three different element types - Text, TextInput, TextEdit | Verify that for each case where the text box shows right-to-left text, the text is aligned to the '+alignment+' | -| (Skip this on devices with no Home/End key) In the right-to-left TextInput, press Home, then End | Verify the cursor moves fully to the right of the text only, and then fully to the left side respectively | -| In the TextEdit field, copy some of the Arabic text | | -| At the leftmost position of the text, press Enter | | -| Paste the copied text | The text is pasted into the box, also '+alignment+' aligned |')); }, justified_text_alignment: function() @@ -85,10 +77,24 @@ Note: Empty/whitepace text has no direction, thus TextEdits will still show the | Execute systemtests/Qt/examples/declarative/rtl/rtltext.qml | Verify that the indicator at the bottom shows Implicit alignment | | Press the indicator until Justify alignment shows | Verify that the indicator at the bottom shows Justify alignment | | Observe two of the three different element types - Text, TextEdit | Verify that for each case where the text box shows right-to-left text, the text is aligned to the right | -| (Skip this on devices with no Home/End key) In the right-to-left TextInput, press Home, then End | Verify the cursor moves fully to the right, and fully to the left respectively | -| In the TextEdit field, copy some of the Arabic text | | -| At the leftmost position of the text, press Enter | | -| Paste the copied text | The text is pasted into the box, also right aligned |')); + }, + + left_center_and_right_text_alignment_data: + { + left: ["Left", "left"], + center: ["Center", "center"], + right: ["Right", "right"] + }, + + select_copy_paste: function(name,alignment) + { +| *Step* | *Verification* | +| Execute systemtests/Qt/examples/declarative/rtl/rtltexteditselection.qml | Verify that the indicator at the bottom button shows Implicit alignment | +| (Skip this on devices with no Home/End key) In the right-to-left TextInput, press Home, then End | Verify the cursor moves fully to the right of the text only, and then fully to the left side respectively | +| Press the lower button until it shows '+name+' Alignment | | +| In the TextEdit field, select some of the text some of the Arabic text | The selected text is shown in the Paste: <text> button - it is now copied | +| At the leftmost position of the text, press Enter on the keypad or soft keyboard | A new line is created below the existing text | +| Press the Paste: <text> button | The text is pasted into the box, also '+alignment+' aligned |')); } } diff --git a/Qt/examples/declarative/textedit/sys_textedit/sys_textedit.qtt b/Qt/examples/declarative/textedit/sys_textedit/sys_textedit.qtt index 65e61b2..4ca41fe 100644 --- a/Qt/examples/declarative/textedit/sys_textedit/sys_textedit.qtt +++ b/Qt/examples/declarative/textedit/sys_textedit/sys_textedit.qtt @@ -49,13 +49,14 @@ testcase = { | *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 Word button, ensuring the previously entered text in no longer in pre-commit mode | 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 turns green and indicates Mouse On | -| Click and drag over some text | Only that text is selected. On sans-keyboard Symbian, the soft keyboard will show with selected text highlighted | +| Click and drag over some text | Only that text is selected. On sans-keyboard Symbian, the soft keyboard may show with selected text highlighted | +| If the soft keyboard is shown, close it | | | Press the Mouse Select button | The button turns gray and indicates Mouse Off | -| Click and drag over some text | No text is selected. On sans-keyboard Symbian, the soft keyboard will show | +| Click and drag over some text | No text is selected. On sans-keyboard Symbian, the soft keyboard may show | ')); }, |