From 8db4921431e7db75c86697a224cf29be672c77ce Mon Sep 17 00:00:00 2001 From: sb Date: Fri, 18 Dec 2009 16:08:08 +0100 Subject: sb118: work in progress of a simplified smoketestoo_native --- smoketestoo_native/check_setup.pl | 73 -- smoketestoo_native/config.pl | 171 ---- smoketestoo_native/data/Common.xcu | 25 - smoketestoo_native/data/Settings.xcu | 11 - smoketestoo_native/data/Setup.xcu | 11 - smoketestoo_native/data/TestExtension.oxt | Bin 4210 -> 0 bytes smoketestoo_native/data/scripts/Global.xba | 739 -------------- smoketestoo_native/data/scripts/Test_10er.xba | 907 ----------------- smoketestoo_native/data/scripts/Test_DB.xba | 135 --- smoketestoo_native/data/scripts/Test_Ext.xba | 95 -- smoketestoo_native/data/scripts/script.xlb | 8 - smoketestoo_native/data/smoketestdoc.sxw | Bin 35157 -> 35384 bytes smoketestoo_native/makefile.mk | 86 +- smoketestoo_native/smoketest.cxx | 313 ++++++ smoketestoo_native/smoketest.pl | 1283 ------------------------- smoketestoo_native/testlog.pl | 290 ------ 16 files changed, 375 insertions(+), 3772 deletions(-) delete mode 100755 smoketestoo_native/check_setup.pl delete mode 100755 smoketestoo_native/config.pl delete mode 100644 smoketestoo_native/data/Common.xcu delete mode 100644 smoketestoo_native/data/Settings.xcu delete mode 100644 smoketestoo_native/data/Setup.xcu delete mode 100755 smoketestoo_native/data/TestExtension.oxt delete mode 100755 smoketestoo_native/data/scripts/Global.xba delete mode 100755 smoketestoo_native/data/scripts/Test_10er.xba delete mode 100755 smoketestoo_native/data/scripts/Test_DB.xba delete mode 100755 smoketestoo_native/data/scripts/Test_Ext.xba delete mode 100755 smoketestoo_native/data/scripts/script.xlb create mode 100644 smoketestoo_native/smoketest.cxx delete mode 100755 smoketestoo_native/smoketest.pl delete mode 100755 smoketestoo_native/testlog.pl (limited to 'smoketestoo_native') diff --git a/smoketestoo_native/check_setup.pl b/smoketestoo_native/check_setup.pl deleted file mode 100755 index 8165b0c8a5b4..000000000000 --- a/smoketestoo_native/check_setup.pl +++ /dev/null @@ -1,73 +0,0 @@ -: -eval 'exec perl -wS $0 ${1+"$@"}' - if 0; -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2008 by Sun Microsystems, Inc. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# $RCSfile: check_setup.pl,v $ -# -# $Revision: 1.3 $ -# -# 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 -# -# for a copy of the LGPLv3 License. -# -#************************************************************************* - -sub checkLogDat { - my ($setuplogfile) = shift; - my ($errorfound) = 0; - - open SETUPLOG, "<$setuplogfile" or die "can´t open file $setuplogfile"; - while() { - $line = $_; - chomp $line; - if ($line =~ /^ERR/ ) { - print "Error: $line\n"; - $errorfound = 1; - } - } - close SETUPLOG; - return !$errorfound; #check ok? -} - -$idStr = ' $Revision: 1.3 $ '; -$idStr =~ /Revision:\s+(\S+)\s+\$/ - ? ($prg_rev = $1) : ($prg_rev = "-"); - -print "checkSetup -- Version: $prg_rev\n"; - -if ( ($#ARGV >-1) && ($#ARGV < 1) ) { - $ARGV[0]=~ s/\"//g; -} - -if ( ! ( ($#ARGV >-1) && ($#ARGV < 1) && $ARGV[0] && (-e $ARGV[0] ) ) ) { - print "Usage: checkSetup \n" ; - exit(1); -} - -if (checkLogDat ($ARGV[0])) { - exit (0); -} -else { - print STDERR "ERROR: setup failed\n"; - exit (2); -} diff --git a/smoketestoo_native/config.pl b/smoketestoo_native/config.pl deleted file mode 100755 index 642a256e33d4..000000000000 --- a/smoketestoo_native/config.pl +++ /dev/null @@ -1,171 +0,0 @@ -: -eval 'exec perl -wS $0 ${1+"$@"}' - if 0; -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2008 by Sun Microsystems, Inc. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# $RCSfile: config.pl,v $ -# -# $Revision: 1.5 $ -# -# 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 -# -# for a copy of the LGPLv3 License. -# -#************************************************************************* - -use File::Path; -use File::Copy; - -### globals ### - -$is_debug = 0; - -$gui = $ENV{GUI}; -$cygwin = "cygwin"; - -if ($^O =~ /cygwin/) { - $gui = $cygwin; -} - -if (($gui eq "UNX") or ($gui eq $cygwin)) { - $pathslash = "/"; -} -else -{ - $pathslash = "\\"; -} - -#### Hardly coded path for -# \share\registry\data\org\openoffice\Office\Jobs.xcu - -$jobs_XML_Path = "share" . $pathslash . "registry" . $pathslash . "data" . $pathslash . "org" . $pathslash . "openoffice" . $pathslash . "Office" . $pathslash . "Jobs.xcu"; - -# \user\registry\data\org\openoffice\ - -$User_Path = "user" . $pathslash . "registry" . $pathslash . "data" . $pathslash . "org" . $pathslash . "openoffice" . $pathslash; - -# \user\registry\data\org\openoffice\Office\ - -$User_Office_Path = $User_Path . "Office" . $pathslash; - -# \user\registry\data\org\openoffice\Office\OOoImprovement - -$OOoImprovement_Path = $User_Office_Path . "OOoImprovement" . $pathslash; - -$common_XML = "Common.xcu"; -$setup_XML = "Setup.xcu"; -$oooimprovement_XML = "Settings.xcu"; - -# $(INPATH)\misc\Common.xcu -$inpath_Common_XCU = $ENV{INPATH} . $pathslash . "misc" . $pathslash . $common_XML; - -### main ### - -$idStr = ' $Revision: 1.5 $ '; -$idStr =~ /Revision:\s+(\S+)\s+\$/ - ? ($cpflat2minor_rev = $1) : ($cpflat2minor_rev = "-"); - -if ( ($#ARGV >= 3) ) { - $ARGV[0] =~ s/\"//g; - $ARGV[1] =~ s/\"//g; - $ARGV[2] =~ s/\"//g; - $ARGV[3] =~ s/\"//g; - chop($ARGV[0]); - chop($ARGV[1]); - chop($ARGV[2]); - chop($ARGV[3]); -} - -if ( ! ( ($#ARGV >= 4) && $ARGV[0] && $ARGV[1] && $ARGV[2] && $ARGV[3] && (-d $ARGV[3]) && $ARGV[4] ) ) { - print "Usage: config \n" ; - exit(1); -} - -$basisdir = $ARGV[0]; -$branddir = $ARGV[1]; -$userinstalldir = $ARGV[2]; -$datapath = $ARGV[3]; -$buildid = $ARGV[4]; - -$fullquickstart_path = $branddir . "program" . $pathslash . "quickstart.exe"; - -print "patching config ... \n"; -if (!-d "$userinstalldir$User_Office_Path") { - mkpath("$userinstalldir$User_Office_Path", 0, 0777); -} -if (!-d "$userinstalldir$OOoImprovement_Path") { - mkpath("$userinstalldir$OOoImprovement_Path", 0, 0777); -} - -# copy Common.xcu -print "Patching Common.xcu\n" if $is_debug; -PatchCommonXcu($buildid); -print "cp $inpath_Common_XCU $userinstalldir$User_Office_Path$common_XML\n" if $is_debug; -copy ("$inpath_Common_XCU", "$userinstalldir$User_Office_Path$common_XML"); - -# copy OOoImprovement/Settings.xcu - -print "cp $datapath$oooimprovement_XML $userinstalldir$OOoImprovement_Path$oooimprovement_XML\n" if $is_debug; -copy ("$datapath$oooimprovement_XML", "$userinstalldir$OOoImprovement_Path$oooimprovement_XML"); - -# copy Setup.xcu - -print "cp $datapath$setup_XML $userinstalldir$User_Path$setup_XML\n" if $is_debug; -copy ("$datapath$setup_XML", "$userinstalldir$User_Path$setup_XML"); - - -# quickstarter loeschen -if ($gui ne "UNX") { - print "kill $fullquickstart_path \n"; - unlink( $fullquickstart_path ) or die "cannot unlink $fullquickstart_path"; -} - -#delete joblist -$fullsource_path = $basisdir . $jobs_XML_Path; -unlink ($fullsource_path); - -exit(0); - -############################################################################ -sub PatchCommonXcu #17.04.2009 10:37 -############################################################################ - { - my $buildid = shift; - open(INFILE, "< $datapath$common_XML") || die "Can't open $datapath$common_XML (read)\n"; - open(OUTFILE, "> $inpath_Common_XCU") || die "Can't open $inpath_Common_XCU (write)\n"; - my $patch_next_line = 0; - my $value = "Patch" . $buildid . "\n"; - while ( $line = ) { - if ( $patch_next_line ) { - print OUTFILE " $value"; - $patch_next_line = 0; - } else - { - print OUTFILE $line; - } - if ( $line =~ /ReminderDate/ ) { - $patch_next_line = 1; - } - } - close(INFILE); - close(OUTFILE); -} ##PatchCommonXcu diff --git a/smoketestoo_native/data/Common.xcu b/smoketestoo_native/data/Common.xcu deleted file mode 100644 index 8cb90a69b7b6..000000000000 --- a/smoketestoo_native/data/Common.xcu +++ /dev/null @@ -1,25 +0,0 @@ - - - - - false - - - - - - 2 - - - 0 - - - - - - - - - - - diff --git a/smoketestoo_native/data/Settings.xcu b/smoketestoo_native/data/Settings.xcu deleted file mode 100644 index 425e789dabc1..000000000000 --- a/smoketestoo_native/data/Settings.xcu +++ /dev/null @@ -1,11 +0,0 @@ - - - - - true - - - false - - - diff --git a/smoketestoo_native/data/Setup.xcu b/smoketestoo_native/data/Setup.xcu deleted file mode 100644 index cbcd2ef8f1ca..000000000000 --- a/smoketestoo_native/data/Setup.xcu +++ /dev/null @@ -1,11 +0,0 @@ - - - - - 2100-01-01T00:00:00 - - - true - - - diff --git a/smoketestoo_native/data/TestExtension.oxt b/smoketestoo_native/data/TestExtension.oxt deleted file mode 100755 index 70580b6a52e3..000000000000 Binary files a/smoketestoo_native/data/TestExtension.oxt and /dev/null differ diff --git a/smoketestoo_native/data/scripts/Global.xba b/smoketestoo_native/data/scripts/Global.xba deleted file mode 100755 index c56b444cf030..000000000000 --- a/smoketestoo_native/data/scripts/Global.xba +++ /dev/null @@ -1,739 +0,0 @@ - - -REM ***** BASIC ***** - -const cMaxErrorStates = 13 - -const cCoGreen = 4057917, cCoRed = 16711680, cCoGrey = 12632256 -const cParagraphBreak = 0 - -global const cExtensionFileName = "TestExtension.oxt" - -global const cDocNew = 0, cDocCut = 1, cDocPaste = 2, cDocSaveOpen8 = 3, cDocSaveOpenXML = 4, cDocSaveOpen50 = 5, cDocClose = 6, cDocWrite = 7 -global const cNewsInit = 0, cNewsSend = 1, cNewsRead = 2 -global const cDBService = 0, cDBOpen = 1, cDBInsert = 2, cDBDelete = 3, cDBSeek = 4, cDBClose = 5 -global const cEXTService = 0, cEXTInstall = 1, cEXTUninstall = 2 -global const cScheduleDateRead = 0 -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 cStMath = 5, cStNews = 10, cStSchedule = 8, 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 frmDataBase = 10, frmSchedule = 11, frmNews = 12, frmJava = 13 -global const frmExtension = 14 - -global const cLogUnknown = 0, cLogFalse = 1, cLogTrue = 2 - -'UserFieldKennungen -Global const cYes = "y", cNo = "n" -Global const cStateNo = 0, cStateYes = 1 - -'Feldtypen -Global const cFtExtUser = 21, cFtPageNum = 5, cFtStatistic = 8, cFtDateTime = 27, cFtDatabase = 31 - -'UnoStrings -Global const cUnoSeparator = "." -Global const cUnoPrefix = "com.sun.star." -Global const cUnoUserField = cUnoPrefix + "text.FieldMaster.User" -Global const cUnoExtUserField = cUnoPrefix + "text.TextField.ExtendedUser" -Global const cUnoMasterDataBase = cUnoPrefix + "text.FieldMaster.Database" -Global const cUnoDataBase = cUnoPrefix + "text.TextField.Database" -Global const cUnoDateTime = cUnoPrefix + "text.TextField.DateTime" -Global const cUnoTextGraphi2 = cUnoPrefix + "text.Graphic" -Global const cUnoJavaLoader = cUnoPrefix + "loader.Java" -Global const cUnoDatabaseContext = cUnoPrefix + "sdb.DatabaseContext" -Global const cUnoRowSet = cUnoPrefix + "sdb.RowSet" -Global const cUnoSmoketestTestExtension = cUnoPrefix + "comp.smoketest.TestExtension" -Global const cUnoSmoketestCommandEnvironment = cUnoPrefix + "deployment.test.SmoketestCommandEnvironment" -Global const cUnothePackageManagerFactory = cUnoPrefix + "deployment.thePackageManagerFactory" - -'UserFieldNames -Global const cUserFieldTestWriter = "Writer", cUserFieldTestCalc = "Calc", cUserFieldTestImpress = "Impress" -Global const cUserFieldTestDraw = "Draw", cUserFieldTestMath = "Math", cUserFieldTestChart = "Chart" -Global const cUserFieldTestHTML = "HTML", cUserFieldTestJava = "Java", cUserFieldTestDatabase = "Database" -Global const cUserFieldTestExtension = "Extension" -Global const cUserFieldTestOpenSaveXML = "SaveOpenXML", cUserFieldTestOpenSave50 = "SaveOpen50", cUserFieldTestCut = "Cut" -Global const cUserFieldTestPaste = "Paste", cUserFieldTestTerminateAfterTest = "Terminate", cUserFieldTestOpenSave8 = "SaveOpen8" - -Global const cOptionsDialogName = "OptionsDlg", cTest10Modul = "Standard" - -Global const cDlgCancel = 1, cDlgOk = 0, cDlgStartTest = 2 - -global gErrorState (cMaxErrorStates, 5) as integer - -global gOutputDoc as Object -global gOutputDocNotUno as Object -global gOptionsDialog as Object -Dim bMakeMailAccount as Boolean, bTestMail as Boolean, bTestDocs as Boolean -Dim bTestSchedule as Boolean, bTestAdr as Boolean - -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, bMakeSaveOpen50Test as boolean, bMakeCutTest as boolean -Global bMakePasteTest as boolean, bMakeTerminateAfterTest as boolean, bShowTable as boolean -Global bMakeSaveOpen8Test as boolean - -global sExtensionURL as string - -Dim gDlgState as Integer - -Sub SetGlobalDoc - gOutPutDoc = StarDesktop.CurrentComponent -end Sub - -Sub ClearStatus - for j% = 0 to cMaxErrorStates - for i% = 0 to 5 - gErrorState (j%, i%) = cLogUnknown - next i% - next j% -end Sub - -Sub ClearAllText - call SetGlobalDoc - call ClearDoc (gOutPutDoc) - call ClearStatus -end Sub - -Sub Main - call SetGlobalDoc - if bShowTable then - call ClearDoc (gOutPutDoc) - end If - - call ClearStatus - - Call Test_10er.Main - - if bShowTable then - call CreateStatusTable2 - call CreateStatusTable - call CreateDocState - call CreateSecondState - gOutputDoc.CurrentController.ViewCursor.JumpToFirstPage - end if -End Sub - -Sub CreateStatusTable - dim tableHeaders(7) as string - tableHeaders(cStWriter) = "Writer" - tableHeaders(cStCalc) = "Calc" - tableHeaders(cStPraesentation) = "Präsen- tation" - tableHeaders(cStZeichnen) = "Zeichn." - tableHeaders(cStChart) = "Diagr." - tableHeaders(cStMath) = "Math" - tableHeaders(cStHTML) = "HTML" - tableHeaders(cStJava) = "Java" - - dim tableColums(5) as string - tableColums(cDocNew) = "new" - tableColums(cDocCut) = "cut" - tableColums(cDocPaste) = "paste" - tableColums(cDocSaveOpen8) = "V8.0" - tableColums(cDocSaveOpenXML) = "XML" - tableColums(cDocSaveOpen50) = "V5.0" -' tableColums(cDocClose) = "close" - - aDoc = gOutPutDoc - - 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) - - table = aDoc.createInstance("com.sun.star.text.TextTable") - table.initialize(7,9) - table.Name = "StTab1" - xText.insertTextContent(xCursor, table, FALSE) - - tableCursor = table.createCursorByCellName(table.CellNames(0)) - tableCursor.gotoStart(FALSE) - tableCursor.goRight(1,FALSE) - - for i% = 0 to 7 - cName = tableCursor.getRangeName() - xCell = table.getCellByName(cName) - xCell.String=tableHeaders(i%) - - xCell.BackTransparent = False - xCell.BackColor = cCoGrey - - tableCursor.goRight(1,FALSE) - next i% - - xCursor.gotoStart(FALSE) -' SetParagraphBreak (xCursor) -' SetParagraphBreak (xCursor) - - tableCursor.gotoStart(FALSE) - cName = tableCursor.getRangeName() - xCell = table.getCellByName(cName) - xCell.BackTransparent = False - xCell.BackColor = cCoGrey - - for i% = 0 to 5 - tableCursor.goDown(1,FALSE) - cName = tableCursor.getRangeName() - xCell = table.getCellByName(cName) - xCell.String=tableColums(i%) - - xCell.BackTransparent = False - xCell.BackColor = cCoGrey - next i% -end Sub - -Sub CreateStatusTable2 - dim tableHeaders(5) as string - tableHeaders(cStDataBase-9) = "Database" - tableHeaders(1) = "" - tableHeaders(cStExtension-9) = "Extension" - 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 tableColums2(3) as string - tableColums2(cEXTService ) = "services" - tableColums2(cEXTInstall ) = "install" - tableColums2(cEXTUninstall ) = "uninstall" - - 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("com.sun.star.text.TextTable") - table.initialize(7,6) - table.Name = "StTab2" - 'table.RelativeWidth =500 - - xText.insertTextContent(xCursor, table, FALSE) - - tableCursor = table.createCursorByCellName(table.CellNames(0)) - tableCursor.gotoStart(FALSE) - tableCursor.goRight(1,FALSE) - - for i% = 0 to 5 - cName = tableCursor.getRangeName() - xCell = table.getCellByName(cName) - xCell.String=tableHeaders(i%) - - xCell.BackTransparent = False - xCell.BackColor = cCoGrey - - tableCursor.goRight(1,FALSE) - next i% - - tableCursor.gotoStart(FALSE) - - cName = tableCursor.getRangeName() - xCell = table.getCellByName(cName) - xCell.BackTransparent = False - xCell.BackColor = cCoGrey - - for i% = 0 to 5 - tableCursor.goDown(1,FALSE) - cName = tableCursor.getRangeName() - xCell = table.getCellByName(cName) - xCell.String=tableColums(i%) - - xCell.BackTransparent = False - xCell.BackColor = cCoGrey - next i% - - tableCursor.gotoStart(FALSE) - tableCursor.goRight(2,FALSE) - - for i% = 0 to 3 - tableCursor.goDown(1,FALSE) - cName = tableCursor.getRangeName() - xCell = table.getCellByName(cName) - xCell.String=tableColums2(i%) - - xCell.BackTransparent = False - xCell.BackColor = cCoGrey - next i% -end Sub - - -Sub CreateDocState - aDoc = gOutPutDoc - table = aDoc.TextTables.GetByIndex (1) - 'table = aDoc.TextTables.GetByName ("StTab1") - - for j% = 0 to 7 - for i% = 0 to 5 - 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 - else - xCell.BackColor = cCoGrey - end If - end If - - next i% - next j% -end Sub - -Sub CreateSecondState - aDoc = gOutPutDoc - table = aDoc.TextTables.GetByIndex (0) - 'table = aDoc.TextTables.GetByName ("StTab2") - - for j% = 0 to cMaxErrorStates-9 - for i% = 0 to 5 - sRangeName = GetRangeName(j%, i%+1) - - tableCursor = table.createCursorByCellName(sRangeName) - - cName = tableCursor.getRangeName() - xCell = table.getCellByName(cName) - - xCell.BackTransparent = False - - if gErrorState (j%+9, i%) = cLogTrue then - xCell.BackColor = cCoGreen - else if gErrorState (j%+9, i%) = cLogFalse then - xCell.BackColor = cCoRed - else - xCell.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 SetStatus (nDocType as Integer, nAction as Integer, bState as Boolean) - Dim nStatusType as Integer - Dim nState as integer - nStatusType = GetStatusType (nDocType) - If nStatusType = cStNone then Exit Sub - - if bState then - nState = cLogTrue - else - nState = cLogFalse - end If - - gErrorState (nStatusType, nAction) = nState -end Sub - -Function GetStatusType (nDocType as Integer) as Integer - Select Case ( nDocType ) - case frmWriter - GetStatusType = cStWriter ' Textdokument - case frmCalc - GetStatusType = cStCalc 'Tabellendokument - case frmMessage - GetStatusType = cStMessage 'Nachricht - case frmImpress - GetStatusType = cStPraesentation 'Präsentation - case frmDraw - GetStatusType = cStZeichnen 'Zeichnen - case frmMath - GetStatusType = cStMath 'Formel - case frmImage - GetStatusType = cStBild 'Bild - case frmHyperText - GetStatusType = cStHTML 'Hypertext-Dokument - case frmChart - GetStatusType = cStChart 'Diagramm - case frmSchedule - GetStatusType = cStSchedule 'Diagramm - case frmJava - GetStatusType = cStJava 'Java - case frmNews - GetStatusType = cStNews 'News - case frmDataBase - GetStatusType = cStDataBase 'DataBase - case frmExtension - GetStatusType = cStExtension '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="" -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="" -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() - - ' 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("cbWriterTest").getState), gOutPutDoc) - SetUserFieldState (cUserFieldTestCalc, -(gOptionsDialog.getControl("cbCalcTest").getState), gOutPutDoc) - SetUserFieldState (cUserFieldTestImpress, -(gOptionsDialog.getControl("cbImpressTest").getState), gOutPutDoc) - SetUserFieldState (cUserFieldTestDraw, -(gOptionsDialog.getControl("cbDrawTest").getState), gOutPutDoc) - SetUserFieldState (cUserFieldTestHTML, -(gOptionsDialog.getControl("cbHTMLTest").getState), gOutPutDoc) - SetUserFieldState (cUserFieldTestMath, -(gOptionsDialog.getControl("cbMathTest").getState), gOutPutDoc) - SetUserFieldState (cUserFieldTestChart, -(gOptionsDialog.getControl("cbChartTest").getState), gOutPutDoc) - SetUserFieldState (cUserFieldTestJava, -(gOptionsDialog.getControl("cbJavaTest").getState), gOutPutDoc) - SetUserFieldState (cUserFieldTestDatabase, -(gOptionsDialog.getControl("cbDatabaseTest").getState), gOutPutDoc) - SetUserFieldState (cUserFieldTestExtension, -(gOptionsDialog.getControl("cbExtensionTest").getState), gOutPutDoc) - SetUserFieldState (cUserFieldTestOpenSaveXML, -(gOptionsDialog.getControl("cbSaveOpenXMLTest").getState), gOutPutDoc) - SetUserFieldState (cUserFieldTestOpenSave50, -(gOptionsDialog.getControl("cbSaveOpen50Test").getState), gOutPutDoc) - SetUserFieldState (cUserFieldTestOpenSave8, -(gOptionsDialog.getControl("cbSaveOpen8Test").getState), gOutPutDoc) - SetUserFieldState (cUserFieldTestCut, -(gOptionsDialog.getControl("cbCutTest").getState), gOutPutDoc) - SetUserFieldState (cUserFieldTestPaste, -(gOptionsDialog.getControl("cbPasteTest").getState), gOutPutDoc) - SetUserFieldState (cUserFieldTestTerminateAfterTest, -(gOptionsDialog.getControl("cbTerminateAfterTest").getState), gOutPutDoc) -end Sub - -Sub GetOptions - call SetGlobalDoc - gOptionsDialog.getControl("cbWriterTest").setState( -( GetUserFieldState (cUserFieldTestWriter, gOutPutDoc))) - gOptionsDialog.getControl("cbCalcTest").setState ( -( GetUserFieldState (cUserFieldTestCalc, gOutPutDoc))) - gOptionsDialog.getControl("cbImpressTest").setState( -( GetUserFieldState (cUserFieldTestImpress, gOutPutDoc))) - gOptionsDialog.getControl("cbDrawTest").setState( -( GetUserFieldState (cUserFieldTestDraw, gOutPutDoc))) - gOptionsDialog.getControl("cbHTMLTest").setState( -( GetUserFieldState (cUserFieldTestHTML, gOutPutDoc))) - gOptionsDialog.getControl("cbMathTest").setState( -( GetUserFieldState (cUserFieldTestMath, gOutPutDoc))) - gOptionsDialog.getControl("cbChartTest").setState( -( GetUserFieldState (cUserFieldTestChart, gOutPutDoc))) - gOptionsDialog.getControl("cbJavaTest").setState( -( GetUserFieldState (cUserFieldTestJava, gOutPutDoc))) - gOptionsDialog.getControl("cbDatabaseTest").setState( -( GetUserFieldState (cUserFieldTestDatabase, gOutPutDoc))) - gOptionsDialog.getControl("cbExtensionTest").setState( -( GetUserFieldState (cUserFieldTestExtension, gOutPutDoc))) - gOptionsDialog.getControl("cbSaveOpenXMLTest").setState( -( GetUserFieldState (cUserFieldTestOpenSaveXML, gOutPutDoc))) - gOptionsDialog.getControl("cbSaveOpen50Test").setState( -( GetUserFieldState (cUserFieldTestOpenSave50, gOutPutDoc))) - gOptionsDialog.getControl("cbSaveOpen8Test").setState( -( GetUserFieldState (cUserFieldTestOpenSave8, gOutPutDoc))) - gOptionsDialog.getControl("cbCutTest").setState( -( GetUserFieldState (cUserFieldTestCut, gOutPutDoc))) - gOptionsDialog.getControl("cbPasteTest").setState( -( GetUserFieldState (cUserFieldTestPaste, gOutPutDoc))) - gOptionsDialog.getControl("cbTerminateAfterTest").setState( -( GetUserFieldState (cUserFieldTestTerminateAfterTest, gOutPutDoc))) -End Sub - -Sub ReadOptions - call SetGlobalDoc - bTestDocs = true - 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) - bMakeSaveOpen50Test = GetUserFieldState (cUserFieldTestOpenSave50, gOutPutDoc) - bMakeSaveOpen8Test = GetUserFieldState (cUserFieldTestOpenSave8, gOutPutDoc) - bMakeCutTest = GetUserFieldState (cUserFieldTestCut, gOutPutDoc) - bMakePasteTest = GetUserFieldState (cUserFieldTestPaste, gOutPutDoc) - bMakeTerminateAfterTest = GetUserFieldState (cUserFieldTestTerminateAfterTest, gOutPutDoc) -end Sub - -Sub SetDefaultOptions - bTestDocs = true - bMakeWriterTest = true - bMakeCalcTest = true - bMakeImpressTest = true - bMakeDrawTest = true - bMakeHTMLTest = true - bMakeMathTest = true - bMakeChartTest = true - bMakeJavaTest = true - bMakeDBTest = true - bMakeExtensionTest = true - bMakeSaveOpenXMLTest = true - REM Disable StarOffice 5.0 tests in case binfilter has not been included - if Environ("WITH_BINFILTER") = "NO" then - bMakeSaveOpen50Test = false - else - bMakeSaveOpen50Test = true - End If - bMakeSaveOpen8Test = true - bMakeCutTest = true - bMakePasteTest = true - bMakeTerminateAfterTest = true -end Sub - -Sub ShutdownQuickstarter - dim qs as Object - qs = createUnoService("com.sun.star.comp.desktop.QuickstartWrapper" ) - qs.setFastPropertyValue( 0, false ) -end Sub - -Sub StartTestByOptions - call ShutdownQuickstarter - bShowTable = true - call ReadOptions - call Main - - if bMakeTerminateAfterTest then - - ClearDocFull (gOutPutDoc) - gOutPutDoc.dispose - 'StarDesktop.Terminate - - 'EnableReschedule( false ) - 'DispatchSlot( 5300 ) - stop - End If -end Sub - -Sub StartTestWithDefaultOptions - call ShutdownQuickstarter - bShowTable = false - call SetDefaultOptions - call Main - - if bMakeTerminateAfterTest then - stop - - ClearDocFull (gOutPutDoc) - gOutPutDoc.dispose - 'StarDesktop.Terminate - 'EnableReschedule( false ) - 'DispatchSlot( 5300 ) - stop - End If -end Sub - -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("com.sun.star.util.URLTransformer") - oUrl.Complete = "slot:" & CStr(SlotID) - oTrans.parsestrict(oUrl) - - oDisp = StarDesktop.queryDispatch(oUrl, "_self", 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 = "LibraryName" - arg.Value = LibName - args(0) = arg - - dim url as new com.sun.star.util.URL - dim trans as object - trans = createUnoService("com.sun.star.util.URLTransformer" ) - url.Complete = "slot:6517" - trans.parsestrict( url ) - - dim disp as object - disp = StarDesktop.currentFrame.queryDispatch( url, "", 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("com.sun.star.util.URLTransformer" ) - url.Complete = "slot:" + SlotNr - trans.parsestrict( url ) - - disp = oDoc.CurrentController.Frame.queryDispatch( url, "", 0 ) - disp.dispatch( url, args() ) - -End Sub - -Sub CutText (oDoc as Object) - ExecuteSlot ("5710", oDoc) -End Sub - -Sub PasteText (oDoc as Object) - ExecuteSlot ("5712", oDoc) -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 <> 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 '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 = "" - 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 - diff --git a/smoketestoo_native/data/scripts/Test_10er.xba b/smoketestoo_native/data/scripts/Test_10er.xba deleted file mode 100755 index b475dfe53b42..000000000000 --- a/smoketestoo_native/data/scripts/Test_10er.xba +++ /dev/null @@ -1,907 +0,0 @@ - - -REM 10er Test - -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 sSDrawLogFileName = "sdrwlog.dat", sJavaLogFileName = "javalog.dat" -const sSDBLogFileName = "dblog.dat", sExtLogFileName = "extlog.dat" -const sLogFileName = "log.dat" -const cTempFileName = "ttt" - -const cMessageSaveOpen8Doc = "Save/Open open Documents (8.0)" -const cMessageSaveOpenXMLDoc = "Save/Open Document XML (6/7)" -const cMessageSaveOpen50Doc = "Save/Open Document 5.0" -const cMessageNewDoc = "New Document" -const cMessageCloseDoc = "Close Document" -const cMessageCutObj = "Cut Object" -const cMessagePasteObj = "Paste Object" - -Global sWorkPath$ -Global sWorkPathURL$ -Global FileChannel% -Global MainFileChannel% - -Sub Main - call TestAllDocs() -end Sub - -Sub DeleteAllSavedFiles() - Dim sFileName as String - sFileName = sWorkPath+cTempFileName+"."+GetDocEndings(frmWriter) - If FileExists (sFileName) then - Kill (sFileName) - End If - sFileName = sWorkPath+cTempFileName+"."+GetDocEndings(frmCalc) - If FileExists (sFileName) then - Kill (sFileName) - End If - sFileName = sWorkPath+cTempFileName+"."+GetDocEndings(frmImpress) - If FileExists (sFileName) then - Kill (sFileName) - End If - sFileName = sWorkPath+cTempFileName+"."+GetDocEndings(frmDraw) - If FileExists (sFileName) then - Kill (sFileName) - End If - sFileName = sWorkPath+cTempFileName+"."+GetDocEndings(frmHyperText) - If FileExists (sFileName) then - Kill (sFileName) - End If - sFileName = sWorkPath+cTempFileName+"."+GetDocEndings(frmWriter or cFltXML) - If FileExists (sFileName) then - Kill (sFileName) - End If - sFileName = sWorkPath+cTempFileName+"."+GetDocEndings(frmCalc or cFltXML) - If FileExists (sFileName) then - Kill (sFileName) - End If - sFileName = sWorkPath+cTempFileName+"."+GetDocEndings(frmImpress or cFltXML) - If FileExists (sFileName) then - Kill (sFileName) - End If - sFileName = sWorkPath+cTempFileName+"."+GetDocEndings(frmDraw or cFltXML) - If FileExists (sFileName) then - Kill (sFileName) - End If - sFileName = sWorkPath+cTempFileName+"."+GetDocEndings(frmWriter or cFlt50) - If FileExists (sFileName) then - Kill (sFileName) - End If - sFileName = sWorkPath+cTempFileName+"."+GetDocEndings(frmCalc or cFlt50) - If FileExists (sFileName) then - Kill (sFileName) - End If - sFileName = sWorkPath+cTempFileName+"."+GetDocEndings(frmImpress or cFlt50) - If FileExists (sFileName) then - Kill (sFileName) - End If - sFileName = sWorkPath+cTempFileName+"."+GetDocEndings(frmDraw or cFlt50) - If FileExists (sFileName) then - Kill (sFileName) - End If -End Sub - -Sub DeleteAllLogFiles() - If FileExists (sWorkPath+sLogFileName) then - Kill (sWorkPath+sLogFileName) - End If - If FileExists (sWorkPath+sSWLogFileName) then - Kill (sWorkPath+sSWLogFileName) - End If - If FileExists (sWorkPath+sSCLogFileName) then - Kill (sWorkPath+sSCLogFileName) - End If - If FileExists (sWorkPath+sSDLogFileName) then - Kill (sWorkPath+sSDLogFileName) - End If - 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 - If FileExists (sWorkPath+sJavaLogFileName) then - Kill (sWorkPath+sJavaLogFileName) - End If - If FileExists (sWorkPath+sSDBLogFileName) then - Kill (sWorkPath+sSDBLogFileName) - End If - If FileExists (sWorkPath+sExtLogFileName) then - Kill (sWorkPath+sExtLogFileName) - End If -end Sub - -Function OpenLogDat (sFileName as String) as Integer - Dim LocaleFileChannel% - If FileExists (sWorkPath+sFileName) then - Kill (sWorkPath+sFileName) - End If - LocaleFileChannel% = Freefile - Open sWorkPath+sFileName For Output As LocaleFileChannel% - OpenLogDat = LocaleFileChannel% -end Function - -Function GetWorkPath as string - sTemp = "$(userpath)/temp/" - GetWorkPath = CreateUnoService("com.sun.star.config.SpecialConfigManager").SubstituteVariables(sTemp) -End Function - -Function GetWorkURL as string - sTemp = "$(userurl)/temp/" - GetWorkURL = CreateUnoService("com.sun.star.config.SpecialConfigManager").SubstituteVariables(sTemp) -End Function - -Function GetSystem (sTmpWorkPath as string) as string - GetSystem = "" - if InStr (sTmpWorkPath, ":") then - GetSystem = "windows" - else - GetSystem = "unix" - End If -end Function - -Function ConvertPathToWin (sTmpWorkPath as string) as string - for i%=1 to Len(sTmpWorkPath) - sTemp = Mid (sTmpWorkPath, i%, 1) - if sTemp = "/" then - sTmpWorkPath = Left (sTmpWorkPath, i%-1) + "\" + Right (sTmpWorkPath, Len(sTmpWorkPath)-i%) - else - if sTemp = "|" then - sTmpWorkPath = Left (sTmpWorkPath, i%-1) + ":" + Right (sTmpWorkPath, Len(sTmpWorkPath)-i%) - end If - end If - next i% - ConvertPathToWin = sTmpWorkPath -end Function - -Sub TestAllDocs() -DIM sDocURL as String, sDocPath as String -DIM nStrPos as Long - - sWorkPath = GetWorkPath - sWorkPathURL = GetWorkURL - - if GetSystem (sWorkPath) = "windows" then - sWorkPath = ConvertPathToWin (sWorkPath) - end if - - 'search ExtensionURL - sExtensionURL = sWorkPathURL - If not FileExists (sExtensionURL + cExtensionFileName) then - if bShowTable then - sDocURL = gOutPutDoc.URL - CompatibilityMode(true) - nStrPos = InStrRev (sDocURL, "/" ) - CompatibilityMode(false) - if nStrPos then - sDocURL = Left (sDocURL, nStrPos) - sExtensionURL = sDocURL - If not FileExists (sExtensionURL + cExtensionFileName) then - bMakeExtensionTest = false ' test is not possible then - end if - else - bMakeExtensionTest = false ' test is not possible then - end if - - else - bMakeExtensionTest = false ' test is not possible then - end if - - end if - - call DeleteAllSavedFiles() - call DeleteAllLogFiles() - MainFileChannel = OpenLogDat (sLogFileName) - call WriteTestSequence (MainFileChannel) - if bMakeWriterTest then - call MakeDocTest (frmWriter) - end if - if bMakeCalcTest then - call MakeDocTest (frmCalc) - end if - if bMakeImpressTest then - call MakeDocTest (frmImpress) - end if - if bMakeDrawTest then - call MakeDocTest (frmDraw) - end if - if bMakeHTMLTest then - call MakeDocTest (frmHyperText) - end if - if bMakeChartTest then - call MakeChartTest (frmChart) - end if - if bMakeMathTest then - call MakeNewDoc (frmMath) - end if - if bMakeJavaTest then - call TestJava (frmJava) - end if - if bMakeDBTest then - call Test_DB.TestDB (frmDataBase) - end if - if bMakeExtensionTest then - call Test_Ext.TestExtensions (frmExtension) - end if - - Close #MainFileChannel -end Sub - -Sub WriteTestSequence (FileChannel as integer) - Print #FileChannel, "Sequence of testing" - - if bMakeWriterTest then - WriteTests ("writer : ", true, FileChannel) - end if - if bMakeCalcTest then - WriteTests ("calc : ", true, FileChannel) - end if - if bMakeImpressTest then - WriteTests ("impress : ", true, FileChannel) - end if - if bMakeDrawTest then - WriteTests ("draw : ", true, FileChannel) - end if - if bMakeHTMLTest then - WriteTests ("HTML : ", true, FileChannel) - end if - if bMakeChartTest then - WriteTests ("chart : ", false, FileChannel) - end if - if bMakeMathTest then - WriteTests ("math : ", false, FileChannel) - end if - if bMakeJavaTest then - WriteTests ("Java : ", false, FileChannel) - end if - if bMakeDBTest then - WriteDBTests ("Database : ", FileChannel) - end if - if bMakeExtensionTest then - WriteExtensionTests ("Extension : ", FileChannel) - end if - - Print #FileChannel -end Sub - -Sub WriteTests (sText as string, bTestAll as boolean, nFileChannel as integer) - Dim sWriteStr as string - - sWriteStr = sText - sWriteStr = sWriteStr + "new" - if bTestAll then - if bMakeCutTest then - sWriteStr = sWriteStr + ", cut" - end if - if bMakePasteTest then - sWriteStr = sWriteStr + ", paste" - end if - if bMakeSaveOpen8Test then - sWriteStr = sWriteStr + ", save 8.0" - end if - if bMakeSaveOpenXMLTest then - sWriteStr = sWriteStr + ", save XML" - end if - if bMakeSaveOpen50Test then - sWriteStr = sWriteStr + ", save 5.0" - end if - if bMakeSaveOpen8Test then - sWriteStr = sWriteStr + ", open 8.0" - end if - if bMakeSaveOpenXMLTest then - sWriteStr = sWriteStr + ", open XML" - end if - if bMakeSaveOpen50Test then - sWriteStr = sWriteStr + ", open 5.0" - end if - end if - - sWriteStr = sWriteStr + ", close" - - Print #nFileChannel, sWriteStr -end Sub - -Sub WriteDBTests (sText as string, nFileChannel as integer) - Dim sWriteStr as string - - sWriteStr = sText - sWriteStr = sWriteStr + "open / services" - sWriteStr = sWriteStr + ", insert" - sWriteStr = sWriteStr + ", delete" - sWriteStr = sWriteStr + ", seek" - sWriteStr = sWriteStr + ", close" - - Print #nFileChannel, sWriteStr -end Sub - -Sub WriteExtensionTests (sText as string, nFileChannel as integer) - Dim sWriteStr as string - - sWriteStr = sText - sWriteStr = sWriteStr + "services" - sWriteStr = sWriteStr + ", install" - sWriteStr = sWriteStr + ", uninstall" - - Print #nFileChannel, sWriteStr -end Sub - -Sub MakeDocTest (FilterType as Integer) - Dim oDoc as Object - Dim sFileNameXML$, sFileName50$, sFileName8$ - Dim bError as Boolean - Dim nCurrentAction as Integer - - On Local Error GoTo DOCTESTERROR - nCurrentAction = cLogfileFailed - FileChannel% = OpenLogDat (GetLogFileName(FilterType)) - nCurrentAction = cDocNew - oDoc = LoadDoc ("private:factory/" + GetDocFilter(FilterType or cFltNewDoc)) - LogState (not IsNull (oDoc), GetDocFilter(FilterType or cFltNewDoc)+" "+ cMessageNewDoc, FileChannel) - LogState (not IsNull (oDoc), GetDocFilter(FilterType or cFltNewDoc)+" "+ cMessageNewDoc, MainFileChannel) - SetStatus (FilterType, cDocNew, not IsNull (oDoc)) - if not IsNull (oDoc) then - nCurrentAction = cDocCut - call CutAndPaste(FilterType, oDoc) -' bError = oDoc.CurrentController.frame.close - nCurrentAction = cDocSaveOpen8 - if bMakeSaveOpen8Test and IsFilterAvailable (FilterType or cFlt8) then - sFileName8 = sWorkPathURL+cTempFileName+"."+GetDocEndings(FilterType or cFlt8) - SaveDoc (sFileName8, oDoc, GetDocFilter(FilterType or cFlt8)) - end if - nCurrentAction = cDocSaveOpenXML - if bMakeSaveOpenXMLTest and IsFilterAvailable (FilterType or cFltXML) then - sFileNameXML = sWorkPathURL+cTempFileName+"."+GetDocEndings(FilterType or cFltXML) - SaveDoc (sFileNameXML, oDoc, GetDocFilter(FilterType or cFltXML)) - end if - nCurrentAction = cDocSaveOpen50 - if bMakeSaveOpen50Test and IsFilterAvailable (FilterType or cFlt50) then - sFileName50 = sWorkPathURL+cTempFileName+"."+GetDocEndings(FilterType or cFlt50) - SaveDoc (sFileName50, oDoc, GetDocFilter(FilterType or cFlt50)) - 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) - nCurrentAction = cDocSaveOpen8 - if bMakeSaveOpen8Test and IsFilterAvailable (FilterType or cFlt8) then - oDoc = LoadDoc (sFileName8) - -' oDoc = Documents.open(sFileName) - LogState (not IsNull (oDoc),GetDocFilter(FilterType or cFltNewDoc)+" "+ cMessageSaveOpen8Doc, FileChannel) - LogState (not IsNull (oDoc),GetDocFilter(FilterType or cFltNewDoc)+" "+ cMessageSaveOpen8Doc, MainFileChannel) - SetStatus (FilterType, cDocSaveOpen8, not IsNull (oDoc)) - - if not IsNull (oDoc) then -' oDoc.dispose - nCurrentAction = cDocClose - oDoc.close (true) - end If - end if - - nCurrentAction = cDocSaveOpenXML - if bMakeSaveOpenXMLTest and IsFilterAvailable (FilterType or cFltXML) then - oDoc = LoadDoc (sFileNameXML) - -' oDoc = Documents.open(sFileName) - LogState (not IsNull (oDoc),GetDocFilter(FilterType or cFltNewDoc)+" "+ cMessageSaveOpenXMLDoc, FileChannel) - LogState (not IsNull (oDoc),GetDocFilter(FilterType or cFltNewDoc)+" "+ cMessageSaveOpenXMLDoc, MainFileChannel) - SetStatus (FilterType, cDocSaveOpenXML, not IsNull (oDoc)) - - if not IsNull (oDoc) then -' oDoc.dispose - nCurrentAction = cDocClose - oDoc.close (true) - end If - end if - - nCurrentAction = cDocSaveOpen50 - if bMakeSaveOpen50Test and IsFilterAvailable (FilterType or cFlt50) then - oDoc = LoadDoc (sFileName50) - -' oDoc = Documents.open(sFileName) - LogState (not IsNull (oDoc),GetDocFilter(FilterType or cFltNewDoc)+" "+ cMessageSaveOpen50Doc, FileChannel) - LogState (not IsNull (oDoc),GetDocFilter(FilterType or cFltNewDoc)+" "+ cMessageSaveOpen50Doc, MainFileChannel) - SetStatus (FilterType, cDocSaveOpen50, not IsNull (oDoc)) - - if not IsNull (oDoc) then -' oDoc.dispose - nCurrentAction = cDocClose - oDoc.close (true) - end If - end if - end If - Print #FileChannel, "---" - Close #FileChannel% - Exit Sub ' Without error - - DOCTESTERROR: - If (nCurrentAction = cLogfileFailed) then - SetStatus (FilterType, cDocNew, False) - Exit Sub - else - LogState (False, GetDocFilter(FilterType or cFltNewDoc)+" "+ GetErrorMessage(nCurrentAction), FileChannel) - LogState (False, GetDocFilter(FilterType or cFltNewDoc)+" "+ GetErrorMessage(nCurrentAction), MainFileChannel) - SetStatus (FilterType, nCurrentAction, False) - Close #FileChannel% - End If - Exit Sub ' With error -End Sub - -Sub MakeNewDoc (FilterType as Integer) - DIM oDoc as Object - Dim bError as Boolean - Dim nCurrentAction as Integer - On Local Error GoTo DOCTESTERROR2 - nCurrentAction = cLogfileFailed - FileChannel% = OpenLogDat (GetLogFileName(FilterType)) - nCurrentAction = cDocNew -' oDoc = Documents.Add(GetDocFilter(FilterType)) - oDoc = LoadDoc ("private:factory/" + GetDocFilter(FilterType or cFltNewDoc)) - LogState (not IsNull (oDoc), GetDocFilter(FilterType or cFltNewDoc)+" "+ cMessageNewDoc, FileChannel) - LogState (not IsNull (oDoc), GetDocFilter(FilterType or cFltNewDoc)+" "+ cMessageNewDoc, MainFileChannel) - 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) - end If - Print #FileChannel, "---" - Close #FileChannel% - Exit Sub ' Without error - - DOCTESTERROR2: - If (nCurrentAction = cLogfileFailed) then - SetStatus (FilterType, cDocNew, False) - Exit Sub - else - LogState (False, GetDocFilter(FilterType or cFltNewDoc)+" "+ GetErrorMessage(nCurrentAction), FileChannel) - LogState (False, GetDocFilter(FilterType or cFltNewDoc)+" "+ GetErrorMessage(nCurrentAction), MainFileChannel) - SetStatus (FilterType, nCurrentAction, False) - Close #FileChannel% - End If - Exit Sub ' With error -End Sub - -Sub MakeChartTest (FilterType as Integer) - Dim oCharts as Object - Dim oDoc as Object - 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 nCurrentAction as Integer - On Local Error GoTo CHARTTESTERROR - nCurrentAction = cLogfileFailed - FileChannel% = OpenLogDat (GetLogFileName(FilterType)) - nCurrentAction = cDocNew - oDoc = LoadDoc ("private:factory/" + GetDocFilter(frmCalc or cFltNewDoc)) - 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 - nCurrentAction = cDocClose - oDoc.close (true) - else - LogState (not IsNull (oDoc), GetDocFilter(frmCalc or cFltNewDoc)+" "+ cMessageNewDoc, FileChannel) - LogState (not IsNull (oDoc), GetDocFilter(frmCalc or cFltNewDoc)+" "+ cMessageNewDoc, MainFileChannel) - SetStatus (frmCalc, cDocNew, not IsNull (oDoc)) - End if - Print #FileChannel, "---" - Close #FileChannel% - Exit Sub ' Without error - - CHARTTESTERROR: - If (nCurrentAction = cLogfileFailed) then - SetStatus (FilterType, cDocNew, False) - Exit Sub - else - LogState (False, GetDocFilter(FilterType or cFltNewDoc)+" "+ GetErrorMessage(nCurrentAction), FileChannel) - LogState (False, GetDocFilter(FilterType or cFltNewDoc)+" "+ GetErrorMessage(nCurrentAction), MainFileChannel) - SetStatus (FilterType, nCurrentAction, False) - Close #FileChannel% - End If - Exit Sub ' With error -End Sub - -Sub LogState (bState as Boolean, sText as String, nLocaleFileChannel as integer) - if bState then - Print #nLocaleFileChannel, sText+" -> ok" - else - Print #nLocaleFileChannel, sText+" -> error" - end If -end Sub - -Function GetDocEndings (DocType as Integer) as String - Select Case ( DocType ) - case frmWriter or cFlt8 - GetDocEndings = "odt" ' Textdokument - case frmCalc or cFlt8 - GetDocEndings = "ods" 'Tabellendokument - case frmImpress or cFlt8 - GetDocEndings = "odp" 'PrĂ•sentation - case frmDraw or cFlt8 - GetDocEndings = "odg" 'Zeichen - case frmHyperText, frmHyperText or cFlt50, frmHyperText or cFltXML - GetDocEndings = "html" 'Hypertext-Dokument - case frmWriter or cFlt50 - GetDocEndings = "sdw" ' Textdokument 5.0 - case frmCalc or cFlt50 - GetDocEndings = "sdc" 'Tabellendokument 5.0 - case frmImpress or cFlt50 - GetDocEndings = "sdd" 'PrĂ•sentation 5.0 - case frmDraw or cFlt50 - GetDocEndings = "sda" 'Zeichen 5.0 - case frmWriter or cFltXML - GetDocEndings = "sxw" ' Textdokument - case frmCalc or cFltXML - GetDocEndings = "sxc" 'Tabellendokument - case frmImpress or cFltXML - GetDocEndings = "sxi" 'PrĂ•sentation - case frmDraw or cFltXML - GetDocEndings = "sxd" 'Zeichen - case else - GetDocEndings = "" - end Select -end Function - -Function GetDocFilter (DocType as Integer) as String - Select Case ( DocType ) - case frmWriter or cFlt8 - GetDocFilter = "writer8" ' Textdokument - case frmCalc or cFlt8 - GetDocFilter = "calc8" 'Tabellendokument - case frmImpress or cFlt8 - GetDocFilter = "impress8" 'Präsentation - case frmDraw or cFlt8 - GetDocFilter = "draw8" 'Zeichen - case frmMath or cFlt8 - GetDocFilter = "math8" 'Formel - - case frmWriter or cFltXML - GetDocFilter = "StarOffice XML (Writer)" ' Textdokument - case frmCalc or cFltXML - GetDocFilter = "StarOffice XML (Calc)" 'Tabellendokument - case frmImpress or cFltXML - GetDocFilter = "StarOffice XML (Impress)" 'Präsentation - case frmDraw or cFltXML - GetDocFilter = "StarOffice XML (Draw)" 'Zeichen - case frmMath or cFltXML - GetDocFilter = "StarOffice XML (Math)" 'Formel - - case frmHyperText, frmHyperText or cFlt50, frmHyperText or cFltXML - GetDocFilter = "HTML" 'Hypertext-Dokument - case frmWriter or cFlt50 - GetDocFilter = "StarWriter 5.0" ' Textdokument 5.0 - case frmCalc or cFlt50 - GetDocFilter = "StarCalc 5.0" 'Tabellendokument 5.0 - case frmImpress or cFlt50 - GetDocFilter = "StarImpress 5.0" 'Präsentation 5.0 - case frmDraw or cFlt50 - GetDocFilter = "StarDraw 5.0" 'Zeichen 5.0 - case frmMath or cFlt50 - GetDocFilter = "StarMath 5.0" 'Formel 5.0 - - case frmWriter or cFltNewDoc - GetDocFilter = "swriter" ' Textdokument - case frmCalc or cFltNewDoc - GetDocFilter = "scalc" 'Tabellendokument - case frmMessage or cFltNewDoc - GetDocFilter = "Message" 'Nachricht - case frmImpress or cFltNewDoc - GetDocFilter = "simpress" 'Präsentation - case frmDraw or cFltNewDoc - GetDocFilter = "sdraw" 'Zeichen - case frmMath or cFltNewDoc - GetDocFilter = "smath" 'Formel - case frmImage or cFltNewDoc - GetDocFilter = "simage" 'Bild - case frmHyperText or cFltNewDoc - GetDocFilter = "swriter/web" 'Hypertext-Dokument - case frmChart or cFltNewDoc - GetDocFilter = "schart" 'Diagramm - case else - GetDocFilter = "" - end Select -end Function - -Function GetLogFileName (DocType as Integer) as String - Select Case ( DocType ) - case frmWriter - GetLogFileName = sSWLogFileName ' Textdokument - case frmCalc - GetLogFileName = sSCLogFileName 'Tabellendokument - case frmMessage - GetLogFileName = sSMessageLogFileName 'Nachricht - case frmImpress - GetLogFileName = sSDLogFileName 'PrĂ•sentation - case frmDraw - GetLogFileName = sSDrawLogFileName 'Zeichnen - case frmMath - GetLogFileName = sSMathLogFileName 'Formel - case frmImage - GetLogFileName = sSImDLogFileName 'Bild - case frmHyperText - GetLogFileName = sSHptLogFileName 'Hypertext-Dokument - case frmChart - GetLogFileName = sSChartLogFileName 'Diagramm - case frmJava - GetLogFileName = sJavaLogFileName 'Java - case frmDataBase - GetLogFileName = sSDBLogFileName 'Database - case frmExtension - GetLogFileName = sExtLogFileName 'Extension - case else - GetLogFileName = "" - end Select -end Function - -Function GetErrorMessageOnAction (nAction as Integer) as String - Select Case ( nAction ) - case cDocNew - GetErrorMessageOnAction = cMessageNewDoc - case cDocCut - GetErrorMessageOnAction = cMessageCutObj - case cDocPaste - GetErrorMessageOnAction = cMessagePasteObj - case cDocSaveOpen8 - GetErrorMessageOnAction = cMessageSaveOpen8Doc - case cDocSaveOpenXML - GetErrorMessageOnAction = cMessageSaveOpenXMLDoc - case cDocSaveOpen50 - GetErrorMessageOnAction = cMessageSaveOpen50Doc - case cDocClose - GetErrorMessageOnAction = cMessageCloseDoc - case else - GetErrorMessageOnAction = "" - end Select -end Function - -Function IsFilterAvailable (FilterType as Integer) as boolean - IsFilterAvailable = true - if ((FilterType = (frmHyperText or cFlt50)) or (FilterType = (frmHyperText or cFltXML))) then - IsFilterAvailable = false - end if -End Function - -Function TestJava (FilterType as Integer) as boolean - Dim oObj as Object - FileChannel% = OpenLogDat (GetLogFileName(FilterType)) - oObj = createUnoService(cUnoJavaLoader) - LogState (not IsNull (oObj), "Java "+ cMessageNewDoc, FileChannel) - LogState (not IsNull (oObj), "Java "+ cMessageNewDoc, MainFileChannel) - SetStatus (FilterType, cDocNew, not IsNull (oObj)) - - Print #FileChannel, "---" - Close #FileChannel% - - TestJava = not IsNull (oObj) -End Function - -Sub CutAndPaste (DocType as Integer, oDoc as Object) - Dim sText as String - Dim oWin as Object - Dim oText as Object - Dim oView as Object - Dim bCutState as boolean, bPasteState as boolean - Select Case ( DocType ) - case frmWriter - Dim oCursor as Object - - sText = "AutomaticText" - oText = oDoc.GetText - oCursor = oText.CreateTextCursor - oText.InsertString(oCursor, sText, true) ' Cursor selektiert den Text - oView = oDoc.getCurrentController - oView.Select(oCursor) - - if bMakeCutTest then - call CutText (oDoc) - - if oText.GetString = "" Then - bCutState = True - else - bCutState = False - end If - SetStatus (DocType, cDocCut, bCutState) - LogState (bCutState, GetDocFilter(DocType or cFltNewDoc)+" "+ cMessageCutObj, FileChannel) - LogState (bCutState, GetDocFilter(DocType or cFltNewDoc)+" "+ cMessageCutObj, MainFileChannel) - end if - - if bMakePasteTest and bMakeCutTest then - call PasteText (oDoc) - - if oText.GetString = sText Then - bPasteState = True - else - bPasteState = False - end If - SetStatus (DocType, cDocPaste, bPasteState) - LogState (bPasteState, GetDocFilter(DocType or cFltNewDoc)+" "+ cMessagePasteObj, FileChannel) - LogState (bPasteState, GetDocFilter(DocType or cFltNewDoc)+" "+ cMessagePasteObj, MainFileChannel) - end if - - case frmCalc - DIM oCell as Object - - sText = "AutomaticText" - oCell = oDoc.Sheets(0).GetCellByPosition(0, 0) - oCell.String = sText - oView = oDoc.getCurrentController - oView.Select(oCell) - - if bMakeCutTest then - call CutText (oDoc) - - if oCell.String = "" Then - bCutState = True - else - bCutState = False - end If - SetStatus (DocType, cDocCut, bCutState) - LogState (bCutState, GetDocFilter(DocType or cFltNewDoc)+" "+ cMessageCutObj, FileChannel) - LogState (bCutState, GetDocFilter(DocType or cFltNewDoc)+" "+ cMessageCutObj, MainFileChannel) - end if - - if bMakePasteTest and bMakeCutTest then - call PasteText (oDoc) - - if oCell.String = sText Then - bPasteState = True - else - bPasteState = False - end If - SetStatus (DocType, cDocPaste, bPasteState) - LogState (bPasteState, GetDocFilter(DocType or cFltNewDoc)+" "+ cMessagePasteObj, FileChannel) - LogState (bPasteState, GetDocFilter(DocType or cFltNewDoc)+" "+ cMessagePasteObj, MainFileChannel) - end if - case frmMessage - case frmImpress, frmDraw - Dim oPage as Object - Dim oRect as Object - Dim xSize as Object - Dim xPoint as Object - Dim bObjState as Boolean - - xSize = CreateUnoStruct ("com.sun.star.awt.Size") - xPoint = CreateUnoStruct ("com.sun.star.awt.Point") - xSize.Width = 2000 - xSize.Height = 2000 - xPoint.x = 10000 - xPoint.y = 10000 - oPage = oDoc.DrawPages(0) - oRect = oDoc.CreateInstance("com.sun.star.drawing.RectangleShape") - oRect.Size = xSize - oRect.Position = xPoint - oPage.add(oRect) - - oView = oDoc.getCurrentController - oView.Select(oRect) - - ' PrĂĽft ob ĂĽberhaupt ein Object angelegt wurde - if oPage.count = 1 Then - bObjState = True - else - bObjState = False - end If - - if bMakeCutTest then - call CutText (oDoc) - - if (oPage.count = 0) and bObjState Then - bCutState = True - else - bCutState = False - end If - SetStatus (DocType, cDocCut, bCutState) - LogState (bCutState, GetDocFilter(DocType or cFltNewDoc)+" "+ cMessageCutObj, FileChannel) - LogState (bCutState, GetDocFilter(DocType or cFltNewDoc)+" "+ cMessageCutObj, MainFileChannel) - end if - - wait (1000) 'wait after cut - - if bMakePasteTest and bMakeCutTest then - call PasteText (oDoc) - - if (oPage.count = 1) and bObjState Then - bPasteState = True - else - bPasteState = False - end If - SetStatus (DocType, cDocPaste, bPasteState) - LogState (bPasteState, GetDocFilter(DocType or cFltNewDoc)+" "+ cMessagePasteObj, FileChannel) - LogState (bPasteState, GetDocFilter(DocType or cFltNewDoc)+" "+ cMessagePasteObj, MainFileChannel) - end if - case frmMath - case frmImage - case frmHyperText - case frmChart - end Select -end Sub - -Sub LoadLibrary( LibName as String ) - - dim args(1) - dim arg as new com.sun.star.beans.PropertyValue - arg.Name = "LibraryName" - arg.Value = LibName - args(0) = arg - - dim url as new com.sun.star.util.URL - dim trans as object - trans = createUnoService("com.sun.star.util.URLTransformer" ) - url.Complete = "slot:6517" - trans.parsestrict( url ) - - dim disp as object - disp = StarDesktop.currentFrame.queryDispatch( url, "", 0 ) - disp.dispatch( url, args() ) - -End Sub - -Sub LoadDoc (DocName as String) as Object - dim trans as object - trans = createUnoService("com.sun.star.util.URLTransformer" ) - url = createUnoStruct("com.sun.star.util.URL" ) - url.Complete = DocName - if Left(DocName, 5 ) <> "file:" then - trans.parsestrict( url ) - endif - - Dim aPropArray(0) as Object - aPropArray(0) = CreateUnoStruct("com.sun.star.beans.PropertyValue") - aPropArray(0).Name = "OpenFlags" - aPropArray(0).Value = "S" - - dim doc as object - dim noargs() - doc = StarDesktop.loadComponentFromURL( url.Complete, "_blank", 0, aPropArray() ) ' XModel - LoadDoc = doc -End Sub - -Sub SaveDoc (DocName as String, oDoc as Object, sFilterName as string ) - dim trans as object - trans = createUnoService("com.sun.star.util.URLTransformer" ) - url = createUnoStruct("com.sun.star.util.URL" ) - url.Complete = DocName - if Left(DocName, 5 ) <> "file:" then - trans.parsestrict( url ) - endif - - if not (sFilterName = "") then - Dim aPropArray(0) as Object - aPropArray(0) = CreateUnoStruct("com.sun.star.beans.PropertyValue") - aPropArray(0).Name = "FilterName" - aPropArray(0).Value = sFilterName - - oDoc.storeAsURL( url.Complete, aPropArray() ) - else - MessageBox "Filtername is unknown!" - end if -end Sub - \ No newline at end of file diff --git a/smoketestoo_native/data/scripts/Test_DB.xba b/smoketestoo_native/data/scripts/Test_DB.xba deleted file mode 100755 index 7e5a74bfe2ab..000000000000 --- a/smoketestoo_native/data/scripts/Test_DB.xba +++ /dev/null @@ -1,135 +0,0 @@ - - -REM ***** Database Test ***** - -const cMessageDatabaseService = "Database Service" -const cMessageDatabaseOpen = "Open Database" -const cMessageDatabaseInsert = "Insert record into Database" -const cMessageDatabaseDelete = "Delete record from Database" -const cMessageDatabaseSeek = "Read other record from Database" -const cMessageDatabaseClose = "Close Database" - -Sub TestDB (FilterType as Integer) - -Dim oDBConnection as Object, oDataSource as Object, oDBContext as Object -Dim sDBName as String, sTable as String, sCurrentMessage as String -Dim nRowCount as Integer, nCurrentAction as Integer -Dim bResult as Boolean -Const sTestString = "Automatical Test" - - - On Local Error GoTo DBERROR - - nCurrentAction = cLogfileFailed - FileChannel% = OpenLogDat (GetLogFileName(FilterType)) - - nCurrentAction = cDBService - sCurrentMessage = cMessageDatabaseService + " " + cUnoDatabaseContext - - oDBContext = CreateUnoService(cUnoDatabaseContext) - sDBName=oDBContext.ElementNames(0) 'Names of Databases - - nCurrentAction = cDBOpen - sCurrentMessage = cMessageDatabaseOpen - - oDataSource = oDBContext.GetByName(sDBName) - sTable=oDataSource.Tables.ElementNames(0) - oDBConnection = oDBContext.GetByName(sDBName).GetConnection("","") - - LogState (not IsNull (oDBConnection), "Database "+ cMessageDatabaseOpen, FileChannel) - LogState (not IsNull (oDBConnection), "Database "+ cMessageDatabaseOpen, MainFileChannel) - SetStatus (FilterType, cDBOpen, not IsNull (oDBConnection)) - if (IsNull(oDBConnection)) then - Close #FileChannel% - Exit Sub - End If - - ' Database is open now - - nCurrentAction = cDBService - sCurrentMessage = cMessageDatabaseService + " " + cUnoRowSet - oRowSet = createUnoService(cUnoRowSet) - - if (IsNull(oRowSet)) then - LogState (not IsNull (oRowSet), "Database "+ cMessageDatabaseService + " " + cUnoRowSet, FileChannel) - LogState (not IsNull (oRowSet), "Database "+ cMessageDatabaseService + " " + cUnoRowSet, MainFileChannel) - SetStatus (FilterType, cDBService, not IsNull (oRowSet)) - Exit Sub - else - LogState (not IsNull (oRowSet), "Database "+ cMessageDatabaseService, FileChannel) - LogState (not IsNull (oRowSet), "Database "+ cMessageDatabaseService, MainFileChannel) - SetStatus (FilterType, cDBService, not IsNull (oRowSet)) - End If - - nCurrentAction = cDBInsert - sCurrentMessage = cMessageDatabaseInsert - - oRowSet.ActiveConnection = oDBConnection - - oRowSet.CommandType = com.sun.star.sdb.CommandType.COMMAND - oRowSet.Command = "SELECT * FROM " + sTable - oRowSet.execute() - - oRowSet.moveToInsertRow - oRowSet.updateString(5, sTestString) - - oRowSet.insertRow() - nRowCount=oRowSet.RowCount - - oRowSet.moveToCurrentRow() - - bResult = (oRowSet.getString(5) = sTestString) - LogState (bResult, "Database "+ cMessageDatabaseInsert, FileChannel) - LogState (bResult, "Database "+ cMessageDatabaseInsert, MainFileChannel) - SetStatus (FilterType, cDBInsert, bResult) - - 'delete only if insert passed - - if (bResult) Then - nCurrentAction = cDBDelete - sCurrentMessage = cMessageDatabaseDelete - oRowSet.deleteRow() - bResult = (nRowCount - oRowSet.RowCount = 0) - if ( bResult ) Then - oRowSet.next() - bResult = (nRowCount - oRowSet.RowCount = 1) - End If - LogState (bResult, "Database "+ cMessageDatabaseDelete, FileChannel) - LogState (bResult, "Database "+ cMessageDatabaseDelete, MainFileChannel) - SetStatus (FilterType, cDBDelete, bResult) - End If - - ' read other record - - nCurrentAction = cDBSeek - sCurrentMessage = cMessageDatabaseSeek - oRowSet.first() - bResult = not (oRowSet.getString(5) = sTestString) - LogState (bResult, "Database "+ cMessageDatabaseSeek, FileChannel) - LogState (bResult, "Database "+ cMessageDatabaseSeek, MainFileChannel) - SetStatus (FilterType, cDBSeek, bResult) - - nCurrentAction = cDBClose - sCurrentMessage = cMessageDatabaseClose - oDBConnection.Dispose() - LogState (True, "Database "+ cMessageDatabaseClose, FileChannel) - LogState (True, "Database "+ cMessageDatabaseClose, MainFileChannel) - SetStatus (FilterType, cDBClose, True) - - Print #FileChannel, "---" - Close #FileChannel% - Exit Sub ' Without error - - DBERROR: - If (nCurrentAction = cLogfileFailed) then - SetStatus (FilterType, cDBOpen, False) - Exit Sub - else - LogState (False, "Database "+ sCurrentMessage, FileChannel) - LogState (False, "Database "+ sCurrentMessage, MainFileChannel) - SetStatus (FilterType, nCurrentAction, False) - Close #FileChannel% - End If - Exit Sub ' With error -End Sub - \ No newline at end of file diff --git a/smoketestoo_native/data/scripts/Test_Ext.xba b/smoketestoo_native/data/scripts/Test_Ext.xba deleted file mode 100755 index 00fc93ff86eb..000000000000 --- a/smoketestoo_native/data/scripts/Test_Ext.xba +++ /dev/null @@ -1,95 +0,0 @@ - - -REM ***** BASIC ***** - -const cMessageExtensionService = "Extension Service" -const cMessageExtensionInstall = "Install Extension" -const cMessageExtensionUninstall = "Uninstall Extension" - -Sub TestExtensions (FilterType as Integer) -Dim oTestExtension as Object, obj_null as Object -Dim sCurrentMessage as String -Dim nCurrentAction as Integer -Dim bResult as Boolean -Dim sImplementationNameString as String -sImplementationNameString = cUnoSmoketestTestExtension + "$_TestExtension" - - On Local Error GoTo EXTERROR - - nCurrentAction = cLogfileFailed - FileChannel% = OpenLogDat (GetLogFileName(FilterType)) - - sCurrentMessage = cMessageExtensionService - nCurrentAction = cEXTService - - 'Create an implementation of com.sun.star.ucb.XCommandEnvironment which is needed for - 'adding the extension. The implementation is in - 'javaunohelper/com/sun/star/comp/juhtest/SmoketestCommandEnvironment.java and the code is in juh.jar - cmdEnv = createUnoService(cUnoSmoketestCommandEnvironment) - - 'Create the component context and then get the singleton thePackageManagerFactory - 'A singleton cannot be created with createUnoService - ctx = getDefaultContext - factory = ctx.getValueByName("/singletons/" + cUnothePackageManagerFactory) - - 'Get the XPackageManager interface. By passing "user" we determine that the actions we perform on - 'XPackageManager only affect the user installation. To modify the share installation one would pass "share". - ext_mgr = factory.getPackageManager("user") - - LogState (not IsNull (ext_mgr), "Extension "+ cMessageExtensionService, FileChannel) - LogState (not IsNull (ext_mgr), "Extension "+ cMessageExtensionService, MainFileChannel) - SetStatus (FilterType, cEXTService, not IsNull (ext_mgr)) - if (IsNull(ext_mgr)) then - Close #FileChannel% - Exit Sub - End If - - sCurrentMessage = cMessageExtensionInstall - nCurrentAction = cEXTInstall - - 'Add the extension. We must provide a file URL here. - ext_mgr.addPackage(sExtensionURL + cExtensionFileName, "", obj_null, cmdEnv) - - 'Check if the extension has been added by creating a service which is contained in the extension. - oTestExtension = createUnoService(cUnoSmoketestTestExtension) - bResult = (oTestExtension.getImplementationName = sImplementationNameString) - LogState (bResult, "Extension "+ cMessageExtensionInstall, FileChannel) - LogState (bResult, "Extension "+ cMessageExtensionInstall, MainFileChannel) - SetStatus (FilterType, cEXTInstall, bResult) - if (not bResult) then - Close #FileChannel% - Exit Sub - End If - - sCurrentMessage = cMessageExtensionUninstall - nCurrentAction = cEXTUninstall - - 'Remove the package - ext_mgr.removePackage("org.openoffice.legacy." + cExtensionFileName, cExtensionFileName, obj_null, cmdEnv) - - 'Try to create the service which is contained in the now removed extension. - oTestExtension = createUnoService(cUnoSmoketestTestExtension) - - 'The service must not be available anymore. Therefor isNull must return true. - LogState (IsNull (oTestExtension), "Extension "+ cMessageExtensionUninstall, FileChannel) - LogState (IsNull (oTestExtension), "Extension "+ cMessageExtensionUninstall, MainFileChannel) - SetStatus (FilterType, cEXTUninstall, IsNull (oTestExtension)) - - Print #FileChannel, "---" - Close #FileChannel% - Exit Sub ' Without error - - EXTERROR: - If (nCurrentAction = cLogfileFailed) then - SetStatus (FilterType, cEXTService, False) - Exit Sub - else - LogState (False, "Extension "+ sCurrentMessage, FileChannel) - LogState (False, "Extension "+ sCurrentMessage, MainFileChannel) - SetStatus (FilterType, nCurrentAction, False) - Close #FileChannel% - End If - Exit Sub ' With error - -End Sub - \ No newline at end of file diff --git a/smoketestoo_native/data/scripts/script.xlb b/smoketestoo_native/data/scripts/script.xlb deleted file mode 100755 index 6b7873432f75..000000000000 --- a/smoketestoo_native/data/scripts/script.xlb +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/smoketestoo_native/data/smoketestdoc.sxw b/smoketestoo_native/data/smoketestdoc.sxw index b9139efda28d..fa67968addec 100755 Binary files a/smoketestoo_native/data/smoketestdoc.sxw and b/smoketestoo_native/data/smoketestdoc.sxw differ diff --git a/smoketestoo_native/makefile.mk b/smoketestoo_native/makefile.mk index f21ae594bf33..ac629d07a995 100644 --- a/smoketestoo_native/makefile.mk +++ b/smoketestoo_native/makefile.mk @@ -1,14 +1,13 @@ -#*********************************************************************** -# +#************************************************************************* # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# +# # Copyright 2008 by Sun Microsystems, Inc. # # OpenOffice.org - a multi-platform office productivity suite # -# $RCSfile: makefile.mk,v $ +# $RCSfile: makefile,v $ # -# $Revision: 1.9 $ +# $Revision: 1.4 $ # # This file is part of OpenOffice.org. # @@ -26,33 +25,72 @@ # version 3 along with OpenOffice.org. If not, see # # for a copy of the LGPLv3 License. -# -#************************************************************************* +#***********************************************************************/ -PRJ=. +PRJ = . +PRJNAME = smoketestoo_native +TARGET = smoketest -PRJNAME=test10 -TARGET=t1 +ENABLE_EXCEPTIONS = TRUE -.INCLUDE : settings.mk +.INCLUDE: settings.mk -STAR_REGISTRY= -.EXPORT : STAR_REGISTRY -.EXPORT : PERL -.EXPORT : DMAKE_WORK_DIR +SLOFILES = $(SHL1OBJS) -.INCLUDE : target.mk +SHL1TARGET = smoketest +SHL1OBJS = $(SLO)/smoketest.obj +SHL1RPATH = NONE +SHL1STDLIBS = $(CPPUHELPERLIB) $(CPPULIB) $(CPPUNITLIB) $(SALLIB) +DEF1NAME = $(SHL1TARGET) -ALLTAR : make_test +.INCLUDE: target.mk +.IF "$(OS)" == "MACOSX" +my_path = OpenOffice.org.app/Contents/MacOS/soffice +.ELSE +my_path = openoffice.org3/program/soffice +.END -make_test: -.IF $(NOREMOVE) - @$(PERL) smoketest.pl -nr $(LAST_MINOR) $(BUILD) +.IF "$(OOO_LIBRARY_PATH_VAR)" != "" +.IF "$(USE_SHELL)" == "bash" +my_arg_env = \ + -env:arg-env=$(OOO_LIBRARY_PATH_VAR)$${{$(OOO_LIBRARY_PATH_VAR)+=$$$(OOO_LIBRARY_PATH_VAR)}} +.ELSE +# The tcsh case is somewhat imprecise in that it treats a null environment +# variable the same as an unset one: +.IF "$($(OOO_LIBRARY_PATH_VAR))" == "" +my_arg_env = -env:arg-env=$(OOO_LIBRARY_PATH_VAR) .ELSE - @$(PERL) smoketest.pl $(LAST_MINOR) $(BUILD) -.ENDIF +my_arg_env = -env:arg-env=$(OOO_LIBRARY_PATH_VAR)=$($(OOO_LIBRARY_PATH_VAR)) +.END +.END +.END + +ALLTAR: smoketest + +smoketest .PHONY: $(MISC)/installation.flag $(SHL1TARGETN) \ + $(MISC)/services.rdb $(BIN)/smoketestdoc.sxw + $(RM) -r $(MISC)/user + $(MKDIR) $(MISC)/user + $(CPPUNITTESTER) $(SHL1TARGETN) \ + -env:UNO_SERVICES=file://$(PWD)/$(MISC)/services.rdb \ + -env:UNO_TYPES=file://$(SOLARBINDIR)/types.rdb \ + -env:arg-path=$(MISC)/installation/opt/$(my_path) \ + -env:arg-user=$(MISC)/user -env:arg-doc=$(BIN)/smoketestdoc.sxw \ + $(my_arg_env) + +$(MISC)/installation.flag: + $(RM) -r $(MISC)/installation + $(MKDIR) $(MISC)/installation + cd $(MISC)/installation && $(GNUTAR) xfz \ + $(SRC_ROOT)/instsetoo_native/$(INPATH)/OpenOffice/archive/install/$(defaultlangiso)/OOo_*_install.tar.gz + $(MV) $(MISC)/installation/OOo_*_install $(MISC)/installation/opt + $(TOUCH) $@ -noremove: - @$(PERL) smoketest.pl -nr $(LAST_MINOR) $(BUILD) +$(MISC)/services.rdb: + $(RM) $@ + $(REGCOMP) -register -r $@ -wop -c bridgefac.uno -c connector.uno \ + -c remotebridge.uno -c uuresolver.uno +$(BIN)/smoketestdoc.sxw: data/smoketestdoc.sxw + $(COPY) $< $@ diff --git a/smoketestoo_native/smoketest.cxx b/smoketestoo_native/smoketest.cxx new file mode 100644 index 000000000000..13970cc2d233 --- /dev/null +++ b/smoketestoo_native/smoketest.cxx @@ -0,0 +1,313 @@ +/************************************************************************* +* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +* +* Copyright 2008 by Sun Microsystems, Inc. +* +* OpenOffice.org - a multi-platform office productivity suite +* +* $RCSfile: code,v $ +* +* $Revision: 1.4 $ +* +* 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 +* +* for a copy of the LGPLv3 License. +************************************************************************/ + +#include "sal/config.h" + +#include "string" + +#include "boost/noncopyable.hpp" +#include "com/sun/star/beans/PropertyState.hpp" +#include "com/sun/star/beans/PropertyValue.hpp" +#include "com/sun/star/bridge/UnoUrlResolver.hpp" +#include "com/sun/star/bridge/XUnoUrlResolver.hpp" +#include "com/sun/star/connection/NoConnectException.hpp" +#include "com/sun/star/document/MacroExecMode.hpp" +#include "com/sun/star/frame/DispatchResultEvent.hpp" +#include "com/sun/star/frame/DispatchResultState.hpp" +#include "com/sun/star/frame/XComponentLoader.hpp" +#include "com/sun/star/frame/XController.hpp" +#include "com/sun/star/frame/XDesktop.hpp" +#include "com/sun/star/frame/XDispatchProvider.hpp" +#include "com/sun/star/frame/XDispatchResultListener.hpp" +#include "com/sun/star/frame/XModel.hpp" +#include "com/sun/star/frame/XNotifyingDispatch.hpp" +#include "com/sun/star/lang/DisposedException.hpp" +#include "com/sun/star/lang/EventObject.hpp" +#include "com/sun/star/lang/XMultiServiceFactory.hpp" +#include "com/sun/star/uno/Reference.hxx" +#include "com/sun/star/uno/RuntimeException.hpp" +#include "com/sun/star/uno/Sequence.hxx" +#include "com/sun/star/uno/XComponentContext.hpp" +#include "com/sun/star/util/URL.hpp" +#include "cppuhelper/bootstrap.hxx" +#include "cppuhelper/implbase1.hxx" +#include "cppunit/TestAssert.h" +#include "cppunit/TestFixture.h" +#include "cppunit/extensions/HelperMacros.h" +#include "cppunit/plugin/TestPlugIn.h" +#include "osl/conditn.hxx" +#include "osl/diagnose.h" +#include "osl/file.hxx" +#include "osl/process.h" +#include "osl/thread.hxx" +#include "osl/time.h" +#include "rtl/bootstrap.hxx" +#include "rtl/string.hxx" +#include "rtl/textenc.h" +#include "rtl/ustring.h" +#include "rtl/ustring.hxx" +#include "sal/main.h" +#include "sal/types.h" + +namespace CppUnit { + +template<> struct assertion_traits< rtl::OUString > { + static bool equal(rtl::OUString const & x, rtl::OUString const & y) { + return x == y; + } + + static std::string toString(rtl::OUString const & x) { + return rtl::OUStringToOString(x, RTL_TEXTENCODING_UTF8).getStr(); + } +}; + +} + +namespace { + +namespace css = com::sun::star; + +rtl::OUString argumentName(rtl::OUString const & name) { + return rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("arg-")) + name; +} + +rtl::OUString getArgument(rtl::OUString const & name) { + rtl::OUString val; + CPPUNIT_ASSERT(rtl::Bootstrap::get(argumentName(name), val)); + return val; +} + +bool getOptionalArgument(rtl::OUString const & name, rtl::OUString * value) { + OSL_ASSERT(value != 0); + return rtl::Bootstrap::get(argumentName(name), *value); +} + +rtl::OUString toUrl(rtl::OUString const & pathname) { + rtl::OUString cwd; + CPPUNIT_ASSERT_EQUAL( + osl_Process_E_None, osl_getProcessWorkingDir(&cwd.pData)); + rtl::OUString url; + CPPUNIT_ASSERT_EQUAL( + osl::FileBase::E_None, + osl::FileBase::getFileURLFromSystemPath(pathname, url)); + rtl::OUString absUrl; + CPPUNIT_ASSERT_EQUAL( + osl::FileBase::E_None, + osl::FileBase::getAbsoluteFileURL(cwd, url, absUrl)); + return absUrl; +} + +struct Result: private boost::noncopyable { + osl::Condition condition; + bool success; + rtl::OUString result; +}; + +class Listener: + public cppu::WeakImplHelper1< css::frame::XDispatchResultListener > +{ +public: + Listener(Result * result): result_(result) { OSL_ASSERT(result != 0); } + +private: + virtual void SAL_CALL disposing(css::lang::EventObject const &) + throw (css::uno::RuntimeException) {} + + virtual void SAL_CALL dispatchFinished( + css::frame::DispatchResultEvent const & Result) + throw (css::uno::RuntimeException); + + Result * result_; +}; + +void Listener::dispatchFinished(css::frame::DispatchResultEvent const & Result) + throw (css::uno::RuntimeException) +{ + result_->success = + (Result.State == css::frame::DispatchResultState::SUCCESS) && + (Result.Result >>= result_->result); + result_->condition.set(); +} + +class Test: public CppUnit::TestFixture { +public: + virtual void setUp(); + + virtual void tearDown(); + +private: + CPPUNIT_TEST_SUITE(Test); + CPPUNIT_TEST(test); + CPPUNIT_TEST_SUITE_END(); + + void test(); + + oslProcess process_; + css::uno::Reference< css::lang::XMultiServiceFactory > factory_; +}; + +void Test::setUp() { + oslProcessInfo info; + info.Size = sizeof info; + CPPUNIT_ASSERT_EQUAL( + osl_Process_E_None, + osl_getProcessInfo(0, osl_Process_IDENTIFIER, &info)); + rtl::OUString desc( + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM("pipe,name=oootest")) + + rtl::OUString::valueOf(static_cast< sal_Int64 >(info.Ident)) + + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(";urp"))); + rtl::OUString userArg( + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("-env:UserInstallation=")) + + toUrl(getArgument(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("user"))))); + rtl::OUString nofirstArg( + RTL_CONSTASCII_USTRINGPARAM("-nofirststartwizard")); + rtl::OUString acceptArg( + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("-accept=")) + desc); + rtl_uString * args[] = { nofirstArg.pData, userArg.pData, acceptArg.pData }; + rtl_uString ** envs = 0; + rtl::OUString argEnv; + if (getOptionalArgument( + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("env")), &argEnv)) + { + envs = &argEnv.pData; + } + CPPUNIT_ASSERT_EQUAL( + osl_Process_E_None, + osl_executeProcess( + (toUrl( + getArgument( + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("path")))). + pData), + args, sizeof args / sizeof args[0], 0, 0, 0, envs, + envs == 0 ? 0 : 1, &process_)); + try { + css::uno::Reference< css::uno::XComponentContext > context( + cppu::defaultBootstrap_InitialComponentContext()); + css::uno::Reference< css::bridge::XUnoUrlResolver > resolver( + css::bridge::UnoUrlResolver::create(context)); + for (int i = 0;; ++i) { + try { + factory_ = + css::uno::Reference< css::lang::XMultiServiceFactory >( + resolver->resolve( + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("uno:")) + + desc + + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + ";StarOffice.ServiceManager"))), + css::uno::UNO_QUERY_THROW); + break; + } catch (css::connection::NoConnectException &) { + if (i == 600) { // 600 sec + throw; + } + } + TimeValue delay = { 1, 0 }; // 1 sec + osl::Thread::wait(delay); + } + } catch (...) { + CPPUNIT_ASSERT_EQUAL( + osl_Process_E_None, osl_terminateProcess(process_)); + osl_freeProcessHandle(process_); + throw; + } +} + +void Test::tearDown() { + css::uno::Reference< css::frame::XDesktop > desktop( + factory_->createInstance( + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM("com.sun.star.frame.Desktop"))), + css::uno::UNO_QUERY_THROW); + factory_.clear(); + try { + CPPUNIT_ASSERT(desktop->terminate()); + desktop.clear(); + } catch (css::lang::DisposedException &) {} + // it appears that DisposedExceptions can already happen while receiving + // the response of the terminate call + CPPUNIT_ASSERT_EQUAL(osl_Process_E_None, osl_joinProcess(process_)); + oslProcessInfo info; + info.Size = sizeof info; + CPPUNIT_ASSERT_EQUAL( + osl_Process_E_None, + osl_getProcessInfo(process_, osl_Process_EXITCODE, &info)); + CPPUNIT_ASSERT_EQUAL(oslProcessExitCode(0), info.Code); + osl_freeProcessHandle(process_); +} + +void Test::test() { + css::uno::Sequence< css::beans::PropertyValue > args(1); + args[0].Name = rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM("MacroExecutionMode")); + args[0].Handle = -1; + args[0].Value <<= + com::sun::star::document::MacroExecMode::ALWAYS_EXECUTE_NO_WARN; + args[0].State = css::beans::PropertyState_DIRECT_VALUE; + css::util::URL url; + url.Complete = rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "vnd.sun.star.script:Standard.Global.StartTestWithDefaultOptions?" + "language=Basic&location=document")); + Result result; + css::uno::Reference< css::frame::XNotifyingDispatch >( + css::uno::Reference< css::frame::XDispatchProvider >( + css::uno::Reference< css::frame::XController >( + css::uno::Reference< css::frame::XModel >( + css::uno::Reference< css::frame::XComponentLoader >( + factory_->createInstance( + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.frame.Desktop"))), + css::uno::UNO_QUERY_THROW)->loadComponentFromURL( + toUrl( + getArgument( + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM("doc")))), + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM("_default")), + 0, args), + css::uno::UNO_QUERY_THROW)->getCurrentController(), + css::uno::UNO_SET_THROW)->getFrame(), + css::uno::UNO_QUERY_THROW)->queryDispatch( + url, rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("_self")), 0), + css::uno::UNO_QUERY_THROW)->dispatchWithNotification( + url, css::uno::Sequence< css::beans::PropertyValue >(), + new Listener(&result)); + result.condition.wait(); + CPPUNIT_ASSERT(result.success); + CPPUNIT_ASSERT_EQUAL(rtl::OUString(), result.result); +} + +CPPUNIT_TEST_SUITE_REGISTRATION(Test); + +} + +CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/smoketestoo_native/smoketest.pl b/smoketestoo_native/smoketest.pl deleted file mode 100755 index 91f6ed681fc1..000000000000 --- a/smoketestoo_native/smoketest.pl +++ /dev/null @@ -1,1283 +0,0 @@ -: -eval 'exec perl -wS $0 ${1+"$@"}' - if 0; -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2008 by Sun Microsystems, Inc. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# $RCSfile: smoketest.pl,v $ -# -# $Revision: 1.35 $ -# -# 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 -# -# for a copy of the LGPLv3 License. -# -#************************************************************************* - -# -# smoketest - do the smoketest -# - -use lib ("$ENV{SOLARENV}/bin/modules"); - -use File::Basename; -use File::Path; -use File::Copy; -use Getopt::Long; -use SourceConfig; - -######################## -# # -# Globale Variablen # -# # -######################### -$is_debug = 0; # run without executing commands -$is_command_infos = 0; # print command details before exec -$is_protocol_test = 0; -$is_remove_on_error = 0; -$is_remove_at_end = 1; -$is_do_deinstall = 0; -$is_without_msiexec = 1; -$is_oo = 1; - -$sourceconfig_obj; -$gui = $ENV{GUI}; -$temp_path = $ENV{TEMP}; -$vcsid = $ENV{VCSID}; -$sversion_saved = 0; -$FileURLPrefix = "file:///"; -$userinstalldir = "UserInstallation"; -$cygwin = "cygwin"; -$prefered_lang = "en-US"; -$global_instset_mask = ""; -$smoketest_install = $ENV{SMOKETESTINSTALLSET}; - -if (!defined($gui)) { - print "The workstamp is missing. Please use setsolar\n"; - exit(1); -} - -if (($gui eq "WNT") and ($ENV{USE_SHELL} ne "4nt")) { - $gui = $cygwin; -} - -if (!defined($temp_path) and (($gui eq "UNX") or ($gui eq $cygwin))) { - $temp_path = $ENV{TMPDIR}; - if (!defined($temp_path) and (-d "/tmp")) { - $temp_path = "/tmp"; - } -} - -if (defined($ENV{INSTALLPATH_SMOKETEST})) { - $installpath_without = $ENV{INSTALLPATH_SMOKETEST}; -} -else { - $installpath_without = $temp_path; -} - -if (!defined($installpath_without)) { - print "Your temp value is missing. Please set your temp-variable or define INSTALLPATH_SMOKETEST\n\n"; - exit(1); -} - -if (!((defined($ENV{UPDATER})) and ($ENV{UPDATER} eq "YES") and !defined($ENV{CWS_WORK_STAMP})) ) { - $is_protocol_test = 0; -} - -if ($gui eq "WNT") { - $PathSeparator = '\\'; - $NewPathSeparator = ';'; - $dos = "$ENV{COMSPEC} -c"; - $PERL = "$dos $ENV{PERL}"; - $REMOVE_DIR = "$dos del /qsxyz"; - $REMOVE_FILE = "$dos del"; - $LIST_DIR = "$dos ls"; - $COPY_FILE = "$dos copy"; - $COPY_DIR = "$dos copy /s"; - $MK_DIR = "md"; - $RENAME_FILE = "ren"; - $nul = '> NUL'; - $RESPFILE="response_fat_wnt"; - $SVERSION_INI = $ENV{USERPROFILE} . $PathSeparator . "Anwendungsdaten" . $PathSeparator . "sversion.ini"; - $SOFFICEBIN = "soffice.exe"; - $bootstrapini = "bootstrap.ini"; - $bootstrapiniTemp = $bootstrapini . "_"; - $packpackage = "msi"; - $installpath_without =~ s/\//\\/g; -} -elsif ($gui eq "UNX") { - $is_do_deinstall = 0; - $PathSeparator = '/'; - $NewPathSeparator = ':'; - $dos = ""; - $PERL = "$ENV{PERL}"; - $REMOVE_DIR = "rm -rf"; - $REMOVE_FILE = "rm -f"; - $LIST_DIR = "ls"; - $COPY_FILE = "cp -f"; - $MK_DIR = "mkdir"; - $RENAME_FILE = "mv"; - $nul = '> /dev/null'; - $RESPFILE="response_fat_unx"; - $SVERSION_INI = $ENV{HOME} . $PathSeparator . ".sversionrc"; - $bootstrapini = "bootstraprc"; - $bootstrapiniTemp = $bootstrapini . "_"; - $packpackage = $ENV{PKGFORMAT}; - $SOFFICEBIN = "soffice"; - if ($ENV{OS} eq "MACOSX") { - $COPY_DIR = "cp -RPfp"; - } - else { - $COPY_DIR = "cp -rf"; - } -} -elsif ($gui eq $cygwin) { - $PathSeparator = '/'; - $NewPathSeparator = ':'; - $dos = ""; - $PERL = "$ENV{PERL}"; - $REMOVE_DIR = "rm -rf"; - $REMOVE_FILE = "rm -f"; - $LIST_DIR = "ls"; - $COPY_FILE = "cp -f"; - $COPY_DIR = "cp -rf"; - $MK_DIR = "mkdir"; - $RENAME_FILE = "mv"; - $nul = '> /dev/null'; - $RESPFILE="response_fat_wnt"; - $SVERSION_INI = $ENV{USERPROFILE} . $PathSeparator . "Anwendungsdaten" . $PathSeparator . "sversion.ini"; - $SOFFICEBIN = "soffice"; - $bootstrapini = "bootstrap.ini"; - $bootstrapiniTemp = $bootstrapini . "_"; - $CygwinLineends = $/; - $WinLineends = "\r\n"; - $packpackage = "msi"; - $installpath_without =~ s/\\/\//g; -} -else { - print_error ("not supported system\n",1); -} - -if ($is_without_msiexec) { - require installer::windows::admin; import installer::windows::admin; - $installer::globals::logfilename = $ENV{DMAKE_WORK_DIR} . $PathSeparator . $ENV{OUTPATH} . $ENV{PROEXT} . $PathSeparator . "misc" . $PathSeparator . "installer.log"; - $installer::globals::exithandler = \&install_error; -} - -if ($is_oo) { - @install_list = ( 'instsetoo_native' - ); -} -else { - @install_list = ( 'instset_native' - ); -} - -@error_messages = ( '', - 'lock flag for pkgadd still exist. Installation not possible!', - 'Error during installation!', - 'Error: patching configuration failed!', - 'Error: starting office failed or office crashed!', - 'Error during testing', - 'can not copy extension', - 'Error in setup log', - 'installationsset is not complete', - 'can not copy all basic scripts', - 'can not patch bottstrapini', - 'msiexec failed. Maybe you have got an installed version', - 'deinstallation is incomplete', - 'this packformat is not supported for this environment', - 'can not set execute permission' -); - -my $show_NoMessage = 0; -my $show_Message = 1; - -my $error_logflag = 1; -my $error_setup = 2; -my $error_patchConfig = 3; -my $error_startOffice = 4; -my $error_testResult = 5; -my $error_copyExtension = 6; -my $error_setup_log = 7; -my $error_installset = 8; -my $error_copyBasic = 9; -my $error_patchBootstrap = 10; -my $error_msiexec = 11; -my $error_deinst = 12; -my $error_packformat = 13; -my $error_permission = 14; - -my $command_normal = 0; -my $command_withoutErrorcheck = 1; -my $command_withoutOutput = 2; - -if ($is_oo) { - $PRODUCT="OpenOffice"; -} -else { - $PRODUCT="StarOffice"; -} - -if (($ENV{PKGFORMAT} eq "installed") and (!defined ($ENV{FORCE2ARCHIVE}))) { - $packpackage = $ENV{PKGFORMAT}; # take it for all environments -} -elsif (defined ($ENV{FORCE2ARCHIVE})) { - $packpackage = "archive"; # take it for all environments -} -$StandDir = $ENV{SOLARSRC} . $PathSeparator; -$SHIP = defined $ENV{SHIPDRIVE} ? $ENV{SHIPDRIVE} . $PathSeparator : "shipdrive_not_set"; -$PORDUCT = "$SHIP$ENV{INPATH}$PathSeparator$PRODUCT$PathSeparator$packpackage$PathSeparator"; -$DATA="$ENV{DMAKE_WORK_DIR}$PathSeparator" . "data$PathSeparator"; -$WORK_STAMP_LC=$ENV{WORK_STAMP}; -$WORK_STAMP_LC =~ tr/A-Z/a-z/; -$ENV{DBGSV_INIT} = $DATA . "dbgsv.ini"; -$ExtensionDir = $ENV{DMAKE_WORK_DIR} . $PathSeparator . $ENV{OUTPATH} . $ENV{PROEXT} . $PathSeparator . "bin" . $PathSeparator; - -if (defined($vcsid)) { - $installpath_without .= $PathSeparator . $vcsid; -} -if (!$is_oo) { - $installpath_without .= $PathSeparator . "StarOffice"; -} -else { - $installpath_without .= $PathSeparator . "OpenOffice"; -} - -$installpath = $installpath_without . $PathSeparator; -$installpath = glob $installpath; - -$ENV{STAR_REGISTRY}=""; -$milestone = ""; - -#### options #### - -$opt_nr = 0; -GetOptions('nr'); - -if ($opt_nr) { - $is_remove_at_end = 0; # do not remove installation -} -if ( $ARGV[0] ) { - $milestone = $ARGV[0]; -} -if ( $ARGV[1] ) { - $buildid = $ARGV[1]; -} - - -#### script id ##### - -( $script_name = $0 ) =~ s/^.*\b(\w+)\.pl$/$1/; - -$id_str = ' $Revision: 1.35 $ '; -$id_str =~ /Revision:\s+(\S+)\s+\$/ - ? ($script_rev = $1) : ($script_rev = "-"); - -print "$script_name -- version: $script_rev\n"; - - -#### main #### - -if (!$is_debug) { - if ($is_do_deinstall) { - deinstallInstallation ($installpath); - } - removeOldInstallation($installpath); - save_sversion ($SVERSION_INI); -} - -($INSTSETNAME, $INSTALLSET) = getInstset(); - -print "Install: $INSTALLSET$INSTSETNAME\n"; -prepare(); -doTest(); - -if (!$is_debug) { - restore_sversion ($SVERSION_INI); - if ($is_remove_at_end) { - if ($is_do_deinstall) { - deinstallInstallation ($installpath); - } - removeInstallation($installpath); - } - else { - print_notRemoved ($installpath); - } -} -print "smoketest successful!\n"; -exit (0); - -######################### -# # -# Procedures # -# # -######################### - -sub getSubFiles { - my ($startDir, $DirArray_ref, $mask) = @_; - my ($dir); - opendir(DIR,"$startDir"); - while($dir = readdir(DIR)) { - if (($dir =~ /\.$/) or ($dir !~ /$mask/)) { - next; - } - push (@{$DirArray_ref}, "$dir"); - } - closedir(DIR); - -} - -sub getSubDirs { - my ($startDir, $DirArray_ref) = @_; - my ($dir); - opendir(DIR,"$startDir"); - while($dir = readdir(DIR)) { - if (($dir !~ /\.$/) and ( -d "$startDir$dir") ) { - push (@{$DirArray_ref}, "$dir"); - } - } - closedir(DIR); - -} - -sub getSubDirsFullPath { - my ($startDir, $DirArray_ref) = @_; - my ($dir); - opendir(DIR,"$startDir"); - while($dir = readdir(DIR)) { - if (($dir !~ /\.$/) and ( -d "$startDir$dir") ) { - push (@{$DirArray_ref}, "$startDir$dir"); - } - } - closedir(DIR); - -} - -sub findSubDir { - my ($DirArray_ref) = @_; - my (@sortedArray, $dir, $instdir); - @sortedArray = sort langsort @{$DirArray_ref}; - print "Langs: @sortedArray\n" if $is_command_infos; - foreach $dir (@sortedArray) { - if ($dir =~ /log$/) { - next; - } - $instdir = "$dir"; - return $instdir; - } - return ""; -} - -sub findMultiple { - my ($base, $name) = @_; - my ($f, @s, @res); - opendir(DIR, $base) or die "cannot open dir $base"; - while ($f = readdir(DIR)) { - push @res, "$base" if $f eq $name; - push @s, $f if - -d "$base$f" && ! -l "$base$f" && $f ne '.' && $f ne '..'; - } - closedir(DIR); - foreach $f (@s) { - push @res, findMultiple("$base$f$PathSeparator", $name); - } - return @res; -} - -sub findUnique { - my ($base, $name) = @_; - my @res = findMultiple($base, $name); - die "no unique $name in $base" unless @res == 1; - return $res[0]; -} - -sub prepare { - if ($gui eq "UNX") { - $ENV{ignore_patch_check}="t"; - $ENV{OOO_FORCE_DESKTOP} = "none"; - } - -} - -sub is_Installset_ok { - my ($installpath, $installname) = @_; - my ($is_ok, $infile); - $is_ok = 1; - $infile = $INSTALLSET. "log$PathSeparator"; - $infile =~ s/_pre_//; - $infile =~ s/[\/\\]normal[\/\\]//; - $infile =~ s/\.(\d+)$/_$1\.html/; - #if ($installname =~ /(?:_pre_){0,1}(.*)\.(\d+)/) { - # $infile .= "$1_$2.html"; - # print "protocol: $infile\n" if $is_debug; - #} - open INTABLE, "<$infile" or return errorFromOpen ($infile); - while() { - $line = $_; - if ( $line =~ />(error)(.*)= 0) { - foreach $file (@DirArray) { - $Command = "$REMOVE_FILE /tmp/$file"; - execute_Command ($Command, $error_logflag, $show_Message, $command_withoutOutput); - } - } - if ($mach eq sun4u) { - $solarisdata = $DATA . "solaris$PathSeparator" . "sparc$PathSeparator"; - } - else { - $solarisdata = $DATA . "solaris$PathSeparator" . "x86$PathSeparator"; - } - $installsetpath .= "packages$PathSeparator"; - $optdir = "$dest_installdir" . "opt" . $PathSeparator; - createPath ($optdir, $error_setup); - createPath ($dest_installdir . "usr$PathSeparator" . "bin", $error_setup); - @DirArray = (); - getSubDirs ("$installsetpath", \@DirArray); - my $ld_preload = $ENV{LD_PRELOAD}; - $ENV{LD_PRELOAD} = $solarisdata . "getuid.so"; - if ($#DirArray == -1) { - print_error ("Installationset in $installsetpath is incomplete", 2); - } - foreach $file (@DirArray) { - if ( ($file =~ /-gnome/) or ($file =~ /-cde/) or ($file =~ /adabas/) or ($file =~ /j3/) or ($file =~ /-desktop-/) ) { - next; - } - $Command = "pkgparam -d $installsetpath $file BASEDIR"; - $output_ref = execute_Command ($Command, $error_setup, $show_Message, $command_withoutOutput); - if (($#{@$output_ref} > -1) and ($$output_ref[0] ne "") ) { - createPath ("$dest_installdir$$output_ref[0]", $error_setup); - } - $Command = "pkgadd -a $solarisdata" . "admin -d $installsetpath -R $dest_installdir $file"; - execute_Command ($Command, $error_setup, $show_Message, $command_withoutErrorcheck | $command_withoutOutput); - } - my $pkgadd_tmpfile = "/tmp/.ai.pkg.zone.lock*"; - $Command = "$REMOVE_FILE $pkgadd_tmpfile"; - execute_Command ($Command, $error_setup, $show_NoMessage, $command_withoutErrorcheck | $command_withoutOutput); - $ENV{LD_PRELOAD} = $ld_preload; - } - elsif ( (defined($ENV{OS})) && ($ENV{OS} eq "MACOSX") ) { - if (defined($ENV{FORCE2ARCHIVE})) { - print_error ($error_messages[$error_packformat], $error_packformat); - } - @DirArray = (); - my $install_dmg; - getSubFiles ("$installsetpath", \@DirArray, "^[a-zA-Z0-9].*\\.dmg\$"); - if ($#DirArray == 0) { - $install_dmg = "$installsetpath" . $DirArray[0]; - } - elsif ($#DirArray > 0) { - print_error ("more than one installset found in $installsetpath", 2); - } - else { - print_error ("no installset found in $installsetpath", 2); - } - $Command = "hdiutil attach " . $install_dmg; - my $output_ref; - $output_ref = execute_Command ($Command, $error_setup, $show_Message, $command_withoutOutput); - my $volumeinfo = $$output_ref[$#{@{$output_ref}}]; - if (!$volumeinfo =~ /OpenOffice/) { - print_error ("mount of $install_dmg failed", 2); - } - $volumeinfo =~ s/\s{2,}/;/g; - my @volumeinfos = split(/;/,$volumeinfo); - my $detachpath = $volumeinfos[0]; - my $newinstallsetpath = $volumeinfos[2] . $PathSeparator; - createPath ($dest_installdir, $error_setup); - $Command = "$COPY_DIR \"$newinstallsetpath\" \"$dest_installdir\""; - execute_Command ($Command, $error_setup, $show_Message, $command_withoutOutput); - $Command = "hdiutil detach " . $detachpath; - execute_Command ($Command, $error_setup, $show_Message, $command_withoutOutput); - @DirArray = (); - getSubFiles ("$dest_installdir", \@DirArray, "\\.app"); - if ($#DirArray == 0) { - $optdir = "$dest_installdir" . $DirArray[0] . $PathSeparator; - my $PListFile = "Info.plist"; - my $officeDir = "$optdir" . "Contents" . $PathSeparator; - my $programmDir = "$officeDir" . "MacOS" . $PathSeparator; - $Command = "$COPY_FILE \"$officeDir$PListFile\" \"$programmDir$PListFile\""; - execute_Command ($Command, $error_setup, $show_Message, $command_withoutOutput); - } - else { - print_error ("Installation in $dest_installdir is incomplete", 2); - } - } - else { - print_error ("Plattform is not supported", 2); - } - @DirArray = (); - getSubDirsFullPath ($optdir, \@DirArray); - if ($#DirArray == 0) { - $basedir = $DirArray[0] . $PathSeparator; - } - elsif ($#DirArray == -1) { - print_error ($error_setup, $show_Message); - } - else { - $basedir = $optdir; - } - } - return ($basedir); -} - -sub langsort { - if ($a eq $prefered_lang) { - return -1; - } - elsif ($b eq $prefered_lang) { - return 1; - } - else { - $a cmp $b; - } -} - -sub getInstset { - my ($INSTSET, $NEWINSTSET); - my (@DirArray, $InstDir, $RootDir, $TestDir1, $TestDir2); - - if (defined ($ENV{EPM}) && ($ENV{EPM} eq 'NO') && ($gui eq "UNX")) { # we do the install ourselves ... - return (); - } - - print "get Instset\n" if $is_debug; - $NEWINSTSET = ""; - if (defined($smoketest_install)) { - my $mask = "\\" . $PathSeparator . "\$"; - $smoketest_install =~ s/$mask//; - my ($sufix); - ($NEWINSTSET, $INSTSET, $sufix) = fileparse ($smoketest_install); - return ($NEWINSTSET, $INSTSET); - } - if (!isLocalEnv() and !defined($ENV{CWS_WORK_STAMP}) and (-e $SHIP)) { - ($NEWINSTSET, $INSTSET) = getSetFromServer(); - } - else { - $InstDir=""; - $RootDir=$ENV{DMAKE_WORK_DIR}; - $RootDir=~s/\w+$//; - foreach $project (@install_list) { - @DirArray=(); - $TestDir1 = "$RootDir$project$PathSeparator$ENV{INPATH}$PathSeparator$PRODUCT$PathSeparator$packpackage$PathSeparator" . "install$PathSeparator"; - if (-e "$TestDir1") { - $InstDir= $TestDir1; - } - else { - $sourceconfig_obj = SourceConfig->new() if (!defined ($sourceconfig_obj)); - my $module_path = $sourceconfig_obj->get_module_path($project); - # only if module exists - if (defined ($module_path)) { - $TestDir2 = "$module_path$PathSeparator$ENV{INPATH}$PathSeparator$PRODUCT$PathSeparator$packpackage$PathSeparator" . "install$PathSeparator"; - } - else { - $TestDir2 = $module_path; - } - if (defined ($TestDir2) && -e "$TestDir2") { - $InstDir="$TestDir2"; - } - } - if ($InstDir eq "") { - next; - } - getSubDirs ("$InstDir", \@DirArray); - $INSTSET = findSubDir (\@DirArray); - print "Lang-Sel: $INSTSET\n" if $is_command_infos; -; - if ($INSTSET ne "") { - $NEWINSTSET = $INSTSET; - $INSTSET = $InstDir; - print "new: $INSTSET\n"; - } - if (($INSTSET ne "") and (-e $INSTSET)) { - return ($NEWINSTSET, $INSTSET); - } - } - print_error ("no installationset found\n",2); - } - return ($NEWINSTSET, $INSTSET); -} - -sub isLocalEnv { - my $returnvalue = 0; - if (defined ($ENV{SOL_TMP}) && defined ($ENV{SOLARVERSION})) { - my $mask = $ENV{SOL_TMP}; - $mask =~ s/\\/\\\\/; - print "Mask: $mask\n" if $is_debug; - if ($ENV{SOLARVERSION}=~ /$mask/) { - $returnvalue = 1; - } - } - return $returnvalue; -} - -sub get_productcode { - my ( $installpath ) = @_; - my ($path, $productcode); - $productcode = ""; - $path = "$installpath" . "setup.ini"; - print "$path\n" if $is_debug; - if ( !open(SETUP,$path) ) { - print "FATAL: can't open $path\n" if ($is_command_infos); - return ($productcode); - } - - if (!eof(SETUP)) { - while () { - chomp; - if ( /productcode=(\{[\d\w-]+\})/ ) { - $productcode = $1; - } - } - - close(SETUP); - } - return ($productcode); -} - -sub InstsetSort { - my ($a1, $b1); - if ($a =~ /$global_instset_mask/) { - $a1 = $1; - } - if ($b =~ /$global_instset_mask/) { - $b1 = $1; - } - $a1 <=> $b1; -} - -sub getSetFromServer { - my ($DirName, $SetupFullPath); - my $workspace = $ENV{WORK_STAMP}; - my $platform = $ENV{INPATH}; - my $latestset; - my (@DirArray, $mask); - $SetupFullPath = $PORDUCT; - if ( ! ( $workspace && $platform ) ) { - print_error ( "Error: environment not set correctly.", 1); - } - if (!defined($milestone)) { - print_error ("Milestone ist not defined!", 2); - } - if (!defined($buildid)) { - print_error ("Build-ID ist not defined!", 2); - } - -# if ( $SetupFullPath =~ /^\/s.*\/install\// ) { -# if ( $gui eq "UNX" ) { -# $SetupFullPath = "/net/jumbo.germany" . $SetupFullPath; -# } else { -# $SetupFullPath = "\\\\jumbo" . $SetupFullPath; -# } -# } - -# my $ws_lc = lc $workspace; - $mask = "^$workspace" . "_" . $milestone . "_native_packed-(\\d+)_en-US\\.$buildid"; - $global_instset_mask = $mask; - getSubFiles ($SetupFullPath, \@DirArray, $mask); - @DirArray = sort InstsetSort @DirArray; - if ($#DirArray > -1) { - $latestset = $DirArray [$#DirArray]; - $DirName = $latestset; - } - else { - print_error ("Cannot find install set $SetupFullPath for $workspace $milestone", 2); - } - print "Latest install sets: $latestset\n" if $is_debug; - - print "$DirName\t $SetupFullPath\n" if $is_debug; - - # compare with file system - # at the moment just the existence is checked. For security reasons it might be - # better to additionally check whether there are newer sets (this must not happen, - # but who knows ...) - if ( -d $SetupFullPath ) { - return ($DirName, $SetupFullPath); - } else { - print_error ("Cannot find install set $SetupFullPath for $workspace $milestone", 2); - } -} - -sub patch_bootstrap { - my ($sourcefile, $destfile) = @_; - my (@convert_split, $line); - my ($Error) = 1; - my ($lineend); - - if ($is_debug) { - print "patching bootstrap $sourcefile ...\n"; - return 1; - } - - $Error &= move ("$sourcefile", "$destfile"); - - open OUTFILE, ">$sourcefile" or return errorFromOpen ($sourcefile); - open INFILE, "<$destfile" or return errorFromOpen ($destfile); - binmode(OUTFILE); - binmode(INFILE); - while() { - $line = $_; - - if ( $line =~ /UserInstallation/ ) { - if ($line =~ /(\r\n)/) { - $lineend = $1; - } - elsif ($line =~ /(\n)/) { - $lineend = $1; - } - else { - $lineend = $/; - } - @convert_split = split "=", $line; - $line = $convert_split[0]; - $line .= "="; - if ($gui eq $cygwin) { - $line .= ConvertToFileURL(ConvertCygwinToWin($userinstallpath_without)); - } - else { - $line .= ConvertToFileURL($userinstallpath_without); - } - $line .= $lineend; - } - print OUTFILE "$line"; - - } - - close OUTFILE; - close INFILE; - $Error &= unlink ($destfile); - return ($Error); -} - -sub SetWinLineends () { - $/ = $WinLineends; -} - -sub SetCygwinLineends () { - $/ = $CygwinLineends; -} - -sub ConvertToFileURL { - my ($filename) = @_; - my ($FileURL); - - $FileURL = $FileURLPrefix . $filename; - $FileURL =~ s/\\/\//g; - $FileURL =~ s/\/\/\/\//\/\/\//; # 4 slashes to 3 slashes - return ($FileURL); -} - -sub ConvertCygwinToWin_Shell { - my ($cygwinpath) = @_; - my ($winpath); - $winpath = ConvertCygwinToWin ($cygwinpath); - $winpath =~ s/\\/\\\\/g; - return ($winpath); -} - -sub ConvertCygwinToWin { - my ($cygwinpath) = @_; - my ($winpath); - my ($last_lineends) = $/; - SetCygwinLineends(); - $winpath=`cygpath --windows $cygwinpath`; - chomp($winpath); - $/ = $last_lineends; - return ($winpath); -} - -sub createPath { - my ($path, $Error) = @_; - if (!-d "$path") { - if (!$is_debug) { - eval {mkpath("$path", 0, 0777)}; - if ($@) { - print_error ($error_messages[$Error], $Error); - } - } - else { - print "mkpath($path, 0, 0777)\n"; - } - } -} - -sub save_sversion { - my ($sversion) = @_; - my ($sversion_bak) = $sversion . "_"; - if (-e $sversion) { - if (-e $sversion_bak) { - execute_system("$REMOVE_FILE \"$sversion_bak\""); - } - execute_system("$COPY_FILE \"$sversion\" \"$sversion_bak\""); - execute_system("$REMOVE_FILE \"$sversion\""); - $sversion_saved = 1; - } -} - -sub restore_sversion { - my ($sversion) = @_; - my ($sversion_bak) = $sversion . "_"; - if ($sversion_saved) { - if (-e $sversion) { - execute_system("$REMOVE_FILE \"$sversion\""); - } - execute_system("$COPY_FILE \"$sversion_bak\" \"$sversion\""); - execute_system("$REMOVE_FILE \"$sversion_bak\""); - $sversion_saved = 0; - } -} - -sub removeOldInstallation { - my ($installpath) = @_; - if (!$is_debug) { - if (-e $installpath) { - execute_system("$REMOVE_DIR \"$installpath\""); - } - if (-e $installpath) { - print_error ("can not clear old installation in $installpath\n", 3); - } - } -} - -sub removeInstallation { - my ($installpath) = @_; - if (!$is_debug) { - if (-e $installpath) { - execute_system("$REMOVE_DIR \"$installpath\""); - } - } -} - -sub deinstallInstallation { - my ($installpath) = @_; - my ($productcode); - if ($gui eq "UNX") { return; } - if (!$is_debug) { - if (-e $installpath) { - $productcode = get_productcode ($installpath); - print "Productcode: $productcode\n" if ($is_command_infos); - if ($productcode ne "") { - print "deinstalling $productcode ...\n"; - $Command = "msiexec.exe -x $productcode -qn"; - execute_Command ($Command, $error_deinst, $show_Message, $command_withoutErrorcheck | $command_withoutOutput); - } - } - } -} - -sub setInstallpath { - my ($infile, $outfile, $installpath) = @_; - if (-e $outfile) { - execute_system ("$REMOVE_FILE \"$outfile\""); - - } - open OUTTABLE, ">$outfile" or die "Error: can\'t open solarfile $outfile"; - open INTABLE, "<$infile" or die "Error: can\'t open solarfile $infile"; - while() { - $line = $_; - if ( $line =~ /^DESTINATIONPATH=officeinstallpath/ ) { - $line =~ s/officeinstallpath/$installpath/; - } - print OUTTABLE "$line"; - } - close INTABLE; - close OUTTABLE; -} - -sub execute_Command { - my ($Command, $Errorcode, $showMessage, $command_action) = @_; - my ($Returncode, $output_ref); - if (!$is_debug) { - if ( ($command_action & $command_withoutOutput) == $command_withoutOutput) { - ($Returncode, $output_ref) = execute_system ("$Command"); - } - else { - print "$Command\n" if $is_command_infos; - $Returncode = system ("$Command"); - } - if ($Returncode) { - if ($showMessage) { - if (($command_action & $command_withoutErrorcheck) == $command_withoutErrorcheck) { - print_warning ($error_messages[$Errorcode], $Errorcode); - } - else { - print_error ($error_messages[$Errorcode], $Errorcode); - } - } - else { - if (($command_action & $command_withoutErrorcheck) != $command_withoutErrorcheck) { - do_exit ($Errorcode); - } - } - } - } - else { - print "$Command\n"; - } - return $output_ref; -} - -sub execute_system { - my ($command) = shift; - my (@output_array, $line); - if ( $is_command_infos ) { - print STDERR "TRACE_SYSTEM: $command\n"; - } - open( COMMAND, "$command 2>&1 |"); - while ($line = ) { - chomp $line; - push (@output_array, $line); - } - close(COMMAND); - return $?, \@output_array; -} - -sub print_warning -{ - my $message = shift; - - print STDERR "$script_name: "; - print STDERR "WARNING $message\n"; - return; -} - -sub print_error -{ - my $message = shift; - my $error_code = shift; - - print STDERR "$script_name: "; - print STDERR "ERROR: $message\n"; - - do_exit($error_code); -} - -sub print_notRemoved { - my ($installpath) = @_; - print "no deinstallation from $installpath\n"; -} - -sub do_exit -{ - my $error_code = shift; - - if ($sversion_saved) { - restore_sversion ($SVERSION_INI); - } - if ($is_remove_on_error) { - if ($is_do_deinstall) { - deinstallInstallation ($installpath); - } - removeInstallation($installpath); - } - else { - print_notRemoved ($installpath); - } - if ( $error_code ) { - print STDERR "\nFAILURE: $script_name aborted.\n"; - } - exit($error_code); - -} diff --git a/smoketestoo_native/testlog.pl b/smoketestoo_native/testlog.pl deleted file mode 100755 index 99364cb9d1c0..000000000000 --- a/smoketestoo_native/testlog.pl +++ /dev/null @@ -1,290 +0,0 @@ -: -eval 'exec perl -wS $0 ${1+"$@"}' - if 0; -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2008 by Sun Microsystems, Inc. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# $RCSfile: testlog.pl,v $ -# -# $Revision: 1.6 $ -# -# 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 -# -# for a copy of the LGPLv3 License. -# -#************************************************************************* - -### globals ### - -$is_debug = 0; - -$global_log = "log.dat"; - -%logfiles_list = ("writer", "swlog.dat", - "math", "smalog.dat", - "HTML", "shptlog.dat", - "draw", "sdrwlog.dat", - "impress", "sdlog.dat", - "calc", "sclog.dat", - "chart", "schlog.dat", - "Java", "javalog.dat", - "Database", "dblog.dat", - "Extension", "extlog.dat" -); - -%log = (); -@ApplicationLog = (); -$dont_kill ="dont_deinstall"; -$error_str = "error"; -$tests_complete = "---"; -$gui = $ENV{GUI}; -$inpath = $ENV{INPATH}; -$cygwin = "cygwin"; - -if ($^O =~ /cygwin/) { - $gui = $cygwin; -} - -if (($gui eq "UNX") or ($gui eq $cygwin)) { - $pathslash = "/"; -} -else -{ - $pathslash = "\\"; -} - -$misc = $inpath . $pathslash . "misc" . $pathslash; -$okfile = $misc . "ok.bat"; -umask (02); - -### sub routines ### - -sub test_logfile { - my ($file, $testname) = @_; - my ($line, $failed, $complete, $linecount, $LastLineError); - - $failed = 0; - $complete = 0; - $linecount = -1; - $LastLineError = 0; - - if (! -e $file) { - print "error: $testname failed! Logfile is missing.\n" if $is_debug; - - return (0,0); - } - - open TABLE, "<$file" or die "Error: can´t open log file $file]"; - - while() { - $line = $_; - chomp $line; - $linecount++; - if ( $line =~ /$error_str/ ) { - print "error: $testname: $line\n"; - $failed = 1; - $LastLineError = 1; - } - elsif ( $line =~ /$tests_complete/ ) { - $complete = 1; - print "$file: $line\n" if $is_debug; - } - else - { - print "$testname: $line\n" if $is_debug; - $LastLineError = 0; - } - } - - close TABLE; - - print "$failed $complete $LastLineError $linecount\n" if $is_debug; - - if (!$complete) { - my $message = "error: $testname: the test was not complete!"; - if ((!$failed) || (($failed) && (!$LastLineError))) { - my $errormessage = getLog ($testname, $linecount+1); - if ($errormessage ne "") { - $message .= " $errormessage possibly failed!"; - } - } - if (!$failed && !$is_testerror) { - print "$message\n"; - } - } - - if (!$failed && $complete) { - print "true\n" if $is_debug; - return (1,1); - } - else - { - print "false\n" if $is_debug; - return (0,1); - } -} - -sub readGlobalLog { - my ($line); - my $logfilename = $logfiledir . $pathslash . $global_log; - if (! -e $logfilename) { - print "$logfilename: file is missing\n" if $is_debug; - return 0; - } - - open TABLE, "<$logfilename" or die "Error: can´t open log file $logfilename]"; - - my $failed = 0; - my $complete = 0; - my $FirstLine = 1; - while(defined($line =
) and !$complete) { - chomp $line; - if ($FirstLine) { - if ( $line =~ /Sequence of testing/ ) { - $FirstLine = 0; - next; - } - else { - print "$logfilename: $line\n" if $is_debug; - $failed = 1; - return 0; - } - } - else { - if ( $line eq "" ) { - $complete = 1; - next; - } - my @splitedLine = split(/:/,$line); - my $testApplication = $splitedLine [0]; - $testApplication =~ s/^ *(.*?) *$/$1/g; #truncate - my $testAction = $splitedLine [1]; - @splitedLine = split(/,/,$testAction); - my @log_array = (); - foreach my $action (@splitedLine) { - $action =~ s/^ *(.*?) *$/$1/g; #truncate - if ($action =~ /\//) { - my @splitAction = split(/\//,$action); - my @specialAction; - foreach my $doubleaction (@splitAction) { - $doubleaction =~ s/^ *(.*?) *$/$1/g; #truncate - push (@specialAction, $doubleaction); - } - $action = join (' or ', @specialAction); - foreach my $doubleaction (@splitAction) { - push (@log_array, $action); - } - } - else { - push (@log_array, $action); - } - } - push (@ApplicationLog, $testApplication); - $log{$testApplication} = \@log_array; - } - } - - close TABLE; - - return 1; -} - -sub getLog { - my ($testname, $linecount) = @_; - if ($linecount <= $#{@{$log{$testname}}}) { - return $log{$testname}[$linecount]; - } - else { - return ""; - } -} - -### main ### - -$idStr = ' $Revision: 1.6 $ '; -$idStr =~ /Revision:\s+(\S+)\s+\$/ - ? ($cpflat2minor_rev = $1) : ($cpflat2minor_rev = "-"); - -print "TestLog -- Version: $cpflat2minor_rev\n"; - -if (-e $okfile) { - unlink ($okfile); -} - -if ( ($#ARGV >-1) && ($#ARGV < 1) ) { - $ARGV[0] =~ s/\"//g; -} - -if ( ! ( ($#ARGV < 1) && $ARGV[0] && (-d $ARGV[0]) ) ) { - print "Error! Usage: testlog \n" ; - exit(1); -} - -$logfiledir = $ARGV[0]; -$is_testerror = 0; -$is_OneTestAvailable = 0; - -print "%logfiles_list\n" if $is_debug; - -readGlobalLog(); - -foreach my $applog (@ApplicationLog) { - if (!exists($logfiles_list{$applog})) { - next; - } - my $logname = $logfiles_list{$applog}; - $current_file = $logfiledir . $pathslash . $logname; - my ($error, $logfile) = test_logfile ($current_file, $applog); - - if ($logfile) { - $is_OneTestAvailable = 1; - } - elsif (!$is_testerror) { - print "error: $applog failed! Logfile is missing.\n"; - } - - if (!$error) { - $is_testerror = 1; - } - -} - -# write file to prevent deinstallation of office -if ($is_testerror) { - $dont_del_file = $logfiledir . $pathslash . $dont_kill; - open (ERRFILE, ">$dont_del_file"); - print ERRFILE "dont delete flag"; - close (ERRFILE); -} -else { - print "$okfile\n" if $is_debug; - open( OKFILE, ">$okfile"); - print OKFILE "echo ok!\n"; - close( OKFILE ); - chmod (0775, "$okfile"); -} - -if (!$is_OneTestAvailable) { - print "error: no test succeeded! Maybe Office crashed during starting!\n"; - $is_testerror = 1; -} - -exit($is_testerror); -- cgit