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 2008 by Sun Microsystems, Inc.
7 '* OpenOffice.org - a multi-platform office productivity suite
9 '* $RCSfile: w_grid_layout1.inc,v $
13 '* last change: $Author: jsk $ $Date: 2008-06-17 07:50:24 $
15 '* This file is part of OpenOffice.org.
17 '* OpenOffice.org is free software: you can redistribute it and/or modify
18 '* it under the terms of the GNU Lesser General Public License version 3
19 '* only, as published by the Free Software Foundation.
21 '* OpenOffice.org is distributed in the hope that it will be useful,
22 '* but WITHOUT ANY WARRANTY; without even the implied warranty of
23 '* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24 '* GNU Lesser General Public License version 3 for more details
25 '* (a copy is included in the LICENSE file that accompanied this code).
27 '* You should have received a copy of the GNU Lesser General Public License
28 '* version 3 along with OpenOffice.org. If not, see
29 '* <http://www.openoffice.org/license.html>
30 '* for a copy of the LGPLv3 License.
32 '/************************************************************************
34 '* owner : thorsten.bosbach@sun.com
36 '* short description : Grid Layout for CJK test in Writer
38 '\***********************************************************************
40 private const SOURCE_PATH = "framework\optional\input\CJK\"
42 testcase tTextGridDialog_1
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")
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")
69 if Active.exists (10) then
72 Active.SetPage TabGrid
77 Active.SetPage TabSeite
80 warnlog "Couldn't get Tabpage: Grid Text"
83 warnlog "FormatPageWriter didn't bring up ndialog"
88 '-------------------------------------------------------------------------
90 testcase tTextGridDialog_2
91 '/// No grid is active, no changes to existing version
92 Dim testFile , sCorrectResult as String
94 testFile = "gridtest.sxw"
99 '/// open a test file , and check No Grid checkbox
100 Call hFileOpen ( gTesttoolPath + SOURCE_PATH + testFile )
101 sMakeReadOnlyDocumentEditable
105 if active.exists(5) then
106 Active.SetPage TabGrid
114 '/// Active navigator dialogue , set page to '2' and wait for a while
117 Kontext "NavigatorWriter"
119 Seitennummer.SetText "2"
123 '/// In No Grid mode, there should be only 1 page, the focus is before the first line
124 Kontext "DocumentWriter"
125 Call DocumentWriter.TypeKeys "<End>"
127 Call DocumentWriter.TypeKeys "<Shift Left>"
130 if GetClipboardText <> sCorrectResult then Warnlog "Something wrong when choosing NoGrid option!"
135 '-------------------------------------------------------------------------
137 testcase tTextGridDialog_3
138 '/// Grid (lines only): The page is set up with a defined number of lines
139 Dim testFile , sCorrectResult , sLinesPerPage as String
141 testFile = "gridtest.sxw"
147 '/// open a test file and check Grid(lines onle) checkbox ,
148 '/// + set 10 line/page
149 Call hFileOpen ( gTesttoolPath + SOURCE_PATH + testFile )
150 sMakeReadOnlyDocumentEditable
153 if active.exists(5) then
154 Active.SetPage TabGrid
158 LinesPerPage.SetText sLinesPerPage
163 '/// Active navigator dialogue , set page to '2' and wait for a while
166 Kontext "NavigatorWriter"
168 Seitennummer.SetText "2"
172 Kontext "DocumentWriter"
173 Call DocumentWriter.TypeKeys "<End>"
175 Call DocumentWriter.TypeKeys "<Shift Left>"
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 hFileOpen ( gTesttoolPath + SOURCE_PATH + testFile )
200 sMakeReadOnlyDocumentEditable
203 if active.exists(5) then
204 Active.SetPage TabGrid
208 LinesPerPage.SetText sLinesPerPage
209 CharsPerLine.SetText sCharsPerLine
214 '/// Active navigator dialogue , set page to '2' and wait for a while
217 Kontext "NavigatorWriter"
219 Seitennummer.SetText "2"
223 Kontext "DocumentWriter"
224 Call DocumentWriter.TypeKeys "<End>"
226 Call DocumentWriter.TypeKeys "<Shift Left>"
229 if GetClipboardText <> sCorrectResult then Warnlog "Something wrong when choosing Grid(lines and characters) option!"
234 '-------------------------------------------------------------------------
236 testcase tGridDisplay_1
237 '/// Print grid: The grid lines will be printed. Inactive if "Display grid" is inactive.
240 '/// format / page / tabpage Text grid
241 '/// + check "display grid" and check "print grid"
244 if active.exists(5) then
245 Active.SetPage TabGrid
256 '/// Print to printer
259 if Active.Exists(5) then
260 if Active.GetRT = 304 then
262 QAErrorLog "No Default-Printer!"
273 if active.exists(5) then
274 qaErrorLog active.getText
279 '/// format / page / tabpage Text grid
280 '/// + check "display grid" and uncheck "print grid"
283 if active.exists(5) then
284 Active.SetPage TabGrid
295 '/// Print to printer
298 if Active.Exists(5) then
299 if Active.GetRT = 304 then
301 QAErrorLog "No Default-Printer!"
312 if active.exists(5) then
313 qaErrorLog active.getText
321 '-------------------------------------------------------------------------
323 testcase tUserDefineLayout_1
324 '/// Decrease characters per line will cause lines per page decrease accordingly
325 Dim sLinesPerPage , sCharsPerLine as String
326 Dim sExpectLinesPerPage , sExpectLinesPerPage1 as String
330 sExpectLinesPerPage = "2"
331 sExpectLinesPerPage1 = "3"
335 '/// Format/page , set lines per page to 20, and set charsets per line to 2
336 '/// + wait for a moment , then check the the number of lines per page.
339 if active.exists(5) then
340 Active.SetPage TabGrid
345 LinesPerPage.SetText sLinesPerPage
347 CharsPerLine.SetText sCharsPerLine
350 'This step is no use, just let the LinesPerPage change the number
353 if LinesPerPage.GetText <> sExpectLinesPerPage AND LinesPerPage.GetText <> sExpectLinesPerPage1 then
354 Warnlog "The lines per page should be" + sExpectLinesPerPage + " OR " + sExpectLinesPerPage1 +" but get " +LinesPerPage.GetText
362 '-------------------------------------------------------------------------
364 testcase tFontSizeChanges_1
365 '/// Change the font size to bigger enough will change the layout
366 Dim testFile , sCorrectResult as String
367 Dim sLinesPerPage , sCharsPerLine as String
370 testFile = "FontSizeChanges_1.sxw"
375 '/// open a test file
376 Call hFileOpen ( gTesttoolPath + SOURCE_PATH + testFile )
377 sMakeReadOnlyDocumentEditable
378 Kontext "DocumentWriter"
379 Call DocumentWriter.TypeKeys "<Shift Right>"
381 '/// set font size to 60
382 Kontext "FormatObjectbar"
383 Schriftgroesse.Select "60"
384 Schriftgroesse.TypeKeys "<Return>"
387 '/// Check if lines per page and charsets per line is still right
388 Kontext "DocumentWriter"
391 if active.exists(5) then
392 Active.SetPage TabGrid
395 if TabGrid.exists(5) then
396 sTemp = LinesPerPage.GetText
397 if sTemp <> sLinesPerPage then
398 Warnlog "The lines per page should be: '" + sLinesPerPage + "'; but get: '" + sTemp + "'"
400 sTemp = CharsPerLine.GetText
401 if sTemp <> sCharsPerLine then
402 Warnlog "The chars per line should be: '" + sCharsPerLine + "'; but get: '" +sTemp + "'"
406 warnlog "TabGrid is not available."
409 '/// Active navigator dialogue , set page to '2' and wait for a while
412 Kontext "NavigatorWriter"
413 if NavigatorWriter.exists(5) then
414 Seitennummer.SetText "2"
417 warnlog "Navigator not available"
421 Kontext "DocumentWriter"
423 Call DocumentWriter.TypeKeys "<Shift Right>"
426 sTemp = GetClipboardText
427 if sTemp <> sCorrectResult then
428 Warnlog "Don't get the expected result , hope to be: '" + sCorrectResult + "'; but get: '" + sTemp + "'"
434 '-------------------------------------------------------------------------
437 '/// If Ruby Text is applied and longer than its Base Text it will stretch over more grid cells than the base text itself.
438 Dim testFile , sRubyText as String
440 testFile = "rubytest.sxw"
441 sRubyText = "Ruby Test Text ....................."
445 '/// open a test file , and insert long ruby test text
446 Call hFileOpen ( gTesttoolPath + SOURCE_PATH + testFile )
447 sMakeReadOnlyDocumentEditable
448 Kontext "DocumentWriter"
449 Call DocumentWriter.TypeKeys "<Shift Right>"
455 RubyText1.setText sRubyText
462 Kontext "DocumentWriter"
463 FormatAutoformatApply
465 Call DocumentWriter.TypeKeys "<End>"
467 Call DocumentWriter.TypeKeys "<Shift Left>"
470 if NOT(GetClipboardText = "5" OR GetClipboardText = "6") then
471 Warnlog "Don't get the correct result after inserting ruby text! Get " + GetClipboardText
477 '-------------------------------------------------------------------------
479 testcase tIndentsTest_1
480 '/// 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.
481 Dim testFile , sCorrectPage1 , sCorrectPage2 as String
483 testFile = "IndentsTest.sxw"
489 '/// open a test file , and press TAB in second line
490 Call hFileOpen ( gTesttoolPath + SOURCE_PATH + testFile )
491 sMakeReadOnlyDocumentEditable
492 Kontext "DocumentWriter"
493 Call DocumentWriter.TypeKeys "<Down>"
495 Call DocumentWriter.TypeKeys "<Tab>"
497 Call DocumentWriter.TypeKeys "<End>"
500 '/// Active navigator dialogue , check if the page number is 1
503 Kontext "NavigatorWriter"
504 if Seitennummer.GetText <> sCorrectPage1 then Warnlog "First test :Something wrong in indents test!"
507 '/// press TAB in second line again
508 Kontext "DocumentWriter"
509 Call DocumentWriter.TypeKeys "<Home>"
511 Call DocumentWriter.TypeKeys "<Tab>"
513 Call DocumentWriter.TypeKeys "<End>"
516 '/// Active navigator dialogue , check if the page number is 2
519 Kontext "NavigatorWriter"
520 if Seitennummer.GetText <> sCorrectPage2 then Warnlog "Second test :Something wrong in indents test!"
526 '-------------------------------------------------------------------------
528 testcase tObjectsTest_1
529 '/// If objects are anchored to text they will "wander" with its surrounding text.
530 '/// If they are anchored as character they will snap to the appropriate grid cell (since they are a character).
531 Dim testFile , sCorrectPage1 , sCorrectPage2 as String
533 testFile = "objectsTest.sxw"
539 '/// open a test file , and press TAB in second line
540 Call hFileOpen ( gTesttoolPath + SOURCE_PATH + testFile )
542 '/// If object is anchored as Character , check if it will snap to the appropriate grid cell
543 fStartupNavigator( "OLEObject" , 1 )
545 Auswahlliste.TypeKeys "<Return>"
551 FormatAnchorAsCharacter
555 Kontext "NavigatorWriter"
556 Seitennummer.SetText sCorrectPage2
558 if Seitennummer.GetText <> sCorrectPage2 then Warnlog "Something wrong when object is anchored as Character!"
561 '/// If object is anchored to Character , check if it will NOT snap to the appropriate grid cell
562 fStartupNavigator( "OLEObject" , 1 )
563 Auswahlliste.TypeKeys "<Return>"
567 FormatAnchorToCharacter
570 Kontext "NavigatorWriter"
571 Seitennummer.SetText sCorrectPage2
573 if Seitennummer.GetText <> sCorrectPage1 then Warnlog "Something wrong when object is anchored to Character!"