diff options
Diffstat (limited to 'testautomation/chart2/tools')
-rw-r--r-- | testautomation/chart2/tools/ch_tools_axes.inc | 193 | ||||
-rw-r--r-- | testautomation/chart2/tools/ch_tools_chart_type.inc | 641 | ||||
-rw-r--r-- | testautomation/chart2/tools/ch_tools_common.inc | 212 | ||||
-rw-r--r-- | testautomation/chart2/tools/ch_tools_data_labels.inc | 369 | ||||
-rw-r--r-- | testautomation/chart2/tools/ch_tools_grids.inc | 202 | ||||
-rw-r--r-- | testautomation/chart2/tools/ch_tools_legend.inc | 241 | ||||
-rw-r--r-- | testautomation/chart2/tools/ch_tools_select.inc | 136 | ||||
-rw-r--r-- | testautomation/chart2/tools/ch_tools_statistics.inc | 429 | ||||
-rw-r--r-- | testautomation/chart2/tools/ch_tools_tab_borders_lines.inc | 144 | ||||
-rw-r--r-- | testautomation/chart2/tools/ch_tools_tab_pages.inc | 147 | ||||
-rw-r--r-- | testautomation/chart2/tools/ch_tools_titles.inc | 189 |
11 files changed, 2903 insertions, 0 deletions
diff --git a/testautomation/chart2/tools/ch_tools_axes.inc b/testautomation/chart2/tools/ch_tools_axes.inc new file mode 100644 index 000000000000..ef897fbc345f --- /dev/null +++ b/testautomation/chart2/tools/ch_tools_axes.inc @@ -0,0 +1,193 @@ +'encoding UTF-8 Do not remove or change this line! +'************************************************************************** +' DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +' +' Copyright 2000, 2010 Oracle and/or its affiliates. +' +' OpenOffice.org - a multi-platform office productivity suite +' +' This file is part of OpenOffice.org. +' +' OpenOffice.org is free software: you can redistribute it and/or modify +' it under the terms of the GNU Lesser General Public License version 3 +' only, as published by the Free Software Foundation. +' +' OpenOffice.org is distributed in the hope that it will be useful, +' but WITHOUT ANY WARRANTY; without even the implied warranty of +' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +' GNU Lesser General Public License version 3 for more details +' (a copy is included in the LICENSE file that accompanied this code). +' +' You should have received a copy of the GNU Lesser General Public License +' version 3 along with OpenOffice.org. If not, see +' <http://www.openoffice.org/license.html> +' for a copy of the LGPLv3 License. +' +'/************************************************************************ +'* +'* owner : oliver.craemer@oracle.com +'* +'* short description : Library for automation of the 'Insert::Axes...' dialog +'* +'************************************************************************************************** +'* +' #1 fInvokeAxesDialog +' #1 fCloseAxesDialogOK +' #1 fSetAxis +'* +'\************************************************************************************************ + +' Return codes (for all functions): +' Error 0: Success. +' Error 1: The basic action beeing applied caused a serious problem, e.g. a crash. +' Error 2 to 9: A functional problem occured. +' Error 11 to 19: Wrong marginal conditions end up in Failure, e.g. control not visible. +' Note: Following errors can be used for negative testing. +' Error 42: Wrong input. Probably only of interest during test development. +' Error 99: Unexpected behaviour - Shouldn't normally occur. +' Attention: +' Only error 42 and error 99 throw 'warnlogs'. +' All other errors are silent. +' They only throw QAErrorlogs the give a hint what probably went wrong. +' Expected Errors <b>must</b> exclusivly be handled by the calling routine. +' +'-------------------------------------------------------------------- +' +function fInvokeAxesDialog() as INTEGER + fInvokeAxesDialog = 99 +' Function to invoke the 'Insert::Axes...' dialog +' No Input +' Returns error-code: +' 0 := Sucess +' 1 := Serious problem trying to invoke the dialog +' 2 := Failure (Dialog not present after invocation) +'99 := Unexpected error + + printlog "** Invoking 'Insert::Axes...' in menu" + '/// Execute menu item 'Insert::Axes...' + try + InsertAxes + catch + qaErrorLog "Error 1: Invoking menu item 'Insert::Axes...' failed" + fInvokeAxesDialog = 1 + exit function + endcatch + + '/// Lookup if call was successful + Kontext "InsertAxesDialog" + if InsertAxesDialog.exists(2) then + printlog ">> Axes dialog is visible now." + fInvokeAxesDialog = 0 + else + qaErrorLog "Error 2: OOPS, calling the slot 'InsertAxes' didn't cause any problem ..." + qaErrorLog "..., BUT the dialog doesn't seem to be visible" + fInvokeAxesDialog = 2 + endif + + if fInvokeAxesDialog = 99 then + warnlog "Error 99: Something unexpected happened!!" + endif +end function +' +'-------------------------------------------------------------------- +' +function fCloseAxesDialogOK() as INTEGER + fCloseAxesDialogOK = 99 +' Function to close the Axes dialog using OK button +' No Input +' Returns error-code: +' 0 := Sucess +' 1 := Serious problem trying to Close the dialog +' 2 := Failure (Dialog present after applying OK button) +'15 := Dialog not present before closing +'99 := Unexpected error + printlog "** Closing Axes dialog" + Kontext "InsertAxesDialog" + '/// Check existence of Axes dialog + if InsertAxesDialog.exists(2) then + printlog ">> Axes dialog is visible as expected." + else + ' Return Error 15 and quit if dialog not found + qaErrorLog "Error 15: OOPS, Axes dialog should be visible ..." + qaErrorLog "... this is a BUG or a scripting error -> Check this out!" + fCloseAxesDialogOK = 15 + exit function + endif + '/// Click OK button in Axes dialog + try + InsertAxesDialog.OK + catch + qaErrorLog "Error 1: Closing the Axes dialog seems to have a serious problem -> Check this out!" + fCloseAxesDialogOK = 1 + exit function + endcatch + '/// Check that Axes dialog is not visible anymore + Kontext "InsertAxesDialog" + if InsertAxesDialog.exists(2) then + ' Return Error 2 if still present + qaErrorLog "Error 2: Axes dialog should be invisible now ..." + qaErrorLog "... closing the dialog doesn't seem to work -> Check this out!" + fCloseAxesDialogOK = 2 + else + printlog ">> Closing the Axes dialog seems to work as expected" + fCloseAxesDialogOK = 0 + endif + + if fCloseAxesDialogOK = 99 then + warnlog "Error 99: Something unexpected happened!!" + endif +end function +' +'-------------------------------------------------------------------- +' +function fSetAxis ( oAxis as OBJECT , bAxisCheck as BOOLEAN ) as INTEGER + fSetAxis = 99 +' Function to check-boxes in Axes dialog +' Input: +' OBJECT oAxis +' Axis Indicator (Name of declaration): Major[XYZ]Axis, Secondary[XY]Axis are valid names +' BOOLEAN bAxisCheck +' TRUE := Check Axis +' FALSE := Uncheck Axis +' Returns error-code: +' 0 := Sucess +' 1 := Serious problem trying to check axis +' 2 := Axis was not set +'12 := Check-box for desired axis is not enabled +'99 := Unexpected error + printlog "** Setting axis" + '/// Check if desired axis check-box is enabled + if NOT oAxis.IsEnabled then + qaErrorLog "Error 12: Check-box for desired axis is not enabled" + qaErrorLog "... BUG or Script problem -> Check this out!" + fSetAxis = 12 + exit function + endif + '/// Try to (Un)Check desired axis + Kontext "InsertAxesDialog" + try + if bAxisCheck then + oAxis.Check + else + oAxis.UnCheck + endif + catch + ' Throw error 1 and quit on serious problem + qaErrorLog "Error 1: Check axis seems to cause a serious problem -> Check this out!" + fSetAxis = 1 + exit function + endcatch + '/// Verify (against input) if axis was checked + if oAxis.IsChecked = bAxisCheck then + fSetAxis = 0 + printlog ">> Chech axis seems to work" + else + qaErrorLog "Error 2: Axis was not checked -> Check this out!" + fSetAxis = 2 + endif + + if fSetAxis = 99 then + warnlog "Error 99: Something unexpected happened!!" + endif +end function + diff --git a/testautomation/chart2/tools/ch_tools_chart_type.inc b/testautomation/chart2/tools/ch_tools_chart_type.inc new file mode 100644 index 000000000000..7cf0a1e7d61b --- /dev/null +++ b/testautomation/chart2/tools/ch_tools_chart_type.inc @@ -0,0 +1,641 @@ +'encoding UTF-8 Do not remove or change this line! +'************************************************************************** +' DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +' +' Copyright 2000, 2010 Oracle and/or its affiliates. +' +' OpenOffice.org - a multi-platform office productivity suite +' +' This file is part of OpenOffice.org. +' +' OpenOffice.org is free software: you can redistribute it and/or modify +' it under the terms of the GNU Lesser General Public License version 3 +' only, as published by the Free Software Foundation. +' +' OpenOffice.org is distributed in the hope that it will be useful, +' but WITHOUT ANY WARRANTY; without even the implied warranty of +' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +' GNU Lesser General Public License version 3 for more details +' (a copy is included in the LICENSE file that accompanied this code). +' +' You should have received a copy of the GNU Lesser General Public License +' version 3 along with OpenOffice.org. If not, see +' <http://www.openoffice.org/license.html> +' for a copy of the LGPLv3 License. +' +'/************************************************************************ +'* +'* owner : oliver.craemer@oracle.com +'* +'* short description : Tool library for chart type dialog +'* +'************************************************************************************************** +'* +' #1 fInvokeChartTypeDialog +' #1 fCloseChartTypeDialogOK +' #1 fSetChartType +' #1 fSetChartTypeVariant +' #1 fSetChartType3D +' #1 fSetChartLook3D +' #1 fSetChartShape3D +' #1 fSetStackSeries +' #1 fSetSmoothLines +' #1 fInvokeSmoothLineProperties +' #1 fCloseSmoothLinePropertiesOK +'* +'\************************************************************************************************ + +' ch_tools_chart_type.inc - A library for automation of the Chart Type dialog +' This Include contains a set of functions to modify the controls of the chart type dialog. +' All functions are designed to return error-codes depending on the behaviour of the action applied. +' Return codes: +' Error 0: Success. +' Error 1: The basic action beeing applied caused a serious problem, e.g. a crash. +' Error 2 TO 9: A functional problem occured. +' Error 11 TO 19: Wrong marginal conditions end up in failure, e.g. control not visible. +' +' NOTE: Following errors can also be used for 'negative' testing. +' Error 42: Wrong input. Probably only of interest during test development. +' Error 99: Unexpected behaviour - Shouldn't normally occur. +' ATTENTION: +' Only Errors 42 and 99 throw 'warnlogs' +' All other errors are silent. +' They only throw QAErrorlogs the give a hint what probably went wrong. +' Expected Errors MUST exclusivly be handled by the calling routine! +' +'------------------------------------------------------------------------- +' +function fInvokeChartTypeDialog() as INTEGER + fInvokeChartTypeDialog = 99 +' Function to invoke the 'Format::Chart Type...' dialog +' No Input +' Returns error-code: +' 0 := Sucess +' 1 := Serious problem trying to invoke the dialog +' 2 := Failure (Dialog not present after invocation) +' 99 := Unexpected error + + printlog "** Invoking 'Format::Chart Type' in menu" + '/// Execute menu item 'Format::Chart type' + try + FormatChartType + catch + qaErrorLog "Error 1: Invoking menu item 'Format::Chart Type' failed" + fInvokeChartTypeDialog = 1 + exit function + endcatch + + '/// Lookup if call was successful + Kontext "ChartType" + if ChartType.exists(2) then + printlog ">> 'Chart Type' dialog is visible now." + fInvokeChartTypeDialog = 0 + else + qaErrorLog "Error 2: OOPS, calling the slot 'FormatChartType' didn't cause any problem ..." + qaErrorLog "..., BUT the dialog doesn't seem to be visible" + fInvokeChartTypeDialog = 2 + endif + + if fInvokeChartTypeDialog = 99 then + warnlog "Error 99: Something unexpected happened!!" + endif +end function +' +'-------------------------------------------------------------------- +' +function fCloseChartTypeDialogOK() as INTEGER + fCloseChartTypeDialogOK = 99 +' Function to close the 'Chart Type' dialog using OK button +' No Input +' Returns error-code: +' 0 := Sucess +' 1 := Serious problem trying to Close the dialog +' 2 := Failure (Dialog present after applying OK button) +' 15 := Dialog not present before closing +' 99 := Unexpected error + + printlog "** Closing 'Chart Type' dialog" + Kontext "ChartType" + '/// Check existence of Chart Type(Wizard) dialog + if ChartType.exists(2) then + printlog ">> 'Chart Type' dialog is visible as expected." + else + '-> Return Error 15 and quit if dialog not found + qaErrorLog "Error 15: OOPS, 'Chart Type' dialog should be visible ..." + qaErrorLog "... this is a BUG or a scripting error -> Check this out!" + fCloseChartTypeDialogOK = 15 + exit function + endif + try + '/// Click on OK + ChartType.OK + printlog "Chart Type dialog has been successfull closed with OK button." + catch + qaErrorLog "Error 1: Closing the 'Chart Type' dialog seems to have a serious problem -> Check this out!" + fCloseChartTypeDialogOK = 1 + exit function + endcatch + '/// Check if the Chart Type(Wizard) dialog gone + if ChartType.Exists(2) then + '-> Return Error 2 if still present + qaErrorLog "Error 2: 'Chart Type' dialog should be invisible now ..." + qaErrorLog "... closing the dialog doesn't seem to work -> Check this out!" + fCloseChartTypeDialogOK = 2 + else + printlog ">> Closing the 'Chart Type' dialog seems to work as expected" + fCloseChartTypeDialogOK = 0 + endif + + if fCloseChartTypeDialogOK = 99 then + warnlog "Error 99: Something unexpected happened!!" + endif +end function +' +'-------------------------------------------------------------------- +' +function fSetChartType ( sChartType as STRING ) as INTEGER + 'Function to choose a chart type in 'Chart Type' dialog + fSetChartType = 99 + + ' Input: STRING sChartType (English UI name of chart type to select) + ' column + ' bar + ' pie + ' area + ' line + ' xy + ' bubble + ' net + ' stock + ' column_line + ' Output (Error-codes) + ' 0 = Sucess + ' 1 = Serious problem trying to select chart type + ' 2 = Failure (wrong chart type selected) + ' 42 = User error, unknown chart type + ' 99 = Unexpected error + + dim iEntryInList as INTEGER + + printlog "** Selecting the chart type" + ' Translate UI string to positon in control 'ChooseType' + select case lCase ( sChartType ) + case "column" : iEntryInList = 1 + case "bar" : iEntryInList = 2 + case "pie" : iEntryInList = 3 + case "area" : iEntryInList = 4 + case "line" : iEntryInList = 5 + case "xy" : iEntryInList = 6 + case "bubble" : iEntryInList = 7 + case "net" : iEntryInList = 8 + case "stock" : iEntryInList = 9 + case "column_line" : iEntryInList = 10 + case else + fSetChartType = 42 + warnlog "USER ERROR: Input doesn't match!" + exit function + end select + Kontext "ChartType" + '/// Select chart type + try + ChooseType.Select ( iEntryInList ) + catch + qaErrorLog "Error 1: Selecting the chart type seems to cause a serious problem -> Check this out!" + fSetChartType = 1 + exit function + endcatch + '/// Check if entry was selected + if ChooseType.GetSelText = ChooseType.GetItemText ( iEntryInList ) then + printlog ">> The desired chart type was selected." + fSetChartType = 0 + else + ' Throw Error 2 if selection fails + qaErrorLog "Error 2: Selecting the desired chart type seems to fail -> Check this out!" + fSetChartType = 2 + endif + + if fSetChartType = 99 then + warnlog "Error 99: Something unexpected happened!!" + endif +end function +' +'-------------------------------------------------------------------- +' +function fSetChartTypeVariant ( iChartTypeVariant as INTEGER ) as INTEGER + ' Function to select the chart type variant + ' Input: INTEGER iChartTypeVariant (Position in variant control) + ' Posible Values are 1,2,3,4 (depending on the chart type) + ' Output (Error-codes) + ' 0 = Sucess + ' 1 = Serious problem while selecting the variant control + ' 42 = User error, input out of range + ' 99 = Unexpected error + + fSetChartTypeVariant = 99 + + dim iMaximumVariant as INTEGER + dim iChartTpye as INTEGER + + Kontext "ChartType" + ' Lookup valid input range for variant depending on chart type + iChartTpye = ChooseType.getSelIndex + + select case iChartTpye + case 1, 2 : + if Look3D.isChecked then + iMaximumVariant = 4 + else + iMaximumVariant = 3 + endif + case 7 : iMaximumVariant = 1 + case 4 : iMaximumVariant = 3 + case 3, 5, 6, 8 ,9 : iMaximumVariant = 4 + case 10 : iMaximumVariant = 2 + end select + + ' Check if input matches this range + if (iChartTypeVariant < 1) OR (iChartTypeVariant > iMaximumVariant) then + fSetChartTypeVariant = 42 + warnlog "USER ERROR: Input doesn't match!" + exit function + endif + + printlog " Selecting the chart type variant" + '/// Select the chart variant + Kontext "ChartType" + try + variant.typeKeys "<HOME>" + variant.typeKeys "<RIGHT>", (iChartTypeVariant - 1) + fSetChartTypeVariant = 0 + printlog "Selecting the chart variant probably worked" + catch + ' Throw error 1 and quit on serious problem + QAErrorLog "Error 1: Selecting variant seems to cause a serious problem -> Check this out!" + fSetChartTypeVariant = 1 + exit function + endcatch + + if fSetChartTypeVariant = 99 then + warnlog "Error 99: Something unexpected happened!!" + endif +end function +' +'-------------------------------------------------------------------- +' +function fSetChartType3D ( bEnable3D as BOOLEAN ) as INTEGER + fSetChartType3D = 99 +' Function to select the 3D option +' Input: +' BOOLEAN bEnable3D: +' Enable (TRUE) or Disable (FALSE) 3D chart. +' Returns error-code: +' 0 = Sucess +' 1 = Serious problem while (de)selecting 3D check-box +' 11 = 3D control not visible +' 12 = 3D control not enabled +' 99 = Unexpected error. + printlog "Selecting the chart 3D feature" + 'Check visibility of 3D check-box + Kontext "ChartType" + if NOT Look3D.isVisible then + QAErrorLog "Error 11: 3D check box has to be visible to check it." + fSetChartType3D = 11 + exit function + endif + '/// Check if 3D check-box is enabled + if NOT Look3D.isEnabled then + qaErrorLog "Error 12: 3D check box has to be enabled to check it." + fSetChartType3D = 12 + exit function + endif + '/// (Un)Check 3D check-box + try + if bEnable3D then + Look3D.Check + else + Look3D.unCheck + endif + fSetChartType3D = 0 + catch + ' Throw error 1 and quit on serious problem + qaErrorLog "Error 1: (Un)Checking the 3D check box seems to cause a serious issue -> Check this out!" + fSetChartType3D = 1 + exit function + endcatch + + if fSetChartType3D = 99 then + warnlog "Error 99: Something unexpected happened!!" + endif +end function +' +'-------------------------------------------------------------------- +' +function fSetChartLook3D ( sSetLook as STRING ) as INTEGER + fSetChartLook3D = 99 +' Function to select the 3D look/// +' Input: STRING sSetLook (English UI name of 3D look) +' simple +' realistic +' Returns error-code: +' 0 = Sucess +' 1 = Serious problem while selecting 3D look +' 12 = 3D look not enabled +' 42 = User error, input doesn't match +' 99 = Unexpected error + dim iEntryInList as INTEGER + ' Translate SIMPLE or REALISTIC to item no. in list-box + select case lcase(sSetLook) + case "simple" : iEntryInList = 1 + printlog "Selecting the chart 3D look 'simple' (default)" + case "realistic" : iEntryInList = 2 + printlog "Selecting the chart 3D look 'realistic'" + case else + fSetChartLook3D = 42 + warnlog "USER ERROR: Input doesn't match!" + exit function + end select + '/// Check if 3D look list-box is enabled + if NOT Scheme3D.isEnabled then + QAErrorLog "Error 12: 3D check box has to be checked to set 3D look ..." + QAErrorLog "... BUG or Script problem -> Check this out!" + fSetChartLook3D = 12 + exit function + endif + '/// Select desired item in list-box + try + Scheme3D.Select ( iEntryInList ) + fSetChartLook3D = 0 + printlog "Selecting the chart 3D scheme seems to work." + catch + ' Throw error 1 and quit on serious problem + qaErrorLog "Error 1: Selecting the 3D look seems to cause a serious issue -> Check this out!" + fSetChartLook3D = 1 + exit function + endcatch + + if fSetChartLook3D = 99 then + warnlog "Error 99: Something unexpected happened!!" + endif +end function +' +'-------------------------------------------------------------------- +' +function fSetChartShape3D ( sSetShape as STRING ) as INTEGER + fSetChartShape3D = 99 +' Function to select the 3D shape/// +' Input: STRING sSetShape (English UI name of shape) +' box +' cylinder +' cone +' pyramid +' Returns (Error-codes): +' 0 = Sucess +' 1 = Serious problem while selecting 3D shape +' 11 = 3D look not visible +' 12 = 3D look not enabled +' 42 = User error, input doesn't match +' 99 = Unexpected error + + dim iEntryInList as INTEGER + ' Translate shape UI name to item no. in list-box + select case lcase ( sSetShape ) + case "box" : iEntryInList = 1 + case "cylinder" : iEntryInList = 2 + case "cone" : iEntryInList = 3 + case "pyramid" : iEntryInList = 4 + case else + fSetChartShape3D = 42 + warnlog "USER ERROR: Input doesn't match!" + exit function + end select + printlog "Selecting the chart 3D shape" + '/// Check if shape list-box is visible + if NOT BarColumnShape.isVisible then + QAErrorLog "Error 11: List box has to be visible to select 3D shape ..." + fSetChartShape3D = 11 + exit function + endif + '/// Check if shape list-box is enabled + if NOT BarColumnShape.isEnabled then + QAErrorLog "Error 12: List box has to be enabled to select 3D shape ..." + fSetChartShape3D = 12 + exit function + endif + '/// Select desired entry in list-box + try + BarColumnShape.Select ( iEntryInList ) + fSetChartShape3D = 0 + printlog "Selecting the chart 3D shape seems to work." + catch + ' Throw error 1 and quit on serious problem + qaErrorLog "Error 1: Selecting the 3D shape seems to cause a serious issue -> Check this out!" + fSetChartShape3D = 1 + exit function + endcatch + + if fSetChartShape3D = 99 then + warnlog "Error 99: Something unexpected happened!!" + endif +end function +' +'-------------------------------------------------------------------- +' +function fSetStackSeries ( sStackMode as STRING ) as INTEGER + fSetStackSeries = 99 + ' Function to adjust data stacking feature/// + ' Input: + ' STRING sStackMode: + ' Select stack mode using three controls + ' <i>disable - Uncheck 'Stack Series' check-box + ' <i>ontop - Check 'Stack Series' check-box and check 'On Top' radio button + ' <i>percent - Check 'Stack Series' check-box and check 'Percent' radio button + ' Returns error-code: + ' 0 := Sucess. + ' 1 := Serious problem while selecting stack mode. + ' 11 := 'Stack Series' not visible + ' 42 := User error, input doesn't match. + ' 99 := Unexpected error. + + printlog "" + printlog "** Selecting the Stack Series Option" + '/// Check visibility of 'Stack Series' + if NOT StackSeries.isVisible then + qaErrorLog "Error 11: 'Stack Series' check-box has to be visible to set this feature" + qaErrorLog "... BUG or Script problem -> Check this out!" + fSetStackSeries = 11 + exit function + endif + '/// Select desired control combination + try + select case lcase ( sStackMode ) + case "disable" + StackSeries.Uncheck + case "ontop" + StackSeries.Check + OnTop.Check + case "percent" + StackSeries.Check + Percent.Check + case else + fSetStackSeries = 42 + warnlog "USER ERROR: Input doesn't match!" + exit function + end select + fSetStackSeries = 0 + printlog ">> Selecting the 'Stack Series' mode seems to work." + catch + ' Throw error 1 and quit on serious problem/// + qaErrorLog "Error 1: Selecting the 'Stack Series' mode seems to cause a serious issue -> Check this out!" + fSetStackSeries = 1 + exit function + endcatch + + if fSetStackSeries = 99 then + warnlog "Error 99: Something unexpected happened!!" + endif +' +end function +' +'-------------------------------------------------------------------- +' +function fSetSmoothLines ( bEnableSmoothLines as BOOLEAN ) as INTEGER + fSetSmoothLines = 99 + ' Function to adjust smooth lines feature + ' Input: + ' BOOLEAN bEnableSmoothLines: + ' Enable (TRUE), Disable (FALSE)'Smooth Lines' + ' Returns error-code: + ' 0 := Sucess. + ' 1 := Serious problem while Enabling/Disable 'Smooth Lines. + ' 11 := 'Smooth lines' not visible + ' 42 := User error, input doesn't match. + ' 99 := Unexpected error. + + printlog "" + printlog "** Selecting the Smooth Lines Option" + '/// Check if 'Smooth Lines' check-box is visible + if NOT SmoothLines.isVisible then + qaErrorLog "Error 11: 'Smooth Lines' check-box has to be visible to set this feature" + qaErrorLog "... BUG or Script problem -> Check this out!" + fSetSmoothLines = 11 + exit function + endif + '/// (Un)Check 'Smooth Lines' check-box + try + if bEnableSmoothLines then + SmoothLines.Check + else + SmoothLines.UnCheck + endif + fSetSmoothLines = 0 + printlog ">> (Un)Selecting the 'Smooth Lines' seems to work." + catch + ' Throw error 1 and quit on serious problem + qaErrorLog "Error 1: (Un)Selecting 'Smooth Lines' seems to cause a serious issue -> Check this out!" + fSetSmoothLines = 1 + exit function + endcatch + + if fSetSmoothLines = 99 then + warnlog "Error 99: Something unexpected happened!!" + endif +end function +' +'-------------------------------------------------------------------- +' +function fInvokeSmoothLineProperties() as INTEGER + fInvokeSmoothLineProperties = 99 +' Click 'Smooth Lines' button to invoke 'Smooth Lines Properties' dialog/// +' No Input +' Returns error-code: +' 0 := Sucess +' 1 := Serious problem trying to invoke the dialog +' 2 := Failure (Dialog not present after invocation) +' 11 := 'Smooth Lines' button isn't visible +' 99 := Unexpected error + + printlog "" + printlog "** Set the Smooth Line Properties" + '/// Check if 'Smooth Lines' button is visible + if NOT SmoothLineProperties.isVisible then + qaErrorLog "Error 11: 'Smooth Lines Properties' button has to be visible to open the dialog ..." + qaErrorLog "... BUG or Script problem -> Check this out!" + fInvokeSmoothLineProperties = 11 + exit function + endif + '/// Click 'Smooth Lines' button + try + SmoothLineProperties.Click + catch + ' Throw error 1 and quit on serious problem + qaErrorLog "Error 1: Opening 'Smooth Lines Properties' seems to cause a serious issue -> Check this out!" + fInvokeSmoothLineProperties = 1 + exit function + endcatch + '/// Check if 'Smooth Lines Properties' dialog exists + Kontext "SmoothLineProperties" + if SmoothLineProperties.exists(1) then + printlog ">> OK, found 'Smooth Lines Properties' dialog" + fInvokeSmoothLineProperties = 0 + else + ' Throw error 2 and quit if opening dialog failed + qaErrorLog "Error 2: Click 'Smooth Lines Properties' button seems to have no effect -> Check this out!" + fInvokeSmoothLineProperties = 2 + exit function + endif + + if fInvokeSmoothLineProperties = 99 then + warnlog "Error 99: Something unexpected happened!!" + endif +end function +' +'-------------------------------------------------------------------- +' +function fCloseSmoothLinePropertiesOK() as INTEGER + fCloseSmoothLinePropertiesOK = 99 +' Function to close the 'Smooth Lines Properties' dialog using OK button/// +' No Input +' Returns error-code: +' 0 := Sucess +' 1 := Serious problem trying to Close the dialog +' 2 := Failure (Dialog present after applying OK button) +' 3 := 'Smooth Lines' check-box isn't checked after closing the dialog +' 99 := Unexpected error + + printlog "** Closing the 'Smooth Line Properties' dialog" + '/// Closing the 'Smooth Line Properties' dialog using OK button + Kontext "SmoothLineProperties" + try + SmoothLineProperties.OK + catch + ' Throw error 1 and quit on serious problem + qaErrorLog "Error 1: Closing the 'Smooth Line Properties' dialog seems to cause a serious issue -> Check this out!" + fCloseSmoothLinePropertiesOK = 1 + exit function + endcatch + '/// Check if 'Smooth Lines Properties' dialog does not exist + Kontext "SmoothLineProperties" + if SmoothLineProperties.exists(1) then + ' Throw error 2 and quit if closing dialog failed + qaErrorLog "Error 2: Click 'Smooth Lines Properties' OK button seems to have no effect -> Check this out!" + fCloseSmoothLinePropertiesOK = 2 + exit function + else + printlog ">> OK, closing the 'Smooth Line Properties' dialog seems to work" + endif + '/// Check if 'Smooth Lines' check-box is checked + Kontext "ChartType" + if SmoothLines.IsChecked then + printlog ">> OK, after adjusting 'Smooth Line Properties' dialog 'Smooth Lines' check-box should always be visible!" + fCloseSmoothLinePropertiesOK = 0 + else + ' Throw error 3 'Smooth Lines' check-box is NOT checked + qaErrorLog "Error 3: After adjusting 'Smooth Line Properties' dialog the 'Smooth Lines' check-box should have been visible! -> Check this out!" + fCloseSmoothLinePropertiesOK = 3 + endif + + if fCloseSmoothLinePropertiesOK = 99 then + warnlog "Error 99: Something unexpected happened!!" + endif +end function + diff --git a/testautomation/chart2/tools/ch_tools_common.inc b/testautomation/chart2/tools/ch_tools_common.inc new file mode 100644 index 000000000000..f6d722fa2a25 --- /dev/null +++ b/testautomation/chart2/tools/ch_tools_common.inc @@ -0,0 +1,212 @@ +'encoding UTF-8 Do not remove or change this line! +'************************************************************************** +' DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +' +' Copyright 2000, 2010 Oracle and/or its affiliates. +' +' OpenOffice.org - a multi-platform office productivity suite +' +' This file is part of OpenOffice.org. +' +' OpenOffice.org is free software: you can redistribute it and/or modify +' it under the terms of the GNU Lesser General Public License version 3 +' only, as published by the Free Software Foundation. +' +' OpenOffice.org is distributed in the hope that it will be useful, +' but WITHOUT ANY WARRANTY; without even the implied warranty of +' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +' GNU Lesser General Public License version 3 for more details +' (a copy is included in the LICENSE file that accompanied this code). +' +' You should have received a copy of the GNU Lesser General Public License +' version 3 along with OpenOffice.org. If not, see +' <http://www.openoffice.org/license.html> +' for a copy of the LGPLv3 License. +' +'/************************************************************************ +'* +'* owner : oliver.craemer@oracle.com +'* +'* short description : Chart2 Tool library +'* +'\************************************************************************************************ + +sub fInsertOLE() as boolean + + ' Insert an OLE object (the name is localized) + call GetOleDefaultNames() + + '/// Insert / Object / OLE + InsertObjectOLEObject + + Kontext "OLEObjektEinfuegen" + if ( OLEObjektEinfuegen.exists( 1 ) ) then + + if ( Objekttyp.getItemcount() = 0 ) then + + warnlog( "fInsertOLE(): There are no OLE-Objects in the <Objekttyp> listbox" ) + OLEObjektEinfuegen.cancel() + fInsertOLE() = false + + else + + try + Objekttyp.Select gOLEChart + OLEObjektEinfuegen.ok() + sleep( 2 ) + fInsertOLE() = true + catch + warnlog( "fInsertOLE(): Invalid OLE Object selected: " & gOLEChart ) + OLEObjektEinfuegen.cancel() + fInsertOLE() = false + endcatch + + endif + + else + warnlog( "fInsertOLE(): Failed to open <Insert OLE object> dialog" ) + fInsertOLE() = false + endif + +end sub +' +'-------------------------------------------------------------------- +' +function fLoadVerySimpleChart() as INTEGER + fLoadVerySimpleChart = 99 + 'Load file with a very simple chart + 'No Input + 'Returns error-code: + '+ 0 := Sucess + '+ 1 := Serious problem trying to load the document + '+99 := Unexpected error + + dim sInputFile as string + sInputFile = convertpath( gtesttoolpath & "chart2/required/input/verySimpleChart.ods" ) + '/// Load file <i>gTesttoolpath</i>/chart2/required/input/verySimpleChart.ods + try + call hFileOpen ( sInputFile ) + printlog "File with very simple chart loaded" + fLoadVerySimpleChart = 0 + catch + qaErrorLog "Loading file with very simple chart seems to fail" + fLoadVerySimpleChart = 1 + endcatch +end function +' +'-------------------------------------------------------------------- +' +function fLoadVerySimpleChartAndSaveLocal() as INTEGER + fLoadVerySimpleChartAndSaveLocal = 99 + 'Load file with a very simple chart and save it loacally + 'No Input + 'Returns error-code: + '+ 0 := Sucess + '+ 1 := Serious problem trying to load the document + '+ 2 := Serious problem trying to save the document + + dim iCheckIsFileLoaded as INTEGER + dim sOutputFile as STRING + sOutputFile = convertpath( gOfficepath & "user/work/verySimpleChart.ods" ) + iCheckIsFileLoaded = fLoadVerySimpleChart() + if iCheckIsFileLoaded > 0 then + 'When loading fails pass error code to current function + fLoadVerySimpleChartAndSaveLocal = iCheckIsFileLoaded + exit function + else + printlog "File with very simple chart loaded successfully." + endif + '/// Save document local + Kontext "DocumentCalc" + DocumentCalc.TypeKeys "<ESCAPE>" + DocumentCalc.TypeKeys "<MOD1 HOME>" + if NOT hFileSaveAsKill (sOutputFile) then + fLoadVerySimpleChartAndSaveLocal = 2 + qaErrorLog "Saving test document localy failed -> Aborting" + call hCloseDocument + exit function + else + printlog "File with very simple chart saved successfully." + endif + fLoadVerySimpleChartAndSaveLocal = 0 +end function +' +'-------------------------------------------------------------------- +' +function fConvertChartTo3D() as BOOLEAN + fConvertChartTo3D = FALSE + 'Function to invoke the 'Insert::Titles...' dialog + 'No Input + 'Returns TRUE on success + + '/// Invoke Format::Chart Type... + if fInvokeChartTypeDialog() > 0 then + warnlog "Invoking 'Format::Chart Type...' seems to cause an Error" + exit function + endif + '/// Check 3D box + if fSetChartType3D ( TRUE ) = 0 then + fConvertChartTo3D = TRUE + else + warnlog "Converting chart to 3D seems to cause an Error" + exit function + endif + '/// Close Chart Type dialog with OK + if fCloseChartTypeDialogOK() > 0 then + warnlog "Closing Chart Type dialog seems to cause an Error" + fConvertChartTo3D = FALSE + endif +end function +' +'------------------------------------------------------------------------- +' +function fOpenTestDocumentAndSelectDataRange(sInputFile as string) as BOOLEAN + fOpenTestDocumentAndSelectDataRange = FALSE + call hFileOpen(sInputFile) + sleep(2) + Call sMakeReadOnlyDocumentEditable() + '/// Select chart using navigator + printlog "Select chart using navigator" + call fSelectFirstOLE + '/// Edit / Object / Edit + printlog "Edit / Object / Edit" + EditObjectEdit + '///Open FORMAT / DATA RANGES + printlog "Open FORMAT / DATA RANGES" + FormatDataRanges + WaitSlot() + '///Switch to tabpage Data Range + printlog "Switch to tabpage Data Range" + Kontext + 'Switching tabpages as workaround for #i77237# + Active.SetPage TabChartTypeDataSeries + QAErrorLog "#i77237#-Testtool can't access OK after switching tabpage" + Active.SetPage TabChartTypeDataRange + Kontext "TabChartTypeDataRange" + call DialogTest ( TabChartTypeDataRange ) + fOpenTestDocumentAndSelectDataRange = TRUE +end function +' +'------------------------------------------------------------------------- +' +function fOpenTestDocumentAndInsertChart(sInputFile as string) as BOOLEAN + fOpenTestDocumentAndInsertChart = FALSE + call hFileOpen(sInputFile) + sleep(2) + Call sMakeReadOnlyDocumentEditable() + Kontext "DocumentCalc" + printlog "Type <STRG+HOME>" + DocumentCalc.TypeKeys "<MOD1 HOME>" + printlog "Type twice <RIGHT> cursor key" + DocumentCalc.TypeKeys "<RIGHT>" , 2 + printlog "Type thrice <DOWN> cursor key" + DocumentCalc.TypeKeys "<DOWN>" , 3 + printlog "Menu Insert chart to open chart wizard" + InsertChart + try + WaitSlot() + fOpenTestDocumentAndInsertChart = TRUE + catch + fOpenTestDocumentAndInsertChart = FALSE + endcatch +end function diff --git a/testautomation/chart2/tools/ch_tools_data_labels.inc b/testautomation/chart2/tools/ch_tools_data_labels.inc new file mode 100644 index 000000000000..879ddae59361 --- /dev/null +++ b/testautomation/chart2/tools/ch_tools_data_labels.inc @@ -0,0 +1,369 @@ +'encoding UTF-8 Do not remove or change this line! +'************************************************************************** +' DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +' +' Copyright 2000, 2010 Oracle and/or its affiliates. +' +' OpenOffice.org - a multi-platform office productivity suite +' +' This file is part of OpenOffice.org. +' +' OpenOffice.org is free software: you can redistribute it and/or modify +' it under the terms of the GNU Lesser General Public License version 3 +' only, as published by the Free Software Foundation. +' +' OpenOffice.org is distributed in the hope that it will be useful, +' but WITHOUT ANY WARRANTY; without even the implied warranty of +' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +' GNU Lesser General Public License version 3 for more details +' (a copy is included in the LICENSE file that accompanied this code). +' +' You should have received a copy of the GNU Lesser General Public License +' version 3 along with OpenOffice.org. If not, see +' <http://www.openoffice.org/license.html> +' for a copy of the LGPLv3 License. +' +'/************************************************************************ +'* +'* owner : oliver.craemer@oracle.com +'* +'* short description : Tool library for Data Labels dialog +'* +'************************************************************************************************** +'* +' #1 fInvokeDataLabelsDialog +' #1 fCloseDataLabelsDialogOK +' #1 fSetShowValue +' #1 fSetValueType +' #1 fSetShowLabelText +' #1 fSetShowLegendIconWithLabel +'* +'\************************************************************************************************ + +'ch_tools_data_labels.inc - Library for automation of the 'Insert::Data Labels...' dialog +'This Include contains a set of functions to modify the controls of the Data Labels dialog. +'All functions are designed to return error-codes depending on the behaviour of the action applied. +'Return codes: +'Error 0: Success. +'Error 1: The basic action beeing applied caused a serious problem, e.g. a crash. +'Error 2 TO 9: A functional problem occured. +'Error 11 TO 19: Wrong marginal conditions end up in Failure, e.g. control not visible. +'NOTE: This errors can also be used for 'negative' testing. +'Error 42: Wrong input. Probably only of interest during test development . +'Error 99: Unexpected behaviour - Shouldn't normally occur. +'ATTENTION: +'Only Errors 42 and 99 throw 'Warnlogs'. +'All other errors are silent! +'They only throw QAErrorlogs the give a hint what probably went wrong. +'Expected Errors MUST exclusivly be handled by the calling routine! +' +'-------------------------------------------------------------------- +' +function fInvokeDataLabelsDialog() as INTEGER + fInvokeDataLabelsDialog = 99 +'///<u><b>Function to invoke the 'Insert::Data Labels...' dialog</b></u>/// +'///No Input +'///Returns error-code: +'///+ 0 := Sucess +'///+ 1 := Serious problem trying to invoke the dialog +'///+ 2 := Failure (Dialog not present after invocation) +'///+99 := Unexpected error + +'///<u><b>Step-by-Step</b></u>/// +'///<ul> + printlog "" + printlog "** Invoking 'Insert::Data Labels...' in menu" + '///+<li>Execute menu item 'Insert::Data Labels...'</li>/// + try + InsertDataLabels + catch + qaErrorLog "Error 1: Invoking menu item 'Insert::Data Labels...' failed" + fInvokeDataLabelsDialog = 1 + exit function + endcatch + + '///+<li>Lookup if call was successful</li>/// + Kontext "InsertLabelsDialog" + if InsertLabelsDialog.exists(2) then + printlog ">> Data Labels dialog is visible now." + fInvokeDataLabelsDialog = 0 + else + qaErrorLog "Error 2: OOPS, calling the slot 'InsertDataLabels' didn't cause any problem ..." + qaErrorLog "..., BUT the dialog doesn't seem to be visible" + fInvokeDataLabelsDialog = 2 + endif + + if fInvokeDataLabelsDialog = 99 then + warnlog "Error 99: Something unexpected happened!!" + endif +'///</ul> +end function +' +'-------------------------------------------------------------------- +' +function fCloseDataLabelsDialogOK() as INTEGER + fCloseDataLabelsDialogOK = 99 +'///<u><b>Function to close the Data Labels dialog using OK button</b></u>/// +'///No Input +'///Returns error-code: +'///+ 0 := Sucess +'///+ 1 := Serious problem trying to Close the dialog +'///+ 2 := Failure (Dialog present after applying OK button) +'///+15 := Dialog not present before closing +'///+99 := Unexpected error + +'///<u><b>Step-by-Step</b></u>/// +'///<ul> + printlog " " + printlog "** Closing Data Labels dialog" + Kontext "InsertLabelsDialog" + '///+<li>Check existence of Data Labels dialog</li>/// + if InsertLabelsDialog.exists(2) then + printlog ">> Data Labels dialog is visible as expected." + else + '///+<li>-> Return Error 15 and quit if dialog not found</li>/// + qaErrorLog "Error 15: OOPS, Data Labels dialog should be visible ..." + qaErrorLog "... this is a BUG or a scripting error -> Check this out!" + fCloseDataLabelsDialogOK = 15 + exit function + endif + '///+<li>Click OK button in Data Labels dialog</li>/// + try + InsertLabelsDialog.OK + catch + qaErrorLog "Error 1: Closing the Data Labels dialog seems to have a serious problem -> Check this out!" + fCloseDataLabelsDialogOK = 1 + exit function + endcatch + '///+<li>Check existence of Data Labels dialog</li>/// + Kontext "InsertLabelsDialog" + if InsertLabelsDialog.exists(2) then + '///+<li>-> Return Error 2 if still present</li>/// + qaErrorLog "Error 2: Data Labels dialog should be invisible now ..." + qaErrorLog "... closing the dialog doesn't seem to work -> Check this out!" + fCloseDataLabelsDialogOK = 2 + else + printlog ">> Closing the Data Labels dialog seems to work as expected" + fCloseDataLabelsDialogOK = 0 + endif + + if fCloseDataLabelsDialogOK = 99 then + warnlog "Error 99: Something unexpected happened!!" + endif +'///</ul> +end function +' +'-------------------------------------------------------------------- +' +function fSetShowValue ( bShowValueCheck as BOOLEAN ) as INTEGER + fSetShowValue = 99 +'///<u><b>Function to check 'Show Value'</b></u>/// +'///<b>BOOLEAN bShowValueCheck</b> +'///+TRUE := Check 'Show Value' - FALSE := Uncheck 'Show Value' +'///<b>Returns error-code:</b> +'///+ 0 := Sucess +'///+ 1 := Serious problem trying to check 'Show Value' +'///+ 2 := 'Show Value' was not set +'///+12 := Check-box for 'Show Value' is not enabled +'///+99 := Unexpected error + +'///<u><b>Step-by-Step</b></u>/// +'///<ul> + printlog "" + printlog "** Setting 'Show Value'" + '///+<li>Check if 'Show Value' is enabled</li>/// + if NOT ShowValue.IsEnabled then + qaErrorLog "Error 12: Check-box for 'Show Value' is not enabled" + qaErrorLog "... BUG or Script problem -> Check this out!" + fSetShowValue = 12 + exit function + endif + '///+<li>Try to (Un)Check 'Show Value'</li>/// + Kontext "InsertLabelsDialog" + try + if bShowValueCheck then + ShowValue.Check + else + ShowValue.UnCheck + endif + catch + '///+<li>Throw error 1 and quit on serious problem</li>/// + qaErrorLog "Error 1: Check 'Show Value' seems to cause a serious problem -> Check this out!" + fSetShowValue = 1 + exit function + endcatch + '///+<li>Verify (against input) if 'Show Value' was checked</li>/// + if ShowValue.IsChecked = bShowValueCheck then + fSetShowValue = 0 + printlog ">> Check 'Show Value' seems to work" + else + qaErrorLog "Error 2: 'Show Value' was not checked -> Check this out!" + fSetShowValue = 2 + endif + + if fSetShowValue = 99 then + warnlog "Error 99: Something unexpected happened!!" + endif +'///</ul> +end function +' +'-------------------------------------------------------------------- +' +function fSetValueType ( oValueType as OBJECT ) as INTEGER + fSetValueType = 99 +'///<u><b>Function to select Value Type</b></u>/// +'///Input: +'///<b>OBJECT oValueType</b> +'///+Declaration name of Radio-Button: <i>AsNumber</i> and <i>AsPercentage</i> are valid values +'///<b>Returns error-code:</b> +'///+ 0 := Sucess +'///+ 1 := Serious problem trying to check Legend position radio-button +'///+ 2 := Value type radio-button was not set +'///+12 := Radio-Button for desired Value type is not enabled +'///+99 := Unexpected error + +'///<u><b>Step-by-Step</b></u>/// +'///<ul> + printlog "" + printlog "** Setting Value type" + '///+<li>Check if Value type radio-button is enabled</li>/// + Kontext "InsertLabelsDialog" + if NOT oValueType.IsEnabled then + qaErrorLog "Error 12: Radio-Button for desired Value type is not enabled" + qaErrorLog "... BUG or Script problem -> Check this out!" + fSetValueType = 12 + exit function + endif + '///+<li>Try to (Un)Check desired radio-button</li>/// + Kontext "InsertLabelsDialog" + try + oValueType.Check + catch + '///+<li>Throw error 1 and quit on serious problem</li>/// + qaErrorLog "Error 1: Check Value type radio-button seems to cause a serious problem -> Check this out!" + fSetValueType = 1 + exit function + endcatch + '///+<li>Verify (against input) if Value type radio-button was checked</li>/// + if oValueType.IsChecked then + fSetValueType = 0 + printlog ">> Setting Value type radio-button seems to work" + else + qaErrorLog "Error 2: Desired Value type radio-button was not checked -> Check this out!" + fSetValueType = 2 + endif + + if fSetValueType = 99 then + warnlog "Error 99: Something unexpected happened!!" + endif +'///</ul> +end function +' +'-------------------------------------------------------------------- +' +function fSetShowLabelText ( bShowLabelTextCheck as BOOLEAN ) as INTEGER + fSetShowLabelText = 99 +'///<u><b>Function to check 'Show Label Text'</b></u>/// +'///<b>BOOLEAN bShowLabelTextCheck</b> +'///+TRUE := Check 'Show Label Text' - FALSE := Uncheck 'Show Label Text' +'///<b>Returns error-code:</b> +'///+ 0 := Sucess +'///+ 1 := Serious problem trying to check 'Show Label Text' +'///+ 2 := 'Show Label Text' was not set +'///+12 := Check-box for 'Show Label Text' is not enabled +'///+99 := Unexpected error + +'///<u><b>Step-by-Step</b></u>/// +'///<ul> + printlog "" + printlog "** Setting 'Show Label Text'" + '///+<li>Check if 'Show Label Text' is enabled</li>/// + if NOT ShowLabelText.IsEnabled then + qaErrorLog "Error 12: Check-box for 'Show Label Text' is not enabled" + qaErrorLog "... BUG or Script problem -> Check this out!" + fSetShowLabelText = 12 + exit function + endif + '///+<li>Try to (Un)Check 'Show Label Text'</li>/// + Kontext "InsertLabelsDialog" + try + if bShowLabelTextCheck then + ShowLabelText.Check + else + ShowLabelText.UnCheck + endif + catch + '///+<li>Throw error 1 and quit on serious problem</li>/// + qaErrorLog "Error 1: Check 'Show Label Text' seems to cause a serious problem -> Check this out!" + fSetShowLabelText = 1 + exit function + endcatch + '///+<li>Verify (against input) if 'Show Label Text' was checked</li>/// + if ShowLabelText.IsChecked = bShowlabelTextCheck then + fSetShowLabelText = 0 + printlog ">> Check 'Show Label Text' seems to work" + else + qaErrorLog "Error 2: 'Show Label Text' was not checked -> Check this out!" + fSetShowLabelText = 2 + endif + + if fSetShowLabelText = 99 then + warnlog "Error 99: Something unexpected happened!!" + endif +'///</ul> +end function +' +'-------------------------------------------------------------------- +' +function fSetShowLegendIconWithLabel ( bShowLegendIconCheck as BOOLEAN ) as INTEGER + fSetShowLegendIconWithLabel = 99 +'///<u><b>Function to check 'Show Legend Icon With Label'</b></u>/// +'///<b>BOOLEAN bShowLegendIconCheck</b> +'///+TRUE := Check 'Show Legend Icon With Label' - FALSE := Uncheck 'Show Legend Icon With Label' +'///<b>Returns error-code:</b> +'///+ 0 := Sucess +'///+ 1 := Serious problem trying to check 'Show Legend Icon With Label' +'///+ 2 := 'Show Legend Icon With Label' was not set +'///+12 := Check-box for 'Show Legend Icon With Label' is not enabled +'///+99 := Unexpected error + +'///<u><b>Step-by-Step</b></u>/// +'///<ul> + printlog "" + printlog "** Setting 'Show Legend Icon With Label'" + '///+<li>Check if 'Show Legend Icon With Label' is enabled</li>/// + if NOT ShowLegendIconWithLabel.IsEnabled then + qaErrorLog "Error 12: Check-box for 'Show Legend Icon With Label' is not enabled" + qaErrorLog "... BUG or Script problem -> Check this out!" + fSetShowLegendIconWithLabel = 12 + exit function + endif + '///+<li>Try to (Un)Check 'Show Legend Icon With Label'</li>/// + Kontext "InsertLabelsDialog" + try + if bShowLegendIconCheck then + ShowLegendIconWithLabel.Check + else + ShowLegendIconWithLabel.UnCheck + endif + catch + '///+<li>Throw error 1 and quit on serious problem</li>/// + qaErrorLog "Error 1: Check 'Show Legend Icon With Label' seems to cause a serious problem -> Check this out!" + fSetShowLegendIconWithLabel = 1 + exit function + endcatch + '///+<li>Verify (against input) if 'Show Legend Icon With Label' was checked</li>/// + if ShowLegendIconWithLabel.IsChecked = bShowLegendIconCheck then + fSetShowLegendIconWithLabel = 0 + printlog ">> Check 'Show Legend Icon With Label' seems to work" + else + qaErrorLog "Error 2: 'Show Legend Icon With Label' was not checked -> Check this out!" + fSetShowLegendIconWithLabel = 2 + endif + + if fSetShowLegendIconWithLabel = 99 then + warnlog "Error 99: Something unexpected happened!!" + endif +'///</ul> +end function + diff --git a/testautomation/chart2/tools/ch_tools_grids.inc b/testautomation/chart2/tools/ch_tools_grids.inc new file mode 100644 index 000000000000..d909ef7426e1 --- /dev/null +++ b/testautomation/chart2/tools/ch_tools_grids.inc @@ -0,0 +1,202 @@ +'encoding UTF-8 Do not remove or change this line! +'************************************************************************** +' DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +' +' Copyright 2000, 2010 Oracle and/or its affiliates. +' +' OpenOffice.org - a multi-platform office productivity suite +' +' This file is part of OpenOffice.org. +' +' OpenOffice.org is free software: you can redistribute it and/or modify +' it under the terms of the GNU Lesser General Public License version 3 +' only, as published by the Free Software Foundation. +' +' OpenOffice.org is distributed in the hope that it will be useful, +' but WITHOUT ANY WARRANTY; without even the implied warranty of +' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +' GNU Lesser General Public License version 3 for more details +' (a copy is included in the LICENSE file that accompanied this code). +' +' You should have received a copy of the GNU Lesser General Public License +' version 3 along with OpenOffice.org. If not, see +' <http://www.openoffice.org/license.html> +' for a copy of the LGPLv3 License. +' +'/************************************************************************ +'* +'* owner : oliver.craemer@oracle.com +'* +'* short description : Tool library for Grids dialog +'* +'************************************************************************************************** +'* +' #1 fInvokeGridsDialog +' #1 fCloseGridsDialogOK +' #1 fSetGrid +'* +'\************************************************************************************************ + +' ch_tools_grids.inc - Library for automation of the 'Insert::Grids...' dialog +' This Include contains a set of functions to modify the controls of the Grids dialog. +' All functions are designed to return error-codes depending on the behaviour of the action applied. +' Return codes: +' Error 0: Success. +' Error 1: The basic action beeing applied caused a serious problem, e.g. a crash. +' Error 2 TO 9: A functional problem occured. +' Error 11 TO 19: Wrong marginal conditions end up in Failure, e.g. control not visible. +' NOTE: This errors can also be used for 'negative' testing. +' Error 42: Wrong input. Probably only of interest during test development . +' Error 99: Unexpected behaviour - Shouldn't normally occur. +' ATTENTION: +' Only Errors 42 and 99 throw 'warnlogs'. +' All other errors are silent. +' They only throw QAErrorlogs the give a hint what probably went wrong. +' Expected Errors MUST exclusivly be handled by the calling routine. +' +'-------------------------------------------------------------------- +' +function fInvokeGridsDialog() as INTEGER + fInvokeGridsDialog = 99 +' Function to invoke the 'Insert / Grids...' dialog +' Returns (Error codes): +' 0 = Sucess +' 1 = Serious problem trying to invoke the dialog +' 2 = Failure (Dialog not present after invocation) +'99 = Unexpected error + printlog "Invoking 'Insert::Grids...' in menu" + '/// Execute menu item 'Insert::Grids...' + try + InsertGrids + catch + QAErrorLog "Error 1: Invoking menu item 'Insert::Grids...' failed" + fInvokeGridsDialog = 1 + exit function + endcatch + + '/// Lookup if call was successful + Kontext "InsertGridsDialog" + if InsertGridsDialog.exists(2) then + printlog ">> Grids dialog is visible now." + fInvokeGridsDialog = 0 + else + qaErrorLog "Error 2: The slot 'InsertGrids' has been executed but the dialog is not visible" + fInvokeGridsDialog = 2 + endif + + if fInvokeGridsDialog = 99 then + warnlog "Error 99: Something unexpected happened!!" + endif +end function +' +'-------------------------------------------------------------------- +' +function fCloseGridsDialogOK() as INTEGER + fCloseGridsDialogOK = 99 +' Function to close the Grids dialog using OK button +' No Input +' Returns error-codes: +' 0 := Sucess +' 1 := Serious problem trying to Close the dialog +' 2 := Failure (Dialog present after applying OK button) +'15 := Dialog not present before closing +'99 := Unexpected error + printlog "** Closing Grids dialog" + Kontext "InsertGridsDialog" + '/// Check existence of Grids dialog + if InsertGridsDialog.exists(2) then + printlog ">> Grids dialog is visible as expected." + else + 'Return Error 15 and quit if dialog not found + qaErrorLog "Error 15: OOPS, Grids dialog should be visible ..." + qaErrorLog "... this is a BUG or a scripting error -> Check this out!" + fCloseGridsDialogOK = 15 + exit function + endif + '/// Click OK button in Grids dialog + try + InsertGridsDialog.OK + catch + qaErrorLog "Error 1: Closing the Grids dialog seems to have a serious problem -> Check this out!" + fCloseGridsDialogOK = 1 + exit function + endcatch + '/// Check that Grids dialog is not available anymore + Kontext "InsertGridsDialog" + if InsertGridsDialog.exists(2) then + 'Return Error 2 if still present + qaErrorLog "Error 2: Grids dialog should be invisible now ..." + qaErrorLog "... closing the dialog doesn't seem to work -> Check this out!" + fCloseGridsDialogOK = 2 + else + printlog ">> Closing the Grids dialog seems to work as expected" + fCloseGridsDialogOK = 0 + endif + + if fCloseGridsDialogOK = 99 then + warnlog "Error 99: Something unexpected happened!!" + endif +end function +' +'-------------------------------------------------------------------- +' +function fSetGrid ( oGrid as OBJECT , bGridCheck as BOOLEAN ) as INTEGER + fSetGrid = 99 +' Function to check-boxes in Grids dialog +' Input: +' OBJECT oGrid +' Grid Indicator (Name of declaration): MainGrid[XYZ]Axis, MinorGrid[XYZ]Axis< are valid name +' BOOLEAN bGridCheck +' TRUE := Check Grid +' FALSE := Uncheck Grid +' Returns error-code: +' 0 := Sucess +' 1 := Serious problem trying to check grid +' 2 := Grid was not set +'11 := Check-box for desired grid is not visible +'12 := Check-box for desired grid is not enabled +'99 := Unexpected error + printlog "** Setting Grid" + Kontext "InsertGridsDialog" + '/// Check if desired grid check-box is visible + if NOT oGrid.IsVisible then + qaErrorLog "Error 11: Check-box for desired grid is not visible" + qaErrorLog "... BUG or Script problem -> Check this out!" + fSetGrid = 11 + exit function + endif + '/// Check if desired grid check-box is enabled + if NOT oGrid.IsEnabled then + qaErrorLog "Error 12: Check-box for desired grid is not enabled" + qaErrorLog "... BUG or Script problem -> Check this out!" + fSetGrid = 12 + exit function + endif + '/// Try to (Un)Check desired Grid + Kontext "InsertGridsDialog" + try + if bGridCheck then + oGrid.Check + else + oGrid.UnCheck + endif + catch + ' Throw error 1 and quit on serious problem + qaErrorLog "Error 1: Check grid seems to cause a serious problem -> Check this out!" + fSetGrid = 1 + exit function + endcatch + '/// Verify (against input) if grid was checked + if oGrid.IsChecked = bGridCheck then + fSetGrid = 0 + printlog ">> Setting grid seems to work" + else + qaErrorLog "Error 2: Grid was not checked -> Check this out!" + fSetGrid = 2 + endif + + if fSetGrid = 99 then + warnlog "Error 99: Something unexpected happened!!" + endif +end function + diff --git a/testautomation/chart2/tools/ch_tools_legend.inc b/testautomation/chart2/tools/ch_tools_legend.inc new file mode 100644 index 000000000000..9c16c71d1af7 --- /dev/null +++ b/testautomation/chart2/tools/ch_tools_legend.inc @@ -0,0 +1,241 @@ +'encoding UTF-8 Do not remove or change this line! +'************************************************************************** +' DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +' +' Copyright 2000, 2010 Oracle and/or its affiliates. +' +' OpenOffice.org - a multi-platform office productivity suite +' +' This file is part of OpenOffice.org. +' +' OpenOffice.org is free software: you can redistribute it and/or modify +' it under the terms of the GNU Lesser General Public License version 3 +' only, as published by the Free Software Foundation. +' +' OpenOffice.org is distributed in the hope that it will be useful, +' but WITHOUT ANY WARRANTY; without even the implied warranty of +' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +' GNU Lesser General Public License version 3 for more details +' (a copy is included in the LICENSE file that accompanied this code). +' +' You should have received a copy of the GNU Lesser General Public License +' version 3 along with OpenOffice.org. If not, see +' <http://www.openoffice.org/license.html> +' for a copy of the LGPLv3 License. +' +'/************************************************************************ +'* +'* owner : oliver.craemer@oracle.com +'* +'* short description : Tool library for Legend dialog +'* +'************************************************************************************************** +'* +' #1 fInvokeLegendDialog +' #1 fCloseLegendDialogOK +' #1 fSetDisplayLegend +' #1 fSetLegendPosition +'* +'\************************************************************************************************ + +' ch_tools_legend.inc - A library for automation of the 'Insert/Legend...' dialog +' This Include contains a set of functions to modify the controls of the Legend dialog. +' All functions are designed to return error-codes depending on the behaviour of the action applied. +' Return codes: +' Error 0: Success. +' Error 1: The basic action beeing applied caused a serious problem, e.g. a crash. +' Error 2 TO 9: A functional problem occured. +' Error 11 TO 19: Wrong marginal conditions end up in failture, e.g. control not visible. +' NOTE: This errors can also be used for 'negative' testing. +' Error 42: Wrong input. Probably only of interest during test development . +' Error 99: Unexpected behaviour - Shouldn't normally occur. +' ATTENTION: +' Only Errors 42 and 99 throw 'warnlogs'. +' All other errors are silent. +' They only throw QAErrorlogs the give a hint what probably went wrong. +' Expected Errors MUST exclusivly be handled by the calling routine. +' +'-------------------------------------------------------------------- +' +function fInvokeLegendDialog() as INTEGER + fInvokeLegendDialog = 99 +' Function to invoke the 'Insert/Legend...' dialog +' Return (Error codes): +' 0 = Sucess +' 1 = Serious problem trying to invoke the dialog +' 2 = Failure (Dialog not present after invocation) +' 99 = Unexpected error + printlog "Invoking 'Insert/Legend...' in menu" + '/// Execute menu item 'Insert/Legend...' + try + InsertLegend + catch + qaErrorLog "Error 1: Invoking menu item 'Insert/Legend...' failed" + fInvokeLegendDialog = 1 + exit function + endcatch + + '/// Lookup if call was successful + Kontext "InsertLegendDialog" + if InsertLegendDialog.exists(2) then + printlog ">> Legend dialog is visible now." + fInvokeLegendDialog = 0 + else + QAErrorLog "Error 2: The slot 'InsertLegend' has been executed but the dialog is not visible" + fInvokeLegendDialog = 2 + endif + + if fInvokeLegendDialog = 99 then + warnlog "Error 99: Something unexpected happened!!" + endif +end function +' +'-------------------------------------------------------------------- +' +function fCloseLegendDialogOK() as INTEGER + fCloseLegendDialogOK = 99 +' Function to close the Legend dialog using OK button +' No Input +' Returns error-code: +' 0 := Sucess +' 1 := Serious problem trying to Close the dialog +' 2 := Failure (Dialog present after applying OK button) +'15 := Dialog not present before closing +'99 := Unexpected error + printlog "** Closing Legend dialog" + Kontext "InsertLegendDialog" + '/// Check existence of Legend dialog + if InsertLegendDialog.exists(2) then + printlog ">> Legend dialog is visible as expected." + else + ' Return Error 15 and quit if dialog not found + qaErrorLog "Error 15: OOPS, Legend dialog should be visible ..." + qaErrorLog "... this is a BUG or a scripting error -> Check this out!" + fCloseLegendDialogOK = 15 + exit function + endif + '/// Click OK button in Legend dialog + try + InsertLegendDialog.OK + catch + qaErrorLog "Error 1: Closing the Legend dialog seems to have a serious problem -> Check this out!" + fCloseLegendDialogOK = 1 + exit function + endcatch + '///+ Check that the Legend dialog is not available any longer + Kontext "InsertLegendDialog" + if InsertLegendDialog.exists(2) then + ' Return Error 2 if still present + qaErrorLog "Error 2: Legend dialog should be invisible now ..." + qaErrorLog "... closing the dialog doesn't seem to work -> Check this out!" + fCloseLegendDialogOK = 2 + else + printlog ">> Closing the Legend dialog seems to work as expected" + fCloseLegendDialogOK = 0 + endif + + if fCloseLegendDialogOK = 99 then + warnlog "Error 99: Something unexpected happened!!" + endif +end function +' +'-------------------------------------------------------------------- +' +function fSetDisplayLegend ( bDisplayLegend as BOOLEAN ) as INTEGER + fSetDisplayLegend = 99 +' Function to [en|dis]able visibility of chart legend +' Input: +' BOOLEAN bDisplayLegend +' TRUE := Check 'Dislay (legend)' +' FALSE := Uncheck 'Dislay (legend)' +' Returns error-code: +' 0 := Sucess +' 1 := Serious problem trying to check grid +' 2 := 'Dislay (legend)' was not set +'11 := 'Dislay (legend)' Check-box is not visible +'99 := Unexpected error + printlog "** Setting Display Legend" + '/// Check if 'Dislay (legend)' check-box is visible + Kontext "InsertLegendDialog" + if NOT Display.IsVisible then + qaErrorLog "Error 11: Check-box for 'Dislay (legend)' is not visible" + qaErrorLog "... BUG or Script problem -> Check this out!" + fSetDisplayLegend = 11 + exit function + endif + '/// Try to (Un)Check 'Dislay (legend)' + Kontext "InsertLegendDialog" + try + if bDisplayLegend then + Display.Check + else + Display.UnCheck + endif + catch + ' Throw error 1 and quit on serious problem + qaErrorLog "Error 1: Check 'Dislay (legend)' seems to cause a serious problem -> Check this out!" + fSetDisplayLegend = 1 + exit function + endcatch + '/// Verify (against input) if check-box was checked + if Display.IsChecked = bDisplayLegend then + fSetDisplayLegend = 0 + printlog ">> Setting 'Dislay (legend)' seems to work" + else + qaErrorLog "Error 2: 'Dislay (legend)' was not checked -> Check this out!" + fSetDisplayLegend = 2 + endif + + if fSetDisplayLegend = 99 then + warnlog "Error 99: Something unexpected happened!!" + endif +end function +' +'-------------------------------------------------------------------- +' +function fSetLegendPosition ( oPosition as OBJECT ) as INTEGER + fSetLegendPosition = 99 +' Function to select Legend position +' Input: +' OBJECT oPosition +' Declaration name of Radio-Button: Position[Left|Right|Top|Bottom] are valid values +' Returns error-code: +' 0 := Sucess +' 1 := Serious problem trying to check Legend position radio-button +' 2 := Legend position radio-button was not set +'12 := Radio-Button for desired position is not enabled +'42 := User error, input doesn't match. +'99 := Unexpected error + printlog "** Setting Legend position" + '/// Check if Legend position radio-button is enabled + Kontext "InsertLegendDialog" + if NOT oPosition.IsEnabled then + qaErrorLog "Error 12: Radio-Button for desired position is not enabled" + qaErrorLog "... BUG or Script problem -> Check this out!" + fSetLegendPosition = 12 + exit function + endif + '/// Try to (Un)Check desired radio-button + Kontext "InsertLegendDialog" + try + oPosition.Check + catch + ' Throw error 1 and quit on serious problem + qaErrorLog "Error 1: Check Legend position radio-button seems to cause a serious problem -> Check this out!" + fSetLegendPosition = 1 + exit function + endcatch + '/// Verify (against input) if Legend position radio-button was checked + if oPosition.IsChecked then + fSetLegendPosition = 0 + printlog ">> Setting Legend position radio-button seems to work" + else + qaErrorLog "Error 2: Desires Legend position radio-button was not checked -> Check this out!" + fSetLegendPosition = 2 + endif + + if fSetLegendPosition = 99 then + warnlog "Error 99: Something unexpected happened!!" + endif +end function + diff --git a/testautomation/chart2/tools/ch_tools_select.inc b/testautomation/chart2/tools/ch_tools_select.inc new file mode 100644 index 000000000000..8df51c8d9279 --- /dev/null +++ b/testautomation/chart2/tools/ch_tools_select.inc @@ -0,0 +1,136 @@ +'encoding UTF-8 Do not remove or change this line! +'************************************************************************** +' DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +' +' Copyright 2000, 2010 Oracle and/or its affiliates. +' +' OpenOffice.org - a multi-platform office productivity suite +' +' This file is part of OpenOffice.org. +' +' OpenOffice.org is free software: you can redistribute it and/or modify +' it under the terms of the GNU Lesser General Public License version 3 +' only, as published by the Free Software Foundation. +' +' OpenOffice.org is distributed in the hope that it will be useful, +' but WITHOUT ANY WARRANTY; without even the implied warranty of +' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +' GNU Lesser General Public License version 3 for more details +' (a copy is included in the LICENSE file that accompanied this code). +' +' You should have received a copy of the GNU Lesser General Public License +' version 3 along with OpenOffice.org. If not, see +' <http://www.openoffice.org/license.html> +' for a copy of the LGPLv3 License. +' +'/************************************************************************ +'* +'* owner : oliver.craemer@oracle.com +'* +'* short description : selecting charts +'* +'************************************************************************************************** +'* +' #1 fSelectChartByNumber +' #1 fCalcSelectSheet +' #1 fChartSelectElement +'* +'\************************************************************************************************ + +function fSelectChartByNumber ( iObjectPosition as INTEGER ) + ' Select any Chart in document + ' INTEGER: iObjectPosition - Position of object (>=1) within OLE objects + ' NOTE: You're moving within a treelistbox which is quite messy to handle. + ' In case 'iObjectPosition' is larger than the real number of objects in category you're end up in another categories. + ' WITHOUT ANY WARNING! + ' RETURNS: BOOLEAN (success) + dim bNavigatorWasVisible as boolean + bNavigatorWasVisible = FALSE + dim iIndex + dim iCategoryPosition as INTEGER + iCategoryPosition = 6 + + fSelectChartByNumber = FALSE + + '/// Check if Navigator is visible + Kontext "NavigatorCalc" + if NavigatorCalc.exists (3) then + bNavigatorWasVisible = TRUE + else + '/// Invoke navigator if not visible + ViewNavigator + end if + + try + Kontext "NavigatorCalc" + '/// Go to Top in Navigator + liste.TypeKeys "<HOME>" + '/// Travel top to bottom through all categories + for iIndex = 1 to 6 + '/// Make sure all elements in category are hidden, apply '-' key + liste.TypeKeys "-<DOWN>" + next iIndex + '/// Select desired category OLE + liste.select ( iCategoryPosition ) + '/// Unfold elements of selected category + liste.TypeKeys "+" + '/// Select desired position within category + liste.select ( iCategoryPosition + iObjectPosition ) + '/// Hit 'RETURN' key to select element in document + liste.TypeKeys "<RETURN>" + '/// Return 'TRUE' for 'fNavigatorSelectObject' + fSelectChartByNumber = TRUE + catch + warnlog "Selecting the desired object failed. Perhaps your input wasn't valid" + endcatch + '/// Close navigator if it wasn't visible before entering this function + if bNavigatorWasVisible = TRUE then + printlog "Leaving navigator open as initially found" + else + ViewNavigator + printlog "Closing navigator as initially found" + end if +end function +' +'-------------------------------------------------------------------- +' +function fCalcSelectSheet ( sSelectThisSheet ) as boolean + ' Select a sheet by name (STRING) or number (INTEGER) + ' RETURNS: boolean (success) + fCalcSelectSheet = FALSE + try + Kontext "DocumentCalc" + '/// Invoke Edit::Sheet::Select + EditSheetSelect + Kontext "SelectSheets" + '/// Select sheet no. or sheet name in listbox + SheetSelectionBox.Select ( sSelectThisSheet ) + '/// OK + SelectSheets.OK + '/// Return true + fCalcSelectSheet = TRUE + catch + warnlog "Something went wrong while selecting a sheet by name" + '/// In case of Failure lookup 'Select sheets' dialog andd close it if exists + Kontext "SelectSheets" + if SelectSheets.exists(2) then + SelectSheets.Cancel + endif + endcatch +end function +' +'-------------------------------------------------------------------- +' +function fChartSelectElement ( iObjectPosition as INTEGER ) as boolean + ' Select a chartelement by using the ChartElementSelectorListBox in the Toolbar + ' RETURNS: boolean (success) + fChartSelectElement = FALSE + try + Kontext "Toolbar" + sleep (2) + ChartElementSelector.Select (iObjectPosition) + fChartSelectElement = TRUE + catch + warnlog "Something went wrong while selecting a chartelement" + endcatch +end function diff --git a/testautomation/chart2/tools/ch_tools_statistics.inc b/testautomation/chart2/tools/ch_tools_statistics.inc new file mode 100644 index 000000000000..59bd74496113 --- /dev/null +++ b/testautomation/chart2/tools/ch_tools_statistics.inc @@ -0,0 +1,429 @@ +'encoding UTF-8 Do not remove or change this line! +'************************************************************************** +' DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +' +' Copyright 2000, 2010 Oracle and/or its affiliates. +' +' OpenOffice.org - a multi-platform office productivity suite +' +' This file is part of OpenOffice.org. +' +' OpenOffice.org is free software: you can redistribute it and/or modify +' it under the terms of the GNU Lesser General Public License version 3 +' only, as published by the Free Software Foundation. +' +' OpenOffice.org is distributed in the hope that it will be useful, +' but WITHOUT ANY WARRANTY; without even the implied warranty of +' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +' GNU Lesser General Public License version 3 for more details +' (a copy is included in the LICENSE file that accompanied this code). +' +' You should have received a copy of the GNU Lesser General Public License +' version 3 along with OpenOffice.org. If not, see +' <http://www.openoffice.org/license.html> +' for a copy of the LGPLv3 License. +' +'/************************************************************************ +'* +'* owner : oliver.craemer@oracle.com +'* +'* short description : Tool library for Statistics dialog +'* +'************************************************************************************************** +'* +' #1 fInvokeTrendlinesDialog +' #1 fInvokeInsertYErrorBarsDialog +' #1 fInsertMeanValueLines +' #1 fSetErrorCategory +' #1 fSetErrorValue +' #1 fSetErrorIndicatorItem +' #1 fSetRegressionCurvesItem +'* +'\************************************************************************************************ + +' ch_tools_statistics.inc - Library for automation of the 'Insert::Statistics...' dialog +' This Include contains a set of functions to modify the controls of the Statistics dialog. +' All functions are designed to return error-codes depending on the behaviour of the action applied. +' Return codes: +' Error 0: Success. +' Error 1: The basic action beeing applied caused a serious problem, e.g. a crash. +' Error 2 TO 9: A functional problem occured. +' Error 11 TO 19: Wrong marginal conditions end up in failture, e.g. control not visible. +' NOTE: This errors can also be used for 'negative' testing. +' Error 42: Wrong input. Probably only of interest during test development. +' Error 99: Unexpected behaviour - Shouldn't normally occur. +' ATTENTION: +' Only Errors 42 and 99 throw 'warnlogs'. +' All other errors are silent. +' They only throw QAErrorlogs the give a hint what probably went wrong. +' Expected Errors MUST exclusivly be handled by the calling routine. +' +'-------------------------------------------------------------------- +' +function fInvokeTrendlinesDialog() as INTEGER + fInvokeTrendlinesDialog = 99 +' Function to invoke the 'Insert::Statistics...' dialog +' No Input +' Returns error-code: +' 0 := Sucess +' 1 := Serious problem trying to invoke the dialog +' 2 := Failure (Dialog not present after invocation) +'99 := Unexpected error + + printlog "** Invoking 'Insert::Trendlines...' in menu" + '/// Execute menu item 'Insert::Trendlines...' + try + InsertTrendlines + catch + qaErrorLog "Error 1: Invoking menu item 'Insert::Trendlines...' failed" + fInvokeTrendlinesDialog = 1 + exit function + endcatch + + '/// Lookup if call was successful + Kontext + active.SetPage (TabTrendLineType) + Kontext "TabTrendLineType" + if TabTrendLineType.exists(2) then + printlog ">> Trend lines dialog is visible now." + fInvokeTrendlinesDialog = 0 + else + qaErrorLog "Error 2: OOPS, calling the slot '.uno:InsertTrendlines' didn't cause any problem ..." + qaErrorLog "..., BUT the dialog doesn't seem to be visible" + fInvokeTrendlinesDialog = 2 + endif + + if fInvokeTrendlinesDialog = 99 then + warnlog "Error 99: Something unexpected happened!!" + endif +end function +' +'-------------------------------------------------------------------- +' +function fInvokeInsertYErrorBarsDialog() as INTEGER + fInvokeInsertYErrorBarsDialog = 99 +' Function to invoke the 'Insert::InsertYErrorBars...' dialog +' No Input +' Returns error-code: +' 0 := Sucess +' 1 := Serious problem trying to invoke the dialog +' 2 := Failure (Dialog not present after invocation) +'99 := Unexpected error + printlog "** Invoking 'Insert::InsertYErrorBars...' in menu" + '/// Execute menu item 'Insert::InsertYErrorBars...' + try + InsertYErrorBars + catch + qaErrorLog "Error 1: Invoking menu item 'Insert::YErrorBars...' failed" + fInvokeInsertYErrorBarsDialog = 1 + exit function + endcatch + + '/// Lookup if call was successful + Kontext "InsertYErrorBarsDLG" + if InsertYErrorBarsDLG.exists(2) then + printlog ">> InsertYErrorBars dialog is visible now." + fInvokeInsertYErrorBarsDialog = 0 + else + qaErrorLog "Error 2: OOPS, calling the slot '.uno:InsertYErrorBars' didn't cause any problem ..." + qaErrorLog "..., BUT the dialog doesn't seem to be visible" + fInvokeInsertYErrorBarsDialog = 2 + endif + + if fInvokeInsertYErrorBarsDialog = 99 then + warnlog "Error 99: Something unexpected happened!!" + endif +end function +' +'------------------------------------------------------------------------- +' +function fInsertMeanValueLines() as INTEGER + fInsertMeanValueLines = 99 +' Function to insert mean value lines in an activated chart object +' Input: + QAErrorLog "#i86055#-Insert/ Mean Value Lines needs a check box in sub-menu to remove all lines with once click" +' Returns error-code: +' 0 := Sucess +' 1 := Serious problem trying to execute the command +' 2 := Serious problem trying to check if the line has been inserted +' 3 := Uncorrect selected object +' 4 := Format Line-dialog did not occour +'99 := Unexpected error + + printlog "** Executing 'Insert::MeanValueLines...' in menu" + '/// Execute menu item 'Insert::MeanValueLines...' + try + InsertMeanValueLines + catch + qaErrorLog "Error 1: Executing menu item 'Insert::MeanValueLines...' failed" + fInsertMeanValueLines = 1 + exit function + endcatch + + Kontext "DocumentChart" + '/// Type three times TAB-key to select the first data series + DocumentChart.TypeKeys "<TAB>" , 3 + '/// Type F3-function key to select the mean value line of that data series + DocumentChart.TypeKeys "<F3>" + '/// Open the context menu + DocumentChart.OpenContextMenu TRUE + if hMenuItemGetCount = 6 then + '/// Select the first entry (properties) + hMenuSelectNr (1) + else + qaErrorLog "Error 2: Opening context menu on inserted mean value line failed!" + fInsertMeanValueLines = 2 + exit function + endif + Kontext + '/// There should be one tab page (chart line) + Active.SetPage TabFormatChartLine + if Active.GetPageCount <> 1 then + qaErrorLog "Error 3: Incorrect selected object!" + fInsertMeanValueLines = 3 + Active.Cancel + exit function + endif + Kontext "TabFormatChartLine" + if TabFormatChartLine.Exists(1) then + fInsertMeanValueLines = 0 + '/// Leave the dialog with CANCEL + TabFormatChartLine.CANCEL + printlog ">> Inserting 'Mean Value Lines' seems to work" + else + qaErrorLog "Error 4: Format Line-dialog did not occour!" + fInsertMeanValueLines = 4 + exit function + end if + if fInsertMeanValueLines = 99 then + warnlog "Error 99: Something unexpected happened!!" + endif +end function +' +'-------------------------------------------------------------------- +' +function fSetErrorCategory ( oErrorCategory as OBJECT ) as INTEGER + fSetErrorCategory = 99 +' Function to select 'Error Category' +' Input: +' OBJECT oErrorCategory +' Declaration name of Radio-Button (valid values): +' - NoFunction +' - Variance< +' - StandardDeviation +' - Percentage +' - ErrorMargin +' - ConstantValue +' Returns error-code: +' 0 := Sucess +' 1 := Serious problem trying to check 'Error Category' radio-button +' 2 := 'Error Category' radio-button was not set +'12 := Radio-Button for desired 'Error Category' is not enabled +'42 := User error, input doesn't match. +'99 := Unexpected error + printlog "** Setting 'Error Category'" + '/// Check if desired 'Error Category' radio-button is enabled + Kontext "InsertStatisticsDialog" + if NOT oErrorCategory.IsEnabled then + qaErrorLog "Error 12: Radio-Button for desired 'Error Category' is not enabled" + qaErrorLog "... BUG or Script problem -> Check this out!" + fSetErrorCategory = 12 + exit function + endif + '/// Try to check desired 'Error Category' + Kontext "InsertStatisticsDialog" + try + oErrorCategory.Check + catch + ' Throw error 1 and quit on serious problem + qaErrorLog "Error 1: Check 'Error Category' radio-button seems to cause a serious problem -> Check this out!" + fSetErrorCategory = 1 + exit function + endcatch + '/// Verify (against input) if 'Error Category' radio-button was checked + if oErrorCategory.IsChecked then + fSetErrorCategory = 0 + printlog ">> Setting 'Error Category' radio-button seems to work" + else + qaErrorLog "Error 2: Desires 'Error Category' radio-button was not checked -> Check this out!" + fSetErrorCategory = 2 + endif + + if fSetErrorCategory = 99 then + warnlog "Error 99: Something unexpected happened!!" + endif +end function +' +'-------------------------------------------------------------------- +' +function fSetErrorValue ( oErrorValue as OBJECT , _ + sErrorValue as STRING , _ + OPTIONAL bCheckResult as BOOLEAN , _ + OPTIONAL sExpectedValue as STRING ) as INTEGER + fSetErrorValue = 99 +' Function to set 'Error Value' +' Input: +' OBJECT oErrorValue +' Declaration name of Spin-Field (valid values): +' - PercentageValue +' - ErrorMarginValue +' - ConstantValuePlus +' - ConstantValueMinus +' - STRING (numeric) sErrorValue +' - Value to assign to Spin-Field +' Returns error-code: +' 0 := Sucess +' 1 := Serious problem trying to check 'Error Value' Spin-Field +' 2 := 'Error Value' Spin-Field was not set +'12 := Spin-Field for desired 'Error Value' is not enabled +'42 := User error, input doesn't match. +'99 := Unexpected error + if isMissing ( bCheckResult ) then + bCheckResult = FALSE + endif + if isMissing ( sExpectedValue ) then + sExpectedValue = sErrorValue + endif + printlog "" + printlog "** Setting 'Error Value'" + '/// Check if desired 'Error Value' Spin-Field is enabled + Kontext "InsertStatisticsDialog" + if NOT oErrorValue.IsEnabled then + qaErrorLog "Error 12: Spin-Field for desired 'Error Value' is not enabled" + qaErrorLog "... BUG or Script problem -> Check this out!" + fSetErrorValue = 12 + exit function + endif + '/// Try to set desired 'Error Value' + Kontext "InsertStatisticsDialog" + try + oErrorValue.setText ( sErrorValue ) + catch + ' Throw error 1 and quit on serious problem + qaErrorLog "Error 1: Setting 'Error Value' Spin-Field seems to cause a serious problem -> Check this out!" + fSetErrorValue = 1 + exit function + endcatch + '/// Verify (against input) if 'Error Value' Spin-Field was set correctly + if bCheckResult then + if oErrorValue.getText = sExpectedValue then + fSetErrorValue = 0 + printlog ">> Setting 'Error Value' Spin-Field seems to work" + else + qaErrorLog "Error 2: Desires 'Error Value' Spin-Field was not set correctly (value out of range?) -> Check this out!" + qaErrorLog "Expected result: " & sExpectedValue + qaErrorLog "Obtained result: " & oErrorValue.getText + fSetErrorValue = 2 + endif + else + fSetErrorValue = 0 + qaErrorLog "!! Skipped verification of result" + endif + + if fSetErrorValue = 99 then + warnlog "Error 99: Something unexpected happened!!" + endif +end function +' +'-------------------------------------------------------------------- +' +function fSetErrorIndicatorItem ( iErrorIndicatorNumber as INTEGER ) as INTEGER + fSetErrorIndicatorItem = 99 +' Function to select the 'Error Indicator' item +' Input: +' INTEGER iErrorIndicatorNumber: +' Position in 'Error Indicator' control. +' Posible Values are 1 to 4 +' NOTE: Currently the 'Error Indicator' control can only be addressed using 'typekeys'. +' -> No 100% proof verification of success possible! +' Returns error-code: +' 0 := Sucess. +' 1 := Serious problem while selecting the variant control. +'11 := 'Error Indicator' is not visible +'42 := User error, input out of range. +'99 := Unexpected error. + '/// Check if 'Error Indicator' is visible + Kontext "InsertStatisticsDialog" + if NOT ErrorIndicator.IsVisible then + qaErrorLog "Error 11: 'Error Indicator' is not visible" + qaErrorLog "... BUG or Script problem -> Check this out!" + fSetErrorIndicatorItem = 11 + exit function + endif + '/// Lookup valid input value for 'Error Indicator Item' + if ( iErrorIndicatorNumber < 1 ) OR ( iErrorIndicatorNumber > 4 ) then + fSetErrorIndicatorItem = 42 + warnlog "USER ERROR: Input doesn't match!" + exit function + endif + printlog "** Selecting the 'Error Indicator'" + '/// Select the desired entry number + Kontext "InsertStatisticsDialog" + try + ErrorIndicator.typeKeys "<HOME>" + ErrorIndicator.typeKeys "<RIGHT>", ( iErrorIndicatorNumber - 1 ) + fSetErrorIndicatorItem = 0 + printlog ">> Selecting the 'Error Indicator' probably worked" + catch + ' Throw error 1 and quit on serious problem + qaErrorLog "Error 1: Selecting 'Error Indicator' seems to cause a serious problem -> Check this out!" + fSetErrorIndicatorItem = 1 + exit function + endcatch + + if fSetErrorIndicatorItem = 99 then + warnlog "Error 99: Something unexpected happened!!" + endif +end function +' +'-------------------------------------------------------------------- +' +function fSetRegressionCurvesItem ( iRegressionCurveNumber as INTEGER ) as INTEGER + fSetRegressionCurvesItem = 99 +' Function to select the 'Regression Curves' item +' Input: +' INTEGER iRegressionCurveNumber: +' Position in 'Regression Curves' control. +' Posible Values are 1 to 5 +' NOTE: Currently the 'Regression Curves' control can only be addressed using 'typekeys'. +' -> No 100% proof verification of success possible! +' Returns error-code: +' 0 := Sucess. +' 1 := Serious problem while selecting the variant control. +'11 := 'Regression Curves' is not visible +'42 := User error, input out of range. +'99 := Unexpected error. + ' Check if 'Regression Curves' is visible + Kontext "InsertStatisticsDialog" + if NOT RegressionCurves.IsVisible then + qaErrorLog "Error 11: 'Regression Curves' is not visible" + qaErrorLog "... BUG or Script problem -> Check this out!" + fSetRegressionCurvesItem = 11 + exit function + endif + '/// Lookup valid input value for 'Regression Curves Item' + if ( iRegressionCurveNumber < 1 ) OR ( iRegressionCurveNumber > 5 ) then + fSetRegressionCurvesItem = 42 + warnlog "USER ERROR: Input doesn't match!" + exit function + endif + printlog "** Selecting the 'Regression Curves'" + '/// Select the desired entry number + Kontext "InsertStatisticsDialog" + try + RegressionCurves.typeKeys "<HOME>" + RegressionCurves.typeKeys "<RIGHT>", ( iRegressionCurveNumber - 1 ) + fSetRegressionCurvesItem = 0 + printlog ">> Selecting the 'Regression Curves' probably worked" + catch + ' Throw error 1 and quit on serious problem + qaErrorLog "Error 1: Selecting 'Regression Curves' seems to cause a serious problem -> Check this out!" + fSetRegressionCurvesItem = 1 + exit function + endcatch + + if fSetRegressionCurvesItem = 99 then + warnlog "Error 99: Something unexpected happened!!" + endif +end function + diff --git a/testautomation/chart2/tools/ch_tools_tab_borders_lines.inc b/testautomation/chart2/tools/ch_tools_tab_borders_lines.inc new file mode 100644 index 000000000000..4d9847615782 --- /dev/null +++ b/testautomation/chart2/tools/ch_tools_tab_borders_lines.inc @@ -0,0 +1,144 @@ +'encoding UTF-8 Do not remove or change this line! +'************************************************************************** +' DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +' +' Copyright 2000, 2010 Oracle and/or its affiliates. +' +' OpenOffice.org - a multi-platform office productivity suite +' +' This file is part of OpenOffice.org. +' +' OpenOffice.org is free software: you can redistribute it and/or modify +' it under the terms of the GNU Lesser General Public License version 3 +' only, as published by the Free Software Foundation. +' +' OpenOffice.org is distributed in the hope that it will be useful, +' but WITHOUT ANY WARRANTY; without even the implied warranty of +' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +' GNU Lesser General Public License version 3 for more details +' (a copy is included in the LICENSE file that accompanied this code). +' +' You should have received a copy of the GNU Lesser General Public License +' version 3 along with OpenOffice.org. If not, see +' <http://www.openoffice.org/license.html> +' for a copy of the LGPLv3 License. +' +'/************************************************************************ +'* +'* owner : oliver.craemer@oracle.com +'* +'* short description : Tool library for Borders and Lines tab-page +'* +'************************************************************************************************** +'* +' #1 fInvokeTabLine +' #1 fCloseTabLineOK +'* +'\************************************************************************************************ + +' ch_tools_tab_borders_lines.inc - A library for automation of tab-pages Borders and Lines +' NOTE: Internal both tab-pages are identical +' This Include contains a set of functions to modify the controls of these tab-pages. +' All functions are designed to return error-codes depending on the behaviour of the action applied. +' Return codes: +' Error 0: Success. +' Error 1: The basic action beeing applied caused a serious problem, e.g. a crash. +' Error 2 TO 9: A functional problem occured. +' Error 11 TO 19: Wrong marginal conditions end up in Failure, e.g. control not visible. +' NOTE: This errors can also be used for 'negative' testing. +' Error 42: Wrong input. Probably only of interest during test development . +' Error 99: Unexpected behaviour - Shouldn't normally occur. +' ATTENTION: +' Only Errors 42 and 99 throw 'warnlogs'. +' All other errors are silent. +' They only throw QAErrorlogs the give a hint what probably went wrong. +' Expected Errors MUST exclusivly be handled by the calling routine. +' +'-------------------------------------------------------------------- +' +function fInvokeTabLine() as INTEGER + fInvokeTabLine = 99 +' Function to invoke the Borders or Line tab page in several dialogs +' No Input +' Returns error-code: +' 0 := Sucess +' 1 := Serious problem trying to invoke the page +' 2 := Failure (Page not present after invocation) +'99 := Unexpected error + + printlog "** Invoking 'Line' or 'Borders' tab page" + '/// Try to change to 'Line' or 'Borders' tab page + Kontext + try + active.setPage TabFormatChartLine + catch + qaErrorLog "Error 1: Invoking tab page 'Line' or 'Borders' failed" + fInvokeTabLine = 1 + exit function + endcatch + + '/// Lookup if call was successful + Kontext "TabFormatChartLine" + if TabFormatChartLine.exists(2) then + printlog ">> Tab page 'Line' or 'Borders' is visible now." + fInvokeTabLine = 0 + else + qaErrorLog "Error 2: OOPS, calling Tab page 'Line' or 'Borders' didn't cause any problem ..." + qaErrorLog "..., BUT the page doesn't seem to be visible" + fInvokeTabLine = 2 + endif + + if fInvokeTabLine = 99 then + warnlog "Error 99: Something unexpected happened!!" + endif +end function +' +'-------------------------------------------------------------------- +' +function fCloseTabLineOK() as INTEGER + fCloseTabLineOK = 99 +' Function to close a dialog using OK button while tab page 'Line' or 'Borders' is visible +' No Input +' Returns error-code: +' 0 := Sucess +' 1 := Serious problem trying to Close the page +' 2 := Failure (Page present after applying OK button) +'15 := Page not present before closing +'99 := Unexpected error + printlog "** Closing 'Line' or 'Borders' tab page" + Kontext "TabFormatChartLine" + '/// Check existence of 'Line' or 'Borders' tab page + if TabFormatChartLine.exists(2) then + printlog ">> 'Line' or 'Borders' tab page is visible as expected." + else + ' Return Error 15 and quit if page not found + qaErrorLog "Error 15: OOPS,'Line' or 'Borders' tab page should be visible ..." + qaErrorLog "... this is a BUG or a scripting error -> Check this out!" + fCloseTabLineOK = 15 + exit function + endif + '/// Click OK button in 'Line' or 'Borders' tab page + try + TabFormatChartLine.OK + catch + qaErrorLog "Error 1: Closing the 'Line' or 'Borders' tab page seems to have a serious problem -> Check this out!" + fCloseTabLineOK = 1 + exit function + endcatch + '/// Check that the 'Line' or 'Borders' tab page is not available anymore. + Kontext "TabFormatChartLine" + if TabFormatChartLine.exists(2) then + ' Return Error 2 if still present + qaErrorLog "Error 2: 'Line' or 'Borders' tab page should be invisible now ..." + qaErrorLog "... closing the dialog doesn't seem to work -> Check this out!" + fCloseTabLineOK = 2 + else + printlog ">> Closing 'Line' or 'Borders' tab page seems to work as expected" + fCloseTabLineOK = 0 + endif + + if fCloseTabLineOK = 99 then + warnlog "Error 99: Something unexpected happened!!" + endif +end function + diff --git a/testautomation/chart2/tools/ch_tools_tab_pages.inc b/testautomation/chart2/tools/ch_tools_tab_pages.inc new file mode 100644 index 000000000000..63d88d35c3ff --- /dev/null +++ b/testautomation/chart2/tools/ch_tools_tab_pages.inc @@ -0,0 +1,147 @@ +'encoding UTF-8 Do not remove or change this line! +'************************************************************************** +' DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +' +' Copyright 2000, 2010 Oracle and/or its affiliates. +' +' OpenOffice.org - a multi-platform office productivity suite +' +' This file is part of OpenOffice.org. +' +' OpenOffice.org is free software: you can redistribute it and/or modify +' it under the terms of the GNU Lesser General Public License version 3 +' only, as published by the Free Software Foundation. +' +' OpenOffice.org is distributed in the hope that it will be useful, +' but WITHOUT ANY WARRANTY; without even the implied warranty of +' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +' GNU Lesser General Public License version 3 for more details +' (a copy is included in the LICENSE file that accompanied this code). +' +' You should have received a copy of the GNU Lesser General Public License +' version 3 along with OpenOffice.org. If not, see +' <http://www.openoffice.org/license.html> +' for a copy of the LGPLv3 License. +' +'/************************************************************************ +'* +'* owner : oliver.craemer@oracle.com +'* +'* short description : Tool library for Borders and Lines tab-page +'* +'************************************************************************************************** +'* +' #1 fInvokeTabPage +' #1 fCloseTabLineOK +'* +'\************************************************************************************************ + +' ch_tools_tab_pages.inc - Library for automation of tab pages +' This Include contains a functions to handle tab-pages. +' All functions are designed to return error-codes depending on the behaviour of the action applied. +' Return codes: +' Error 0: Success. +' Error 1: The basic action beeing applied caused a serious problem, e.g. a crash. +' Error 2 TO 9: A functional problem occured. +' Error 11 TO 19: Wrong marginal conditions end up in Failure, e.g. control not visible. +' NOTE: This errors can also be used for 'negative' testing. +' Error 42: Wrong input. Probably only of interest during test development . +' Error 99: Unexpected behaviour - Shouldn't normally occur. +' ATTENTION: +' Only Errors 42 and 99 throw 'warnlogs'. +' All other errors are silent. +' They only throw QAErrorlogs the give a hint what probably went wrong. +' Expected Errors MUST exclusivly be handled by the calling routine. +' +'-------------------------------------------------------------------- +' +function fInvokeTabPage( oThisPage as OBJECT ) as INTEGER + fInvokeTabPage = 99 +' Function to invoke a tab page +' Input: +' OBJECT oThisPage +' Tab page name in declaration +' Returns error-code: +' 0 := Sucess +' 1 := Serious problem trying to invoke the page +' 2 := Failure (Page not present after invocation) +'99 := Unexpected error + + printlog "** Invoking tab page" + '/// Try to invoke tab page + Kontext + try + active.setPage oThisPage + catch + qaErrorLog "Error 1: Invoking tab page failed" + fInvokeTabPage = 1 + exit function + endcatch + + '/// Lookup if call was successful + Kontext oThisPage + if oThisPage.exists(2) then + printlog ">> Tab page is visible now." + fInvokeTabPage = 0 + else + qaErrorLog "Error 2: OOPS, calling Tab page cause any problem ..." + qaErrorLog "..., BUT the page doesn't seem to be visible" + fInvokeTabPage = 2 + endif + + if fInvokeTabPage = 99 then + warnlog "Error 99: Something unexpected happened!!" + endif +end function +' +'-------------------------------------------------------------------- +' +function fCloseTabPage( oThisPage as OBJECT ) as INTEGER + fCloseTabPage = 99 +' Function to close a tab page dialog using OK button +' Input: +' OBJECT oThisPage +' Tab page name in declaration +' Returns error-code: +' 0 := Sucess +' 1 := Serious problem trying to Close the page +' 2 := Failure (Page present after applying OK button) +'15 := Page not present before closing +'99 := Unexpected error + printlog "** Closing tab page" + Kontext oThisPage + '/// Check existence of tab page + if oThisPage.exists(2) then + printlog ">> Tab page is visible as expected." + else + ' Return Error 15 and quit if page not found + qaErrorLog "Error 15: OOPS, tab page should be visible ..." + qaErrorLog "... this is a BUG or a scripting error -> Check this out!" + fCloseTabPage = 15 + exit function + endif + '/// Click OK button in tab page + try + oThisPage.OK + catch + qaErrorLog "Error 1: Closing tab page seems to have a serious problem -> Check this out!" + fCloseTabPage = 1 + exit function + endcatch + '/// Check that of tab page has been gone + Kontext oThisPage + if oThisPage.exists(2) then + ' Return Error 2 if still present + qaErrorLog "Error 2: Tab page should be invisible now ..." + qaErrorLog "... closing the dialog doesn't seem to work -> Check this out!" + fCloseTabPage = 2 + else + printlog ">> Tab page seems to work as expected" + fCloseTabPage = 0 + endif + + if fCloseTabPage = 99 then + warnlog "Error 99: Something unexpected happened!!" + endif +end function + diff --git a/testautomation/chart2/tools/ch_tools_titles.inc b/testautomation/chart2/tools/ch_tools_titles.inc new file mode 100644 index 000000000000..c3b64a6fa8f7 --- /dev/null +++ b/testautomation/chart2/tools/ch_tools_titles.inc @@ -0,0 +1,189 @@ +'encoding UTF-8 Do not remove or change this line! +'************************************************************************** +' DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +' +' Copyright 2000, 2010 Oracle and/or its affiliates. +' +' OpenOffice.org - a multi-platform office productivity suite +' +' This file is part of OpenOffice.org. +' +' OpenOffice.org is free software: you can redistribute it and/or modify +' it under the terms of the GNU Lesser General Public License version 3 +' only, as published by the Free Software Foundation. +' +' OpenOffice.org is distributed in the hope that it will be useful, +' but WITHOUT ANY WARRANTY; without even the implied warranty of +' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +' GNU Lesser General Public License version 3 for more details +' (a copy is included in the LICENSE file that accompanied this code). +' +' You should have received a copy of the GNU Lesser General Public License +' version 3 along with OpenOffice.org. If not, see +' <http://www.openoffice.org/license.html> +' for a copy of the LGPLv3 License. +' +'/************************************************************************ +'* +'* owner : oliver.craemer@oracle.com +'* +'* short description : Tool library for Titles dialog +'* +'************************************************************************************************** +'* +' #1 fInvokeTitlesDialog +' #1 fCloseTitlesDialogOK +' #1 fSetTitle +'* +'\************************************************************************************************ + +' ch_tools_titles.inc - A library for automation of the 'Insert::Titles...' dialog +' This Include contains a set of functions to modify the controls of the Titles dialog. +' All functions are designed to return error-codes depending on the behaviour of the action applied. +' Return codes: +' Error 0: Success. +' Error 1: The basic action beeing applied caused a serious problem, e.g. a crash. +' Error 2 TO 9: A functional problem occured. +' Error 11 TO 19: Wrong marginal conditions end up in Failure, e.g. control not visible. +' NOTE: This errors can also be used for 'negative' testing. +' Error 42: Wrong input. Probably only of interest during test development . +' Error 99: Unexpected behaviour - Shouldn't normally occur. +' ATTENTION: +' Only Errors 42 and 99 throw 'Warnlogs'. +' All other errors are silent! +' They only throw QAErrorlogs the give a hint what probably went wrong. +' Expected Errors MUST exclusivly be handled by the calling routine! +' +'-------------------------------------------------------------------- +' +function fInvokeTitlesDialog() as INTEGER + fInvokeTitlesDialog = 99 +' Function to invoke the 'Insert::Titles...' dialog +' Return (Error codes): +' 0 = Sucess +' 1 = Serious problem trying to invoke the dialog +' 2 = Failure (Dialog not present after invocation) +'99 = Unexpected error + printlog "Invoking 'Insert::Titles...' in menu" + '/// Execute menu item 'Insert::Titles...' + try + InsertTitle + catch + qaErrorLog "Error 1: Invoking menu item 'Insert::Titles...' failed" + fInvokeTitlesDialog = 1 + exit function + endcatch + + '/// Lookup if call was successfull + Kontext "InsertTitleDialog" + if InsertTitleDialog.exists(2) then + printlog "Titles dialog is visible now." + fInvokeTitlesDialog = 0 + else + qaErrorLog "Error 2: 'InsertTitles' has been executed but the dialog is not visible" + fInvokeTitlesDialog = 2 + endif + + if fInvokeTitlesDialog = 99 then + warnlog "Error 99: Something unexpected happened!!" + endif +end function +' +'-------------------------------------------------------------------- +' +function fCloseTitlesDialogOK() as INTEGER + fCloseTitlesDialogOK = 99 +' Function to close the Titles dialog using OK button +' No Input +' Returns error-code: +' 0 := Sucess +' 1 := Serious problem trying to Close the dialog +' 2 := Failure (Dialog present after applying OK button) +'15 := Dialog not present before closing +'99 := Unexpected error + +printlog "** Closing Titles dialog" + Kontext "InsertTitleDialog" + '/// Check existence of Titles dialog + if InsertTitleDialog.exists(2) then + printlog ">> Titles dialog is visible as expected." + else + ' Return Error 15 and quit if dialog not found + qaErrorLog "Error 15: OOPS, Titles dialog should be visible ..." + qaErrorLog "... this is a BUG or a scripting error -> Check this out!" + fCloseTitlesDialogOK = 15 + exit function + endif + '/// Click OK button in Titles dialog + try + InsertTitleDialog.OK + catch + qaErrorLog "Error 1: Closing the Titles dialog seems to have a serious problem -> Check this out!" + fCloseTitlesDialogOK = 1 + exit function + endcatch + '/// Check that Titles dialog not existing anymore + Kontext "InsertTitleDialog" + if InsertTitleDialog.exists(2) then + ' Return Error 2 if still present + qaErrorLog "Error 2: Titles dialog should be invisible now ..." + qaErrorLog "... closing the dialog doesn't seem to work -> Check this out!" + fCloseTitlesDialogOK = 2 + else + printlog ">> Closing the Titles dialog seems to work as expected" + fCloseTitlesDialogOK = 0 + endif + + if fCloseTitlesDialogOK = 99 then + warnlog "Error 99: Something unexpected happened!!" + endif +end function +' +'-------------------------------------------------------------------- +' +function fSetTitle ( oTitle as OBJECT , sTitleString as STRING ) as INTEGER + fSetTitle = 99 +' Function to set strings in Titles dialog +' Input: OBJECT oTitle +' Title Indicator (Name of declaration): +' MainTitle, SubTitle, TitleXaxis, TitleYaxis, TitleZaxis are valid names +' STRING sTitleString +' Text to set on 'oTitle' +' Returns error-code: +' 0 := Sucess +' 1 := Serious problem trying to set title +' 2 := Title was not set +'12 := Text-box for desired title is not enabled +'99 := Unexpected error + printlog "** Setting title" + '/// Check if desired title text-box is enabled + if NOT oTitle.IsEnabled then + qaErrorLog "Error 12: Text-box for desired title is not enabled" + qaErrorLog "... BUG or Script problem -> Check this out!" + fSetTitle = 12 + exit function + endif + '/// Put the text in desired title field + Kontext "InsertTitleDialog" + try + oTitle.setText ( sTitleString ) + catch + ' Throw error 1 and quit on serious problem + qaErrorLog "Error 1: Set text on title seems to cause a serious problem -> Check this out!" + fSetTitle = 1 + exit function + endcatch + '/// Verify (against input) if title was set correctly + if oTitle.getText = sTitleString then + fSetTitle = 0 + printlog ">> Setting title seems to work" + else + qaErrorLog "Error 2: Title was not set -> Check this out!" + fSetTitle = 2 + endif + + if fSetTitle = 99 then + warnlog "Error 99: Something unexpected happened!!" + endif +end function + |