From 50d0937a706fd9c3aeebebd55e21d60499b8be20 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Tue, 8 Feb 2011 12:58:37 +0100 Subject: debuglevels: some cleanup of the smoketest code, in preparation of #i116845# --- smoketestoo_native/data/Events.xml | 23 +++++++ smoketestoo_native/data/Global.xml | 94 ++++++++++++-------------- smoketestoo_native/data/Test_10er.xml | 120 ++++++++++++++++------------------ smoketestoo_native/data/content.xml | 87 +++++++++++++++++++++++- 4 files changed, 208 insertions(+), 116 deletions(-) (limited to 'smoketestoo_native') diff --git a/smoketestoo_native/data/Events.xml b/smoketestoo_native/data/Events.xml index 61272293f633..414f2c48e884 100644 --- a/smoketestoo_native/data/Events.xml +++ b/smoketestoo_native/data/Events.xml @@ -28,6 +28,8 @@ REM ***** BASIC ***** +Global s_CloseListenerCalled As Boolean + Sub PressCancel gDlgState = cDlgCancel end Sub @@ -40,4 +42,25 @@ Sub PressTest gOptionsDialog.EndExecute() gDlgState = cDlgStartTest end Sub + +Sub closeListener_queryClosing + ' not interested in + closeListener_queryClosing = TRUE +End Sub + +Sub closeListener_notifyClosing + s_CloseListenerCalled = TRUE +End Sub + +Sub closeListener_disposing + ' not interested in +End Sub + +Sub ResetCloseListenerFlag + s_CloseListenerCalled = FALSE +End Sub + +Function HasCloseListenerBeenCalled As Boolean + HasCloseListenerBeenCalled = s_CloseListenerCalled +End Function diff --git a/smoketestoo_native/data/Global.xml b/smoketestoo_native/data/Global.xml index 1ff082b0a1eb..e80ded136725 100644 --- a/smoketestoo_native/data/Global.xml +++ b/smoketestoo_native/data/Global.xml @@ -35,21 +35,21 @@ const cParagraphBreak = 0 global const cExtensionFileName = "TestExtension.oxt" -global const cDocNew = 0, cDocSaveOpen8 = 1, cDocSaveOpenXML = 2, cDocSaveOpen50 = 3, cDocClose = 4, cDocWrite = 5 +global const cDocNew = 0, cDocSaveOpen8 = 1, cDocSaveOpenXML = 2, cDocSaveOpen50 = 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 cLogfileFailed = 255 global const cStWriter = 0, cStCalc = 1, cStPraesentation = 2, cStZeichnen = 3 -global const cStMessage = 12, cStHTML = 6, cStChart = 4, cStJava = 7 +global const cStHTML = 6, cStChart = 4, cStJava = 7 global const cStMath = 5, cStDataBase = 9 global const cStExtension = 11 global const cStNone = -1 global const cFlt8 = 0, cFlt50 = 32, cFltNewDoc = 64, cFltXML = 128 -global const frmWriter = 1, frmCalc = 2, frmMessage = 3, frmImpress = 4 -global const frmMath = 5, frmImage = 6, frmChart = 7, frmHyperText = 8, frmDraw = 9 +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 @@ -156,31 +156,27 @@ Sub CreateStatusTable tableHeaders(cStHTML) = "HTML" tableHeaders(cStJava) = "Java" - dim tableColums(3) as string - tableColums(cDocNew) = "new" - tableColums(cDocSaveOpen8) = "V8.0" - tableColums(cDocSaveOpenXML) = "XML" - tableColums(cDocSaveOpen50) = "V5.0" -' tableColums(cDocClose) = "close" + dim tableRows(4) as string + tableRows(cDocNew) = "new" + tableRows(cDocSaveOpen8) = "V8.0" + tableRows(cDocSaveOpenXML) = "XML" + tableRows(cDocSaveOpen50) = "V5.0" + tableRows(cDocClose) = "close" - aDoc = gOutPutDoc + aDoc = gOutPutDoc - xText = aDoc.Text - xCursor = xText.createTextCursor() + xText = aDoc.Text + xCursor = xText.createTextCursor() -' xCursor.gotoStart(FALSE) -' xCursor.GoRight (2, False) -' SetParagraphBreak (xCursor) -' SetParagraphBreak (xCursor) - xCursor.gotoStart(FALSE) - xCursor.GoRight (4, False) - SetParagraphBreak (xCursor) - xCursor.GoRight (1, False) - SetParagraphBreak (xCursor) - xCursor.GoRight (1, False) + xCursor.gotoStart(FALSE) + xCursor.GoRight (4, False) + SetParagraphBreak (xCursor) + xCursor.GoRight (1, False) + SetParagraphBreak (xCursor) + xCursor.GoRight (1, False) - table = aDoc.createInstance("com.sun.star.text.TextTable") - table.initialize(7,9) + table = aDoc.createInstance("com.sun.star.text.TextTable") + table.initialize(6,9) table.Name = "StTab1" xText.insertTextContent(xCursor, table, FALSE) @@ -200,8 +196,6 @@ Sub CreateStatusTable next i% xCursor.gotoStart(FALSE) -' SetParagraphBreak (xCursor) -' SetParagraphBreak (xCursor) tableCursor.gotoStart(FALSE) cName = tableCursor.getRangeName() @@ -209,11 +203,11 @@ Sub CreateStatusTable xCell.BackTransparent = False xCell.BackColor = cCoGrey - for i% = 0 to 3 + for i% = 0 to 4 tableCursor.goDown(1,FALSE) cName = tableCursor.getRangeName() xCell = table.getCellByName(cName) - xCell.String=tableColums(i%) + xCell.String=tableRows(i%) xCell.BackTransparent = False xCell.BackColor = cCoGrey @@ -228,13 +222,13 @@ Sub CreateStatusTable2 tableHeaders(3) = "" tableHeaders(4) = "" - dim tableColums(5) as string - tableColums(cDBService ) = "services" - tableColums(cDBOpen ) = "open" - tableColums(cDBInsert ) = "insert" - tableColums(cDBDelete ) = "delete" - tableColums(cDBSeek ) = "seek" - tableColums(cDBClose ) = "close" + dim tableRows(5) as string + tableRows(cDBService ) = "services" + tableRows(cDBOpen ) = "open" + tableRows(cDBInsert ) = "insert" + tableRows(cDBDelete ) = "delete" + tableRows(cDBSeek ) = "seek" + tableRows(cDBClose ) = "close" dim tableColums2(3) as string tableColums2(cEXTService ) = "services" @@ -284,11 +278,11 @@ Sub CreateStatusTable2 for i% = 0 to 5 tableCursor.goDown(1,FALSE) cName = tableCursor.getRangeName() - xCell = table.getCellByName(cName) - xCell.String=tableColums(i%) + xCell = table.getCellByName(cName) + xCell.String=tableRows(i%) - xCell.BackTransparent = False - xCell.BackColor = cCoGrey + xCell.BackTransparent = False + xCell.BackColor = cCoGrey next i% tableCursor.gotoStart(FALSE) @@ -312,7 +306,7 @@ Sub CreateDocState 'table = aDoc.TextTables.GetByName ("StTab1") for j% = 0 to 7 - for i% = 0 to 5 + for i% = 0 to 4 sRangeName = GetRangeName(j%, i%+1) tableCursor = table.createCursorByCellName(sRangeName) @@ -386,23 +380,19 @@ end Sub Function GetStatusType (nDocType as Integer) as Integer Select Case ( nDocType ) case frmWriter - GetStatusType = cStWriter ' Textdokument + GetStatusType = cStWriter ' text document case frmCalc - GetStatusType = cStCalc 'Tabellendokument - case frmMessage - GetStatusType = cStMessage 'Nachricht + GetStatusType = cStCalc ' spreadsheet document case frmImpress - GetStatusType = cStPraesentation 'Präsentation + GetStatusType = cStPraesentation ' presentation case frmDraw - GetStatusType = cStZeichnen 'Zeichnen + GetStatusType = cStZeichnen ' drawing case frmMath - GetStatusType = cStMath 'Formel - case frmImage - GetStatusType = cStBild 'Bild + GetStatusType = cStMath ' formula case frmHyperText - GetStatusType = cStHTML 'Hypertext-Dokument + GetStatusType = cStHTML ' HTML document case frmChart - GetStatusType = cStChart 'Diagramm + GetStatusType = cStChart ' chart case frmJava GetStatusType = cStJava 'Java case frmDataBase diff --git a/smoketestoo_native/data/Test_10er.xml b/smoketestoo_native/data/Test_10er.xml index 56a8d130fc13..c48f564cd447 100644 --- a/smoketestoo_native/data/Test_10er.xml +++ b/smoketestoo_native/data/Test_10er.xml @@ -30,8 +30,8 @@ const sSWLogFileName = "swlog.dat", sSCLogFileName = "sclog.dat" const sSDLogFileName = "sdlog.dat", sSMathLogFileName = "smalog.dat" -const sSImDLogFileName = "simlog.dat", sSChartLogFileName = "schlog.dat" -const sSHptLogFileName = "shptlog.dat", sSMessageLogFileName = "smeslog.dat" +const sSChartLogFileName = "schlog.dat" +const sSHptLogFileName = "shptlog.dat" const sSDrawLogFileName = "sdrwlog.dat", sJavaLogFileName = "javalog.dat" const sSDBLogFileName = "dblog.dat", sExtLogFileName = "extlog.dat" const sLogFileName = "log.dat" @@ -107,18 +107,12 @@ Sub DeleteAllLogFiles() If FileExists (sWorkPath+sSMathLogFileName) then Kill (sWorkPath+sSMathLogFileName) End If - If FileExists (sWorkPath+sSImDLogFileName) then - Kill (sWorkPath+sSImDLogFileName) - End If If FileExists (sWorkPath+sSChartLogFileName) then Kill (sWorkPath+sSChartLogFileName) End If If FileExists (sWorkPath+sSHptLogFileName) then Kill (sWorkPath+sSHptLogFileName) End If - If FileExists (sWorkPath+sSMessageLogFileName) then - Kill (sWorkPath+sSMessageLogFileName) - End If If FileExists (sWorkPath+sSDrawLogFileName) then Kill (sWorkPath+sSDrawLogFileName) End If @@ -321,7 +315,7 @@ end Sub Sub MakeDocTest (FilterType as Integer) Dim oDoc as Object Dim sFileNameXML$, sFileName8$ - Dim bError as Boolean + Dim bSuccess as Boolean Dim nCurrentAction as Integer On Local Error GoTo DOCTESTERROR @@ -343,13 +337,11 @@ Sub MakeDocTest (FilterType as Integer) sFileNameXML = sWorkPathURL+cTempFileName+"."+GetDocEndings(FilterType or cFltXML) SaveDoc (sFileNameXML, oDoc, GetDocFilter(FilterType or cFltXML)) end if -' oDoc.dispose nCurrentAction = cDocClose - oDoc.close (true) -' bError = true ' nur zum ¦bergang, weil bError = oDoc.CurrentController.frame.close nicht geht -' LogState (bError, GetDocFilter(FilterType)+" "+ cMessageCloseDoc, FileChannel) -' LogState (bError, GetDocFilter(FilterType)+" "+ cMessageCloseDoc, MainFileChannel) -' SetStatus (FilterType, cDocClose, bError) + bSuccess = CloseDoc( oDoc ) + LogState (bSuccess, GetDocFilter(FilterType)+" "+ cMessageCloseDoc, FileChannel) + LogState (bSuccess, GetDocFilter(FilterType)+" "+ cMessageCloseDoc, MainFileChannel) + SetStatus (FilterType, cDocClose, bSuccess) nCurrentAction = cDocSaveOpen8 if bMakeSaveOpen8Test and IsFilterAvailable (FilterType or cFlt8) then oDoc = LoadDoc (sFileName8) @@ -360,7 +352,6 @@ Sub MakeDocTest (FilterType as Integer) SetStatus (FilterType, cDocSaveOpen8, not IsNull (oDoc)) if not IsNull (oDoc) then -' oDoc.dispose nCurrentAction = cDocClose oDoc.close (true) end If @@ -376,7 +367,6 @@ Sub MakeDocTest (FilterType as Integer) SetStatus (FilterType, cDocSaveOpenXML, not IsNull (oDoc)) if not IsNull (oDoc) then -' oDoc.dispose nCurrentAction = cDocClose oDoc.close (true) end If @@ -402,7 +392,7 @@ End Sub Sub MakeNewDoc (FilterType as Integer) DIM oDoc as Object - Dim bError as Boolean + Dim bSuccess as Boolean Dim nCurrentAction as Integer On Local Error GoTo DOCTESTERROR2 nCurrentAction = cLogfileFailed @@ -415,12 +405,10 @@ Sub MakeNewDoc (FilterType as Integer) SetStatus (FilterType, cDocNew, not IsNull (oDoc)) if not IsNull (oDoc) then nCurrentAction = cDocClose -' oDoc.dispose - oDoc.close (true) -' bError = true ' nur zum ¦bergang, weil bError = oDoc.CurrentController.frame.close nicht geht -' LogState (bError, GetDocFilter(FilterType)+" "+ cMessageCloseDoc, FileChannel) -' LogState (bError, GetDocFilter(FilterType)+" "+ cMessageCloseDoc, MainFileChannel) -' SetStatus (FilterType, cDocClose, bError) + bSuccess = CloseDoc( oDoc ) + LogState (bSuccess, GetDocFilter(FilterType)+" "+ cMessageCloseDoc, FileChannel) + LogState (bSuccess, GetDocFilter(FilterType)+" "+ cMessageCloseDoc, MainFileChannel) + SetStatus (FilterType, cDocClose, bSuccess) end If Print #FileChannel, "---" Close #FileChannel% @@ -445,7 +433,7 @@ Sub MakeChartTest (FilterType as Integer) Dim oRange(0) as New com.sun.star.table.CellRangeAddress Dim oRect as New com.sun.star.awt.Rectangle const cChartName="TestChart" - Dim bError as Boolean + Dim bSuccess as Boolean Dim nCurrentAction as Integer On Local Error GoTo CHARTTESTERROR nCurrentAction = cLogfileFailed @@ -455,11 +443,10 @@ Sub MakeChartTest (FilterType as Integer) if not IsNull (oDoc) then oCharts = oDoc.sheets(0).Charts oCharts.AddNewByName (cChartName, oRect, oRange(), true, true) - bError=oCharts.HasByName(cChartName) - LogState (bError, GetDocFilter(FilterType or cFltNewDoc)+" "+ cMessageNewDoc, FileChannel) - LogState (bError, GetDocFilter(FilterType or cFltNewDoc)+" "+ cMessageNewDoc, MainFileChannel) - SetStatus (FilterType, cDocNew, bError) -' oDoc.dispose + bSuccess=oCharts.HasByName(cChartName) + LogState (bSuccess, GetDocFilter(FilterType or cFltNewDoc)+" "+ cMessageNewDoc, FileChannel) + LogState (bSuccess, GetDocFilter(FilterType or cFltNewDoc)+" "+ cMessageNewDoc, MainFileChannel) + SetStatus (FilterType, cDocNew, bSuccess) nCurrentAction = cDocClose oDoc.close (true) else @@ -520,48 +507,44 @@ end Function Function GetDocFilter (DocType as Integer) as String Select Case ( DocType ) case frmWriter or cFlt8 - GetDocFilter = "writer8" ' Textdokument + GetDocFilter = "writer8" ' text document case frmCalc or cFlt8 - GetDocFilter = "calc8" 'Tabellendokument + GetDocFilter = "calc8" ' spreadsheet document case frmImpress or cFlt8 - GetDocFilter = "impress8" 'Präsentation + GetDocFilter = "impress8" ' presentation case frmDraw or cFlt8 - GetDocFilter = "draw8" 'Zeichen + GetDocFilter = "draw8" ' drawing case frmMath or cFlt8 - GetDocFilter = "math8" 'Formel + GetDocFilter = "math8" ' formula case frmWriter or cFltXML - GetDocFilter = "StarOffice XML (Writer)" ' Textdokument + GetDocFilter = "StarOffice XML (Writer)" ' text document case frmCalc or cFltXML - GetDocFilter = "StarOffice XML (Calc)" 'Tabellendokument + GetDocFilter = "StarOffice XML (Calc)" ' spreadsheet document case frmImpress or cFltXML - GetDocFilter = "StarOffice XML (Impress)" 'Präsentation + GetDocFilter = "StarOffice XML (Impress)" ' presentation case frmDraw or cFltXML - GetDocFilter = "StarOffice XML (Draw)" 'Zeichen + GetDocFilter = "StarOffice XML (Draw)" ' drawing case frmMath or cFltXML - GetDocFilter = "StarOffice XML (Math)" 'Formel + GetDocFilter = "StarOffice XML (Math)" ' formula case frmHyperText, frmHyperText or cFltXML - GetDocFilter = "HTML" 'Hypertext-Dokument + GetDocFilter = "HTML" ' HTML document case frmWriter or cFltNewDoc - GetDocFilter = "swriter" ' Textdokument + GetDocFilter = "swriter" ' text document case frmCalc or cFltNewDoc - GetDocFilter = "scalc" 'Tabellendokument - case frmMessage or cFltNewDoc - GetDocFilter = "Message" 'Nachricht + GetDocFilter = "scalc" ' spreadsheet document case frmImpress or cFltNewDoc - GetDocFilter = "simpress" 'Präsentation + GetDocFilter = "simpress" ' presentation case frmDraw or cFltNewDoc - GetDocFilter = "sdraw" 'Zeichen + GetDocFilter = "sdraw" ' drawing case frmMath or cFltNewDoc - GetDocFilter = "smath" 'Formel - case frmImage or cFltNewDoc - GetDocFilter = "simage" 'Bild + GetDocFilter = "smath" ' formula case frmHyperText or cFltNewDoc - GetDocFilter = "swriter/web" 'Hypertext-Dokument + GetDocFilter = "swriter/web" ' HTML document case frmChart or cFltNewDoc - GetDocFilter = "schart" 'Diagramm + GetDocFilter = "schart" ' chart case else GetDocFilter = "" end Select @@ -570,23 +553,19 @@ end Function Function GetLogFileName (DocType as Integer) as String Select Case ( DocType ) case frmWriter - GetLogFileName = sSWLogFileName ' Textdokument + GetLogFileName = sSWLogFileName ' text document case frmCalc - GetLogFileName = sSCLogFileName 'Tabellendokument - case frmMessage - GetLogFileName = sSMessageLogFileName 'Nachricht + GetLogFileName = sSCLogFileName ' spreadsheet document case frmImpress - GetLogFileName = sSDLogFileName 'PrÕsentation + GetLogFileName = sSDLogFileName ' presentation case frmDraw - GetLogFileName = sSDrawLogFileName 'Zeichnen + GetLogFileName = sSDrawLogFileName ' drawing case frmMath - GetLogFileName = sSMathLogFileName 'Formel - case frmImage - GetLogFileName = sSImDLogFileName 'Bild + GetLogFileName = sSMathLogFileName ' formula case frmHyperText - GetLogFileName = sSHptLogFileName 'Hypertext-Dokument + GetLogFileName = sSHptLogFileName ' HTML document case frmChart - GetLogFileName = sSChartLogFileName 'Diagramm + GetLogFileName = sSChartLogFileName ' chart case frmJava GetLogFileName = sJavaLogFileName 'Java case frmDataBase @@ -694,4 +673,19 @@ Sub SaveDoc (DocName as String, oDoc as Object, sFilterName as string ) MessageBox "Filtername is unknown!" end if end Sub + +Function CloseDoc( oDoc as Object ) + Dim oListener as Object + oListener = CreateUnoListener( "Events.closeListener_", "com.sun.star.util.XCloseListener" ) + oDoc.addCloseListener( oListener ) + + Events.ResetCloseListenerFlag() + oDoc.close( true ) + closeDoc = Events.HasCloseListenerBeenCalled() + + if ( Not Events.HasCloseListenerBeenCalled() ) Then + ' do this only if closing was not successful - otherwise, we'd get a DisposedException + oDoc.removeCloseListener( oListener ) + End If +End Function diff --git a/smoketestoo_native/data/content.xml b/smoketestoo_native/data/content.xml index dcd31b1759e4..3c81bbfbad5e 100644 --- a/smoketestoo_native/data/content.xml +++ b/smoketestoo_native/data/content.xml @@ -25,4 +25,89 @@ * for a copy of the LGPLv3 License. * **********************************************************************--> -stardiv.one.form.control.CommandButtonstardiv.one.form.control.CommandButtonstardiv.one.form.control.CommandButton + + + + + + + + + + + + + + + + + + + + + + + + stardiv.one.form.control.CommandButton + + + + + + + + + + + + stardiv.one.form.control.CommandButton + + + + + + + + + + + + stardiv.one.form.control.CommandButton + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + -- cgit