'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 : Chart resource test - Menu FILE
'*
'************************************************************************
'*
' #1 tFileClose
' #1 tFileSaveAsOTS
' #1 tFileSaveAsSXC
' #1 tFileSaveAsSTC
' #1 tFileSaveAsXLS
' #1 tFileSaveAsXLT
' #1 tFileReload
'*
'\************************************************************************
testcase tFileClose
'///Dialog test after invocation of File::CloseSave the test file as OpenDocument Spreadsheet Template (.ots)
Dim sOutputFile as string
sOutputFile = convertpath( gOfficepath & "user/work/verySimpleChart.ots" )
'/// Load simple chart document
if fLoadVerySimpleChartAndSaveLocal() > 0 then
warnlog "Loading test document failed!"
goto endsub
else
printlog "Test document successfully been loaded."
endif
'/// Select first OLE using the navigator
call fSelectFirstOLE
printlog "First OLE selected via navigator"
'/// Edit / Object / Edit to enter Inplace Mode
EditObjectEdit
printlog "Edit / Object / Edit"
'/// Convert chart to 3D (just to edit document)
if NOT fConvertChartTo3D() then
warnlog "Conversion of chart to 3D failed -> Quit testcase"
Call hCloseDocument
goto endsub
else
printlog "Conversation of chart to 3D was successful."
endif
'/// Unselect chart using Escape key
Kontext "DocumentCalc"
DocumentCalc.TypeKeys ""
if NOT hFileSaveAsWithFilterKill ( sOutputFile , "calc8_template" ) then
warnlog "Saving test document as '" & sOutputFile & "' failed -> Aborting"
call hCloseDocument
goto endsub
endif
'/// Clsoing the Navigator
Kontext "NavigatorCalc"
if NavigatorCalc.Exists(1) then
NavigatorCalc.Close
QAErrorLog "Why did fSelectFirstOLE not close this dialog?"
endif
'/// Close document
Call hCloseDocument
endcase
'
'-------------------------------------------------------------
'
testcase tFileSaveAsSXC
'///Save the test file as StarOffice 6.0/7 Spreadsheet (.sxc)
Dim sOutputFile as string
sOutputFile = convertpath( gOfficepath & "user/work/verySimpleChart.sxc" )
'/// Load simple chart document
if fLoadVerySimpleChartAndSaveLocal() > 0 then
warnlog "Loading test document failed!"
goto endsub
else
printlog "Loading test document was successful!"
endif
'/// Select chart using navigator
call fSelectFirstOLE
printlog "First OLE selected via Navigator"
'/// Edit / Object / Edit to enter Inplace Mode
EditObjectEdit
printlog "Edit / Object / Edit"
'/// Convert chart to 3D (just to edit document)
if NOT fConvertChartTo3D() then
warnlog "Conversion of chart to 3D failed -> Quit testcase"
Call hCloseDocument
goto endsub
endif
'/// Unselect chart using Escape key
Kontext "DocumentCalc"
DocumentCalc.TypeKeys ""
'/// Save document as StarOffice 6.0/7 Spreadsheet (.sxc)
if NOT hFileSaveAsWithFilterKill ( sOutputFile , "StarOffice XML (Calc)") then
warnlog "Saving test document as '" & sOutputFile & "' failed -> Aborting"
call hCloseDocument
goto endsub
endif
'/// Close document
Call hCloseDocument
endcase
'
'-------------------------------------------------------------
'
testcase tFileSaveAsSTC
'///Save the test file as StarOffice 6.0/7 Spreadsheet Template (.stc)
Dim sOutputFile as string
sOutputFile = convertpath( gOfficepath & "user/work/verySimpleChart.stc" )
'/// Load simple chart document
if fLoadVerySimpleChartAndSaveLocal() > 0 then
warnlog "Loading test document seems to have failed -> Check this out!"
goto endsub
else
printlog "Simple chart document successfully been loaded."
endif
'/// Select chart using navigator
call fSelectFirstOLE
'/// Edit / Object / Edit
EditObjectEdit
'/// Convert chart to 3D (just to edit document)
if NOT fConvertChartTo3D() then
warnlog "Conversion of chart to 3D failed -> Quit testcase"
Call hCloseDocument
goto endsub
endif
'/// Unselect chart using Escape key
Kontext "DocumentCalc"
DocumentCalc.TypeKeys ""
'/// Save document as StarOffice 6.0/7 Spreadsheet Template (.stc)
if NOT hFileSaveAsWithFilterKill ( sOutputFile , "calc_StarOffice_XML_Calc_Template" ) then
warnlog "Saving test document as '" & sOutputFile & "' failed -> Aborting"
call hCloseDocument
goto endsub
endif
'/// Close document
Call hCloseDocument
endcase
'
'-------------------------------------------------------------
'
testcase tFileSaveAsXLS
'///Save the test file as Microsoft Excel 97/2000/XP (.xls)
Dim sOutputFile as string
sOutputFile = convertpath( gOfficepath & "user/work/verySimpleChart.xls" )
'/// Load simple chart document Testtoolpath/chart2/required/input/verySimpleChart.ods
if fLoadVerySimpleChartAndSaveLocal() > 0 then
warnlog "Loading test document failed!"
goto endsub
endif
'/// Edit / Navigator
'/// Select the first OLE object in the tree view of the Navigator
'/// Press
call fSelectFirstOLE
printlog "First OLE selected."
'/// Edit / Object / Edit to enter Inplace Mode
EditObjectEdit
printlog "Edit / Object / Edit executed."
'/// Format / Chart Type
'/// Check 3D checkbox
'/// Close Chart Type dialog
if NOT fConvertChartTo3D() then
warnlog "Conversion of chart to 3D failed -> Quit testcase"
Call hCloseDocument
goto endsub
else
printlog "Chart type converted to 3D."
endif
'/// Unselect chart using Escape key
Kontext "DocumentCalc"
DocumentCalc.TypeKeys ""
'/// Save document as Microsoft Excel 97/2000/XP (.xls)
if NOT hFileSaveAsWithFilterKill ( sOutputFile , "MS Excel 97" ) then
warnlog "Saving test document as '" & sOutputFile & "' failed -> Aborting"
call hCloseDocument
goto endsub
endif
'/// Close document
Kontext "DocumentCalc"
DocumentCalc.TypeKeys ""
Call hCloseDocument
endcase
'
'-------------------------------------------------------------------------------
'
testcase tFileSaveAsXLT
'///Save the test file as Microsoft Excel 97/2000/XP Template(.xlt)
Dim sOutputFile as string
sOutputFile = convertpath( gOfficepath & "user/work/verySimpleChart.xlt" )
'/// Load simple chart document Testtoolpath/chart2/required/input/verySimpleChart.ods
if fLoadVerySimpleChartAndSaveLocal() > 0 then
warnlog "Loading test document failed!"
goto endsub
endif
'/// Edit / Navigator
'/// Select the first OLE object in the tree view of the Navigator
'/// Press
call fSelectFirstOLE
printlog "First OLE selected."
'/// Edit / Object / Edit to enter Inplace Mode
EditObjectEdit
printlog "Edit / Object / Edit executed."
'/// Format / Chart Type
'/// Check 3D checkbox
'/// Close Chart Type dialog
if NOT fConvertChartTo3D() then
warnlog "Conversion of chart to 3D failed -> Quit testcase"
Call hCloseDocument
goto endsub
else
printlog "Chart type converted to 3D."
endif
'/// Unselect chart using Escape key
Kontext "DocumentCalc"
DocumentCalc.TypeKeys ""
'/// Save document as Microsoft Excel 97/2000/XP Template(.xlt)
if NOT hFileSaveAsWithFilterKill ( sOutputFile , "MS Excel 97 Vorlage/Template" ) then
warnlog "Saving test document as '" & sOutputFile & "' failed -> Aborting"
call hCloseDocument
goto endsub
endif
'/// Close document
Kontext "DocumentCalc"
DocumentCalc.TypeKeys ""
Call hCloseDocument
endcase
'
'-------------------------------------------------------------
'
testcase tFileReload
printlog "Load simple chart document"
if fLoadVerySimpleChartAndSaveLocal() > 0 then
warnlog "Loading test document seems to have failed -> Check this out!"
goto endsub
endif
printlog "Select chart using navigator"
call fSelectFirstOLE
printlog "Invoke Edit / Object / Edit to enter Inplace Mode"
EditObjectEdit
printlog "Convert chart to 3D (just to edit document)"
if NOT fConvertChartTo3D() then
warnlog "Conversion of chart to 3D failed -> Quit testcase"
Call hCloseDocument
goto endsub
endif
printlog "Unselect chart using Escape key"
Kontext "DocumentCalc"
DocumentCalc.TypeKeys ""
sleep (2)
printlog "File / Reload"
FileReload
printlog "MsgBox 'Cancel all changes?' should be visible -> Commit OK"
Kontext
Active.Yes
sleep (2)
printlog "Close document ///"
Call hCloseDocument
endcase