summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2011-08-24 01:23:25 +0100
committerCaolán McNamara <caolanm@redhat.com>2011-08-24 11:21:42 +0100
commit7e4ed3e5b8b9209240b9608aa0037a6a6732ef1c (patch)
treef9d4cb21c28259324ab8666d38736940e714dd31
parente56c8606952e99d7ba1cfc5ff1c8b2ea0b533373 (diff)
add a macros test, and a calc placeholder example
-rw-r--r--smoketestdoc/data/Global.xml20
-rw-r--r--smoketestdoc/data/OptionsDlg.xml11
-rw-r--r--smoketestdoc/data/Test_10er.xml39
-rw-r--r--smoketestdoc/data/content.xml1
4 files changed, 59 insertions, 12 deletions
diff --git a/smoketestdoc/data/Global.xml b/smoketestdoc/data/Global.xml
index f285ef51c458..6f9c066fc3b6 100644
--- a/smoketestdoc/data/Global.xml
+++ b/smoketestdoc/data/Global.xml
@@ -35,7 +35,7 @@ const cParagraphBreak = 0
global const cExtensionFileName = &quot;TestExtension.oxt&quot;
-global const cDocNew = 0, cDocSaveOpen8 = 1, cDocSaveOpenXML = 2, cDocOpen50 = 3, cDocClose = 4
+global const cDocNew = 0, cDocSaveOpen8 = 1, cDocSaveOpenXML = 2, cDocOpen50 = 3, cDocClose = 4, cDocMacros = 5
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
@@ -91,7 +91,7 @@ Global const cUserFieldTestHTML = &quot;HTML&quot;, cUserFieldTestJava = &quot;J
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 cUserFieldTestTerminateAfterTest = &quot;Terminate&quot;, cUserFieldTestOpenSave8 = &quot;SaveOpen8&quot;, cUserFieldTestMacros = &quot;Macros&quot;
Global const cOptionsDialogName = &quot;OptionsDlg&quot;, cTest10Modul = &quot;Standard&quot;
@@ -110,7 +110,7 @@ Global bMakeHTMLTest as boolean, bMakeJavaTest as boolean, bMakeDBTest as boolea
Global bMakeExtensionTest as boolean
Global bMakeSaveOpenXMLTest as boolean, bMakeOpen50Test as boolean
Global bMakeTerminateAfterTest as boolean, bShowTable as boolean
-Global bMakeSaveOpen8Test as boolean
+Global bMakeSaveOpen8Test as boolean, bMakeMacrosTest as boolean
global sExtensionURL as string
@@ -235,12 +235,13 @@ Sub CreateStatusTable
tableHeaders(cStHTML) = &quot;HTML&quot;
tableHeaders(cStJava) = &quot;Java&quot;
- dim tableRows(4) as string
+ dim tableRows(5) 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;
+ tableRows(cDocMacros) = &quot;macros&quot;
aDoc = gOutputDoc
@@ -255,7 +256,7 @@ Sub CreateStatusTable
xCursor.GoRight (1, False)
table = aDoc.createInstance(&quot;com.sun.star.text.TextTable&quot;)
- table.initialize(6,9)
+ table.initialize(7,9)
table.Name = &quot;StTab1&quot;
table.BackColor = cCoGrey
xText.insertTextContent(xCursor, table, FALSE)
@@ -341,7 +342,7 @@ Sub CreateDocState
table = aDoc.TextTables.GetByIndex (1)
for j% = 0 to 7
- for i% = 0 to 4
+ for i% = 0 to 5
sRangeName = GetRangeName(j%, i%+1)
tableCursor = table.createCursorByCellName(sRangeName)
@@ -580,6 +581,7 @@ Sub SetOptions
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 (cUserFieldTestMacros, -(gOptionsDialog.getControl(&quot;cbMacrosTest&quot;).getState), gOutputDoc)
SetUserFieldState (cUserFieldTestTerminateAfterTest, -(gOptionsDialog.getControl(&quot;cbTerminateAfterTest&quot;).getState), gOutputDoc)
end Sub
@@ -602,6 +604,7 @@ Sub GetOptions
gOptionsDialog.getControl(&quot;cbOpen50Test&quot;).setState(0)
end If
gOptionsDialog.getControl(&quot;cbSaveOpen8Test&quot;).setState( -( GetUserFieldState (cUserFieldTestOpenSave8, gOutputDoc)))
+ gOptionsDialog.getControl(&quot;cbMacrosTest&quot;).setState( -( GetUserFieldState (cUserFieldTestMacros, gOutputDoc)))
gOptionsDialog.getControl(&quot;cbTerminateAfterTest&quot;).setState( -( GetUserFieldState (cUserFieldTestTerminateAfterTest, gOutputDoc)))
End Sub
@@ -624,6 +627,7 @@ Sub ReadOptions
bMakeOpen50Test = false
End If
bMakeSaveOpen8Test = GetUserFieldState (cUserFieldTestOpenSave8, gOutputDoc)
+ bMakeMacrosTest = GetUserFieldState (cUserFieldTestMacros, gOutputDoc)
bMakeTerminateAfterTest = GetUserFieldState (cUserFieldTestTerminateAfterTest, gOutputDoc)
end Sub
@@ -652,6 +656,7 @@ Sub SetDefaultOptions
bMakeOpen50Test = false
End If
bMakeSaveOpen8Test = true
+ bMakeMacrosTest = true
bMakeTerminateAfterTest = false
end Sub
@@ -685,12 +690,13 @@ Function StartTestWithDefaultOptions
component(cStJava) = &quot;Java&quot;
component(cStDataBase) = &quot;Base&quot;
component(cStExtension) = &quot;Extensions&quot;
- dim action(4) as string
+ dim action(5) 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;
+ action(cDocMacros) = &quot;macros&quot;
dim baseAction(5) as string
baseAction(cDBService) = &quot;services&quot;
baseAction(cDBOpen) = &quot;open&quot;
diff --git a/smoketestdoc/data/OptionsDlg.xml b/smoketestdoc/data/OptionsDlg.xml
index 809f03712a97..5da93552f476 100644
--- a/smoketestdoc/data/OptionsDlg.xml
+++ b/smoketestdoc/data/OptionsDlg.xml
@@ -48,16 +48,17 @@
<dlg:checkbox dlg:id="cbSaveOpen8Test" dlg:tab-index="12" dlg:left="126" dlg:top="21" dlg:width="80" dlg:height="8" dlg:value="Save / Open V8.0" dlg:checked="false"/>
<dlg:checkbox dlg:id="cbSaveOpenXMLTest" dlg:tab-index="13" dlg:left="126" dlg:top="35" dlg:width="80" dlg:height="8" dlg:value="Save / Open XML" dlg:checked="false"/>
<dlg:checkbox dlg:id="cbOpen50Test" dlg:tab-index="14" dlg:left="126" dlg:top="49" dlg:width="80" dlg:height="8" dlg:value="Open V5.0" dlg:checked="false"/>
- <dlg:titledbox dlg:id="fmBroker" dlg:tab-index="15" dlg:left="7" dlg:top="169" dlg:width="208" dlg:height="17"/>
- <dlg:checkbox dlg:id="cbTerminateAfterTest" dlg:tab-index="16" dlg:disabled="true" dlg:left="19" dlg:top="174" dlg:width="190" dlg:height="8" dlg:value="Terminate Office after test" dlg:checked="false"/>
+ <dlg:checkbox dlg:id="cbMacrosTest" dlg:tab-index="15" dlg:left="126" dlg:top="63" dlg:width="80" dlg:height="8" dlg:value="Macros" dlg:checked="false"/>
+ <dlg:titledbox dlg:id="fmBroker" dlg:tab-index="16" dlg:left="7" dlg:top="169" dlg:width="208" dlg:height="17"/>
+ <dlg:checkbox dlg:id="cbTerminateAfterTest" dlg:tab-index="17" dlg:disabled="true" dlg:left="19" dlg:top="174" dlg:width="190" dlg:height="8" dlg:value="Terminate Office after test" dlg:checked="false"/>
- <dlg:button dlg:id="btOk" dlg:tab-index="17" dlg:left="7" dlg:top="193" dlg:width="65" dlg:height="15" dlg:value="Ok" dlg:button-type="ok" dlg:default="true">
+ <dlg:button dlg:id="btOk" dlg:tab-index="18" dlg:left="7" dlg:top="193" dlg:width="65" dlg:height="15" dlg:value="Ok" dlg:button-type="ok" dlg:default="true">
<script:event script:event-name="on-performaction" script:location="document" script:macro-name="Standard.Events.PressOk" script:language="StarBasic"/>
</dlg:button>
- <dlg:button dlg:id="btCancel" dlg:tab-index="18" dlg:left="80" dlg:top="193" dlg:width="65" dlg:height="15" dlg:value="Cancel" dlg:button-type="ok">
+ <dlg:button dlg:id="btCancel" dlg:tab-index="19" dlg:left="80" dlg:top="193" dlg:width="65" dlg:height="15" dlg:value="Cancel" dlg:button-type="ok">
<script:event script:event-name="on-performaction" script:location="document" script:macro-name="Standard.Events.PressCancel" script:language="StarBasic"/>
</dlg:button>
- <dlg:button dlg:id="btStart" dlg:tab-index="19" dlg:left="152" dlg:top="193" dlg:width="65" dlg:height="15" dlg:value="Smoketest">
+ <dlg:button dlg:id="btStart" dlg:tab-index="20" dlg:left="152" dlg:top="193" dlg:width="65" dlg:height="15" dlg:value="Smoketest">
<script:event script:event-name="on-performaction" script:location="vnd.sun.star.script" script:macro-name="Standard.Events.PressTest?language=Basic&amp;location=document" script:language="Script"/>
</dlg:button>
</dlg:bulletinboard>
diff --git a/smoketestdoc/data/Test_10er.xml b/smoketestdoc/data/Test_10er.xml
index fc95049a2072..54ee0769a5b8 100644
--- a/smoketestdoc/data/Test_10er.xml
+++ b/smoketestdoc/data/Test_10er.xml
@@ -43,6 +43,7 @@ const cMessageSaveOpenXMLDoc = &quot;Save/Open Document XML (6/7)&quot;
const cMessageOpen50Doc = &quot;Open Document 5.0&quot;
const cMessageNewDoc = &quot;New Document&quot;
const cMessageCloseDoc = &quot;Close Document&quot;
+const cMessageRunMacros = &quot;Run Macros&quot;
Global sWorkPath$
Global sWorkPathURL$
@@ -307,6 +308,9 @@ Sub WriteTestSequence
if bMakeOpen50Test then
sWriteStr = sWriteStr + &quot;, open 5.0&quot;
end if
+ if bMakeMacrosTest then
+ sWriteStr = sWriteStr + &quot;, run macros&quot;
+ end if
end if
sWriteStr = sWriteStr + &quot;, close&quot;
@@ -404,6 +408,39 @@ Sub MakeDocTest
end If
end if
+ gCurrentTestCase = cDocMacros
+ &apos; Just one calc macro test for now
+ &apos; To-Do split this into its own per-module/test .xml and add more
+ if bMakeMacrosTest and gCurrentDocTest = frmCalc then
+ oDoc = LoadDoc (&quot;private:factory/&quot; + GetDocFilter(gCurrentDocTest or cFltNewDoc))
+ oDocCtrl = oDoc.getCurrentController()
+ oDocFrame = oDocCtrl.getFrame()
+ oDispatcher = createUnoService(&quot;com.sun.star.frame.DispatchHelper&quot;)
+
+ dim args(0) as new com.sun.star.beans.PropertyValue
+
+ args(0).Name = &quot;ToPoint&quot;
+ args(0).Value = &quot;$A$1&quot;
+ oDispatcher.executeDispatch(oDocFrame, &quot;.uno:GoToCell&quot;, &quot;&quot;, 0, args())
+ args(0).Name = &quot;By&quot;
+ args(0).Value = 5
+ oDispatcher.executeDispatch(oDocFrame, &quot;.uno:GoRightSel&quot;, &quot;&quot;, 0, args())
+ args(0).Name = &quot;By&quot;
+ args(0).Value = 5
+ oDispatcher.executeDispatch(oDocFrame, &quot;.uno:GoDownSel&quot;, &quot;&quot;, 0, args())
+
+ oRangeAddr = oDoc.getCurrentSelection().getRangeAddress()
+
+ bResult = oRangeAddr.StartColumn = 0 and oRangeAddr.EndColumn = 5 and oRangeAddr.StartRow = 0 and oRangeAddr.EndRow = 5
+
+ LogTestResult( GetDocFilter(gCurrentDocTest or cFltNewDoc)+&quot; &quot;+ cMessageRunMacros, bResult )
+
+ if not IsNull (oDoc) then
+ gCurrentTestCase = cDocClose
+ oDoc.close (true)
+ end If
+ end if
+
end If
Print #LocalTestLog, &quot;---&quot;
Close #LocalTestLog%
@@ -629,6 +666,8 @@ Function GetErrorMessageOnAction (nAction as Integer) as String
GetErrorMessageOnAction = cMessageSaveOpenXMLDoc
case cDocOpen50
GetErrorMessageOnAction = cMessageOpen50Doc
+ case cDocMacros
+ GetErrorMessageOnAction = cMessageRunMacros
case cDocClose
GetErrorMessageOnAction = cMessageCloseDoc
case else
diff --git a/smoketestdoc/data/content.xml b/smoketestdoc/data/content.xml
index 5aba7013c047..60559afac4ab 100644
--- a/smoketestdoc/data/content.xml
+++ b/smoketestdoc/data/content.xml
@@ -97,6 +97,7 @@
<text:user-field-decl text:value-type="string" text:string-value="y" text:name="Math"/>
<text:user-field-decl text:value-type="string" text:string-value="y" text:name="Chart"/>
<text:user-field-decl text:value-type="string" text:string-value="y" text:name="SaveOpenXML"/>
+ <text:user-field-decl text:value-type="string" text:string-value="y" text:name="Macros"/>
<text:user-field-decl text:value-type="string" text:string-value="y" text:name="Open50"/>
<text:user-field-decl text:value-type="string" text:string-value="n" text:name="Terminate"/>
<text:user-field-decl text:value-type="string" text:string-value="y" text:name="Java"/>