1d6d5eaea969a88f5258bf83a75c4c6e12353abb
[profile/ivi/qtdeclarative.git] / tests / system / sys_textedit.qtt
1 /****************************************************************************
2 **
3 ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
4 ** All rights reserved.
5 ** Contact: http://www.qt-project.org/
6 **
7 ** This file is part of the test suite of the Qt Toolkit.
8 **
9 ** $QT_BEGIN_LICENSE:LGPL$
10 ** GNU Lesser General Public License Usage
11 ** This file may be used under the terms of the GNU Lesser General Public
12 ** License version 2.1 as published by the Free Software Foundation and
13 ** appearing in the file LICENSE.LGPL included in the packaging of this
14 ** file. Please review the following information to ensure the GNU Lesser
15 ** General Public License version 2.1 requirements will be met:
16 ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
17 **
18 ** In addition, as a special exception, Nokia gives you certain additional
19 ** rights. These rights are described in the Nokia Qt LGPL Exception
20 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
21 **
22 ** GNU General Public License Usage
23 ** Alternatively, this file may be used under the terms of the GNU General
24 ** Public License version 3.0 as published by the Free Software Foundation
25 ** and appearing in the file LICENSE.GPL included in the packaging of this
26 ** file. Please review the following information to ensure the GNU General
27 ** Public License version 3.0 requirements will be met:
28 ** http://www.gnu.org/copyleft/gpl.html.
29 **
30 ** Other Usage
31 ** Alternatively, this file may be used in accordance with the terms and
32 ** conditions contained in a signed written agreement between you and Nokia.
33 **
34 **
35 **
36 **
37 **
38 ** $QT_END_LICENSE$
39 **
40 ****************************************************************************/
41
42 //TESTED_COMPONENT=qtdeclarative
43
44 testcase = {
45
46     text_formatting_data: {
47         // Text type, autotext, plain text, rich text, styled text
48         BasicText: ["Basic","plain, unformatted red text","plain, unformatted red text","plain, unformatted red text","plain, unformatted red text"],
49         Rich: ["Rich","bold style","surrounding b,/b tags and no formatting","bold style","bold style"]
50     },
51
52     text_formatting: function(texttype,autoformat,plainformat,richformat,styledformat) {
53         // Test Meta-data
54         testTitle = "Text Formats";
55         testBinary = "qmlscene tests/testapplications/text/textedit.qml";
56         testGoal = "Verify that text shows correctly when displayed in different formats";
57         testPreconditions = "None";
58         testGroups = "BAT";
59
60         // Test Steps
61         prompt(twiki('---+++ ' + testTitle + '<br><br>
62         *Goal:* ' + testGoal + '<br>
63         *Pre-Requisites:* ' + testPreconditions + '<br>
64         *Tested Binary:* ' + testBinary + '<br>
65     | *Step* | *Verification* |
66     | Run ' + testBinary + ' | Verify that the Text application is displayed |
67     | Select Text: '+texttype+', Format: AutoText controls | A single line of text is shown |
68     | | Qt Quick should be rendered with '+autoformat+' |
69     | Select the Wrap: Word option | A block of text is shown |
70     | Select the Format: PlainText option | Qt Quick should be shown with '+plainformat+' |
71     | Select the Format: RichText option | Qt Quick should be shown with '+richformat+' |
72     | Select the Format: StyledText option | Qt Quick should be shown with '+styledformat+' |'));
73     },
74
75     text_wrapping_data: {
76         // Text type, No wrap, word wrap, wrap anywhere, auto wrap
77         Basic: ["Basic",
78             "two lines, wrapped at the newline (Qt Quick consists...)",
79             "many lines, with no broken words",
80             "many lines, words broken at the text boundary",
81             "many lines, with no broken words"],
82         Long: ["Long",
83             "one lone line",
84             "two lines, wrapped at the - (topboxesand...),",
85             "many lines, wrapped at the boundary",
86             "many lines, wrapped at the boundary, and specifically the - in set-top"],
87         Rich: ["Rich",
88             "two lines, wrapped at the break (Qt Quick consists...)",
89             "many lines, with no broken words",
90             "many lines, words broken at the text boundary",
91             "many lines, with no broken words"]
92     },
93
94     text_wrapping: function(texttype,noWrap,wordWrap,anywhereWrap,autoWrap) {
95         // Test Meta-data
96         testTitle = "Wrap Modes";
97         testBinary = "qmlscene tests/testapplications/text/textedit.qml";
98         testGoal = "Verify that text wraps correctly with different wrap methods and text formats";
99         testPreconditions = "None";
100         testGroups = "BAT";
101
102         // Test Steps
103         prompt(twiki('---+++ ' + testTitle + '<br><br>
104         *Goal:* ' + testGoal + '<br>
105         *Pre-Requisites:* ' + testPreconditions + '<br>
106         *Tested Binary:* ' + testBinary + '<br>
107     | *Step* | *Verification* |
108     | Run ' + testBinary + ' | Verify that the Text application is displayed |
109     | Select Text: '+texttype+', Format: AutoText controls | Verify '+noWrap+' is displayed |
110     | Select the Wrap: Word option | Verify '+wordWrap+' is displayed |
111     | Select the Wrap: Anywhere option | Verify '+anywhereWrap+' is displayed |
112     | Select the Wrap: Auto option | Verify '+autoWrap+' is displayed |'));
113     },
114
115     text_styling_data: {
116         // Text type
117         Basic: ["Basic"],
118         Long: ["Long"],
119         Rich: ["Rich"]
120     },
121
122     text_styling: function(texttype) {
123         // Test Meta-data
124         testTitle = "Style Effects";
125         testBinary = "qmlscene tests/testapplications/text/textedit.qml";
126         testGoal = "Verify that styling (underline, strikeout etc) works as intended";
127         testPreconditions = "None";
128         testGroups = "BAT";
129
130         // Test Steps
131         prompt(twiki('---+++ ' + testTitle + '<br><br>
132         *Goal:* ' + testGoal + '<br>
133         *Pre-Requisites:* ' + testPreconditions + '<br>
134         *Tested Binary:* ' + testBinary + '<br>
135     | *Step* | *Verification* |
136     | Run ' + testBinary + ' | Verify that the Text application is displayed |
137     | Select Text: '+texttype+', Wrap: WordWrap | Verify the text is displayed, wrapped if necessary |
138     | Select the U_Line: On option | Verify an underline is drawn under each character |
139     | Select the Strike: On option | Verify a strikethrough is drawn through each character |'));
140     },
141
142     select_text: function()
143   {
144        // Test meta data
145        testTitle = "Text Selection";
146        testBinary = "qmlscene tests/testapplications/text/text.qml";
147        testGoal = "Verify text can be selected via various methods";
148        testPreconditions = "None";
149        testGroups = "BAT";
150
151        // Test Steps
152        prompt(twiki('---+++ ' + testTitle + '<br><br>
153            *Goal:* ' + testGoal + '<br>
154            *Pre-Requisites:* ' + testPreconditions + '<br>
155            *Tested Binary:* ' + testBinary + '<br>
156
157     | *Step* | *Verification* |
158     | Execute '+testBinary+' | "The TextInput item displays an editable line of text." is displayed |
159     | Select the Text: Short option | "Hello World" is shown |
160     | Press the Select Word button | World is selected |
161     | Press the Select All button | Hello World is selected |
162     | Press the Select None button | No text is selected |
163     | Select the Mouse: On option | |
164     | Drag over some text | Only that text is selected. On a touchscreen only device the virtual keyboard may show |
165     | Select the Mouse: Off option | |
166     | Press the Select None button | No text is selected |
167     | Drag over some text | No text is selected. On a touchscreen only device the virtual keyboard may show | '));
168   },
169
170   cut_copy_and_paste: function()
171   {
172       // Test meta data
173       testTitle = "Cut, copy and paste";
174       testBinary = "qmlscene tests/testapplications/text/textedit.qml";
175       testGoal = "Verify selected text can be copied/cut to the clipboard, and returned";
176       testPreconditions = "None";
177       testGroups = "BAT";
178
179       // Test Steps
180       prompt(twiki('---+++ ' + testTitle + '<br><br>
181           *Goal:* ' + testGoal + '<br>
182           *Pre-Requisites:* ' + testPreconditions + '<br>
183           *Tested Binary:* ' + testBinary + '<br>
184
185     | *Step* | *Verification* |
186     | Execute '+testBinary+' | "The TextInput item displays an editable line of text." is displayed |
187     | Select the Text: Short option | "Hello World" is shown |
188     | Press the Select All button | Hello World is selected |
189     | Press the Copy Button | |
190     | Tap at the end of the text | Text is no longer selected, cursor is at the text end |
191     | Press the Paste Button | "Hello WorldHello World" is shown  |
192     | Press the Select Word button | World is highlighted |
193     | Press the Cut button | World is removed from the text |
194     | Press the Paste button | "Hello WorldHello World" is shown | '));
195   },
196
197   activate_links: function()
198   {
199       // Test meta data
200       testTitle = "Link Activation";
201       testBinary = "qmlscene tests/testapplications/text/textedit.qml";
202       testGoal = "Verify http links in text can be activated";
203       testPreconditions = "None";
204       testGroups = "BAT";
205
206       // Test Steps
207       prompt(twiki('---+++ ' + testTitle + '<br><br>
208           *Goal:* ' + testGoal + '<br>
209           *Pre-Requisites:* ' + testPreconditions + '<br>
210           *Tested Binary:* ' + testBinary + '<br>
211
212     | *Step* | *Verification* |
213     | Execute '+testBinary+' | "The TextInput item displays an editable line of text." is displayed |
214     | Select the Text: Links option | "This is a link..." is shown |
215     | Tap on the "Qt Docs" text | The border around the TextEdit will become red | '));
216   }
217
218 }