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 : oliver.craemer@oracle.com
30 '* short description : Library for automation of the 'Insert::Axes...' dialog
32 '**************************************************************************************************
34 ' #1 fInvokeAxesDialog
35 ' #1 fCloseAxesDialogOK
38 '\************************************************************************************************
40 ' Return codes (for all functions):
42 ' Error 1: The basic action beeing applied caused a serious problem, e.g. a crash.
43 ' Error 2 to 9: A functional problem occured.
44 ' Error 11 to 19: Wrong marginal conditions end up in Failure, e.g. control not visible.
45 ' Note: Following errors can be used for negative testing.
46 ' Error 42: Wrong input. Probably only of interest during test development.
47 ' Error 99: Unexpected behaviour - Shouldn't normally occur.
49 ' Only error 42 and error 99 throw 'warnlogs'.
50 ' All other errors are silent.
51 ' They only throw QAErrorlogs the give a hint what probably went wrong.
52 ' Expected Errors <b>must</b> exclusivly be handled by the calling routine.
54 '--------------------------------------------------------------------
56 function fInvokeAxesDialog() as INTEGER
57 fInvokeAxesDialog = 99
58 ' Function to invoke the 'Insert::Axes...' dialog
62 ' 1 := Serious problem trying to invoke the dialog
63 ' 2 := Failure (Dialog not present after invocation)
64 '99 := Unexpected error
66 printlog "** Invoking 'Insert::Axes...' in menu"
67 '/// Execute menu item 'Insert::Axes...'
71 qaErrorLog "Error 1: Invoking menu item 'Insert::Axes...' failed"
76 '/// Lookup if call was successful
77 Kontext "InsertAxesDialog"
78 if InsertAxesDialog.exists(2) then
79 printlog ">> Axes dialog is visible now."
82 qaErrorLog "Error 2: OOPS, calling the slot 'InsertAxes' didn't cause any problem ..."
83 qaErrorLog "..., BUT the dialog doesn't seem to be visible"
87 if fInvokeAxesDialog = 99 then
88 warnlog "Error 99: Something unexpected happened!!"
92 '--------------------------------------------------------------------
94 function fCloseAxesDialogOK() as INTEGER
95 fCloseAxesDialogOK = 99
96 ' Function to close the Axes dialog using OK button
100 ' 1 := Serious problem trying to Close the dialog
101 ' 2 := Failure (Dialog present after applying OK button)
102 '15 := Dialog not present before closing
103 '99 := Unexpected error
104 printlog "** Closing Axes dialog"
105 Kontext "InsertAxesDialog"
106 '/// Check existence of Axes dialog
107 if InsertAxesDialog.exists(2) then
108 printlog ">> Axes dialog is visible as expected."
110 ' Return Error 15 and quit if dialog not found
111 qaErrorLog "Error 15: OOPS, Axes dialog should be visible ..."
112 qaErrorLog "... this is a BUG or a scripting error -> Check this out!"
113 fCloseAxesDialogOK = 15
116 '/// Click OK button in Axes dialog
120 qaErrorLog "Error 1: Closing the Axes dialog seems to have a serious problem -> Check this out!"
121 fCloseAxesDialogOK = 1
124 '/// Check that Axes dialog is not visible anymore
125 Kontext "InsertAxesDialog"
126 if InsertAxesDialog.exists(2) then
127 ' Return Error 2 if still present
128 qaErrorLog "Error 2: Axes dialog should be invisible now ..."
129 qaErrorLog "... closing the dialog doesn't seem to work -> Check this out!"
130 fCloseAxesDialogOK = 2
132 printlog ">> Closing the Axes dialog seems to work as expected"
133 fCloseAxesDialogOK = 0
136 if fCloseAxesDialogOK = 99 then
137 warnlog "Error 99: Something unexpected happened!!"
141 '--------------------------------------------------------------------
143 function fSetAxis ( oAxis as OBJECT , bAxisCheck as BOOLEAN ) as INTEGER
145 ' Function to check-boxes in Axes dialog
148 ' Axis Indicator (Name of declaration): Major[XYZ]Axis, Secondary[XY]Axis are valid names
151 ' FALSE := Uncheck Axis
152 ' Returns error-code:
154 ' 1 := Serious problem trying to check axis
155 ' 2 := Axis was not set
156 '12 := Check-box for desired axis is not enabled
157 '99 := Unexpected error
158 printlog "** Setting axis"
159 '/// Check if desired axis check-box is enabled
160 if NOT oAxis.IsEnabled then
161 qaErrorLog "Error 12: Check-box for desired axis is not enabled"
162 qaErrorLog "... BUG or Script problem -> Check this out!"
166 '/// Try to (Un)Check desired axis
167 Kontext "InsertAxesDialog"
175 ' Throw error 1 and quit on serious problem
176 qaErrorLog "Error 1: Check axis seems to cause a serious problem -> Check this out!"
180 '/// Verify (against input) if axis was checked
181 if oAxis.IsChecked = bAxisCheck then
183 printlog ">> Chech axis seems to work"
185 qaErrorLog "Error 2: Axis was not checked -> Check this out!"
189 if fSetAxis = 99 then
190 warnlog "Error 99: Something unexpected happened!!"