summaryrefslogtreecommitdiff
path: root/testautomation/dbaccess/optional/includes/ctrl_TextControl.inc
blob: 1cf2617a59b03922c7a5db98b8965505dbe299e2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
'encoding UTF-8  Do not remove or change this line!
'**************************************************************************
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 * 
 * Copyright 2000, 2010 Oracle and/or its affiliates.
 *
 * OpenOffice.org - a multi-platform office productivity suite
 *
 * This file is part of OpenOffice.org.
 *
 * OpenOffice.org is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License version 3
 * only, as published by the Free Software Foundation.
 *
 * OpenOffice.org is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Lesser General Public License version 3 for more details
 * (a copy is included in the LICENSE file that accompanied this code).
 *
 * You should have received a copy of the GNU Lesser General Public License
 * version 3 along with OpenOffice.org.  If not, see
 * <http://www.openoffice.org/license.html>
 * for a copy of the LGPLv3 License.
 *
'/************************************************************************
'*
'* owner : marc.neumann@sun.com
'*
'* short description : Text Control
'*
'\***********************************************************************

sub ctrl_TextControl

    call tTextControl
    call tRichTextControl
    call tRichTextControlDraw
    
end sub
'--------------------------------------------------------------------------------------
testcase tTextControl 
    
    '/// Open a new document,
    printlog "Open a new document,"
	call hNewDocument
    Kontext "DocumentWriter"       
	DocumentWriter.TypeKeys "tt_doc" , true
	sleep(1)

    call hToolbarSelect("FormControls",true)
	
  	Kontext "FormControls"   	
   	Edit.Click
   	sleep(1)      
	'/// insert a text box
    printlog "insert a text box"                    
    call hDrawingWithSelection ( 50, 20, 60, 30 )    
    sleep(1)    
	Kontext "FormControls"
	ControlProperties.Click
	sleep(2)
    '/// set properties: Background color, Horizontal scrollbar, Vertical scrollbar, Password
    printlog "set properties"  
	fsetControlProperty("TextBox","Background","92")
    fsetControlProperty("TextBox","TextType","3")    
    '/// save the document
    printlog "save the document"
	hFileSaveAsKill ( gOfficePath + ConvertPath("user/work/TT_TextBox.odt"))
	hCloseDocument
    sleep(1)
    '/// reload the document
    printlog "reload the document"
	hFileOpen ( gOfficePath + ConvertPath("user/work/TT_TextBox.odt"))    

    call hToolbarSelect("FormControls",true)    

  	Kontext "FormControls"  
     SwitchControlDesignMode.Click
    Kontext "DocumentWriter"
     DocumentWriter.TypeKeys "<SHIFT F4>"
    sleep(1)
    Kontext "FormControls"    
     try
        ControlProperties.Click
     catch 
        warnlog "error while open the control properties browser"
        call hCloseDocument
        goto endsub
     endcatch
    '/// check if the values are saved
    printlog "check if the values are saved"
	sleep(2)
    if fgetControlProperty("TextBox","Background") <> "92" then
        warnlog "the value: background is not saved"
    endif      
    
    if fgetControlProperty("TextBox","TextType") <> "3" then
        warnlog "the value: TextType is not saved"
    endif       
    sleep(1)    	
    hCloseDocument 
endcase
'--------------------------------------------------------------------------------------
testcase tRichTextControl 
    
    '/// Open a new document,
    printlog "Open a new document,"
	call hNewDocument
    Kontext "DocumentWriter"       
	DocumentWriter.TypeKeys "tt_doc" , true
	sleep(1)

    call hToolbarSelect("FormControls",true)
	
  	Kontext "FormControls"   	
   	Edit.Click
   	sleep(1)      
	'/// insert a text box
    printlog "insert a text box"                    
    call hDrawingWithSelection ( 50, 20, 60, 30 )    
    sleep(2)
	Kontext "FormControls"
	ControlProperties.Click
	sleep(2)
    '/// set properties: Background color, Horizontal scrollbar, Vertical scrollbar, Password
    printlog "set properties"  
	fsetControlProperty("TextBox","TextType","3")
    '/// turn off the design view
    printlog "turn off the design view"
    
    call hToolbarSelect("FormControls",true)

  	Kontext "FormControls"  
        SwitchControlDesignMode.Click
    '/// insert some text in the control
    printlog "insert some text in the control"
    Kontext "DocumentWriter"
        sleep(1)
        DocumentWriter.TypeKeys "<MOD1 F5>" , true
        sleep(1)
        DocumentWriter.TypeKeys "this is a blind text" , true        
        sleep(1)
        DocumentWriter.TypeKeys "<SHIFT MOD1 LEFT>" ,2, true        
        sleep(1)
        FormatStyleStrikeThrough
        sleep(1)
    '/// save the document
    printlog "save the document"
	hFileSaveAsKill ( gOfficePath + ConvertPath("user/work/TT_RichTextBox.odt"))
	hCloseDocument
    sleep(1)
    '/// reload the document
    printlog "reload the document"
	hFileOpen ( gOfficePath + ConvertPath("user/work/TT_RichTextBox.odt"))
    Kontext "DocumentWriter"
        DocumentWriter.TypeKeys "<MOD1 F5>" , true
        qaerrorlog "workaround for issue 102010"
        DocumentWriter.TypeKeys "<RIGHT>" , true
        DocumentWriter.TypeKeys "<LEFT>" , true
        sleep(1)
        DocumentWriter.TypeKeys "<MOD1 SHIFT END>" , true
        sleep(1)
        DocumentWriter.TypeKeys "<MOD1 C>" , true
        sleep(1)
        'printlog "getClipboard = " + getClipboard
        if ( getClipboard <> "this is a blind text" ) then
            warnlog "The text in the control is not saved (" + getClipboard() + ")"
        end if
        DocumentWriter.TypeKeys "<END>" , true        
        sleep(1)
        DocumentWriter.TypeKeys "<SHIFT MOD1 LEFT>" ,2, true        
        sleep(1)
        FormatCharacter
        Kontext
            active.SetPage TabFontEffects
        Kontext "TabFontEffects"
        if StrikeThrough.getSelIndex() <> 2 then            
            warnlog "StrikeThrought is not set"
        else
            printlog "StrikeThrought is set"
        end if        
        TabFontEffects.Cancel
        
        sleep(1)
                
    hCloseDocument 
endcase
'--------------------------------------------------------------------------------------
testcase tRichTextControlDraw 
    
    '/// Open a new document,
    printlog "Open a new document,"
	gApplication = "DRAW"
    call hNewDocument
    Kontext "DocumentDraw"       
	DocumentDraw.TypeKeys "tt_doc" , true
	sleep(1)

    call hToolbarSelect("FormControls",true)
	
    Kontext "DocumentDraw"
    DocumentDraw.MouseDown ( 20, 20 )
    sleep(1)
    DocumentDraw.MouseUp ( 20, 20 )
    sleep(1)
    Kontext "FormControls" 
    sleep(1)  	
   	Edit.Click
   	sleep(1) 
    call hDrawingWithSelection ( 50, 20, 60, 30 )
    sleep(2)
	Kontext "FormControls"
	ControlProperties.Click
	sleep(2)
    '/// set properties: Background color, Horizontal scrollbar, Vertical scrollbar, Password
    printlog "set properties"  
	fsetControlProperty("TextBox","TextType","3")
    '/// turn off the design view
    printlog "turn off the design view"

    printlog "close control property browser"    
    Kontext "ControlPropertiesDialog"
        ControlPropertiesDialog.close
    
    call hToolbarSelect("FormControls",true)

  	Kontext "FormControls"  
        SwitchControlDesignMode.Click
    '/// insert some text in the control
    printlog "insert some text in the control"
    Kontext "DocumentDraw"
        sleep(1)
        DocumentDraw.TypeKeys "<MOD1 F5>" , true
        sleep(1)
	DocumentDraw.TypeKeys "<MOD1 F5>" , true
	sleep(1)
        DocumentDraw.TypeKeys "this is a blind text" , true        
        sleep(1)
        DocumentDraw.TypeKeys "<SHIFT MOD1 LEFT>" ,2, true        
        sleep(1)
        FormatStyleStrikeThrough
        sleep(1)
    '/// save the document
    printlog "save the document"
	hFileSaveAsKill ( gOfficePath + ConvertPath("user/work/TT_RichTextBox.odg"),gDrawFilter)
	hCloseDocument
    sleep(1)
    '/// reload the document
    printlog "reload the document"
	hFileOpen ( gOfficePath + ConvertPath("user/work/TT_RichTextBox.odg"))
    Kontext "DocumentDraw"
        DocumentDraw.TypeKeys "<MOD1 F5>" , true
        sleep(1)
	    DocumentDraw.TypeKeys "<MOD1 F5>" , true
	    qaerrorlog "workaround for issue 102010"
	    DocumentDraw.TypeKeys "<RIGHT>" , true
        DocumentDraw.TypeKeys "<LEFT>" , true
        sleep(1)
        DocumentDraw.TypeKeys "<MOD1 SHIFT END>" , true
        sleep(1)
        DocumentDraw.TypeKeys "<MOD1 C>" , true
        sleep(1)
        printlog "getClipboard = " + getClipboard
        if ( getClipboard <> "this is a blind text" ) then
            warnlog "The text in the control is not saved"
        end if
        DocumentDraw.TypeKeys "<END>" , true        
        sleep(1)
        DocumentDraw.TypeKeys "<SHIFT MOD1 LEFT>" ,2, true        
        sleep(1)
        FormatCharacter
        Kontext
            active.SetPage TabFontEffects
        Kontext "TabFontEffects"
        if StrikeThrough.getSelIndex() <> 2 then            
            warnlog "StrikeThrought is not set (issue 32921)"
        else
            printlog "StrikeThrought is set"
        end if        
        TabFontEffects.Cancel
        
        sleep(1)
                
    hCloseDocument 
endcase
'--------------------------------------------------------------------------------------
'--------------------------------------------------------------------------------------
'--------------------------------------------------------------------------------------