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: ch_tools_axes.inc,v $
13 '* last change: $Author: jsi $ $Date: 2008-06-13 14:27:02 $
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 : Library for automation of the 'Insert::Axes...' dialog
38 '**************************************************************************************************
40 ' #1 fInvokeAxesDialog
41 ' #1 fCloseAxesDialogOK
44 '\************************************************************************************************
46 ' Return codes (for all functions):
48 ' Error 1: The basic action beeing applied caused a serious problem, e.g. a crash.
49 ' Error 2 to 9: A functional problem occured.
50 ' Error 11 to 19: Wrong marginal conditions end up in Failure, e.g. control not visible.
51 ' Note: Following errors can be used for negative testing.
52 ' Error 42: Wrong input. Probably only of interest during test development.
53 ' Error 99: Unexpected behaviour - Shouldn't normally occur.
55 ' Only error 42 and error 99 throw 'warnlogs'.
56 ' All other errors are silent.
57 ' They only throw QAErrorlogs the give a hint what probably went wrong.
58 ' Expected Errors <b>must</b> exclusivly be handled by the calling routine.
60 '--------------------------------------------------------------------
62 function fInvokeAxesDialog() as INTEGER
63 fInvokeAxesDialog = 99
64 ' Function to invoke the 'Insert::Axes...' dialog
68 ' 1 := Serious problem trying to invoke the dialog
69 ' 2 := Failure (Dialog not present after invocation)
70 '99 := Unexpected error
72 printlog "** Invoking 'Insert::Axes...' in menu"
73 '/// Execute menu item 'Insert::Axes...'
77 qaErrorLog "Error 1: Invoking menu item 'Insert::Axes...' failed"
82 '/// Lookup if call was successful
83 Kontext "InsertAxesDialog"
84 if InsertAxesDialog.exists(2) then
85 printlog ">> Axes dialog is visible now."
88 qaErrorLog "Error 2: OOPS, calling the slot 'InsertAxes' didn't cause any problem ..."
89 qaErrorLog "..., BUT the dialog doesn't seem to be visible"
93 if fInvokeAxesDialog = 99 then
94 warnlog "Error 99: Something unexpected happened!!"
98 '--------------------------------------------------------------------
100 function fCloseAxesDialogOK() as INTEGER
101 fCloseAxesDialogOK = 99
102 ' Function to close the Axes dialog using OK button
104 ' Returns error-code:
106 ' 1 := Serious problem trying to Close the dialog
107 ' 2 := Failure (Dialog present after applying OK button)
108 '15 := Dialog not present before closing
109 '99 := Unexpected error
110 printlog "** Closing Axes dialog"
111 Kontext "InsertAxesDialog"
112 '/// Check existence of Axes dialog
113 if InsertAxesDialog.exists(2) then
114 printlog ">> Axes dialog is visible as expected."
116 ' Return Error 15 and quit if dialog not found
117 qaErrorLog "Error 15: OOPS, Axes dialog should be visible ..."
118 qaErrorLog "... this is a BUG or a scripting error -> Check this out!"
119 fCloseAxesDialogOK = 15
122 '/// Click OK button in Axes dialog
126 qaErrorLog "Error 1: Closing the Axes dialog seems to have a serious problem -> Check this out!"
127 fCloseAxesDialogOK = 1
130 '/// Check that Axes dialog is not visible anymore
131 Kontext "InsertAxesDialog"
132 if InsertAxesDialog.exists(2) then
133 ' Return Error 2 if still present
134 qaErrorLog "Error 2: Axes dialog should be invisible now ..."
135 qaErrorLog "... closing the dialog doesn't seem to work -> Check this out!"
136 fCloseAxesDialogOK = 2
138 printlog ">> Closing the Axes dialog seems to work as expected"
139 fCloseAxesDialogOK = 0
142 if fCloseAxesDialogOK = 99 then
143 warnlog "Error 99: Something unexpected happened!!"
147 '--------------------------------------------------------------------
149 function fSetAxis ( oAxis as OBJECT , bAxisCheck as BOOLEAN ) as INTEGER
151 ' Function to check-boxes in Axes dialog
154 ' Axis Indicator (Name of declaration): Major[XYZ]Axis, Secondary[XY]Axis are valid names
157 ' FALSE := Uncheck Axis
158 ' Returns error-code:
160 ' 1 := Serious problem trying to check axis
161 ' 2 := Axis was not set
162 '12 := Check-box for desired axis is not enabled
163 '99 := Unexpected error
164 printlog "** Setting axis"
165 '/// Check if desired axis check-box is enabled
166 if NOT oAxis.IsEnabled then
167 qaErrorLog "Error 12: Check-box for desired axis is not enabled"
168 qaErrorLog "... BUG or Script problem -> Check this out!"
172 '/// Try to (Un)Check desired axis
173 Kontext "InsertAxesDialog"
181 ' Throw error 1 and quit on serious problem
182 qaErrorLog "Error 1: Check axis seems to cause a serious problem -> Check this out!"
186 '/// Verify (against input) if axis was checked
187 if oAxis.IsChecked = bAxisCheck then
189 printlog ">> Chech axis seems to work"
191 qaErrorLog "Error 2: Axis was not checked -> Check this out!"
195 if fSetAxis = 99 then
196 warnlog "Error 99: Something unexpected happened!!"