'encoding UTF-8 Do not remove or change this line!
'**************************************************************
'
' Licensed to the Apache Software Foundation (ASF) under one
' or more contributor license agreements. See the NOTICE file
' distributed with this work for additional information
' regarding copyright ownership. The ASF licenses this file
' to you under the Apache License, Version 2.0 (the
' "License"); you may not use this file except in compliance
' with the License. You may obtain a copy of the License at
'
' http://www.apache.org/licenses/LICENSE-2.0
'
' Unless required by applicable law or agreed to in writing,
' software distributed under the License is distributed on an
' "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
' KIND, either express or implied. See the License for the
' specific language governing permissions and limitations
' under the License.
'
'**************************************************************
'*
'* 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
'///Function to invoke the 'Insert::Data Labels...' 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
'///Step-by-Step///
'///
printlog ""
printlog "** Invoking 'Insert::Data Labels...' in menu"
'///+- Execute menu item 'Insert::Data Labels...'
///
try
InsertDataLabels
catch
qaErrorLog "Error 1: Invoking menu item 'Insert::Data Labels...' failed"
fInvokeDataLabelsDialog = 1
exit function
endcatch
'///+- Lookup if call was successful
///
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
'///
end function
'
'--------------------------------------------------------------------
'
function fCloseDataLabelsDialogOK() as INTEGER
fCloseDataLabelsDialogOK = 99
'///Function to close the Data Labels 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
'///Step-by-Step///
'///
printlog " "
printlog "** Closing Data Labels dialog"
Kontext "InsertLabelsDialog"
'///+- Check existence of Data Labels dialog
///
if InsertLabelsDialog.exists(2) then
printlog ">> Data Labels dialog is visible as expected."
else
'///+- -> Return Error 15 and quit if dialog not found
///
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
'///+- Click OK button in Data Labels dialog
///
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
'///+- Check existence of Data Labels dialog
///
Kontext "InsertLabelsDialog"
if InsertLabelsDialog.exists(2) then
'///+- -> Return Error 2 if still present
///
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
'///
end function
'
'--------------------------------------------------------------------
'
function fSetShowValue ( bShowValueCheck as BOOLEAN ) as INTEGER
fSetShowValue = 99
'///Function to check 'Show Value'///
'///BOOLEAN bShowValueCheck
'///+TRUE := Check 'Show Value' - FALSE := Uncheck 'Show Value'
'///Returns error-code:
'///+ 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
'///Step-by-Step///
'///
printlog ""
printlog "** Setting 'Show Value'"
'///+- Check if 'Show Value' is enabled
///
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
'///+- Try to (Un)Check 'Show Value'
///
Kontext "InsertLabelsDialog"
try
if bShowValueCheck then
ShowValue.Check
else
ShowValue.UnCheck
endif
catch
'///+- Throw error 1 and quit on serious problem
///
qaErrorLog "Error 1: Check 'Show Value' seems to cause a serious problem -> Check this out!"
fSetShowValue = 1
exit function
endcatch
'///+- Verify (against input) if 'Show Value' was checked
///
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
'///
end function
'
'--------------------------------------------------------------------
'
function fSetValueType ( oValueType as OBJECT ) as INTEGER
fSetValueType = 99
'///Function to select Value Type///
'///Input:
'///OBJECT oValueType
'///+Declaration name of Radio-Button: AsNumber and AsPercentage are valid values
'///Returns error-code:
'///+ 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
'///Step-by-Step///
'///
printlog ""
printlog "** Setting Value type"
'///+- Check if Value type radio-button is enabled
///
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
'///+- Try to (Un)Check desired radio-button
///
Kontext "InsertLabelsDialog"
try
oValueType.Check
catch
'///+- Throw error 1 and quit on serious problem
///
qaErrorLog "Error 1: Check Value type radio-button seems to cause a serious problem -> Check this out!"
fSetValueType = 1
exit function
endcatch
'///+- Verify (against input) if Value type radio-button was checked
///
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
'///
end function
'
'--------------------------------------------------------------------
'
function fSetShowLabelText ( bShowLabelTextCheck as BOOLEAN ) as INTEGER
fSetShowLabelText = 99
'///Function to check 'Show Label Text'///
'///BOOLEAN bShowLabelTextCheck
'///+TRUE := Check 'Show Label Text' - FALSE := Uncheck 'Show Label Text'
'///Returns error-code:
'///+ 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
'///Step-by-Step///
'///
printlog ""
printlog "** Setting 'Show Label Text'"
'///+- Check if 'Show Label Text' is enabled
///
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
'///+- Try to (Un)Check 'Show Label Text'
///
Kontext "InsertLabelsDialog"
try
if bShowLabelTextCheck then
ShowLabelText.Check
else
ShowLabelText.UnCheck
endif
catch
'///+- Throw error 1 and quit on serious problem
///
qaErrorLog "Error 1: Check 'Show Label Text' seems to cause a serious problem -> Check this out!"
fSetShowLabelText = 1
exit function
endcatch
'///+- Verify (against input) if 'Show Label Text' was checked
///
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
'///
end function
'
'--------------------------------------------------------------------
'
function fSetShowLegendIconWithLabel ( bShowLegendIconCheck as BOOLEAN ) as INTEGER
fSetShowLegendIconWithLabel = 99
'///Function to check 'Show Legend Icon With Label'///
'///BOOLEAN bShowLegendIconCheck
'///+TRUE := Check 'Show Legend Icon With Label' - FALSE := Uncheck 'Show Legend Icon With Label'
'///Returns error-code:
'///+ 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
'///Step-by-Step///
'///
printlog ""
printlog "** Setting 'Show Legend Icon With Label'"
'///+- Check if 'Show Legend Icon With Label' is enabled
///
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
'///+- Try to (Un)Check 'Show Legend Icon With Label'
///
Kontext "InsertLabelsDialog"
try
if bShowLegendIconCheck then
ShowLegendIconWithLabel.Check
else
ShowLegendIconWithLabel.UnCheck
endif
catch
'///+- Throw error 1 and quit on serious problem
///
qaErrorLog "Error 1: Check 'Show Legend Icon With Label' seems to cause a serious problem -> Check this out!"
fSetShowLegendIconWithLabel = 1
exit function
endcatch
'///+- Verify (against input) if 'Show Legend Icon With Label' was checked
///
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
'///
end function