jl165 merging heads
[LibreOffice.git] / testautomation / chart2 / tools / ch_tools_tab_borders_lines.inc
blob4d98476157825f1c517ee47db947e15bc4f59ea1
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 : Tool library for Borders and Lines tab-page
32 '**************************************************************************************************
34 ' #1 fInvokeTabLine
35 ' #1 fCloseTabLineOK
37 '\************************************************************************************************
39 ' ch_tools_tab_borders_lines.inc - A library for automation of tab-pages Borders and Lines
40 ' NOTE: Internal both tab-pages are identical
41 ' This Include contains a set of functions to modify the controls of these tab-pages.
42 ' All functions are designed to return error-codes depending on the behaviour of the action applied.
43 ' Return codes:
44 ' Error 0: Success.
45 ' Error 1: The basic action beeing applied caused a serious problem, e.g. a crash.
46 ' Error 2 TO 9: A functional problem occured.
47 ' Error 11 TO 19: Wrong marginal conditions end up in Failure, e.g. control not visible.
48 ' NOTE: This errors can also be used for 'negative' testing.
49 ' Error 42: Wrong input. Probably only of interest during test development .
50 ' Error 99: Unexpected behaviour - Shouldn't normally occur.
51 ' ATTENTION:
52 ' Only Errors 42 and 99 throw 'warnlogs'.
53 ' All other errors are silent.
54 ' They only throw QAErrorlogs the give a hint what probably went wrong.
55 ' Expected Errors MUST exclusivly be handled by the calling routine.
57 '--------------------------------------------------------------------
59 function fInvokeTabLine() as INTEGER
60          fInvokeTabLine = 99
61 ' Function to invoke the Borders or Line tab page in several dialogs
62 ' No Input
63 ' Returns error-code:
64 ' 0 := Sucess
65 ' 1 := Serious problem trying to invoke the page
66 ' 2 := Failure (Page not present after invocation)
67 '99 := Unexpected error
68     
69     printlog "** Invoking 'Line' or 'Borders' tab page"
70     '/// Try to change to 'Line' or 'Borders' tab page
71     Kontext
72     try 
73         active.setPage TabFormatChartLine
74     catch
75         qaErrorLog "Error 1: Invoking tab page 'Line' or 'Borders' failed"
76         fInvokeTabLine = 1
77         exit function
78     endcatch
79     
80     '/// Lookup if call was successful
81     Kontext "TabFormatChartLine"
82     if TabFormatChartLine.exists(2) then
83         printlog ">> Tab page 'Line' or 'Borders' is visible now."
84         fInvokeTabLine = 0
85     else
86         qaErrorLog "Error 2: OOPS, calling Tab page 'Line' or 'Borders' didn't cause any problem ..."
87         qaErrorLog "..., BUT the page doesn't seem to be visible"
88         fInvokeTabLine = 2
89     endif
91     if fInvokeTabLine = 99 then
92         warnlog "Error 99: Something unexpected happened!!"
93     endif    
94 end function
96 '--------------------------------------------------------------------
98 function fCloseTabLineOK() as INTEGER
99          fCloseTabLineOK = 99
100 ' Function to close a dialog using OK button while tab page 'Line' or 'Borders' is visible
101 ' No Input
102 ' Returns error-code:
103 ' 0 := Sucess
104 ' 1 := Serious problem trying to Close the page
105 ' 2 := Failure (Page present after applying OK button)
106 '15 := Page not present before closing
107 '99 := Unexpected error    
108     printlog "** Closing 'Line' or 'Borders' tab page"
109     Kontext "TabFormatChartLine"
110     '/// Check existence of 'Line' or 'Borders' tab page
111     if TabFormatChartLine.exists(2) then
112         printlog ">> 'Line' or 'Borders' tab page is visible as expected."
113     else
114         ' Return Error 15 and quit if page not found
115         qaErrorLog "Error 15: OOPS,'Line' or 'Borders' tab page should be visible ..."
116         qaErrorLog "... this is a BUG or a scripting error -> Check this out!"
117         fCloseTabLineOK = 15
118         exit function
119     endif
120     '/// Click OK button in 'Line' or 'Borders' tab page
121     try 
122         TabFormatChartLine.OK
123     catch
124         qaErrorLog "Error 1: Closing the 'Line' or 'Borders' tab page seems to have a serious problem -> Check this out!"
125         fCloseTabLineOK = 1
126         exit function
127     endcatch
128     '/// Check that the  'Line' or 'Borders' tab page is not available anymore.
129     Kontext "TabFormatChartLine"
130     if TabFormatChartLine.exists(2) then
131         ' Return Error 2 if still present
132         qaErrorLog "Error 2: 'Line' or 'Borders' tab page should be invisible now ..."
133         qaErrorLog "... closing the dialog doesn't seem to work -> Check this out!"
134         fCloseTabLineOK = 2
135     else
136         printlog ">> Closing 'Line' or 'Borders' tab page seems to work as expected"
137         fCloseTabLineOK = 0
138     endif
139     
140     if fCloseTabLineOK = 99 then
141         warnlog "Error 99: Something unexpected happened!!"
142     endif
143 end function