office-gobmx/smoketestdoc/data/Global.xml
2011-03-24 10:33:51 +00:00

832 lines
30 KiB
XML

<?xml version="1.0" encoding="UTF-8"?>
<!--**********************************************************************
*
* 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.
*
**********************************************************************-->
<!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd">
<script:module xmlns:script="http://openoffice.org/2000/script" script:name="Global" script:language="StarBasic">REM ***** BASIC *****
const cMaxErrorStates = 14
const cCoGreen = 4057917, cCoRed = 16711680, cCoGrey = 12632256
const cParagraphBreak = 0
global const cExtensionFileName = &quot;TestExtension.oxt&quot;
global const cDocNew = 0, cDocSaveOpen8 = 1, cDocSaveOpenXML = 2, cDocOpen50 = 3, cDocClose = 4
global const cDBService = 0, cDBOpen = 1, cDBInsert = 2, cDBDelete = 3, cDBSeek = 4, cDBClose = 5
global const cEXTService = 0, cEXTInstall = 1, cEXTUninstall = 2
global const cTestClosureSetupDoc = 0, cTestClosureWriteStatus = 1
global const cLogfileFailed = 255
global const cStWriter = 0, cStCalc = 1, cStPraesentation = 2, cStZeichnen = 3
global const cStHTML = 6, cStChart = 4, cStJava = 7
global const cStMath = 5, cStDataBase = 9
global const cStExtension = 11
global const cStTestGlue = 12
global const cStNone = -1
global const cFlt8 = 0, cFlt50 = 32, cFltNewDoc = 64, cFltXML = 128
global const frmWriter = 1, frmCalc = 2, frmImpress = 4
global const frmMath = 5, frmChart = 7, frmHyperText = 8, frmDraw = 9
global const frmDataBase = 10, frmJava = 13
global const frmExtension = 14
global const frmTestClosure = 15
Global gCurrentDocTest As Integer
Global gCurrentTestCase As Integer
global const cLogUnknown = 0, cLogFalse = 1, cLogTrue = 2
&apos;UserFieldKennungen
Global const cYes = &quot;y&quot;, cNo = &quot;n&quot;
Global const cStateNo = 0, cStateYes = 1
&apos;Feldtypen
Global const cFtExtUser = 21, cFtPageNum = 5, cFtStatistic = 8, cFtDateTime = 27, cFtDatabase = 31
&apos;UnoStrings
Global const cUnoSeparator = &quot;.&quot;
Global const cUnoPrefix = &quot;com.sun.star.&quot;
Global const cUnoUserField = cUnoPrefix + &quot;text.FieldMaster.User&quot;
Global const cUnoExtUserField = cUnoPrefix + &quot;text.TextField.ExtendedUser&quot;
Global const cUnoMasterDataBase = cUnoPrefix + &quot;text.FieldMaster.Database&quot;
Global const cUnoDataBase = cUnoPrefix + &quot;text.TextField.Database&quot;
Global const cUnoDateTime = cUnoPrefix + &quot;text.TextField.DateTime&quot;
Global const cUnoTextGraphi2 = cUnoPrefix + &quot;text.Graphic&quot;
Global const cUnoJavaLoader = cUnoPrefix + &quot;loader.Java&quot;
Global const cUnoDatabaseContext = cUnoPrefix + &quot;sdb.DatabaseContext&quot;
Global const cUnoRowSet = cUnoPrefix + &quot;sdb.RowSet&quot;
Global const cUnoSmoketestTestExtension = cUnoPrefix + &quot;comp.smoketest.TestExtension&quot;
Global const cUnoSmoketestCommandEnvironment = cUnoPrefix + &quot;deployment.test.SmoketestCommandEnvironment&quot;
Global const cExtensionManager = cUnoPrefix + &quot;deployment.ExtensionManager&quot;
&apos;UserFieldNames
Global const cUserFieldTestWriter = &quot;Writer&quot;, cUserFieldTestCalc = &quot;Calc&quot;, cUserFieldTestImpress = &quot;Impress&quot;
Global const cUserFieldTestDraw = &quot;Draw&quot;, cUserFieldTestMath = &quot;Math&quot;, cUserFieldTestChart = &quot;Chart&quot;
Global const cUserFieldTestHTML = &quot;HTML&quot;, cUserFieldTestJava = &quot;Java&quot;, cUserFieldTestDatabase = &quot;Database&quot;
Global const cUserFieldTestExtension = &quot;Extension&quot;
Global const cUserFieldTestOpenSaveXML = &quot;SaveOpenXML&quot;
Global const cUserFieldTestOpen50 = &quot;Open50&quot;
Global const cUserFieldTestTerminateAfterTest = &quot;Terminate&quot;, cUserFieldTestOpenSave8 = &quot;SaveOpen8&quot;
Global const cOptionsDialogName = &quot;OptionsDlg&quot;, cTest10Modul = &quot;Standard&quot;
Global const cDlgCancel = 1, cDlgOk = 0, cDlgStartTest = 2
global gErrorState (cMaxErrorStates, 5) as integer
Global gTestCaseAnnotations( cMaxErrorStates, 5 ) As String
global gOutputDoc as Object
global gOutputDocNotUno as Object
global gOptionsDialog as Object
Global bMakeWriterTest as boolean, bMakeCalcTest as boolean, bMakeImpressTest as boolean
Global bMakeDrawTest as Boolean, bMakeMathTest as boolean, bMakeChartTest as boolean
Global bMakeHTMLTest as boolean, bMakeJavaTest as boolean, bMakeDBTest as boolean
Global bMakeExtensionTest as boolean
Global bMakeSaveOpenXMLTest as boolean, bMakeOpen50Test as boolean
Global bMakeTerminateAfterTest as boolean, bShowTable as boolean
Global bMakeSaveOpen8Test as boolean
global sExtensionURL as string
Dim gDlgState as Integer
Sub SetGlobalDoc
gOutputDoc = ThisComponent
end Sub
Sub ClearStatus
for j% = 0 to cMaxErrorStates
for i% = 0 to 5
gErrorState (j%, i%) = cLogUnknown
gTestCaseAnnotations( J%, i% ) = ""
next i%
next j%
end Sub
Sub ClearAllText
call SetGlobalDoc
call ClearDoc (gOutputDoc)
call ClearStatus
end Sub
Sub AssertionHandler( sMessage as String )
LogTestResult( &quot;assertion caught: &quot; + sMessage, FALSE )
End Sub
Sub Main
On Local Error Goto MainError
gCurrentDocTest = frmTestClosure
gCurrentTestCase = cLogfileFailed
DeleteAllSavedFiles()
DeleteAllLogFiles()
SetupWorkPath()
if GetSystem (sWorkPath) = &quot;windows&quot; then
sWorkPath = ConvertPathToWin (sWorkPath)
end if
LocalTestLog% = OpenLogDat( GetLogFileName( gCurrentDocTest ) )
gCurrentTestCase = cTestClosureSetupDoc
CaptureAssertions( "AssertionHandler" )
call SetGlobalDoc
Dim bWasModified as Boolean
bWasModified = gOutputDoc.isModified()
if bShowTable then
call ClearDoc (gOutputDoc)
end If
call ClearStatus
LogTestResult( GetTestGlueDescription( gCurrentTestCase ), TRUE )
Dim nPreserveFileHandle%
nPreserveFileHandle% = LocalTestLog%
Call Test_10er.Main
LocalTestLog% = nPreserveFileHandle%
gCurrentDocTest = frmTestClosure
gCurrentTestCase = cTestClosureWriteStatus
if bShowTable then
call CreateStatusTable2
call CreateStatusTable
call CreateDocState
LogTestResult( GetTestGlueDescription( gCurrentTestCase ), TRUE )
&apos; do this LogTestResult call before CreateSecondState, since the latter accesses (and displays) the result
call CreateSecondState
gOutputDoc.CurrentController.ViewCursor.JumpToFirstPage
Else
LogTestResult( GetTestGlueDescription( gCurrentTestCase ), TRUE )
End If
&apos; print the &apos;test complete&apos; marker
Print #LocalTestLog%, &quot;---&quot;
LocalTestLog% = 0
gOutputDoc.setModified( bWasModified )
CaptureAssertions( &quot;&quot; )
Exit Sub
MainError:
If ( gCurrentTestCase = cLogfileFailed ) then
LogTestResult( &quot;&quot;, False )
Exit Sub
else
LogTestResult( &quot;testclosure &quot; + GetTestGlueDescription( gCurrentTestCase ), FALSE )
Close #LocalTestLog%
LocalTestLog = 0
End If
End Sub
Function GetTestGlueDescription( nTestCase as Integer )
Select Case ( nTestCase )
case cTestClosureSetupDoc
GetTestGlueDescription = &quot;setup&quot;
case cTestClosureWriteStatus
GetTestGlueDescription = &quot;write_status&quot;
case Else
GetTestGlueDescription = &quot;&quot;
End Select
End Function
Sub CreateStatusTable
dim tableHeaders(7) as string
tableHeaders(cStWriter) = &quot;Writer&quot;
tableHeaders(cStCalc) = &quot;Calc&quot;
tableHeaders(cStPraesentation) = &quot;Präsen- tation&quot;
tableHeaders(cStZeichnen) = &quot;Zeichn.&quot;
tableHeaders(cStChart) = &quot;Diagr.&quot;
tableHeaders(cStMath) = &quot;Math&quot;
tableHeaders(cStHTML) = &quot;HTML&quot;
tableHeaders(cStJava) = &quot;Java&quot;
dim tableRows(4) as string
tableRows(cDocNew) = &quot;new&quot;
tableRows(cDocSaveOpen8) = &quot;V8.0&quot;
tableRows(cDocSaveOpenXML) = &quot;XML&quot;
tableRows(cDocOpen50) = &quot;V5.0&quot;
tableRows(cDocClose) = &quot;close&quot;
aDoc = gOutputDoc
xText = aDoc.Text
xCursor = xText.createTextCursor()
xCursor.gotoStart(FALSE)
xCursor.GoRight (4, False)
SetParagraphBreak (xCursor)
xCursor.GoRight (1, False)
SetParagraphBreak (xCursor)
xCursor.GoRight (1, False)
table = aDoc.createInstance(&quot;com.sun.star.text.TextTable&quot;)
table.initialize(6,9)
table.Name = &quot;StTab1&quot;
table.BackColor = cCoGrey
xText.insertTextContent(xCursor, table, FALSE)
for i% = 0 to 7
tableCell = table.getCellByPosition( i% + 1, 0 )
tableCell.String = tableHeaders( i% )
next i%
for i% = LBound( tableRows ) to UBound( tableRows )
tableCell = table.getCellByPosition( 0, i% + 1 )
tableCell.String=tableRows(i%)
next i%
end Sub
Sub CreateStatusTable2
dim tableHeaders(4) as string
tableHeaders(0) = &quot;Database&quot;
tableHeaders(1) = &quot;&quot;
tableHeaders(2) = &quot;Extension&quot;
tableHeaders(3) = &quot;&quot;
tableHeaders(4) = &quot;Other&quot;
dim tableRows(5) as string
tableRows(cDBService ) = &quot;services&quot;
tableRows(cDBOpen ) = &quot;open&quot;
tableRows(cDBInsert ) = &quot;insert&quot;
tableRows(cDBDelete ) = &quot;delete&quot;
tableRows(cDBSeek ) = &quot;seek&quot;
tableRows(cDBClose ) = &quot;close&quot;
dim tableRows2(2) as string
tableRows2(cEXTService ) = &quot;services&quot;
tableRows2(cEXTInstall ) = &quot;install&quot;
tableRows2(cEXTUninstall ) = &quot;uninstall&quot;
dim tableRows3(1) as string
tableRows3(cTestClosureSetupDoc ) = &quot;setup test&quot;
tableRows3(cTestClosureWriteStatus ) = &quot;write test result&quot;
aDoc = gOutputDoc
xText = aDoc.Text
xCursor = xText.createTextCursor()
xCursor.gotoStart(FALSE)
xCursor.GoRight (4, False)
SetParagraphBreak (xCursor)
SetParagraphBreak (xCursor)
xCursor.gotoEnd(FALSE)
table = aDoc.createInstance(&quot;com.sun.star.text.TextTable&quot;)
table.initialize(7,6)
table.Name = &quot;StTab2&quot;
table.BackColor = cCoGrey
xText.insertTextContent(xCursor, table, FALSE)
for i% = LBound( tableHeaders ) to UBound( tableHeaders )
tableCell = table.getCellByPosition( i% + 1, 0 )
tableCell.String = tableHeaders(i%)
next i%
for i% = LBound( tableRows ) to UBound( tableRows )
tableCell = table.getCellByPosition( 0, i% + 1 )
tableCell.String=tableRows(i%)
next i%
for i% = LBound( tableRows2 ) to UBound( tableRows2 )
tableCell = table.getCellByPosition( 2, i% + 1 )
tableCell.String=tableRows2(i%)
next i%
for i% = LBound( tableRows3 ) to UBound( tableRows3 )
tableCell = table.getCellByPosition( 4, i% + 1 )
tableCell.String=tableRows3(i%)
next i%
end Sub
Sub CreateDocState
aDoc = gOutputDoc
table = aDoc.TextTables.GetByIndex (1)
for j% = 0 to 7
for i% = 0 to 4
sRangeName = GetRangeName(j%, i%+1)
tableCursor = table.createCursorByCellName(sRangeName)
cName = tableCursor.getRangeName()
xCell = table.getCellByName(cName)
xCell.BackTransparent = False
If gErrorState (j%, i%) = cLogTrue Then
xCell.BackColor = cCoGreen
else
If gErrorState (j%, i%) = cLogFalse Then
xCell.BackColor = cCoRed
If ( gTestCaseAnnotations( j%, i% ) &lt;&gt; "" ) Then
Dim annotation as Object
annotation = aDoc.createInstance( &quot;com.sun.star.text.TextField.Annotation&quot; )
annotation.Author = &quot;smoketest&quot;
annotation.Content = gTestCaseAnnotations( j%, i% )
xCell.insertTextContent( xCell, annotation, false )
End If
else
xCell.BackColor = cCoGrey
end If
end If
next i%
next j%
end Sub
Sub CreateSecondState
aDoc = gOutputDoc
table = aDoc.TextTables.GetByIndex (0)
Dim stateIndex(2) as Integer
stateIndex(0) = cStDataBase
stateIndex(1) = cStExtension
stateIndex(2) = cStTestGlue
Dim j as Integer
For j = LBound( stateIndex ) To UBound( stateIndex )
for i% = 1 to 6
tableCell = table.getCellByPosition( 2 * j + 1, i% )
tableCell.BackTransparent = False
if gErrorState( stateIndex(j), i% - 1 ) = cLogTrue then
tableCell.BackColor = cCoGreen
else
if gErrorState ( stateIndex(j), i% - 1 ) = cLogFalse then
tableCell.BackColor = cCoRed
If ( gTestCaseAnnotations( stateIndex(j), i% - 1 ) &lt;&gt; &quot;&quot; ) Then
Dim annotation as Object
annotation = aDoc.createInstance( &quot;com.sun.star.text.TextField.Annotation&quot; )
annotation.Author = &quot;smoketest&quot;
annotation.Content = gTestCaseAnnotations( stateIndex(j), i% - 1 )
tableCell.insertTextContent( tableCell, annotation, false )
End If
else
tableCell.BackColor = cCoGrey
end If
end If
next i%
next j%
end Sub
Function GetRangeName (nColumn as integer, nRow as integer) as string
GetRangeName = chr (nColumn+66) + Trim(Str(nRow+1))
end Function
Sub LogTestResult( sTestCaseDescription as String, bSuccess as Boolean )
If ( gCurrentTestCase = cLogfileFailed ) Then
Dim sAnnotation as String
sAnnotation = &quot;creating logfile &apos;&quot; + GetLogFileName( gCurrentDocTest ) + &quot;&apos; failed&quot;
LogState( FALSE, sAnnotation, GlobalTestLog )
RecordTestCaseStatus( 0, FALSE, sAnnotation )
Else
bSuccess = RecordTestCaseStatus( gCurrentTestCase, bSuccess, sTestCaseDescription )
If ( LocalTestLog &lt;&gt; 0 ) Then
LogState( bSuccess, sTestCaseDescription, LocalTestLog )
EndIf
if ( GlobalTestLog &lt;&gt; 0 ) Then
LogState( bSuccess, sTestCaseDescription, GlobalTestLog )
EndIf
End If
End Sub
Function RecordTestCaseStatus( nAction as Integer, bState as Boolean, sFailureAnnotation as String ) as Boolean
Dim nStatusType as Integer
Dim nState as integer
nStatusType = GetStatusType( gCurrentDocTest )
If nStatusType = cStNone then Exit Function
If ( gErrorState( nStatusType, nAction ) = cLogFalse ) Then
&apos; don't overwrite a previous &quot;failed&quot; state for this test
bState = FALSE
End If
if bState then
nState = cLogTrue
else
nState = cLogFalse
end If
gErrorState (nStatusType, nAction) = nState
If ( nState = cLogFalse ) And ( sFailureAnnotation &lt;&gt; &quot;&quot; ) Then
gTestCaseAnnotations( nStatusType, nAction ) = gTestCaseAnnotations( nStatusType, nAction ) + sFailureAnnotation + chr(13)
End If
RecordTestCaseStatus = bState
End Function
Function GetStatusType (nDocType as Integer) as Integer
Select Case ( nDocType )
case frmWriter
GetStatusType = cStWriter &apos; text document
case frmCalc
GetStatusType = cStCalc &apos; spreadsheet document
case frmImpress
GetStatusType = cStPraesentation &apos; presentation
case frmDraw
GetStatusType = cStZeichnen &apos; drawing
case frmMath
GetStatusType = cStMath &apos; formula
case frmHyperText
GetStatusType = cStHTML &apos; HTML document
case frmChart
GetStatusType = cStChart &apos; chart
case frmJava
GetStatusType = cStJava &apos;Java
case frmTestClosure
GetStatusType = cStTestGlue &apos; test framework
case frmDataBase
GetStatusType = cStDataBase &apos;DataBase
case frmExtension
GetStatusType = cStExtension &apos;Extension
case else
GetStatusType = cStNone
end Select
end Function
Sub SetParagraphBreak (aCursor as Object)
aCursor.Text.InsertControlCharacter (aCursor, cParagraphBreak, True)
end Sub
Sub ClearDoc (aDoc as Object)
Dim aText as Object
Dim i%
for i%=1 to aDoc.TextTables.count
aDoc.TextTables.GetByIndex(0).dispose
next
aText = aDoc.Text.CreateTextCursor
aText.GotoStart (False)
aText.GoRight (3, False)
SetParagraphBreak (aText)
aText.GotoEnd (True)
aText.String=&quot;&quot;
end Sub
Sub ClearDocFull (aDoc as Object)
Dim aText as Object
Dim i%
for i%=1 to aDoc.TextTables.count
aDoc.TextTables.GetByIndex(0).dispose
next
aText = aDoc.Text.CreateTextCursor
aText.GotoStart (False)
aText.GotoEnd (True)
aText.String=&quot;&quot;
end Sub
Sub SetGlobalOptionsDialog ()
Dim oLibContainer As Object, oLib As Object
Dim oInputStreamProvider As Object
Dim oDialog As Object
Const sLibName = cTest10Modul
Const sDialogName = cOptionsDialogName
REM get library and input stream provider
oLibContainer = DialogLibraries
REM load the library
oLibContainer.loadLibrary( sLibName )
oLib = oLibContainer.getByName( sLibName )
oInputStreamProvider = oLib.getByName( sDialogName )
REM create dialog control
gOptionsDialog = CreateUnoDialog( oInputStreamProvider )
end Sub
Sub ShowOptionsDlg
call SetGlobalDoc
call SetGlobalOptionsDialog
call GetOptions
REM show the dialog
gOptionsDialog.execute()
&apos; jetzt läuft der Dialog, bis ein Button gedrückt wird
Select Case (gDlgState)
case cDlgOk
call SetOptions ()
case cDlgStartTest
call SetOptions ()
call StartTestByOptions ()
end Select
gOptionsDialog.dispose()
end Sub
Sub SetOptions
call SetGlobalDoc
SetUserFieldState (cUserFieldTestWriter, -(gOptionsDialog.getControl(&quot;cbWriterTest&quot;).getState), gOutputDoc)
SetUserFieldState (cUserFieldTestCalc, -(gOptionsDialog.getControl(&quot;cbCalcTest&quot;).getState), gOutputDoc)
SetUserFieldState (cUserFieldTestImpress, -(gOptionsDialog.getControl(&quot;cbImpressTest&quot;).getState), gOutputDoc)
SetUserFieldState (cUserFieldTestDraw, -(gOptionsDialog.getControl(&quot;cbDrawTest&quot;).getState), gOutputDoc)
SetUserFieldState (cUserFieldTestHTML, -(gOptionsDialog.getControl(&quot;cbHTMLTest&quot;).getState), gOutputDoc)
SetUserFieldState (cUserFieldTestMath, -(gOptionsDialog.getControl(&quot;cbMathTest&quot;).getState), gOutputDoc)
SetUserFieldState (cUserFieldTestChart, -(gOptionsDialog.getControl(&quot;cbChartTest&quot;).getState), gOutputDoc)
SetUserFieldState (cUserFieldTestJava, -(gOptionsDialog.getControl(&quot;cbJavaTest&quot;).getState), gOutputDoc)
SetUserFieldState (cUserFieldTestDatabase, -(gOptionsDialog.getControl(&quot;cbDatabaseTest&quot;).getState), gOutputDoc)
SetUserFieldState (cUserFieldTestExtension, -(gOptionsDialog.getControl(&quot;cbExtensionTest&quot;).getState), gOutputDoc)
SetUserFieldState (cUserFieldTestOpenSaveXML, -(gOptionsDialog.getControl(&quot;cbSaveOpenXMLTest&quot;).getState), gOutputDoc)
SetUserFieldState (cUserFieldTestOpen50, -(gOptionsDialog.getControl(&quot;cbOpen50Test&quot;).getState), gOutPutDoc)
SetUserFieldState (cUserFieldTestOpenSave8, -(gOptionsDialog.getControl(&quot;cbSaveOpen8Test&quot;).getState), gOutputDoc)
SetUserFieldState (cUserFieldTestTerminateAfterTest, -(gOptionsDialog.getControl(&quot;cbTerminateAfterTest&quot;).getState), gOutputDoc)
end Sub
Sub GetOptions
call SetGlobalDoc
gOptionsDialog.getControl(&quot;cbWriterTest&quot;).setState( -( GetUserFieldState (cUserFieldTestWriter, gOutputDoc)))
gOptionsDialog.getControl(&quot;cbCalcTest&quot;).setState ( -( GetUserFieldState (cUserFieldTestCalc, gOutputDoc)))
gOptionsDialog.getControl(&quot;cbImpressTest&quot;).setState( -( GetUserFieldState (cUserFieldTestImpress, gOutputDoc)))
gOptionsDialog.getControl(&quot;cbDrawTest&quot;).setState( -( GetUserFieldState (cUserFieldTestDraw, gOutputDoc)))
gOptionsDialog.getControl(&quot;cbHTMLTest&quot;).setState( -( GetUserFieldState (cUserFieldTestHTML, gOutputDoc)))
gOptionsDialog.getControl(&quot;cbMathTest&quot;).setState( -( GetUserFieldState (cUserFieldTestMath, gOutputDoc)))
gOptionsDialog.getControl(&quot;cbChartTest&quot;).setState( -( GetUserFieldState (cUserFieldTestChart, gOutputDoc)))
gOptionsDialog.getControl(&quot;cbJavaTest&quot;).setState( -( GetUserFieldState (cUserFieldTestJava, gOutputDoc)))
gOptionsDialog.getControl(&quot;cbDatabaseTest&quot;).setState( -( GetUserFieldState (cUserFieldTestDatabase, gOutputDoc)))
gOptionsDialog.getControl(&quot;cbExtensionTest&quot;).setState( -( GetUserFieldState (cUserFieldTestExtension, gOutputDoc)))
gOptionsDialog.getControl(&quot;cbSaveOpenXMLTest&quot;).setState( -( GetUserFieldState (cUserFieldTestOpenSaveXML, gOutputDoc)))
gOptionsDialog.getControl(&quot;cbOpen50Test&quot;).setState( -( GetUserFieldState (cUserFieldTestOpen50, gOutPutDoc)))
gOptionsDialog.getControl(&quot;cbSaveOpen8Test&quot;).setState( -( GetUserFieldState (cUserFieldTestOpenSave8, gOutputDoc)))
gOptionsDialog.getControl(&quot;cbTerminateAfterTest&quot;).setState( -( GetUserFieldState (cUserFieldTestTerminateAfterTest, gOutputDoc)))
End Sub
Sub ReadOptions
call SetGlobalDoc
bMakeWriterTest = GetUserFieldState (cUserFieldTestWriter, gOutputDoc)
bMakeCalcTest = GetUserFieldState (cUserFieldTestCalc, gOutputDoc)
bMakeImpressTest = GetUserFieldState (cUserFieldTestImpress, gOutputDoc)
bMakeDrawTest = GetUserFieldState (cUserFieldTestDraw, gOutputDoc)
bMakeHTMLTest = GetUserFieldState (cUserFieldTestHTML, gOutputDoc)
bMakeMathTest = GetUserFieldState (cUserFieldTestMath, gOutputDoc)
bMakeChartTest = GetUserFieldState (cUserFieldTestChart, gOutputDoc)
bMakeJavaTest = GetUserFieldState (cUserFieldTestJava, gOutputDoc)
bMakeDBTest = GetUserFieldState (cUserFieldTestDatabase, gOutputDoc)
bMakeExtensionTest = GetUserFieldState (cUserFieldTestExtension, gOutputDoc)
bMakeSaveOpenXMLTest = GetUserFieldState (cUserFieldTestOpenSaveXML, gOutputDoc)
bMakeOpen50Test = GetUserFieldState (cUserFieldTestOpen50, gOutPutDoc)
bMakeSaveOpen8Test = GetUserFieldState (cUserFieldTestOpenSave8, gOutputDoc)
bMakeTerminateAfterTest = GetUserFieldState (cUserFieldTestTerminateAfterTest, gOutputDoc)
end Sub
Sub SetDefaultOptions
bMakeWriterTest = true
bMakeCalcTest = true
bMakeImpressTest = true
bMakeDrawTest = true
bMakeHTMLTest = true
bMakeMathTest = true
bMakeChartTest = true
if Environ(&quot;SOLAR_JAVA&quot;) = &quot;&quot; then
bMakeJavaTest = false
bMakeDBTest = false
bMakeExtensionTest = false
else
bMakeJavaTest = true
bMakeDBTest = true
bMakeExtensionTest = true
End If
bMakeSaveOpenXMLTest = true
REM Disable StarOffice 5.0 tests in case binfilter has not been included
if Environ(&quot;WITH_BINFILTER&quot;) = &quot;NO&quot; then
bMakeOpen50Test = false
else
bMakeOpen50Test = true
End If
bMakeSaveOpen8Test = true
bMakeTerminateAfterTest = false
end Sub
Sub StartTestByOptions
bShowTable = true
call ReadOptions
call Main
if bMakeTerminateAfterTest then
ClearDocFull (gOutputDoc)
gOutputDoc.dispose
&apos;StarDesktop.Terminate
&apos;EnableReschedule( false )
&apos;DispatchSlot( 5300 )
stop
End If
end Sub
Function StartTestWithDefaultOptions
bShowTable = false
call SetDefaultOptions
call Main
dim component(cMaxErrorStates) as string
component(cStWriter) = &quot;Writer&quot;
component(cStCalc) = &quot;Calc&quot;
component(cStPraesentation) = &quot;Impress&quot;
component(cStZeichnen) = &quot;Draw&quot;
component(cStChart) = &quot;Chart&quot;
component(cStMath) = &quot;Math&quot;
component(cStHTML) = &quot;HTML&quot;
component(cStJava) = &quot;Java&quot;
component(cStDataBase) = &quot;Base&quot;
component(cStExtension) = &quot;Extensions&quot;
dim action(4) as string
action(cDocNew) = &quot;new&quot;
action(cDocSaveOpen8) = &quot;V8.0&quot;
action(cDocSaveOpenXML) = &quot;XML&quot;
action(cDocOpen50) = &quot;V5.0&quot;
action(cDocClose) = &quot;close&quot;
dim baseAction(5) as string
baseAction(cDBService) = &quot;services&quot;
baseAction(cDBOpen) = &quot;open&quot;
baseAction(cDBInsert) = &quot;insert&quot;
baseAction(cDBDelete) = &quot;delete&quot;
baseAction(cDBSeek) = &quot;seek&quot;
baseAction(cDBClose) = &quot;close&quot;
dim extAction(2) as string
extAction(cEXTService) = &quot;services&quot;
extAction(cEXTInstall) = &quot;install&quot;
extAction(cEXTUninstall) = &quot;uninstall&quot;
dim result as string
for i = 0 to cMaxErrorStates
for j = 0 to 5
if gErrorState(i, j) = cLogFalse then
result = result &amp; &quot; &quot; &amp; component(i) &amp; &quot;:&quot;
if i = cStDataBase then
result = result &amp; baseAction(j)
else if i = cStExtension then
result = result &amp; extAction(j)
else
result = result &amp; action(j)
end if
end if
end if
next j
next i
StartTestWithDefaultOptions = result
end Function
Sub DispatchSlot(SlotID as Integer)
Dim oArg() as new com.sun.star.beans.PropertyValue
Dim oUrl as new com.sun.star.util.URL
Dim oTrans as Object
Dim oDisp as Object
oTrans = createUNOService(&quot;com.sun.star.util.URLTransformer&quot;)
oUrl.Complete = &quot;slot:&quot; &amp; CStr(SlotID)
oTrans.parsestrict(oUrl)
oDisp = StarDesktop.queryDispatch(oUrl, &quot;_self&quot;, 0)
oDisp.dispatch(oUrl, oArg())
End Sub
Sub LoadLibrary( LibName As String )
dim args(1)
dim arg as new com.sun.star.beans.PropertyValue
arg.Name = &quot;LibraryName&quot;
arg.Value = LibName
args(0) = arg
dim url as new com.sun.star.util.URL
dim trans as object
trans = createUnoService(&quot;com.sun.star.util.URLTransformer&quot; )
url.Complete = &quot;slot:6517&quot;
trans.parsestrict( url )
dim disp as object
disp = StarDesktop.currentFrame.queryDispatch( url, &quot;&quot;, 0 )
disp.dispatch( url, args() )
End Sub
Sub ExecuteSlot( SlotNr As String, oDoc as Object )
dim args()
dim url as new com.sun.star.util.URL
dim trans as object
dim disp as object
trans = createUnoService(&quot;com.sun.star.util.URLTransformer&quot; )
url.Complete = &quot;slot:&quot; + SlotNr
trans.parsestrict( url )
disp = oDoc.CurrentController.Frame.queryDispatch( url, &quot;&quot;, 0 )
disp.dispatch( url, args() )
End Sub
Sub DelAllUserFields (aDoc as Object)
Dim aFieldType as Object
Dim aElements as Variant
Dim i%
Dim aFieldMasters, aFieldMaster as Object
Dim sElement$
aFieldMasters = aDoc.TextFieldMasters
aElements = aFieldMasters.ElementNames
for i = 0 to UBound(aElements)
sElement$ = aElements(i)
if 0 &lt;&gt; instr(sElement$, cUnoUserField ) then
aFieldMaster = aFieldMasters.GetByName(sElement$)
aFieldMaster.Dispose
endif
next
end Sub
Function GetUserFieldState (sName as String, aDoc as Object) as boolean
Dim sFieldText as String
Dim bState as boolean
sFieldText = ReadUserField (sName, aDoc)
if LCase(sFieldText) = cYes then
bState = true
else
bState = false
end IF
GetUserFieldState = bState
end Function
Sub SetUserFieldState (sName as String, nState as boolean, aDoc as Object)
Dim sFieldText as String
sFieldText = cNo &apos;default
Select case nState
case true
sFieldText = cYes
case false
sFieldText = cNo
end Select
WriteUserField (sFieldText, sName, aDoc)
end Sub
Function ReadUserField(sFieldName as String, aDoc as Object) as String
Dim aMasters as Object
aMasters = aDoc.TextFieldMasters
if aMasters.HasByName (cUnoUserField+cUnoSeparator+sFieldName) then
ReadUserField = aMasters.GetByName (cUnoUserField+cUnoSeparator+sFieldName).Content
else
ReadUserField = &quot;&quot;
end If
End Function
Sub WriteUserField(sValue as String, sFieldName as String, aDoc as Object, optional aCursor as Object)
Dim aMasters, aUserField, aTxtCursor as Object
aMasters = aDoc.TextFieldMasters
if aMasters.HasByName (cUnoUserField+cUnoSeparator+sFieldName) then
aUserField = aMasters.GetByName (cUnoUserField+cUnoSeparator+sFieldName)
else
aUserField = aDoc.CreateInstance (cUnoUserField)
aUserField.Name = sFieldName
end if
aUserField.Content = sValue
End Sub
Sub WriteExtUserField(nIndex as Integer, aCursor as Object, aDoc as Object)
Dim aUserField as Object
aUserField = aDoc.CreateInstance (cUnoExtUserField)
aUserField.UserDataType = nIndex
aCursor.Text.InsertTextContent (aCursor, aUserField, True)
aUserField.Fix = True
End Sub
</script:module>