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: extras_table_autoformat.inc,v $
13 '* last change: $Author: jsi $ $Date: 2008-06-16 12:18:14 $
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 : joerg.skottke@sun.com
36 '* short description : Test the autoformat-feature for tables
38 '\******************************************************************************
40 testcase tAutoformatTable( iApp as integer )
42 if ( gIsoLang <> "en-US" ) then
43 printlog( "No testing for non-en_US languages" )
47 '///<h1>Autoformats for tables in Writer and Calc</h1>
50 dim al_UI_formats( 1000 ) as string
51 al_UI_formats( 0 ) = "0"
53 dim iFormatCount as integer
54 dim iCurrentFormat as integer
55 dim cCurrentFormat as string
59 dim sFileOut as string
62 sFileIn = gTesttoolPath & "framework\optional\input\extras_formats\"
64 dim oControl as object
68 case 1 : sFile = "Tables_writer_" & gISOLang & ".txt"
69 case 2 : sFile = "Tables_calc_" & gISOLang & ".txt"
72 sFileIn = convertpath( sFileIn & sFile )
73 sFileOut = hGetWorkPath() & sFile
75 '///+<li>Open a new document - Writer or Calc</li>
78 '///+<li>Depending on the doctype create a table to work on</li>
80 case 1 : kontext "DocumentWriter"
82 case 2 : kontext "DocumentCalc"
83 DocumentCalc.TypeKeys( "<Shift Right>", 5 )
84 DocumentCalc.TypeKeys( "<Shift Down>", 3 )
87 '///+<li>Open the table autoformat dialog</li>
91 case 1 : kontext "AutoformatTabelle"
92 if ( AutoformatTabelle.exists( 2 ) ) then
95 warnlog( "Unable to access Table Autoformat dialog (Writer)" )
99 case 2 : kontext "AutoformatCalc"
100 if ( AutoformatCalc.exists( 2 ) ) then
101 oControl = FormatListe
103 warnlog( "Unable to access Table Autoformat dialog (Calc)" )
108 '///+<li>Get the number of items from the list</li>
109 iFormatCount = oControl.getItemCount()
111 '///+<li>Compile a list of the autoformat names</li>
113 for iCurrentFormat = 1 to iFormatCount
115 '///+<li>Select the (next) format name from the list</li>
116 oControl.select( iCurrentFormat )
118 '///+<li>Retrieve the name of the current item and store it into a list
119 cCurrentFormat = oControl.getSelText()
120 ListAppend( al_UI_formats() , cCurrentFormat )
125 '///+<li>Close the autoformat dialog</li>
127 case 1 : AutoformatTabelle.ok()
128 case 2 : AutoformatCalc.ok()
131 '///+<li>Close the document</li>
134 '///+<li>Compare the list against the reference file</li>
135 irc = hManageComparisionList( sFileIn, sFileOut, al_UI_formats() )
137 warnlog( "The list of table autoformats has changed, please review." )
139 printlog( "The list of table autoformats is unchanged. Good." )