summaryrefslogtreecommitdiff
path: root/testautomation/chart2
diff options
context:
space:
mode:
Diffstat (limited to 'testautomation/chart2')
-rw-r--r--testautomation/chart2/tools/ch_tools_common.inc179
1 files changed, 94 insertions, 85 deletions
diff --git a/testautomation/chart2/tools/ch_tools_common.inc b/testautomation/chart2/tools/ch_tools_common.inc
index 311e8c354f74..2a8664109e19 100644
--- a/testautomation/chart2/tools/ch_tools_common.inc
+++ b/testautomation/chart2/tools/ch_tools_common.inc
@@ -29,83 +29,92 @@
'*
'* short description : Chart2 Tool library
'*
-'**************************************************************************************************
-'*
-' #1 fInsertOLE ' User Insert / Object / OLE to insert a chart
-' #1 fLoadVerySimpleChart ' Load file with a very simple chart
-' #1 fLoadVerySimpleChartAndSaveLocal ' Load file with a very simple chart and save it loacally
-' #1 fConvertChartTo3D ' Function to invoke the 'Insert::Titles...' dialog
-' #1 fOpenTestDocumentAndSelectDataRange ' Opens a test document and executes FormatDataRange
-' #1 fOpenTestDocumentAndInsertChart ' Opens a test document and selects a data range at a specific position
-'*
'\************************************************************************************************
-sub fInsertOLE as BOOLEAN
-'Insert Chart OLE in Document
- 'Get localised OLE names
- call GetOleDefaultNames()
- fInsertOLE = FALSE
+sub fInsertOLE() as boolean
+
+ ' Insert an OLE object (the name is localized)
+ call GetOleDefaultNames()
+
'/// Insert / Object / OLE
InsertObjectOLEObject
- sleep(1)
+
Kontext "OLEObjektEinfuegen"
- '/// Check if list box is not empty
- if Objekttyp.getItemcount < 1 then
- warnlog "There are no OLE-Objects in the listbox"
+ 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
- '/// Select chart in listbox
- Objekttyp.Select gOLEChart
- '/// Quit dialog using OK
- OLEObjektEinfuegen.OK
- sleep(2)
- fInsertOLE = TRUE
+
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
+ 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
+ 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
+ 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" )
+ 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."
+ printlog "File with very simple chart loaded successfully."
endif
'/// Save document local
Kontext "DocumentCalc"
@@ -125,28 +134,28 @@ end function
'--------------------------------------------------------------------
'
function fConvertChartTo3D() as BOOLEAN
- fConvertChartTo3D = FALSE
-'Function to invoke the 'Insert::Titles...' dialog
-'No Input
-'Returns TRUE on success
+ 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
+ '/// 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
'
'-------------------------------------------------------------------------
@@ -155,13 +164,13 @@ function fOpenTestDocumentAndSelectDataRange(sInputFile as string) as BOOLEAN
fOpenTestDocumentAndSelectDataRange = FALSE
call hFileOpen(sInputFile)
sleep(2)
- Call sMakeReadOnlyDocumentEditable()
+ Call sMakeReadOnlyDocumentEditable()
'/// Select chart using navigator
printlog "Select chart using navigator"
- call fSelectFirstOLE
+ call fSelectFirstOLE
'/// Edit / Object / Edit
printlog "Edit / Object / Edit"
- EditObjectEdit
+ EditObjectEdit
'///Open FORMAT / DATA RANGES
printlog "Open FORMAT / DATA RANGES"
FormatDataRanges
@@ -172,9 +181,9 @@ function fOpenTestDocumentAndSelectDataRange(sInputFile as string) as BOOLEAN
'Switching tabpages as workaround for #i77237#
Active.SetPage TabChartTypeDataSeries
QAErrorLog "#i77237#-Testtool can't access OK after switching tabpage"
- Active.SetPage TabChartTypeDataRange
+ Active.SetPage TabChartTypeDataRange
Kontext "TabChartTypeDataRange"
- call DialogTest ( TabChartTypeDataRange )
+ call DialogTest ( TabChartTypeDataRange )
fOpenTestDocumentAndSelectDataRange = TRUE
end function
'
@@ -184,20 +193,20 @@ 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>"
+ Call sMakeReadOnlyDocumentEditable()
+ Kontext "DocumentCalc"
+ printlog "Type <STRG+HOME>"
+ DocumentCalc.TypeKeys "<MOD1 HOME>"
printlog "Type twice <RIGHT> cursor key"
- DocumentCalc.TypeKeys "<RIGHT>" , 2
+ DocumentCalc.TypeKeys "<RIGHT>" , 2
printlog "Type thrice <DOWN> cursor key"
- DocumentCalc.TypeKeys "<DOWN>" , 3
- printlog "Menu Insert chart to open chart wizard"
+ DocumentCalc.TypeKeys "<DOWN>" , 3
+ printlog "Menu Insert chart to open chart wizard"
InsertChart
try
WaitSlot()
fOpenTestDocumentAndInsertChart = TRUE
- catch
+ catch
fOpenTestDocumentAndInsertChart = FALSE
endcatch
end function