1 'encoding UTF-8 Do not remove or change this line!
2 '**************************************************************************
3 ' DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 ' Copyright 2000, 2010 Oracle and/or its affiliates.
7 ' OpenOffice.org - a multi-platform office productivity suite
9 ' This file is part of OpenOffice.org.
11 ' OpenOffice.org is free software: you can redistribute it and/or modify
12 ' it under the terms of the GNU Lesser General Public License version 3
13 ' only, as published by the Free Software Foundation.
15 ' OpenOffice.org is distributed in the hope that it will be useful,
16 ' but WITHOUT ANY WARRANTY; without even the implied warranty of
17 ' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 ' GNU Lesser General Public License version 3 for more details
19 ' (a copy is included in the LICENSE file that accompanied this code).
21 ' You should have received a copy of the GNU Lesser General Public License
22 ' version 3 along with OpenOffice.org. If not, see
23 ' <http://www.openoffice.org/license.html>
24 ' for a copy of the LGPLv3 License.
26 '/************************************************************************
28 '* owner : thorsten.bosbach@oracle.com
30 '* short description : Grid Layout for CJK test in Writer
32 '\***********************************************************************
34 private const SOURCE_PATH = "framework\optional\input\CJK\"
36 testcase tTextGridDialog_1
38 dim lsSave( 3 ) as string
39 dim lbSave( 3 ) as boolean
42 hCloseDialog( Navigator, "close,optional" )
44 '/// Check if tabpage 'Text Grid' disappears when "Asian Language support" is NOT checked
45 if iSystemSprache <> 81 AND iSystemSprache <> 82 AND iSystemSprache <> 86 AND iSystemSprache <> 88 then
46 Call CheckAsianLanguageSupport("Off")
48 hUseAsyncSlot( "FormatPageWriter" )
51 Active.SetPage TabGrid
54 warnlog "Shouldn't get Tabpage: Grid Text"
57 Active.SetPage TabSeite
63 '/// Check if tabpage 'Text Grid' appears when "Asian Language support" is checked
64 Call CheckAsianLanguageSupport("On")
68 hToolsOptions ( "StarOffice", "General" )
70 printlog " - save old data"
71 lsSave ( 1 ) = Zweistellig.GetText
72 lbSave ( 1 ) = Aktivieren.IsChecked
74 if gPlatgroup = "w95" then
75 lbSave (2) = StarOfficeDialogeBenutzen.IsChecked
77 lbSave ( 3 ) = DruckenStatus.IsChecked
78 lsSave ( 3 ) = StyleSheet.GetSelText
80 printlog " - invert/change data"
81 Zweistellig.SetText "1950"
83 if gPlatgroup = "w95" then
84 if lbSave (2) = TRUE then StarOfficeDialogeBenutzen.Uncheck else StarOfficeDialogeBenutzen.Check
86 If lbSave ( 3 ) = TRUE then DruckenStatus.Uncheck else DruckenStatus.Check
89 Kontext "ExtrasOptionenDlg"
90 hCloseDialog( ExtrasOptionenDlg, "ok" )
95 '-------------------------------------------------------------------------
97 testcase tTextGridDialog_2
98 '/// No grid is active, no changes to existing version
99 Dim testFile , sCorrectResult as String
101 testFile = "gridtest.sxw"
106 '/// open a test file , and check No Grid checkbox
107 Call hFileOpenLocally( gTesttoolPath + SOURCE_PATH + testFile )
109 hUseAsyncSlot( "FormatPageWriter" )
111 if active.exists(5) then
112 Active.SetPage TabGrid
116 hCloseDialog( TabGrid, "ok" )
119 '/// Active navigator dialogue , set page to '2' and wait for a while
122 Kontext "NavigatorWriter"
123 Seitennummer.SetText "2" : Wait( 2000 )
125 hCloseDialog( Navigator, "close" )
127 '/// In No Grid mode, there should be only 1 page, the focus is before the first line
128 Kontext "DocumentWriter"
129 Call DocumentWriter.TypeKeys "<End>"
130 wait( 200 ) ' sleep 1
131 Call DocumentWriter.TypeKeys "<Shift Left>"
132 hUseAsyncSlot( "EditCopy" )
134 if GetClipboardText <> sCorrectResult then Warnlog "Something wrong when choosing NoGrid option!"
139 '-------------------------------------------------------------------------
141 testcase tTextGridDialog_3
142 '/// Grid (lines only): The page is set up with a defined number of lines
143 Dim testFile , sCorrectResult , sLinesPerPage as String
145 testFile = "gridtest.sxw"
151 '/// open a test file and check Grid(lines onle) checkbox ,
152 '/// + set 10 line/page
153 Call hFileOpenLocally( gTesttoolPath + SOURCE_PATH + testFile )
154 hUseAsyncSlot( "FormatPageWriter" )
156 if active.exists(5) then
157 Active.SetPage TabGrid
161 LinesPerPage.SetText sLinesPerPage
162 hCloseDialog( TabGrid, "ok" )
164 '/// Active navigator dialogue , set page to '2' and wait for a while
167 Kontext "NavigatorWriter"
168 Seitennummer.SetText "2" : Wait( 2000 )
170 hCloseDialog( Navigator, "close" )
172 Kontext "DocumentWriter"
173 Call DocumentWriter.TypeKeys "<End>"
174 wait( 200 ) ' sleep 1
175 Call DocumentWriter.TypeKeys "<Shift Left>"
176 hUseAsyncSlot( "EditCopy" )
178 if GetClipboardText <> sCorrectResult then Warnlog "Something wrong when choosing Grid(lines only) option!"
183 '-------------------------------------------------------------------------
185 testcase tTextGridDialog_4
186 '/// Grid (lines and characters): The page is set up with a defined number of lines and a defined number of characters in each line
187 Dim testFile , sCorrectResult as String
188 Dim sLinesPerPage , sCharsPerLine as String
190 testFile = "gridtest.sxw"
197 '/// open a test file and check Grid(lines and characters) checkbox
198 '/// + set 10 line/page and 9 characters/line
199 Call hFileOpenLocally( gTesttoolPath + SOURCE_PATH + testFile )
200 hUseAsyncSlot( "FormatPageWriter" )
202 if active.exists(5) then
203 Active.SetPage TabGrid
207 LinesPerPage.SetText sLinesPerPage
208 CharsPerLine.SetText sCharsPerLine
209 hCloseDialog( TabGrid, "ok" )
211 '/// Active navigator dialogue , set page to '2' and wait for a while
214 Kontext "NavigatorWriter"
215 Seitennummer.SetText "2" : Wait( 2000 )
217 hCloseDialog( Navigator, "close" )
219 Kontext "DocumentWriter"
220 Call DocumentWriter.TypeKeys "<End>"
221 wait( 200 ) ' sleep 1
222 Call DocumentWriter.TypeKeys "<Shift Left>"
223 hUseAsyncSlot( "EditCopy" )
225 if GetClipboardText <> sCorrectResult then Warnlog "Something wrong when choosing Grid(lines and characters) option!"
230 '-------------------------------------------------------------------------
232 testcase tGridDisplay_1
233 '/// Print grid: The grid lines will be printed. Inactive if "Display grid" is inactive.
236 '/// format / page / tabpage Text grid
237 '/// + check "display grid" and check "print grid"
238 hUseAsyncSlot( "FormatPageWriter" )
240 if active.exists(5) then
241 Active.SetPage TabGrid
247 hCloseDialog( TabGrid, "ok" )
250 '/// Print to printer
251 hUseAsyncSlot( "FilePrint" )
253 if ( Active.Exists( 5 ) ) then
254 if Active.GetRT() = 304 then
256 QAErrorLog "No Default-Printer!"
258 if ( Printing.exists( 1 )) then
264 if ( Printing.exists( 2 )) then
266 Printing.notExists( 5 )
270 if active.exists(5) then
271 qaErrorLog active.getText()
276 '/// format / page / tabpage Text grid
277 '/// + check "display grid" and uncheck "print grid"
280 if active.exists(5) then
281 Active.SetPage TabGrid
287 hCloseDialog( TabGrid, "ok" )
289 '/// Print to printer
292 if ( Active.Exists( 5 ) )then
293 if Active.GetRT() = 304 then
295 QAErrorLog "No Default-Printer!"
297 if ( Printing.exists( 1 )) then
303 hCloseDialog( Printing, "ok" )
306 if ( active.exists( 2 ) ) then
307 qaErrorLog active.getText
315 '-------------------------------------------------------------------------
317 testcase tUserDefineLayout_1
318 '/// Decrease characters per line will cause lines per page decrease accordingly
319 Dim sLinesPerPage , sCharsPerLine as String
320 Dim sExpectLinesPerPage , sExpectLinesPerPage1 as String
324 sExpectLinesPerPage = "2"
325 sExpectLinesPerPage1 = "3"
329 '/// Format/page , set lines per page to 20, and set charsets per line to 2
330 '/// + wait for a moment , then check the the number of lines per page.
331 hUseAsyncSlot( "FormatPageWriter" )
333 if active.exists(5) then
334 Active.SetPage TabGrid
339 LinesPerPage.SetText sLinesPerPage
340 CharsPerLine.SetText sCharsPerLine
342 'This step is no use, just let the LinesPerPage change the number
345 if LinesPerPage.GetText <> sExpectLinesPerPage AND LinesPerPage.GetText <> sExpectLinesPerPage1 then
346 Warnlog "The lines per page should be" + sExpectLinesPerPage + " OR " + sExpectLinesPerPage1 +" but get " +LinesPerPage.GetText
354 '-------------------------------------------------------------------------
356 testcase tFontSizeChanges_1
357 '/// Change the font size to bigger enough will change the layout
358 Dim testFile , sCorrectResult as String
359 Dim sLinesPerPage , sCharsPerLine as String
362 testFile = "FontSizeChanges_1.sxw"
367 Call hFileOpenLocally( gTesttoolPath + SOURCE_PATH + testFile )
368 Kontext "DocumentWriter"
369 Call DocumentWriter.TypeKeys "<Shift Right>"
371 Kontext "FormatObjectbar"
372 Schriftgroesse.Select "60"
373 Schriftgroesse.TypeKeys "<Return>"
375 Kontext "DocumentWriter"
376 hUseAsyncSlot( "FormatPageWriter" )
378 if active.exists(5) then
379 Active.SetPage TabGrid
382 if TabGrid.exists(5) then
383 sTemp = LinesPerPage.GetText
384 if sTemp <> sLinesPerPage then
385 Warnlog "The lines per page should be: '" + sLinesPerPage + "'; but get: '" + sTemp + "'"
387 sTemp = CharsPerLine.GetText
388 if sTemp <> sCharsPerLine then
389 Warnlog "The chars per line should be: '" + sCharsPerLine + "'; but get: '" +sTemp + "'"
393 warnlog "TabGrid is not available."
398 Kontext "NavigatorWriter"
399 if NavigatorWriter.exists(5) then
400 Seitennummer.SetText "2" : Wait( 2000 )
402 hCloseDialog( Navigator, "close" )
404 warnlog( "Navigator not open" )
407 Kontext "DocumentWriter"
408 wait( 200 ) ' sleep 3
409 Call DocumentWriter.TypeKeys "<Shift Right>"
411 hUseAsyncSlot( "EditCopy" )
412 sTemp = GetClipboardText
413 if sTemp <> sCorrectResult then
414 Warnlog "Don't get the expected result , hope to be: '" + sCorrectResult + "'; but get: '" + sTemp + "'"
420 '-------------------------------------------------------------------------
424 '/// If Ruby Text is applied and longer than its Base Text it will stretch over more grid cells than the base text itself.
425 const TEST_FILE = "rubytest.sxw"
426 const RUBY_TEXT = "Ruby Test Text ....................."
428 printlog( "Create a new document" )
431 printlog( "Open test file" )
432 hFileOpenLocally( gTesttoolPath + SOURCE_PATH + TEST_FILE )
434 Kontext "DocumentWriter"
435 printlog( "Mark character to the right of current cursor position" )
436 Call DocumentWriter.TypeKeys "<Shift Right>"
438 printlog( "Open <Format Ruby> dialog" )
439 hUseAsyncSlot( "FormatRuby" )
442 if ( RubyDialog.exists( 3 ) ) then
443 RubyText1.setText( RUBY_TEXT )
447 warnlog( "Ruby dialog not open" )
450 Kontext "DocumentWriter"
451 printlog( "Apply Autoformat" )
452 hUseAsyncSlot( "FormatAutoformatApply" )
454 printlog( "Select last character in current line" )
455 Call DocumentWriter.TypeKeys "<End>"
457 Call DocumentWriter.TypeKeys "<Shift Left>"
460 printlog( "<EditCopy>" )
461 hUseAsyncSlot( "EditCopy" )
463 if NOT(GetClipboardText = "5" OR GetClipboardText = "6") then
464 Warnlog "Don't get the correct result after inserting ruby text! Get " + GetClipboardText
470 '-------------------------------------------------------------------------
472 testcase tIndentsTest_1
473 '/// Indents should work and always indenting as close as possible to their measurements by snapping to the appropriate grid cell. Tabs therefore will be ignored.
475 const TEST_FILE = "IndentsTest.sxw"
476 const CORRECT_PAGE_1 = "1"
477 const CORRECT_PAGE_2 = "2"
481 '/// open a test file , and press TAB in second line
482 hFileOpenLocally( gTesttoolPath + SOURCE_PATH + TEST_FILE )
484 Kontext "DocumentWriter"
485 Call DocumentWriter.TypeKeys "<Down>"
486 wait( 200 ) ' sleep 1
487 Call DocumentWriter.TypeKeys "<Tab>"
488 wait( 200 ) ' sleep 1
489 Call DocumentWriter.TypeKeys "<End>"
490 wait( 200 ) ' sleep 1
492 '/// Active navigator dialogue , check if the page number is 1
495 Kontext "NavigatorWriter"
496 if ( Seitennummer.GetText <> CORRECT_PAGE_1 ) then
497 Warnlog "First test :Something wrong in indents test!"
500 hCloseDialog( Navigator, "close" )
502 '/// press TAB in second line again
503 Kontext "DocumentWriter"
504 Call DocumentWriter.TypeKeys "<Home>"
505 wait( 200 ) ' sleep 1
506 Call DocumentWriter.TypeKeys "<Tab>"
507 wait( 200 ) ' sleep 1
508 Call DocumentWriter.TypeKeys "<End>"
509 wait( 200 ) ' sleep 1
511 '/// Active navigator dialogue , check if the page number is 2
514 Kontext "NavigatorWriter"
515 if ( Seitennummer.GetText <> CORRECT_PAGE_2 ) then
516 Warnlog "Second test :Something wrong in indents test!"
519 hCloseDialog( Navigator, "close" )
524 '-------------------------------------------------------------------------
526 testcase tObjectsTest_1
527 '/// If objects are anchored to text they will "wander" with its surrounding text.
528 '/// If they are anchored as character they will snap to the appropriate grid cell (since they are a character).
530 const TEST_FILE = "objectsTest.sxw"
531 const CORRECT_PAGE_1 = "1"
532 const CORRECT_PAGE_2 = "2"
536 '/// open a test file , and press TAB in second line
537 Call hFileOpen ( gTesttoolPath + SOURCE_PATH + TEST_FILE )
539 '/// If object is anchored as Character , check if it will snap to the appropriate grid cell
540 fStartupNavigator( "OLEObject" , 1 )
541 wait( 200 ) ' sleep 1
542 Auswahlliste.TypeKeys "<Return>"
543 wait( 200 ) ' sleep 1
545 hCloseDialog( Navigator, "close" )
548 FormatAnchorAsCharacter
553 Kontext "NavigatorWriter"
554 Seitennummer.SetText( CORRECT_PAGE_1 )
555 WaitSlot( 5000 ) ' wait( 200 ) ' sleep 5
556 if ( Seitennummer.GetText <> CORRECT_PAGE_1 ) then
557 Warnlog "Something wrong when object is anchored as Character!"
560 hCloseDialog( Navigator, "close" )
562 '/// If object is anchored to Character , check if it will NOT snap to the appropriate grid cell
563 fStartupNavigator( "OLEObject" , 1 )
564 Auswahlliste.TypeKeys "<Return>"
566 hCloseDialog( Navigator, "close" )
569 FormatAnchorToCharacter
572 Kontext "NavigatorWriter"
573 Seitennummer.SetText( CORRECT_PAGE_2 )
574 WaitSlot( 5000 ) ' wait( 200 ) ' sleep 5
575 if ( Seitennummer.GetText <> CORRECT_PAGE_1 ) then
576 Warnlog "Something wrong when object is anchored to Character!"
579 hCloseDialog( Navigator, "close" )