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: c_namedrange.inc,v $
13 '* last change: $Author: jsi $ $Date: 2008-06-16 08:05:51 $
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 : oliver.craemer@sun.com
36 '* short description : calc named range level 2 test
38 '*************************************************************************
40 ' #1 c_namedrange ' Initial routine
42 ' #1 tCheckErrorInvalidRangeName
43 ' #1 tCheckErrorInvalidRangeSelected
45 '\************************************************************************
46 'TODO: add some old features
50 Printlog Chr(13) + "--------- named range ---------"
53 call tCheckErrorInvalidRangeName
54 call tCheckErrorInvalidRangeSelected
57 '---------------------------------------------------------------------------
59 testcase tAssignRangeName
61 dim sInputFile as string
62 sInputFile = convertpath(gTesttoolPath & "spreadsheet/optional/input/namedrange.sxc")
63 dim sOutputFile as String
64 sOutputFile = convertpath(gOfficePath & "user/work/assignrangename." & sDefaultExtension)
67 printlog "Assign range names in name box"
69 printlog " Load testdocument and save locally with current filter"
70 call hFileOpen (sInputFile)
71 if NOT hFileSaveAsWithFilterKill (sOutputFile , "calc8") then
72 warnlog "Saving test document localy failed -> Aborting"
77 printlog " Select range C2:F10"
78 call fCalcSelectRange("C2:F10")
79 printlog " Assign name 'FirstRange'"
80 call fCalcNameRange("FirstRange")
81 printlog " Select range X31996:AB32005"
82 call fCalcSelectRange("X31996:AB32005")
83 printlog " Assign name 'SecondRange'"
84 call fCalcNameRange("SecondRange")
85 printlog " Select range IT65533:IU65535"
86 call fCalcSelectRange("IT65533:IU65535")
87 printlog " Assign name 'ThördRänge' (Special Characters ;-)"
88 call fCalcNameRange("ThördRänge")
89 printlog " Select cell J333"
90 call fCalcSelectRange("J333")
91 printlog " Assign name 'OneCell'"
92 call fCalcNameRange("OneCell")
93 printlog " Save changes and reload"
96 call hFileOpen (sOutputFile)
97 printlog " Select range C2:F10"
98 call fCalcSelectRange("C2:F10")
99 printlog " Check for formula bar visibility"
100 Kontext "RechenleisteCalc"
101 if not RechenleisteCalc.isvisible then
102 warnlog "Formula bar was expected to be visible"
103 ViewToolbarsFormulaBar
106 printlog " Check name box for 'FirstRange'"
107 Kontext "RechenleisteCalc"
108 if Bereich.GetSelText = "FirstRange" then
109 printlog "Correct name assigned for 'C2:F10'"
111 warnlog "Name for 'C2:F10' is " & Bereich.GetSelText & " instead of 'FirstRange'"
113 printlog " Select range X31996:AB32005"
114 call fCalcSelectRange("X31996:AB32005")
115 printlog " Check name box for 'SecondRange'"
116 Kontext "RechenleisteCalc"
117 if Bereich.GetSelText = "SecondRange" then
118 printlog "Correct name assigned for 'X31996:AB32005'"
120 warnlog "Name for 'X31996:AB32005' is " & Bereich.GetSelText & " instead of 'SecondRange'"
122 printlog " Select range IT65533:IU65535"
123 call fCalcSelectRange("IT65533:IU65535")
124 printlog " Check name box for 'ThördRänge'"
125 Kontext "RechenleisteCalc"
126 if Bereich.GetSelText = "ThördRänge" then
127 printlog "Correct name assigned for 'IT65533:IU65535'"
129 warnlog "Name for 'IT65533:IU65535' is " & Bereich.GetSelText & " instead of 'ThördRänge'"
131 printlog " Select cell J333"
132 call fCalcSelectRange("J333")
133 printlog " Check name box for 'OneCell'"
134 Kontext "RechenleisteCalc"
135 if Bereich.GetSelText = "OneCell" then
136 printlog "Correct name assigned for 'J333'"
138 warnlog "Name for 'J333' is " & Bereich.GetSelText & " instead of 'OneCell'"
140 printlog " Close document and finish test</ul>"
146 '---------------------------------------------------------------------------
148 testcase tCheckErrorInvalidRangeName
150 printlog "Check for error messages when assigning invalid range name"
151 printlog " New calc document"
153 printlog " Select range C2:F10"
154 call fCalcSelectRange("C2:F10")
155 printlog " Try to assign name '%FirstRange'"
156 printlog " and check for failture"
157 if fCalcNameRange("%FirstRange") then
158 warnlog "OOPS, assigning invalid range name '%FirstRange' should fail!"
160 printlog "Invalid name was not accepted"
162 printlog " Close document and finish test</ul>"
166 '---------------------------------------------------------------------------
168 testcase tCheckErrorInvalidRangeSelected
170 printlog "Check for error messages when assigning invalid range name"
171 printlog " New calc document"
173 printlog " Select range C2:F10"
174 call fCalcSelectRange("C2:D3")
175 printlog " Change calc selection mode"
176 Kontext "DocumentCalc"
177 DocumentCalc.TypeKeys ("<SHIFT F8>")
178 printlog " Add random cell to selection"
179 Kontext "DocumentCalc"
180 call gMouseClick (90,90)
181 printlog " Try to assign valid name 'FirstRange'"
182 printlog " and check for failture"
183 if fCalcNameRange("FirstRange") then
184 warnlog "OOPS, assigning invalid range selected with 'FirstRange' should fail!"
186 printlog "Invalid selection was not accepted"
188 Kontext "DocumentCalc"
189 printlog " Reset calc selection mode"
190 DocumentCalc.TypeKeys ("<SHIFT F8>")
191 printlog " Close document and finish test"