diff options
author | Petr Mladek <pmladek@suse.cz> | 2011-12-02 18:33:11 +0100 |
---|---|---|
committer | Petr Mladek <pmladek@suse.cz> | 2011-12-02 18:35:40 +0100 |
commit | 57578c1828755850d1dfdb391d571d7bf1b7cada (patch) | |
tree | d24aa2e2e0e583a998048b83b864995b2dae5535 /smoketest | |
parent | c1baeb25ad3a5d6afb59f9329a634f742a7a9e5a (diff) |
split smoketest module to fix build
+ move the library and other build stuff to a new "smoketest" module
+ keep "smoketestoo_native" only for installing and running the tests
+ restore the targets in top level make
Diffstat (limited to 'smoketest')
29 files changed, 3953 insertions, 0 deletions
diff --git a/smoketest/com/sun/star/comp/smoketest/MANIFEST.MF b/smoketest/com/sun/star/comp/smoketest/MANIFEST.MF new file mode 100755 index 000000000000..09e2f42ca0f6 --- /dev/null +++ b/smoketest/com/sun/star/comp/smoketest/MANIFEST.MF @@ -0,0 +1,2 @@ +RegistrationClassName: com.sun.star.comp.smoketest.TestExtension + diff --git a/smoketest/com/sun/star/comp/smoketest/TestExtension.idl b/smoketest/com/sun/star/comp/smoketest/TestExtension.idl new file mode 100644 index 000000000000..83c370e11a18 --- /dev/null +++ b/smoketest/com/sun/star/comp/smoketest/TestExtension.idl @@ -0,0 +1,40 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _com_sun_star_comp_smoketest_TestExtension_idl_ +#define _com_sun_star_comp_smoketest_TestExtension_idl_ + +#include <com/sun/star/lang/XServiceInfo.idl> + + +module com { module sun { module star { module comp { module smoketest { + // example service, XServiceInfo is implemented here for demonstration + // issues. XServiceInfo must be implemented by all components. + service TestExtension: ::com::sun::star::lang::XServiceInfo; +};};};};}; + +#endif diff --git a/smoketest/com/sun/star/comp/smoketest/TestExtension.java b/smoketest/com/sun/star/comp/smoketest/TestExtension.java new file mode 100755 index 000000000000..c08c719116ae --- /dev/null +++ b/smoketest/com/sun/star/comp/smoketest/TestExtension.java @@ -0,0 +1,166 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +package com.sun.star.comp.smoketest; + +import com.sun.star.lib.uno.helper.Factory; +import com.sun.star.lang.XMultiComponentFactory; +import com.sun.star.lang.XSingleComponentFactory; +import com.sun.star.lib.uno.helper.WeakBase; +import com.sun.star.uno.UnoRuntime; +import com.sun.star.uno.XComponentContext; +import com.sun.star.registry.XRegistryKey; +import com.sun.star.lang.XInitialization; +import com.sun.star.lang.XTypeProvider; +import com.sun.star.lang.XServiceInfo; +import com.sun.star.uno.Type; + +/** This class capsulates the class, that implements the minimal component, a + * factory for creating the service (<CODE>__getComponentFactory</CODE>) and a + * method, that writes the information into the given registry key + * (<CODE>__writeRegistryServiceInfo</CODE>). + */ +public class TestExtension { + /** This class implements the component. At least the interfaces XServiceInfo, + * XTypeProvider, and XInitialization should be provided by the service. + */ + public static class _TestExtension extends WeakBase + implements XServiceInfo { + /** The service name, that must be used to get an instance of this service. + */ + static private final String __serviceName = + "com.sun.star.comp.smoketest.TestExtension"; + + /** The initial component contextr, that gives access to + * the service manager, supported singletons, ... + * It's often later used + */ + private XComponentContext m_cmpCtx; + + /** The service manager, that gives access to all registered services. + * It's often later used + */ + private XMultiComponentFactory m_xMCF; + + /** The constructor of the inner class has a XMultiServiceFactory parameter. + * @param xmultiservicefactoryInitialization A special service factory + * could be introduced while initializing. + */ + public _TestExtension(XComponentContext xCompContext) { + try { + m_cmpCtx = xCompContext; + m_xMCF = m_cmpCtx.getServiceManager(); + } + catch( Exception e ) { + e.printStackTrace(); + } + } + + /** This method returns an array of all supported service names. + * @return Array of supported service names. + */ + public String[] getSupportedServiceNames() { + return getServiceNames(); + } + + /** This method is a simple helper function to used in the + * static component initialisation functions as well as in + * getSupportedServiceNames. + */ + public static String[] getServiceNames() { + String[] sSupportedServiceNames = { __serviceName }; + return sSupportedServiceNames; + } + + /** This method returns true, if the given service will be + * supported by the component. + * @param sServiceName Service name. + * @return True, if the given service name will be supported. + */ + public boolean supportsService( String sServiceName ) { + return sServiceName.equals( __serviceName ); + } + + /** Return the class name of the component. + * @return Class name of the component. + */ + public String getImplementationName() { + return _TestExtension.class.getName(); + } + } + + + /** + * Gives a factory for creating the service. + * This method is called by the <code>JavaLoader</code> + * <p> + * @return returns a <code>XSingleComponentFactory</code> for creating + * the component + * @param sImplName the name of the implementation for which a + * service is desired + * @see com.sun.star.comp.loader.JavaLoader + */ + public static XSingleComponentFactory __getComponentFactory(String sImplName) + { + XSingleComponentFactory xFactory = null; + + if ( sImplName.equals( _TestExtension.class.getName() ) ) + xFactory = Factory.createComponentFactory(_TestExtension.class, + _TestExtension.getServiceNames()); + + return xFactory; + } + + /** + * Writes the service information into the given registry key. + * This method is called by the <code>JavaLoader</code> + * <p> + * @return returns true if the operation succeeded + * @param regKey the registryKey + * @see com.sun.star.comp.loader.JavaLoader + */ + public static boolean __writeRegistryServiceInfo(XRegistryKey regKey) { + return Factory.writeRegistryServiceInfo(_TestExtension.class.getName(), + _TestExtension.getServiceNames(), + regKey); + } + /** This method is a member of the interface for initializing an object + * directly after its creation. + * @param object This array of arbitrary objects will be passed to the + * component after its creation. + * @throws Exception Every exception will not be handled, but will be + * passed to the caller. + */ + public void initialize( Object[] object ) + throws com.sun.star.uno.Exception { + /* The component describes what arguments its expected and in which + * order!At this point you can read the objects and can intialize + * your component using these objects. + */ + } + +} diff --git a/smoketest/com/sun/star/comp/smoketest/delzip b/smoketest/com/sun/star/comp/smoketest/delzip new file mode 100755 index 000000000000..636fda90bfcb --- /dev/null +++ b/smoketest/com/sun/star/comp/smoketest/delzip @@ -0,0 +1 @@ +ECHO is OFF diff --git a/smoketest/com/sun/star/comp/smoketest/makefile.mk b/smoketest/com/sun/star/comp/smoketest/makefile.mk new file mode 100755 index 000000000000..937f377acd79 --- /dev/null +++ b/smoketest/com/sun/star/comp/smoketest/makefile.mk @@ -0,0 +1,90 @@ +#************************************************************************* +# +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# Copyright 2000, 2010 Oracle and/or its affiliates. +# +# OpenOffice.org - a multi-platform office productivity suite +# +# This file is part of OpenOffice.org. +# +# OpenOffice.org is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License version 3 +# only, as published by the Free Software Foundation. +# +# OpenOffice.org is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Lesser General Public License version 3 for more details +# (a copy is included in the LICENSE file that accompanied this code). +# +# You should have received a copy of the GNU Lesser General Public License +# version 3 along with OpenOffice.org. If not, see +# <http://www.openoffice.org/license.html> +# for a copy of the LGPLv3 License. +# +#************************************************************************* + +PRJ = ../../../../.. +PRJNAME = smoketestdoc +PACKAGE = com/sun/star/comp/smoketest +TARGET = com_sun_star_comp_smoketest + +no_common_build_zip:=TRUE + +# --- Settings ----------------------------------------------------- + +.IF "$(SOLAR_JAVA)" != "" + +.INCLUDE : settings.mk + +JARFILES = ridl.jar jurt.jar unoil.jar juh.jar + +JARTARGET = TestExtension.jar +JARCOMPRESS = TRUE +CUSTOMMANIFESTFILE = MANIFEST.MF + +ZIP1TARGET=TestExtension +ZIP1LIST=* +ZIPFLAGS=-r +ZIP1DIR=$(MISC)/$(TARGET) +ZIP1EXT=.oxt + +# --- Files -------------------------------------------------------- + +JAVAFILES = TestExtension.java + +# --- Targets ------------------------------------------------------ + +ZIP1DEPS=$(MISC)/$(TARGET)/$(JARTARGET)\ + $(MISC)/$(TARGET)/TestExtension.rdb\ + $(MISC)/$(TARGET)/META-INF/manifest.xml + +.INCLUDE : target.mk + +.IF "$(depend)" == "" +$(MISC)/$(TARGET)/META-INF: + @-$(MKDIRHIER) $(@) + +$(MISC)/TestExtension.urd: TestExtension.idl + $(COMMAND_ECHO)$(IDLC) -O$(MISC) -I$(SOLARIDLDIR) -cid -we $< + +$(MISC)/$(TARGET)/META-INF/manifest.xml $(MISC)/$(TARGET)/TestExtension.rdb : $(MISC)/$(TARGET)/META-INF + +$(MISC)/$(TARGET)/META-INF/manifest.xml: manifest.xml + $(COMMAND_ECHO)$(COPY) $< $@ + +$(MISC)/$(TARGET)/TestExtension.rdb: $(MISC)/TestExtension.urd + $(COMMAND_ECHO)$(REGMERGE) $@ /UCR $< + +$(JAVACLASSFILES) .UPDATEALL: $(MISC)/$(TARGET)/TestExtension.rdb + $(COMMAND_ECHO)$(JAVAMAKER) -O$(CLASSDIR) -BUCR -nD -X$(SOLARBINDIR)/types.rdb $< + +$(MISC)/$(TARGET)/$(JARTARGET) : $(JARTARGETN) + $(COMMAND_ECHO)$(COPY) $< $@ +.END + +.ELSE +@all: + @echo "Java disabled. Nothing to do." +.ENDIF diff --git a/smoketest/com/sun/star/comp/smoketest/manifest.xml b/smoketest/com/sun/star/comp/smoketest/manifest.xml new file mode 100755 index 000000000000..fcedabf96b4b --- /dev/null +++ b/smoketest/com/sun/star/comp/smoketest/manifest.xml @@ -0,0 +1,5 @@ +<?xml version="1.0" encoding="UTF-8"?> +<manifest:manifest xmlns:manifest="http://openoffice.org/2001/manifest"> + <manifest:file-entry manifest:full-path="TestExtension.jar" manifest:media-type="application/vnd.sun.star.uno-component;type=Java"/> + <manifest:file-entry manifest:full-path="TestExtension.rdb" manifest:media-type="application/vnd.sun.star.uno-typelibrary;type=RDB"/> +</manifest:manifest> diff --git a/smoketest/data/Events.xml b/smoketest/data/Events.xml new file mode 100644 index 000000000000..414f2c48e884 --- /dev/null +++ b/smoketest/data/Events.xml @@ -0,0 +1,66 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!--********************************************************************** +* +* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +* +* Copyright 2000, 2010 Oracle and/or its affiliates. +* +* OpenOffice.org - a multi-platform office productivity suite +* +* This file is part of OpenOffice.org. +* +* OpenOffice.org is free software: you can redistribute it and/or modify +* it under the terms of the GNU Lesser General Public License version 3 +* only, as published by the Free Software Foundation. +* +* OpenOffice.org is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU Lesser General Public License version 3 for more details +* (a copy is included in the LICENSE file that accompanied this code). +* +* You should have received a copy of the GNU Lesser General Public License +* version 3 along with OpenOffice.org. If not, see +* <http://www.openoffice.org/license.html> +* for a copy of the LGPLv3 License. +* +**********************************************************************--> +<!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd"> +<script:module xmlns:script="http://openoffice.org/2000/script" script:name="Events" script:language="StarBasic">REM ***** BASIC ***** + +Global s_CloseListenerCalled As Boolean + +Sub PressCancel + gDlgState = cDlgCancel +end Sub + +Sub PressOk + gDlgState = cDlgOk +end Sub + +Sub PressTest + gOptionsDialog.EndExecute() + gDlgState = cDlgStartTest +end Sub + +Sub closeListener_queryClosing + ' not interested in + closeListener_queryClosing = TRUE +End Sub + +Sub closeListener_notifyClosing + s_CloseListenerCalled = TRUE +End Sub + +Sub closeListener_disposing + ' not interested in +End Sub + +Sub ResetCloseListenerFlag + s_CloseListenerCalled = FALSE +End Sub + +Function HasCloseListenerBeenCalled As Boolean + HasCloseListenerBeenCalled = s_CloseListenerCalled +End Function +</script:module> diff --git a/smoketest/data/Global.xml b/smoketest/data/Global.xml new file mode 100644 index 000000000000..8c549f824be2 --- /dev/null +++ b/smoketest/data/Global.xml @@ -0,0 +1,865 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!--********************************************************************** +* +* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +* +* Copyright 2000, 2010 Oracle and/or its affiliates. +* +* OpenOffice.org - a multi-platform office productivity suite +* +* This file is part of OpenOffice.org. +* +* OpenOffice.org is free software: you can redistribute it and/or modify +* it under the terms of the GNU Lesser General Public License version 3 +* only, as published by the Free Software Foundation. +* +* OpenOffice.org is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU Lesser General Public License version 3 for more details +* (a copy is included in the LICENSE file that accompanied this code). +* +* You should have received a copy of the GNU Lesser General Public License +* version 3 along with OpenOffice.org. If not, see +* <http://www.openoffice.org/license.html> +* for a copy of the LGPLv3 License. +* +**********************************************************************--> +<!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd"> +<script:module xmlns:script="http://openoffice.org/2000/script" script:name="Global" script:language="StarBasic">REM ***** BASIC ***** + +const cMaxErrorStates = 14 + +const cCoGreen = 4057917, cCoRed = 16711680, cCoGrey = 12632256 +const cParagraphBreak = 0 + +global const cExtensionFileName = "TestExtension.oxt" + +global const cDocNew = 0, cDocSaveOpen8 = 1, cDocSaveOpenXML = 2, cDocOpen50 = 3, cDocClose = 4, cDocMacros = 5 +global const cDBService = 0, cDBOpen = 1, cDBInsert = 2, cDBDelete = 3, cDBSeek = 4, cDBClose = 5 +global const cEXTService = 0, cEXTInstall = 1, cEXTUninstall = 2 +global const cTestClosureSetupDoc = 0, cTestClosureWriteStatus = 1 +global const cLogfileFailed = 255 + +global const cStWriter = 0, cStCalc = 1, cStPraesentation = 2, cStZeichnen = 3 +global const cStHTML = 6, cStChart = 4, cStJava = 7 +global const cStMath = 5, cStDataBase = 9 +global const cStExtension = 11 +global const cStTestGlue = 12 +global const cStNone = -1 + +global const cFlt8 = 0, cFlt50 = 32, cFltNewDoc = 64, cFltXML = 128 + +global const frmWriter = 1, frmCalc = 2, frmImpress = 4 +global const frmMath = 5, frmChart = 7, frmHyperText = 8, frmDraw = 9 +global const frmDataBase = 10, frmJava = 13 +global const frmExtension = 14 +global const frmTestClosure = 15 + +Global gCurrentDocTest As Integer +Global gCurrentTestCase As Integer + +global const cLogUnknown = 0, cLogFalse = 1, cLogTrue = 2 + +'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 cExtensionManager = cUnoPrefix + "deployment.ExtensionManager" + +'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" +Global const cUserFieldTestOpen50 = "Open50" +Global const cUserFieldTestTerminateAfterTest = "Terminate", cUserFieldTestOpenSave8 = "SaveOpen8", cUserFieldTestMacros = "Macros" + +Global const cOptionsDialogName = "OptionsDlg", cTest10Modul = "Standard" + +Global const cDlgCancel = 1, cDlgOk = 0, cDlgStartTest = 2 + +global gErrorState (cMaxErrorStates, 5) as integer +Global gTestCaseAnnotations( cMaxErrorStates, 5 ) As String + +global gOutputDoc as Object +global gOutputDocNotUno as Object +global gOptionsDialog as Object + +Global bMakeWriterTest as boolean, bMakeCalcTest as boolean, bMakeImpressTest as boolean +Global bMakeDrawTest as Boolean, bMakeMathTest as boolean, bMakeChartTest as boolean +Global bMakeHTMLTest as boolean, bMakeJavaTest as boolean, bMakeDBTest as boolean +Global bMakeExtensionTest as boolean +Global bMakeSaveOpenXMLTest as boolean, bMakeOpen50Test as boolean +Global bMakeTerminateAfterTest as boolean, bShowTable as boolean +Global bMakeSaveOpen8Test as boolean, bMakeMacrosTest as boolean + +global sExtensionURL as string + +global oBinFilterComp as Object + +Dim gDlgState as Integer + +Sub SetGlobalDoc + gOutputDoc = ThisComponent + REM need to have the binfilter component, and SOLARSRC set to find sample docs + if Environ("SOLARSRC") <> "" then + oBinFilterComp = createUnoService( "com.sun.star.comp.office.BF_MigrateFilter" ) + End If +end Sub + +Sub ClearStatus + for j% = 0 to cMaxErrorStates + for i% = 0 to 5 + gErrorState (j%, i%) = cLogUnknown + gTestCaseAnnotations( J%, i% ) = "" + next i% + next j% +end Sub + +Sub ClearAllText + call SetGlobalDoc + call ClearDoc (gOutputDoc) + call ClearStatus +end Sub + +Sub AssertionHandler( sMessage as String ) + LogTestResult( "assertion caught: " + sMessage, FALSE ) +End Sub + +Sub Main + On Local Error Goto MainError + + gCurrentDocTest = frmTestClosure + gCurrentTestCase = cLogfileFailed + + DeleteAllSavedFiles() + DeleteAllLogFiles() + SetupWorkPath() + + if GetSystem (sWorkPath) = "windows" then + sWorkPath = ConvertPathToWin (sWorkPath) + end if + + LocalTestLog% = OpenLogDat( GetLogFileName( gCurrentDocTest ) ) + + gCurrentTestCase = cTestClosureSetupDoc + CaptureAssertions( "AssertionHandler" ) + + call SetGlobalDoc + + Dim bWasModified as Boolean + bWasModified = gOutputDoc.isModified() + + if bShowTable then + call ClearDoc (gOutputDoc) + end If + + call ClearStatus + + LogTestResult( GetTestGlueDescription( gCurrentTestCase ), TRUE ) + + Dim nPreserveFileHandle% + nPreserveFileHandle% = LocalTestLog% + Call Test_10er.Main + LocalTestLog% = nPreserveFileHandle% + + gCurrentDocTest = frmTestClosure + gCurrentTestCase = cTestClosureWriteStatus + if bShowTable then + call CreateStatusTable2 + call CreateStatusTable + call CreateDocState + LogTestResult( GetTestGlueDescription( gCurrentTestCase ), TRUE ) + ' do this LogTestResult call before CreateSecondState, since the latter accesses (and displays) the result + call CreateSecondState + gOutputDoc.CurrentController.ViewCursor.JumpToFirstPage + Else + LogTestResult( GetTestGlueDescription( gCurrentTestCase ), TRUE ) + End If + + ' print the 'test complete' marker + Print #LocalTestLog%, "---" + LocalTestLog% = 0 + + gOutputDoc.setModified( bWasModified ) + + CaptureAssertions( "" ) + Exit Sub + +MainError: + If ( gCurrentTestCase = cLogfileFailed ) then + LogTestResult( "", False ) + Exit Sub + else + LogTestResult( "testclosure " + GetTestGlueDescription( gCurrentTestCase ), FALSE ) + Close #LocalTestLog% + LocalTestLog = 0 + End If +End Sub + +Function GetTestGlueDescription( nTestCase as Integer ) + Select Case ( nTestCase ) + case cTestClosureSetupDoc + GetTestGlueDescription = "setup" + case cTestClosureWriteStatus + GetTestGlueDescription = "write_status" + case Else + GetTestGlueDescription = "" + End Select +End Function + +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 tableRows(5) as string + tableRows(cDocNew) = "new" + tableRows(cDocSaveOpen8) = "V8.0" + tableRows(cDocSaveOpenXML) = "XML" + tableRows(cDocOpen50) = "V5.0" + tableRows(cDocClose) = "close" + tableRows(cDocMacros) = "macros" + + aDoc = gOutputDoc + + xText = aDoc.Text + xCursor = xText.createTextCursor() + + xCursor.gotoStart(FALSE) + xCursor.GoRight (4, False) + SetParagraphBreak (xCursor) + xCursor.GoRight (1, False) + SetParagraphBreak (xCursor) + xCursor.GoRight (1, False) + + table = aDoc.createInstance("com.sun.star.text.TextTable") + table.initialize(7,9) + table.Name = "StTab1" + table.BackColor = cCoGrey + xText.insertTextContent(xCursor, table, FALSE) + + for i% = 0 to 7 + tableCell = table.getCellByPosition( i% + 1, 0 ) + tableCell.String = tableHeaders( i% ) + next i% + + for i% = LBound( tableRows ) to UBound( tableRows ) + tableCell = table.getCellByPosition( 0, i% + 1 ) + tableCell.String=tableRows(i%) + next i% +end Sub + +Sub CreateStatusTable2 + dim tableHeaders(4) as string + tableHeaders(0) = "Database" + tableHeaders(1) = "" + tableHeaders(2) = "Extension" + tableHeaders(3) = "" + tableHeaders(4) = "Other" + + dim tableRows(5) as string + tableRows(cDBService ) = "services" + tableRows(cDBOpen ) = "open" + tableRows(cDBInsert ) = "insert" + tableRows(cDBDelete ) = "delete" + tableRows(cDBSeek ) = "seek" + tableRows(cDBClose ) = "close" + + dim tableRows2(2) as string + tableRows2(cEXTService ) = "services" + tableRows2(cEXTInstall ) = "install" + tableRows2(cEXTUninstall ) = "uninstall" + + dim tableRows3(1) as string + tableRows3(cTestClosureSetupDoc ) = "setup test" + tableRows3(cTestClosureWriteStatus ) = "write test result" + + 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.BackColor = cCoGrey + + xText.insertTextContent(xCursor, table, FALSE) + + for i% = LBound( tableHeaders ) to UBound( tableHeaders ) + tableCell = table.getCellByPosition( i% + 1, 0 ) + tableCell.String = tableHeaders(i%) + next i% + + for i% = LBound( tableRows ) to UBound( tableRows ) + tableCell = table.getCellByPosition( 0, i% + 1 ) + tableCell.String=tableRows(i%) + next i% + + for i% = LBound( tableRows2 ) to UBound( tableRows2 ) + tableCell = table.getCellByPosition( 2, i% + 1 ) + tableCell.String=tableRows2(i%) + next i% + + for i% = LBound( tableRows3 ) to UBound( tableRows3 ) + tableCell = table.getCellByPosition( 4, i% + 1 ) + tableCell.String=tableRows3(i%) + next i% +end Sub + + +Sub CreateDocState + aDoc = gOutputDoc + table = aDoc.TextTables.GetByIndex (1) + + for j% = 0 to 7 + for i% = 0 to 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 + If ( gTestCaseAnnotations( j%, i% ) <> "" ) Then + Dim annotation as Object + annotation = aDoc.createInstance( "com.sun.star.text.TextField.Annotation" ) + annotation.Author = "smoketest" + annotation.Content = gTestCaseAnnotations( j%, i% ) + xCell.insertTextContent( xCell, annotation, false ) + End If + else + xCell.BackColor = cCoGrey + end If + end If + next i% + next j% +end Sub + +Sub CreateSecondState + aDoc = gOutputDoc + table = aDoc.TextTables.GetByIndex (0) + + Dim stateIndex(2) as Integer + stateIndex(0) = cStDataBase + stateIndex(1) = cStExtension + stateIndex(2) = cStTestGlue + + Dim j as Integer + For j = LBound( stateIndex ) To UBound( stateIndex ) + for i% = 1 to 6 + tableCell = table.getCellByPosition( 2 * j + 1, i% ) + tableCell.BackTransparent = False + + if gErrorState( stateIndex(j), i% - 1 ) = cLogTrue then + tableCell.BackColor = cCoGreen + else + if gErrorState ( stateIndex(j), i% - 1 ) = cLogFalse then + tableCell.BackColor = cCoRed + If ( gTestCaseAnnotations( stateIndex(j), i% - 1 ) <> "" ) Then + Dim annotation as Object + annotation = aDoc.createInstance( "com.sun.star.text.TextField.Annotation" ) + annotation.Author = "smoketest" + annotation.Content = gTestCaseAnnotations( stateIndex(j), i% - 1 ) + tableCell.insertTextContent( tableCell, annotation, false ) + End If + else + tableCell.BackColor = cCoGrey + end If + end If + next i% + next j% +end Sub + +Function GetRangeName (nColumn as integer, nRow as integer) as string + GetRangeName = chr (nColumn+66) + Trim(Str(nRow+1)) +end Function + +Sub LogTestResult( sTestCaseDescription as String, bSuccess as Boolean ) + If ( gCurrentTestCase = cLogfileFailed ) Then + Dim sAnnotation as String + sAnnotation = "creating logfile '" + GetLogFileName( gCurrentDocTest ) + "' failed" + LogState( FALSE, sAnnotation, GlobalTestLog ) + RecordTestCaseStatus( 0, FALSE, sAnnotation ) + Else + bSuccess = RecordTestCaseStatus( gCurrentTestCase, bSuccess, sTestCaseDescription ) + If ( LocalTestLog <> 0 ) Then + LogState( bSuccess, sTestCaseDescription, LocalTestLog ) + EndIf + if ( GlobalTestLog <> 0 ) Then + LogState( bSuccess, sTestCaseDescription, GlobalTestLog ) + EndIf + End If +End Sub + +Function RecordTestCaseStatus( nAction as Integer, bState as Boolean, sFailureAnnotation as String ) as Boolean + Dim nStatusType as Integer + Dim nState as integer + nStatusType = GetStatusType( gCurrentDocTest ) + If nStatusType = cStNone then Exit Function + + If ( gErrorState( nStatusType, nAction ) = cLogFalse ) Then + ' don't overwrite a previous "failed" state for this test + bState = FALSE + End If + + if bState then + nState = cLogTrue + else + nState = cLogFalse + end If + + gErrorState (nStatusType, nAction) = nState + + If ( nState = cLogFalse ) And ( sFailureAnnotation <> "" ) Then + if gTestCaseAnnotations(nStatusType, nAction) <> "" then + gTestCaseAnnotations(nStatusType, nAction) = _ + gTestCaseAnnotations(nStatusType, nAction) & "; " + end if + gTestCaseAnnotations( nStatusType, nAction ) = gTestCaseAnnotations( nStatusType, nAction ) + sFailureAnnotation + End If + + RecordTestCaseStatus = bState +End Function + +Function GetStatusType (nDocType as Integer) as Integer + Select Case ( nDocType ) + case frmWriter + GetStatusType = cStWriter ' text document + case frmCalc + GetStatusType = cStCalc ' spreadsheet document + case frmImpress + GetStatusType = cStPraesentation ' presentation + case frmDraw + GetStatusType = cStZeichnen ' drawing + case frmMath + GetStatusType = cStMath ' formula + case frmHyperText + GetStatusType = cStHTML ' HTML document + case frmChart + GetStatusType = cStChart ' chart + case frmJava + GetStatusType = cStJava 'Java + case frmTestClosure + GetStatusType = cStTestGlue ' test framework + 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 ) + + if isNull(oBinFilterComp) then + oControl = gOptionsDialog.getControl("cbOpen50Test") + oControl.Model.setPropertyValue("Enabled", FALSE) + end If + +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 (cUserFieldTestOpen50, -(gOptionsDialog.getControl("cbOpen50Test").getState), gOutPutDoc) + SetUserFieldState (cUserFieldTestOpenSave8, -(gOptionsDialog.getControl("cbSaveOpen8Test").getState), gOutputDoc) + SetUserFieldState (cUserFieldTestMacros, -(gOptionsDialog.getControl("cbMacrosTest").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))) + if not isNull(oBinFilterComp) then + gOptionsDialog.getControl("cbOpen50Test").setState( -( GetUserFieldState (cUserFieldTestOpen50, gOutPutDoc))) + else + gOptionsDialog.getControl("cbOpen50Test").setState(0) + end If + gOptionsDialog.getControl("cbSaveOpen8Test").setState( -( GetUserFieldState (cUserFieldTestOpenSave8, gOutputDoc))) + gOptionsDialog.getControl("cbMacrosTest").setState( -( GetUserFieldState (cUserFieldTestMacros, gOutputDoc))) + gOptionsDialog.getControl("cbTerminateAfterTest").setState( -( GetUserFieldState (cUserFieldTestTerminateAfterTest, gOutputDoc))) +End Sub + +Sub ReadOptions + call SetGlobalDoc + bMakeWriterTest = GetUserFieldState (cUserFieldTestWriter, gOutputDoc) + bMakeCalcTest = GetUserFieldState (cUserFieldTestCalc, gOutputDoc) + bMakeImpressTest = GetUserFieldState (cUserFieldTestImpress, gOutputDoc) + bMakeDrawTest = GetUserFieldState (cUserFieldTestDraw, gOutputDoc) + bMakeHTMLTest = GetUserFieldState (cUserFieldTestHTML, gOutputDoc) + bMakeMathTest = GetUserFieldState (cUserFieldTestMath, gOutputDoc) + bMakeChartTest = GetUserFieldState (cUserFieldTestChart, gOutputDoc) + bMakeJavaTest = GetUserFieldState (cUserFieldTestJava, gOutputDoc) + bMakeDBTest = GetUserFieldState (cUserFieldTestDatabase, gOutputDoc) + bMakeExtensionTest = GetUserFieldState (cUserFieldTestExtension, gOutputDoc) + bMakeSaveOpenXMLTest = GetUserFieldState (cUserFieldTestOpenSaveXML, gOutputDoc) + if not isNull(oBinFilterComp) then + bMakeOpen50Test = GetUserFieldState (cUserFieldTestOpen50, gOutPutDoc) + else + bMakeOpen50Test = false + End If + bMakeSaveOpen8Test = GetUserFieldState (cUserFieldTestOpenSave8, gOutputDoc) + bMakeMacrosTest = GetUserFieldState (cUserFieldTestMacros, gOutputDoc) + bMakeTerminateAfterTest = GetUserFieldState (cUserFieldTestTerminateAfterTest, gOutputDoc) +end Sub + +Sub SetDefaultOptions + bMakeWriterTest = true + bMakeCalcTest = true + bMakeImpressTest = true + bMakeDrawTest = true + bMakeHTMLTest = true + bMakeMathTest = true + bMakeChartTest = true + if Environ("SOLAR_JAVA") = "" then + bMakeJavaTest = false + bMakeDBTest = false + bMakeExtensionTest = false + else + bMakeJavaTest = true + bMakeDBTest = true + bMakeExtensionTest = true + End If + bMakeSaveOpenXMLTest = true + REM Disable StarOffice 5.0 tests in case binfilter has not been included + if not isNull(oBinFilterComp) then + bMakeOpen50Test = true + else + bMakeOpen50Test = false + End If + bMakeSaveOpen8Test = true + bMakeMacrosTest = true + bMakeTerminateAfterTest = false +end Sub + +Sub StartTestByOptions + bShowTable = true + call ReadOptions + call Main + if bMakeTerminateAfterTest then + ClearDocFull (gOutputDoc) + gOutputDoc.dispose + 'StarDesktop.Terminate + + 'EnableReschedule( false ) + 'DispatchSlot( 5300 ) + stop + End If +end Sub + +Function StartTestWithDefaultOptions + bShowTable = false + call SetDefaultOptions + call Main + dim component(cMaxErrorStates) as string + component(cStWriter) = "Writer" + component(cStCalc) = "Calc" + component(cStPraesentation) = "Impress" + component(cStZeichnen) = "Draw" + component(cStChart) = "Chart" + component(cStMath) = "Math" + component(cStHTML) = "HTML" + component(cStJava) = "Java" + component(cStDataBase) = "Base" + component(cStExtension) = "Extensions" + dim action(5) as string + action(cDocNew) = "new" + action(cDocSaveOpen8) = "V8.0" + action(cDocSaveOpenXML) = "XML" + action(cDocOpen50) = "V5.0" + action(cDocClose) = "close" + action(cDocMacros) = "macros" + dim baseAction(5) as string + baseAction(cDBService) = "services" + baseAction(cDBOpen) = "open" + baseAction(cDBInsert) = "insert" + baseAction(cDBDelete) = "delete" + baseAction(cDBSeek) = "seek" + baseAction(cDBClose) = "close" + dim extAction(2) as string + extAction(cEXTService) = "services" + extAction(cEXTInstall) = "install" + extAction(cEXTUninstall) = "uninstall" + dim result as string + for i = 0 to cMaxErrorStates + for j = 0 to 5 + if gErrorState(i, j) = cLogFalse then + result = result & " " & component(i) & ":" + if i = cStDataBase then + result = result & baseAction(j) + else if i = cStExtension then + result = result & extAction(j) + else + result = result & action(j) + end if + end if + if gTestCaseAnnotations(i, j) <> "" then + result = result & "(" & _ + gTestCaseAnnotations(i, j) & ")" + end if + end if + next j + next i + StartTestWithDefaultOptions = result +end Function + +Sub DispatchSlot(SlotID as Integer) + Dim oArg() as new com.sun.star.beans.PropertyValue + Dim oUrl as new com.sun.star.util.URL + Dim oTrans as Object + Dim oDisp as Object + + oTrans = createUNOService("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 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 +</script:module> diff --git a/smoketest/data/OptionsDlg.xml b/smoketest/data/OptionsDlg.xml new file mode 100644 index 000000000000..5da93552f476 --- /dev/null +++ b/smoketest/data/OptionsDlg.xml @@ -0,0 +1,65 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!--********************************************************************** +* +* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +* +* Copyright 2000, 2010 Oracle and/or its affiliates. +* +* OpenOffice.org - a multi-platform office productivity suite +* +* This file is part of OpenOffice.org. +* +* OpenOffice.org is free software: you can redistribute it and/or modify +* it under the terms of the GNU Lesser General Public License version 3 +* only, as published by the Free Software Foundation. +* +* OpenOffice.org is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU Lesser General Public License version 3 for more details +* (a copy is included in the LICENSE file that accompanied this code). +* +* You should have received a copy of the GNU Lesser General Public License +* version 3 along with OpenOffice.org. If not, see +* <http://www.openoffice.org/license.html> +* for a copy of the LGPLv3 License. +* +**********************************************************************--> +<!DOCTYPE dlg:window PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "dialog.dtd"> +<dlg:window xmlns:dlg="http://openoffice.org/2000/dialog" xmlns:script="http://openoffice.org/2000/script" dlg:id="OptionsDlg" dlg:left="173" dlg:top="100" dlg:width="223" dlg:height="214" dlg:closeable="true" dlg:moveable="true" dlg:title="Options for smoketest"> + <dlg:bulletinboard> + <dlg:titledbox dlg:id="fmTests" dlg:tab-index="0" dlg:left="114" dlg:top="7" dlg:width="100" dlg:height="157"> + <dlg:title dlg:value="Tests"/> + </dlg:titledbox> + <dlg:checkbox dlg:id="cbWriterTest" dlg:tab-index="1" dlg:left="19" dlg:top="21" dlg:width="80" dlg:height="8" dlg:value="Writer" dlg:checked="false"/> + <dlg:checkbox dlg:id="cbCalcTest" dlg:tab-index="2" dlg:left="19" dlg:top="35" dlg:width="80" dlg:height="8" dlg:value="Calc" dlg:checked="false"/> + <dlg:checkbox dlg:id="cbImpressTest" dlg:tab-index="3" dlg:left="19" dlg:top="49" dlg:width="80" dlg:height="8" dlg:value="Impress" dlg:checked="false"/> + <dlg:checkbox dlg:id="cbDrawTest" dlg:tab-index="4" dlg:left="19" dlg:top="63" dlg:width="80" dlg:height="8" dlg:value="Draw" dlg:checked="false"/> + <dlg:checkbox dlg:id="cbHTMLTest" dlg:tab-index="5" dlg:left="19" dlg:top="77" dlg:width="80" dlg:height="8" dlg:value="HTML" dlg:checked="false"/> + <dlg:checkbox dlg:id="cbMathTest" dlg:tab-index="6" dlg:left="19" dlg:top="91" dlg:width="80" dlg:height="8" dlg:value="Math" dlg:checked="false"/> + <dlg:checkbox dlg:id="cbChartTest" dlg:tab-index="7" dlg:left="19" dlg:top="105" dlg:width="80" dlg:height="8" dlg:value="Chart" dlg:checked="false"/> + <dlg:checkbox dlg:id="cbJavaTest" dlg:tab-index="8" dlg:left="19" dlg:top="119" dlg:width="80" dlg:height="8" dlg:value="Java" dlg:checked="false"/> + <dlg:checkbox dlg:id="cbDatabaseTest" dlg:tab-index="9" dlg:left="19" dlg:top="133" dlg:width="80" dlg:height="8" dlg:value="Database" dlg:checked="false"/> + <dlg:checkbox dlg:id="cbExtensionTest" dlg:tab-index="10" dlg:left="19" dlg:top="147" dlg:width="80" dlg:height="8" dlg:value="Extension" dlg:checked="false"/> + + <dlg:titledbox dlg:id="fmInstalls" dlg:tab-index="11" dlg:left="7" dlg:top="7" dlg:width="100" dlg:height="157"> + <dlg:title dlg:value="Functions"/> + </dlg:titledbox> + <dlg:checkbox dlg:id="cbSaveOpen8Test" dlg:tab-index="12" dlg:left="126" dlg:top="21" dlg:width="80" dlg:height="8" dlg:value="Save / Open V8.0" dlg:checked="false"/> + <dlg:checkbox dlg:id="cbSaveOpenXMLTest" dlg:tab-index="13" dlg:left="126" dlg:top="35" dlg:width="80" dlg:height="8" dlg:value="Save / Open XML" dlg:checked="false"/> + <dlg:checkbox dlg:id="cbOpen50Test" dlg:tab-index="14" dlg:left="126" dlg:top="49" dlg:width="80" dlg:height="8" dlg:value="Open V5.0" dlg:checked="false"/> + <dlg:checkbox dlg:id="cbMacrosTest" dlg:tab-index="15" dlg:left="126" dlg:top="63" dlg:width="80" dlg:height="8" dlg:value="Macros" dlg:checked="false"/> + <dlg:titledbox dlg:id="fmBroker" dlg:tab-index="16" dlg:left="7" dlg:top="169" dlg:width="208" dlg:height="17"/> + <dlg:checkbox dlg:id="cbTerminateAfterTest" dlg:tab-index="17" dlg:disabled="true" dlg:left="19" dlg:top="174" dlg:width="190" dlg:height="8" dlg:value="Terminate Office after test" dlg:checked="false"/> + + <dlg:button dlg:id="btOk" dlg:tab-index="18" dlg:left="7" dlg:top="193" dlg:width="65" dlg:height="15" dlg:value="Ok" dlg:button-type="ok" dlg:default="true"> + <script:event script:event-name="on-performaction" script:location="document" script:macro-name="Standard.Events.PressOk" script:language="StarBasic"/> + </dlg:button> + <dlg:button dlg:id="btCancel" dlg:tab-index="19" dlg:left="80" dlg:top="193" dlg:width="65" dlg:height="15" dlg:value="Cancel" dlg:button-type="ok"> + <script:event script:event-name="on-performaction" script:location="document" script:macro-name="Standard.Events.PressCancel" script:language="StarBasic"/> + </dlg:button> + <dlg:button dlg:id="btStart" dlg:tab-index="20" dlg:left="152" dlg:top="193" dlg:width="65" dlg:height="15" dlg:value="Smoketest"> + <script:event script:event-name="on-performaction" script:location="vnd.sun.star.script" script:macro-name="Standard.Events.PressTest?language=Basic&location=document" script:language="Script"/> + </dlg:button> + </dlg:bulletinboard> +</dlg:window> diff --git a/smoketest/data/Test_10er.xml b/smoketest/data/Test_10er.xml new file mode 100644 index 000000000000..54ee0769a5b8 --- /dev/null +++ b/smoketest/data/Test_10er.xml @@ -0,0 +1,775 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!--********************************************************************** +* +* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +* +* Copyright 2000, 2010 Oracle and/or its affiliates. +* +* OpenOffice.org - a multi-platform office productivity suite +* +* This file is part of OpenOffice.org. +* +* OpenOffice.org is free software: you can redistribute it and/or modify +* it under the terms of the GNU Lesser General Public License version 3 +* only, as published by the Free Software Foundation. +* +* OpenOffice.org is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU Lesser General Public License version 3 for more details +* (a copy is included in the LICENSE file that accompanied this code). +* +* You should have received a copy of the GNU Lesser General Public License +* version 3 along with OpenOffice.org. If not, see +* <http://www.openoffice.org/license.html> +* for a copy of the LGPLv3 License. +* +**********************************************************************--> +<!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd"> +<script:module xmlns:script="http://openoffice.org/2000/script" script:name="Test_10er" script:language="StarBasic">REM 10er Test + +const sSWLogFileName = "swlog.dat", sSCLogFileName = "sclog.dat" +const sSDLogFileName = "sdlog.dat", sSMathLogFileName = "smalog.dat" +const sSChartLogFileName = "schlog.dat" +const sSHptLogFileName = "shptlog.dat" +const sSDrawLogFileName = "sdrwlog.dat", sJavaLogFileName = "javalog.dat" +const sSDBLogFileName = "dblog.dat", sExtLogFileName = "extlog.dat" +const sTestGlueLogFileName = "testclosure.log" +const sLogFileName = "smoketest.log" +const cTempFileName = "smoketest_file" + +const cMessageSaveOpen8Doc = "Save/Open open Documents (8.0)" +const cMessageSaveOpenXMLDoc = "Save/Open Document XML (6/7)" +const cMessageOpen50Doc = "Open Document 5.0" +const cMessageNewDoc = "New Document" +const cMessageCloseDoc = "Close Document" +const cMessageRunMacros = "Run Macros" + +Global sWorkPath$ +Global sWorkPathURL$ +Global LocalTestLog% +Global GlobalTestLog% + +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+sSChartLogFileName) then + Kill (sWorkPath+sSChartLogFileName) + End If + If FileExists (sWorkPath+sSHptLogFileName) then + Kill (sWorkPath+sSHptLogFileName) + 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+sTestGlueLogFileName) then + Kill (sWorkPath+sTestGlueLogFileName) + 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 + +Sub SetupWorkPath + Dim configManager as Object + configManager = CreateUnoService( "com.sun.star.config.SpecialConfigManager" ) + + sWorkPath = configManager.SubstituteVariables( "$(userpath)/temp/" ) + sWorkPathURL = configManager.SubstituteVariables( "$(userurl)/temp/" ) +End Sub + +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 + + 'search ExtensionURL + sDocURL = gOutputDoc.URL + CompatibilityMode(true) + nStrPos = InStrRev (sDocURL, "/" ) + CompatibilityMode(false) + sExtensionURL = Left (sDocURL, nStrPos) + + GlobalTestLog = OpenLogDat (sLogFileName) + call WriteTestSequence + if bMakeWriterTest then + gCurrentDocTest = frmWriter + call MakeDocTest + end if + if bMakeCalcTest then + gCurrentDocTest = frmCalc + call MakeDocTest + end if + if bMakeImpressTest then + gCurrentDocTest = frmImpress + call MakeDocTest + end if + if bMakeDrawTest then + gCurrentDocTest = frmDraw + call MakeDocTest + end if + if bMakeHTMLTest then + gCurrentDocTest = frmHyperText + call MakeDocTest + end if + if bMakeChartTest then + gCurrentDocTest = frmChart + call MakeChartTest + end if + if bMakeMathTest then + gCurrentDocTest = frmMath + call MakeNewDoc + end if + if bMakeJavaTest then + gCurrentDocTest = frmJava + call TestJava + end if + if bMakeDBTest then + gCurrentDocTest = frmDataBase + call Test_DB.TestDB + end if + if bMakeExtensionTest then + gCurrentDocTest = frmExtension + call Test_Ext.TestExtensions + end if + + Close #GlobalTestLog + GlobalTestLog = 0 +end Sub + +Sub WriteTestSequence + Print #GlobalTestLog, "Sequence of testing" + + if bMakeWriterTest then + WriteTests ("writer : ", true, GlobalTestLog) + end if + if bMakeCalcTest then + WriteTests ("calc : ", true, GlobalTestLog) + end if + if bMakeImpressTest then + WriteTests ("impress : ", true, GlobalTestLog) + end if + if bMakeDrawTest then + WriteTests ("draw : ", true, GlobalTestLog) + end if + if bMakeHTMLTest then + WriteTests ("HTML : ", true, GlobalTestLog) + end if + if bMakeChartTest then + WriteTests ("chart : ", false, GlobalTestLog) + end if + if bMakeMathTest then + WriteTests ("math : ", false, GlobalTestLog) + end if + if bMakeJavaTest then + WriteTests ("Java : ", false, GlobalTestLog) + end if + if bMakeDBTest then + WriteDBTests ("Database : ", GlobalTestLog) + end if + if bMakeExtensionTest then + WriteExtensionTests ("Extension : ", GlobalTestLog) + end if + + Print #GlobalTestLog, "testclosure : setup, write_status" + + Print #GlobalTestLog + end Sub + + Sub WriteTests (sText as string, bTestAll as boolean) + Dim sWriteStr as string + + sWriteStr = sText + sWriteStr = sWriteStr + "new" + if bTestAll then + if bMakeSaveOpen8Test then + sWriteStr = sWriteStr + ", save 8.0" + end if + if bMakeSaveOpenXMLTest then + sWriteStr = sWriteStr + ", save XML" + end if + if bMakeSaveOpen8Test then + sWriteStr = sWriteStr + ", open 8.0" + end if + if bMakeSaveOpenXMLTest then + sWriteStr = sWriteStr + ", open XML" + end if + if bMakeOpen50Test then + sWriteStr = sWriteStr + ", open 5.0" + end if + if bMakeMacrosTest then + sWriteStr = sWriteStr + ", run macros" + end if + end if + + sWriteStr = sWriteStr + ", close" + + Print #GlobalTestLog, 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 + Dim oDoc as Object + Dim sFileNameXML$, sFileName50$, sFileName8$ + Dim bSuccess as Boolean + + On Local Error GoTo DOCTESTERROR + gCurrentTestCase = cLogfileFailed + LocalTestLog% = OpenLogDat (GetLogFileName(gCurrentDocTest)) + gCurrentTestCase = cDocNew + oDoc = LoadDoc ("private:factory/" + GetDocFilter(gCurrentDocTest or cFltNewDoc)) + LogTestResult( GetDocFilter(gCurrentDocTest or cFltNewDoc)+" "+ cMessageNewDoc, not IsNull (oDoc) ) + if not IsNull (oDoc) then + gCurrentTestCase = cDocSaveOpen8 + if bMakeSaveOpen8Test and IsFilterAvailable (gCurrentDocTest or cFlt8) then + sFileName8 = sWorkPathURL+cTempFileName+"."+GetDocEndings(gCurrentDocTest or cFlt8) + SaveDoc (sFileName8, oDoc, GetDocFilter(gCurrentDocTest or cFlt8)) + end if + gCurrentTestCase = cDocSaveOpenXML + if bMakeSaveOpenXMLTest and IsFilterAvailable (gCurrentDocTest or cFltXML) then + sFileNameXML = sWorkPathURL+cTempFileName+"."+GetDocEndings(gCurrentDocTest or cFltXML) + SaveDoc (sFileNameXML, oDoc, GetDocFilter(gCurrentDocTest or cFltXML)) + end if + gCurrentTestCase = cDocClose + bSuccess = CloseDoc( oDoc ) + LogTestResult( GetDocFilter(gCurrentDocTest)+" "+ cMessageCloseDoc, bSuccess ) + gCurrentTestCase = cDocSaveOpen8 + if bMakeSaveOpen8Test and IsFilterAvailable (gCurrentDocTest or cFlt8) then + oDoc = LoadDoc (sFileName8) + +' oDoc = Documents.open(sFileName) + LogTestResult( GetDocFilter(gCurrentDocTest or cFltNewDoc)+" "+ cMessageSaveOpen8Doc, not IsNull (oDoc) ) + + if not IsNull (oDoc) then + gCurrentTestCase = cDocClose + oDoc.close (true) + end If + end if + + gCurrentTestCase = cDocSaveOpenXML + if bMakeSaveOpenXMLTest and IsFilterAvailable (gCurrentDocTest or cFltXML) then + oDoc = LoadDoc (sFileNameXML) + +' oDoc = Documents.open(sFileName) + LogTestResult( GetDocFilter(gCurrentDocTest or cFltNewDoc)+" "+ cMessageSaveOpenXMLDoc, not IsNull (oDoc) ) + + if not IsNull (oDoc) then + gCurrentTestCase = cDocClose + oDoc.close (true) + end If + end if + + gCurrentTestCase = cDocOpen50 + if bMakeOpen50Test and IsFilterAvailable (gCurrentDocTest or cFlt50) then + SOLARSRC = ConvertToURL(Environ("SOLARSRC")) + sFileName50 = SOLARSRC+"/qadevOOo/testdocs/ttt."+GetDocEndings(gCurrentDocTest or cFlt50) + oDoc = LoadDoc (sFileName50) + +' oDoc = Documents.open(sFileName) + LogTestResult( GetDocFilter(gCurrentDocTest or cFltNewDoc)+" "+ cMessageOpen50Doc, not IsNull (oDoc) ) + + if not IsNull (oDoc) then + gCurrentTestCase = cDocClose + oDoc.close (true) + end If + end if + + gCurrentTestCase = cDocMacros + ' Just one calc macro test for now + ' To-Do split this into its own per-module/test .xml and add more + if bMakeMacrosTest and gCurrentDocTest = frmCalc then + oDoc = LoadDoc ("private:factory/" + GetDocFilter(gCurrentDocTest or cFltNewDoc)) + oDocCtrl = oDoc.getCurrentController() + oDocFrame = oDocCtrl.getFrame() + oDispatcher = createUnoService("com.sun.star.frame.DispatchHelper") + + dim args(0) as new com.sun.star.beans.PropertyValue + + args(0).Name = "ToPoint" + args(0).Value = "$A$1" + oDispatcher.executeDispatch(oDocFrame, ".uno:GoToCell", "", 0, args()) + args(0).Name = "By" + args(0).Value = 5 + oDispatcher.executeDispatch(oDocFrame, ".uno:GoRightSel", "", 0, args()) + args(0).Name = "By" + args(0).Value = 5 + oDispatcher.executeDispatch(oDocFrame, ".uno:GoDownSel", "", 0, args()) + + oRangeAddr = oDoc.getCurrentSelection().getRangeAddress() + + bResult = oRangeAddr.StartColumn = 0 and oRangeAddr.EndColumn = 5 and oRangeAddr.StartRow = 0 and oRangeAddr.EndRow = 5 + + LogTestResult( GetDocFilter(gCurrentDocTest or cFltNewDoc)+" "+ cMessageRunMacros, bResult ) + + if not IsNull (oDoc) then + gCurrentTestCase = cDocClose + oDoc.close (true) + end If + end if + + end If + Print #LocalTestLog, "---" + Close #LocalTestLog% + LocalTestLog = 0 + Exit Sub ' Without error + + DOCTESTERROR: + If ( gCurrentTestCase = cLogfileFailed ) then + LogTestResult( " ", False ) + Exit Sub + else + LogTestResult( GetDocFilter(gCurrentDocTest or cFltNewDoc)+" "+ GetErrorMessage(gCurrentTestCase), False ) + Close #LocalTestLog% + LocalTestLog = 0 + End If + Exit Sub ' With error +End Sub + +Sub MakeNewDoc + DIM oDoc as Object + Dim bSuccess as Boolean + On Local Error GoTo DOCTESTERROR2 + gCurrentTestCase = cLogfileFailed + LocalTestLog% = OpenLogDat (GetLogFileName(gCurrentDocTest)) + gCurrentTestCase = cDocNew +' oDoc = Documents.Add(GetDocFilter(gCurrentDocTest)) + oDoc = LoadDoc ("private:factory/" + GetDocFilter(gCurrentDocTest or cFltNewDoc)) + LogTestResult( GetDocFilter(gCurrentDocTest or cFltNewDoc)+" "+ cMessageNewDoc, not IsNull (oDoc) ) + if not IsNull (oDoc) then + gCurrentTestCase = cDocClose + bSuccess = CloseDoc( oDoc ) + LogTestResult( GetDocFilter(gCurrentDocTest)+" "+ cMessageCloseDoc, bSuccess ) + end If + Print #LocalTestLog, "---" + Close #LocalTestLog% + LocalTestLog = 0 + Exit Sub ' Without error + + DOCTESTERROR2: + If ( gCurrentTestCase = cLogfileFailed ) then + LogTestResult( " ", False ) + Exit Sub + else + LogTestResult( GetDocFilter(gCurrentDocTest or cFltNewDoc)+" "+ GetErrorMessage(gCurrentTestCase), False ) + Close #LocalTestLog% + LocalTestLog = 0 + End If + Exit Sub ' With error +End Sub + +Sub MakeChartTest + 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 bSuccess as Boolean + On Local Error GoTo CHARTTESTERROR + gCurrentTestCase = cLogfileFailed + LocalTestLog% = OpenLogDat (GetLogFileName(gCurrentDocTest)) + gCurrentTestCase = 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) + bSuccess=oCharts.HasByName(cChartName) + LogTestResult( GetDocFilter(gCurrentDocTest or cFltNewDoc)+" "+ cMessageNewDoc, bSuccess ) + gCurrentTestCase = cDocClose + oDoc.close (true) + else + LogTestResult( GetDocFilter(frmCalc or cFltNewDoc)+" "+ cMessageNewDoc, FALSE ) + End if + Print #LocalTestLog, "---" + Close #LocalTestLog% + LocalTestLog = 0 + Exit Sub ' Without error + + CHARTTESTERROR: + If ( gCurrentTestCase = cLogfileFailed ) then + LogTestResult( " ", False ) + Exit Sub + else + LogTestResult( GetDocFilter(gCurrentDocTest or cFltNewDoc)+" "+ GetErrorMessage(gCurrentTestCase), FALSE ) + Close #LocalTestLog% + LocalTestLog = 0 + 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" ' text document + case frmCalc or cFlt8 + GetDocFilter = "calc8" ' spreadsheet document + case frmImpress or cFlt8 + GetDocFilter = "impress8" ' presentation + case frmDraw or cFlt8 + GetDocFilter = "draw8" ' drawing + case frmMath or cFlt8 + GetDocFilter = "math8" ' formula + + case frmWriter or cFltXML + GetDocFilter = "StarOffice XML (Writer)" ' text document + case frmCalc or cFltXML + GetDocFilter = "StarOffice XML (Calc)" ' spreadsheet document + case frmImpress or cFltXML + GetDocFilter = "StarOffice XML (Impress)" ' presentation + case frmDraw or cFltXML + GetDocFilter = "StarOffice XML (Draw)" ' drawing + case frmMath or cFltXML + GetDocFilter = "StarOffice XML (Math)" ' formula + + case frmHyperText, frmHyperText or cFlt50, frmHyperText or cFltXML + GetDocFilter = "HTML" ' HTML document + 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" ' text document + case frmCalc or cFltNewDoc + GetDocFilter = "scalc" ' spreadsheet document + case frmImpress or cFltNewDoc + GetDocFilter = "simpress" ' presentation + case frmDraw or cFltNewDoc + GetDocFilter = "sdraw" ' drawing + case frmMath or cFltNewDoc + GetDocFilter = "smath" ' formula + case frmHyperText or cFltNewDoc + GetDocFilter = "swriter/web" ' HTML document + case frmChart or cFltNewDoc + GetDocFilter = "schart" ' chart + case else + GetDocFilter = "" + end Select +end Function + +Function GetLogFileName (DocType as Integer) as String + Select Case ( DocType ) + case frmWriter + GetLogFileName = sSWLogFileName ' text document + case frmCalc + GetLogFileName = sSCLogFileName ' spreadsheet document + case frmImpress + GetLogFileName = sSDLogFileName ' presentation + case frmDraw + GetLogFileName = sSDrawLogFileName ' drawing + case frmMath + GetLogFileName = sSMathLogFileName ' formula + case frmHyperText + GetLogFileName = sSHptLogFileName ' HTML document + case frmChart + GetLogFileName = sSChartLogFileName ' chart + case frmJava + GetLogFileName = sJavaLogFileName 'Java + case frmTestClosure + GetLogFileName = sTestGlueLogFileName ' test framework + 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 cDocSaveOpen8 + GetErrorMessageOnAction = cMessageSaveOpen8Doc + case cDocSaveOpenXML + GetErrorMessageOnAction = cMessageSaveOpenXMLDoc + case cDocOpen50 + GetErrorMessageOnAction = cMessageOpen50Doc + case cDocMacros + GetErrorMessageOnAction = cMessageRunMacros + 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 + Dim oObj as Object + gCurrentTestCase = cLogfileFailed + LocalTestLog% = OpenLogDat (GetLogFileName(gCurrentDocTest)) + gCurrentTestCase = cDocNew + oObj = createUnoService( cUnoJavaLoader ) + LogTestResult( "Java "+ cMessageNewDoc, not IsNull (oObj) ) + + Print #LocalTestLog, "---" + Close #LocalTestLog% + LocalTestLog = 0 + + TestJava = not IsNull (oObj) +End Function + +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 + +Function CloseDoc( oDoc as Object ) + Dim oListener as Object + oListener = CreateUnoListener( "Events.closeListener_", "com.sun.star.util.XCloseListener" ) + oDoc.addCloseListener( oListener ) + + Events.ResetCloseListenerFlag() + oDoc.close( true ) + closeDoc = Events.HasCloseListenerBeenCalled() + + if ( Not Events.HasCloseListenerBeenCalled() ) Then + ' do this only if closing was not successful - otherwise, we'd get a DisposedException + oDoc.removeCloseListener( oListener ) + End If +End Function +</script:module> diff --git a/smoketest/data/Test_DB.xml b/smoketest/data/Test_DB.xml new file mode 100644 index 000000000000..52ea5d9be934 --- /dev/null +++ b/smoketest/data/Test_DB.xml @@ -0,0 +1,147 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!--********************************************************************** +* +* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +* +* Copyright 2000, 2010 Oracle and/or its affiliates. +* +* OpenOffice.org - a multi-platform office productivity suite +* +* This file is part of OpenOffice.org. +* +* OpenOffice.org is free software: you can redistribute it and/or modify +* it under the terms of the GNU Lesser General Public License version 3 +* only, as published by the Free Software Foundation. +* +* OpenOffice.org is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU Lesser General Public License version 3 for more details +* (a copy is included in the LICENSE file that accompanied this code). +* +* You should have received a copy of the GNU Lesser General Public License +* version 3 along with OpenOffice.org. If not, see +* <http://www.openoffice.org/license.html> +* for a copy of the LGPLv3 License. +* +**********************************************************************--> +<!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd"> +<script:module xmlns:script="http://openoffice.org/2000/script" script:name="Test_DB" script:language="StarBasic">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 + + Dim oDBConnection as Object, oDataSource as Object, oDBContext as Object + Dim sDBName as String, sTable as String, sCurrentMessage as String + Dim nRowCount as Integer + Dim bResult as Boolean + Const sTestString = "Automatical Test" + + On Local Error GoTo DBERROR + + gCurrentTestCase = cLogfileFailed + LocalTestLog% = OpenLogDat (GetLogFileName(gCurrentDocTest)) + + gCurrentTestCase = cDBService + sCurrentMessage = cMessageDatabaseService + " " + cUnoDatabaseContext + + oDBContext = CreateUnoService(cUnoDatabaseContext) + sDBName="Bibliography" 'Names of Databases + + gCurrentTestCase = cDBOpen + sCurrentMessage = cMessageDatabaseOpen + + oDataSource = oDBContext.GetByName(sDBName) + sTable=oDataSource.Tables.ElementNames(0) + oDBConnection = oDBContext.GetByName(sDBName).GetConnection("","") + + LogTestResult( "Database "+ cMessageDatabaseOpen, not IsNull (oDBConnection) ) + if (IsNull(oDBConnection)) then + Close #LocalTestLog% + LocalTestLog = 0 + Exit Sub + End If + + ' Database is open now + + gCurrentTestCase = cDBService + sCurrentMessage = cMessageDatabaseService + " " + cUnoRowSet + oRowSet = createUnoService(cUnoRowSet) + + if (IsNull(oRowSet)) then + LogTestResult( "Database "+ cMessageDatabaseService + " " + cUnoRowSet, not IsNull (oRowSet) ) + Exit Sub + else + LogTestResult( "Database "+ cMessageDatabaseService, TRUE ) + End If + + gCurrentTestCase = 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) + LogTestResult( "Database "+ cMessageDatabaseInsert, bResult ) + + 'delete only if insert passed + + if (bResult) Then + gCurrentTestCase = cDBDelete + sCurrentMessage = cMessageDatabaseDelete + oRowSet.deleteRow() + bResult = (nRowCount - oRowSet.RowCount = 0) + if ( bResult ) Then + oRowSet.next() + bResult = (nRowCount - oRowSet.RowCount = 1) + End If + LogTestResult( "Database "+ cMessageDatabaseDelete, bResult ) + End If + + ' read other record + + gCurrentTestCase = cDBSeek + sCurrentMessage = cMessageDatabaseSeek + oRowSet.first() + bResult = not (oRowSet.getString(5) = sTestString) + LogTestResult( "Database "+ cMessageDatabaseSeek, bResult ) + + gCurrentTestCase = cDBClose + sCurrentMessage = cMessageDatabaseClose + oDBConnection.Dispose() + LogTestResult( "Database "+ cMessageDatabaseClose, True ) + + Print #LocalTestLog, "---" + Close #LocalTestLog% + LocalTestLog = 0 + Exit Sub ' Without error + + DBERROR: + If ( gCurrentTestCase = cLogfileFailed ) then + LogTestResult( " ", False ) + Exit Sub + else + LogTestResult( "Database "+ sCurrentMessage, FALSE ) + Close #LocalTestLog% + LocalTestLog = 0 + End If + Exit Sub ' With error +End Sub +</script:module> diff --git a/smoketest/data/Test_Ext.xml b/smoketest/data/Test_Ext.xml new file mode 100644 index 000000000000..ac39f4816d7b --- /dev/null +++ b/smoketest/data/Test_Ext.xml @@ -0,0 +1,116 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!--********************************************************************** +* +* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +* +* Copyright 2000, 2010 Oracle and/or its affiliates. +* +* OpenOffice.org - a multi-platform office productivity suite +* +* This file is part of OpenOffice.org. +* +* OpenOffice.org is free software: you can redistribute it and/or modify +* it under the terms of the GNU Lesser General Public License version 3 +* only, as published by the Free Software Foundation. +* +* OpenOffice.org is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU Lesser General Public License version 3 for more details +* (a copy is included in the LICENSE file that accompanied this code). +* +* You should have received a copy of the GNU Lesser General Public License +* version 3 along with OpenOffice.org. If not, see +* <http://www.openoffice.org/license.html> +* for a copy of the LGPLv3 License. +* +**********************************************************************--> +<!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd"> +<script:module xmlns:script="http://openoffice.org/2000/script" script:name="Test_Ext" script:language="StarBasic">REM ***** BASIC ***** + +const cMessageExtensionService = "Extension Service" +const cMessageExtensionInstall = "Install Extension" +const cMessageExtensionUninstall = "Uninstall Extension" + +Sub TestExtensions + Dim oTestExtension as Object, obj_null as Object + Dim sCurrentMessage as String + Dim bResult as Boolean + Dim sImplementationNameString as String + sImplementationNameString = cUnoSmoketestTestExtension + "$_TestExtension" + + On Local Error GoTo EXTERROR + + gCurrentTestCase = cLogfileFailed + LocalTestLog% = OpenLogDat (GetLogFileName(gCurrentDocTest)) + + sCurrentMessage = cMessageExtensionService + gCurrentTestCase = 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 ExtensionManager + 'A singleton cannot be created with createUnoService + ctx = getDefaultContext + ext_mgr = ctx.getValueByName("/singletons/" + cExtensionManager) + + LogTestResult( "Extension "+ cMessageExtensionService, not IsNull (ext_mgr) ) + if (IsNull(ext_mgr)) then + Close #LocalTestLog% + LocalTestLog = 0 + Exit Sub + End If + + sCurrentMessage = cMessageExtensionInstall + gCurrentTestCase = cEXTInstall + + 'Add the extension. We must provide a file URL here. + 'By passing "user" we determine that the actions we perform on + 'XExtensionManager only affect the user installation. To modify the share installation one would pass "share". + + Dim props() as Object + ext_mgr.addExtension(sExtensionURL + cExtensionFileName, props, "user", 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) + LogTestResult( "Extension "+ cMessageExtensionInstall, bResult ) + if (not bResult) then + Close #LocalTestLog% + LocalTestLog = 0 + Exit Sub + End If + + sCurrentMessage = cMessageExtensionUninstall + gCurrentTestCase = cEXTUninstall + + 'Remove the package + ext_mgr.removeExtension("org.openoffice.legacy." + cExtensionFileName, cExtensionFileName, "user",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. + LogTestResult( "Extension "+ cMessageExtensionUninstall, IsNull (oTestExtension) ) + + Print #LocalTestLog, "---" + Close #LocalTestLog% + LocalTestLog = 0 + Exit Sub ' Without error + + EXTERROR: + If ( gCurrentTestCase = cLogfileFailed ) then + LogTestResult( " ", False ) + Exit Sub + else + LogTestResult( "Extension "+ sCurrentMessage, False ) + Close #LocalTestLog% + LocalTestLog = 0 + End If + Exit Sub ' With error + +End Sub +</script:module> diff --git a/smoketest/data/content.xml b/smoketest/data/content.xml new file mode 100644 index 000000000000..60559afac4ab --- /dev/null +++ b/smoketest/data/content.xml @@ -0,0 +1,114 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!--********************************************************************** +* +* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +* +* Copyright 2000, 2010 Oracle and/or its affiliates. +* +* OpenOffice.org - a multi-platform office productivity suite +* +* This file is part of OpenOffice.org. +* +* OpenOffice.org is free software: you can redistribute it and/or modify +* it under the terms of the GNU Lesser General Public License version 3 +* only, as published by the Free Software Foundation. +* +* OpenOffice.org is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU Lesser General Public License version 3 for more details +* (a copy is included in the LICENSE file that accompanied this code). +* +* You should have received a copy of the GNU Lesser General Public License +* version 3 along with OpenOffice.org. If not, see +* <http://www.openoffice.org/license.html> +* for a copy of the LGPLv3 License. +* +**********************************************************************--> +<office:document-content xmlns:office="http://openoffice.org/2000/office" xmlns:style="http://openoffice.org/2000/style" xmlns:text="http://openoffice.org/2000/text" xmlns:table="http://openoffice.org/2000/table" xmlns:draw="http://openoffice.org/2000/drawing" xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:meta="http://openoffice.org/2000/meta" xmlns:number="http://openoffice.org/2000/datastyle" xmlns:svg="http://www.w3.org/2000/svg" xmlns:chart="http://openoffice.org/2000/chart" xmlns:dr3d="http://openoffice.org/2000/dr3d" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:form="http://openoffice.org/2000/form" xmlns:script="http://openoffice.org/2000/script" xmlns:ooo="http://openoffice.org/2004/office" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:dom="http://www.w3.org/2001/xml-events" xmlns:xforms="http://www.w3.org/2002/xforms" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:rpt="http://openoffice.org/2005/report" xmlns:of="urn:oasis:names:tc:opendocument:xmlns:of:1.2" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:grddl="http://www.w3.org/2003/g/data-view#" xmlns:tableooo="http://openoffice.org/2009/table" xmlns:field="urn:openoffice:names:experimental:ooo-ms-interop:xmlns:field:1.0" office:version="1.2" grddl:transformation="http://docs.oasis-open.org/office/1.2/xslt/odf2rdf.xsl" office:class="text"> + <office:script/> + <office:font-decls> + <style:font-decl style:name="Arial Unicode MS" fo:font-family="'Arial Unicode MS'" style:font-pitch="variable"/> + <style:font-decl style:name="HG Mincho Light J" fo:font-family="'HG Mincho Light J', 'MS Mincho', 'HG Mincho J', 'HG Mincho L', 'HG Mincho', Mincho, 'MS PMincho', 'MS Gothic', 'HG Gothic J', 'HG Gothic B', 'HG Gothic', Gothic, 'MS PGothic', 'Andale Sans UI', 'Arial Unicode MS', 'Lucida Sans Unicode', Tahoma" style:font-pitch="variable"/> + <style:font-decl style:name="Thorndale" fo:font-family="Thorndale, 'Times New Roman', Times, 'Lucida Serif', 'Lucida Bright', Timmons, 'New York', Serif" style:font-family-generic="roman" style:font-pitch="variable"/> + <style:font-decl style:name="Arial" fo:font-family="Arial" style:font-family-generic="swiss" style:font-pitch="variable"/> + </office:font-decls> + <office:automatic-styles> + <style:style style:name="P1" style:family="paragraph"> + <style:properties fo:text-align="center"/> + </style:style> + <style:style style:name="gr1" style:family="graphics"> + <style:properties style:wrap="run-through" style:number-wrapped-paragraphs="no-limit" style:vertical-pos="from-top" style:horizontal-pos="from-left" style:horizontal-rel="paragraph"/> + </style:style> + </office:automatic-styles> + <office:body> + <office:forms form:automatic-focus="true" form:apply-design-mode="false"> + <form:form form:name="Standard" form:apply-filter="true" form:command-type="table" form:service-name="com.sun.star.form.component.Form" office:target-frame="" xlink:href=""> + <form:control form:name="start" form:service-name="com.sun.star.form.component.CommandButton" form:id="control1"> + <form:button form:label="start smoketest" office:target-frame="" xlink:href="" form:image-data="" form:delay-for-repeat="PT0.50S" form:image-position="center"> + <form:properties> + <form:property form:property-name="DefaultControl" form:property-type="string"> + <form:property-value>stardiv.one.form.control.CommandButton</form:property-value> + </form:property> + </form:properties> + <office:events> + <script:event script:language="StarBasic" script:event-name="on-performaction" script:macro-name="Standard.Global.StartTestByOptions" script:location="document" script:library="document"/> + </office:events> + </form:button> + </form:control> + <form:control form:name="options" form:service-name="com.sun.star.form.component.CommandButton" form:id="control2"> + <form:button form:label="options" office:target-frame="" xlink:href="" form:image-data="" form:delay-for-repeat="PT0.50S" form:image-position="center"> + <form:properties> + <form:property form:property-name="DefaultControl" form:property-type="string"> + <form:property-value>stardiv.one.form.control.CommandButton</form:property-value> + </form:property> + </form:properties> + <office:events> + <script:event script:language="StarBasic" script:event-name="on-performaction" script:macro-name="Standard.Global.ShowOptionsDlg" script:location="document" script:library="document"/> + </office:events> + </form:button> + </form:control> + <form:control form:name="table" form:service-name="com.sun.star.form.component.CommandButton" form:id="control3"> + <form:button form:label="delete table" office:target-frame="" xlink:href="" form:image-data="" form:delay-for-repeat="PT0.50S" form:image-position="center"> + <form:properties> + <form:property form:property-name="DefaultControl" form:property-type="string"> + <form:property-value>stardiv.one.form.control.CommandButton</form:property-value> + </form:property> + </form:properties> + <office:events> + <script:event script:language="StarBasic" script:event-name="on-performaction" script:macro-name="Standard.Global.ClearAllText" script:location="document" script:library="document"/> + </office:events> + </form:button> + </form:control> + </form:form> + </office:forms> + <text:sequence-decls> + <text:sequence-decl text:display-outline-level="0" text:name="Illustration"/> + <text:sequence-decl text:display-outline-level="0" text:name="Table"/> + <text:sequence-decl text:display-outline-level="0" text:name="Text"/> + <text:sequence-decl text:display-outline-level="0" text:name="Drawing"/> + </text:sequence-decls> + <text:user-field-decls> + <text:user-field-decl text:value-type="string" text:string-value="y" text:name="Writer"/> + <text:user-field-decl text:value-type="string" text:string-value="y" text:name="Calc"/> + <text:user-field-decl text:value-type="string" text:string-value="y" text:name="Impress"/> + <text:user-field-decl text:value-type="string" text:string-value="y" text:name="Draw"/> + <text:user-field-decl text:value-type="string" text:string-value="y" text:name="HTML"/> + <text:user-field-decl text:value-type="string" text:string-value="y" text:name="Math"/> + <text:user-field-decl text:value-type="string" text:string-value="y" text:name="Chart"/> + <text:user-field-decl text:value-type="string" text:string-value="y" text:name="SaveOpenXML"/> + <text:user-field-decl text:value-type="string" text:string-value="y" text:name="Macros"/> + <text:user-field-decl text:value-type="string" text:string-value="y" text:name="Open50"/> + <text:user-field-decl text:value-type="string" text:string-value="n" text:name="Terminate"/> + <text:user-field-decl text:value-type="string" text:string-value="y" text:name="Java"/> + <text:user-field-decl text:value-type="string" text:string-value="y" text:name="SaveOpen8"/> + <text:user-field-decl text:value-type="string" text:string-value="y" text:name="Database"/> + <text:user-field-decl text:value-type="string" text:string-value="y" text:name="Extension"/> + </text:user-field-decls> + <text:p text:style-name="Standard"> + <draw:control text:anchor-type="page" text:anchor-page-number="1" svg:x="2cm" svg:y="2cm" draw:z-index="1" draw:style-name="gr1" draw:text-style-name="P1" svg:width="2.477cm" svg:height="0.787cm" form:id="control1"/> + <draw:control text:anchor-type="page" text:anchor-page-number="1" svg:x="5cm" svg:y="2cm" draw:z-index="0" draw:style-name="gr1" draw:text-style-name="P1" svg:width="2.477cm" svg:height="0.787cm" form:id="control2"/> + <draw:control text:anchor-type="page" text:anchor-page-number="1" svg:x="8cm" svg:y="2cm" draw:z-index="2" draw:style-name="gr1" draw:text-style-name="P1" svg:width="2.477cm" svg:height="0.787cm" form:id="control3"/> + </text:p> + </office:body> +</office:document-content> diff --git a/smoketest/data/dialog-lb.xml b/smoketest/data/dialog-lb.xml new file mode 100644 index 000000000000..973dfe688828 --- /dev/null +++ b/smoketest/data/dialog-lb.xml @@ -0,0 +1,31 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!--********************************************************************** +* +* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +* +* Copyright 2000, 2010 Oracle and/or its affiliates. +* +* OpenOffice.org - a multi-platform office productivity suite +* +* This file is part of OpenOffice.org. +* +* OpenOffice.org is free software: you can redistribute it and/or modify +* it under the terms of the GNU Lesser General Public License version 3 +* only, as published by the Free Software Foundation. +* +* OpenOffice.org is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU Lesser General Public License version 3 for more details +* (a copy is included in the LICENSE file that accompanied this code). +* +* You should have received a copy of the GNU Lesser General Public License +* version 3 along with OpenOffice.org. If not, see +* <http://www.openoffice.org/license.html> +* for a copy of the LGPLv3 License. +* +**********************************************************************--> +<!DOCTYPE library:library PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "library.dtd"> +<library:library xmlns:library="http://openoffice.org/2000/library" library:name="Standard" library:readonly="false" library:passwordprotected="false"> + <library:element library:name="OptionsDlg"/> +</library:library> diff --git a/smoketest/data/dialog-lc.xml b/smoketest/data/dialog-lc.xml new file mode 100644 index 000000000000..e3a5a0e326e4 --- /dev/null +++ b/smoketest/data/dialog-lc.xml @@ -0,0 +1,31 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!--********************************************************************** +* +* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +* +* Copyright 2000, 2010 Oracle and/or its affiliates. +* +* OpenOffice.org - a multi-platform office productivity suite +* +* This file is part of OpenOffice.org. +* +* OpenOffice.org is free software: you can redistribute it and/or modify +* it under the terms of the GNU Lesser General Public License version 3 +* only, as published by the Free Software Foundation. +* +* OpenOffice.org is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU Lesser General Public License version 3 for more details +* (a copy is included in the LICENSE file that accompanied this code). +* +* You should have received a copy of the GNU Lesser General Public License +* version 3 along with OpenOffice.org. If not, see +* <http://www.openoffice.org/license.html> +* for a copy of the LGPLv3 License. +* +**********************************************************************--> +<!DOCTYPE library:libraries PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "libraries.dtd"> +<library:libraries xmlns:library="http://openoffice.org/2000/library" xmlns:xlink="http://www.w3.org/1999/xlink"> + <library:library library:name="Standard" library:link="false"/> +</library:libraries> diff --git a/smoketest/data/makefile.mk b/smoketest/data/makefile.mk new file mode 100644 index 000000000000..6cf2706b52b2 --- /dev/null +++ b/smoketest/data/makefile.mk @@ -0,0 +1,70 @@ +#************************************************************************* +# +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# Copyright 2000, 2010 Oracle and/or its affiliates. +# +# OpenOffice.org - a multi-platform office productivity suite +# +# This file is part of OpenOffice.org. +# +# OpenOffice.org is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License version 3 +# only, as published by the Free Software Foundation. +# +# OpenOffice.org is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Lesser General Public License version 3 for more details +# (a copy is included in the LICENSE file that accompanied this code). +# +# You should have received a copy of the GNU Lesser General Public License +# version 3 along with OpenOffice.org. If not, see +# <http://www.openoffice.org/license.html> +# for a copy of the LGPLv3 License. +# +#***********************************************************************/ + +PRJ = .. +PRJNAME = smoketestdoc +TARGET = data + +.INCLUDE: settings.mk + +$(BIN)/smoketestdoc.sxw: $(MISC)/zip/smoketestdoc.sxw + $(COPY) $< $@ + +$(MISC)/zip/smoketestdoc.sxw: \ + Events.xml \ + Global.xml \ + OptionsDlg.xml \ + Test_10er.xml \ + Test_DB.xml \ + Test_Ext.xml \ + content.xml \ + dialog-lb.xml \ + dialog-lc.xml \ + manifest.xml \ + meta.xml \ + script-lb.xml \ + script-lc.xml \ + settings.xml \ + styles.xml + $(COMMAND_ECHO)$(RM) -r $(MISC)/zip + $(COMMAND_ECHO)$(MKDIR) $(MISC)/zip + $(COMMAND_ECHO)$(COPY) content.xml meta.xml settings.xml styles.xml $(MISC)/zip/ + $(COMMAND_ECHO)printf application/vnd.sun.xml.writer > $(MISC)/zip/mimetype + $(COMMAND_ECHO)$(MKDIR) $(MISC)/zip/META-INF + $(COMMAND_ECHO)$(COPY) manifest.xml $(MISC)/zip/META-INF/ + $(COMMAND_ECHO)$(MKDIR) $(MISC)/zip/Basic + $(COMMAND_ECHO)$(COPY) script-lc.xml $(MISC)/zip/Basic/ + $(COMMAND_ECHO)$(MKDIR) $(MISC)/zip/Basic/Standard + $(COMMAND_ECHO)$(COPY) script-lb.xml Events.xml Global.xml Test_10er.xml Test_DB.xml \ + Test_Ext.xml $(MISC)/zip/Basic/Standard/ + $(COMMAND_ECHO)$(MKDIR) $(MISC)/zip/Dialogs + $(COMMAND_ECHO)$(COPY) dialog-lc.xml $(MISC)/zip/Dialogs/ + $(COMMAND_ECHO)$(MKDIR) $(MISC)/zip/Dialogs/Standard + $(COMMAND_ECHO)$(COPY) dialog-lb.xml OptionsDlg.xml $(MISC)/zip/Dialogs/Standard/ + $(COMMAND_ECHO)cd $(MISC)/zip && zip -rD $(@:f) . + +.INCLUDE: target.mk diff --git a/smoketest/data/manifest.xml b/smoketest/data/manifest.xml new file mode 100644 index 000000000000..48fc9ce900a0 --- /dev/null +++ b/smoketest/data/manifest.xml @@ -0,0 +1,49 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!--********************************************************************** +* +* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +* +* Copyright 2000, 2010 Oracle and/or its affiliates. +* +* OpenOffice.org - a multi-platform office productivity suite +* +* This file is part of OpenOffice.org. +* +* OpenOffice.org is free software: you can redistribute it and/or modify +* it under the terms of the GNU Lesser General Public License version 3 +* only, as published by the Free Software Foundation. +* +* OpenOffice.org is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU Lesser General Public License version 3 for more details +* (a copy is included in the LICENSE file that accompanied this code). +* +* You should have received a copy of the GNU Lesser General Public License +* version 3 along with OpenOffice.org. If not, see +* <http://www.openoffice.org/license.html> +* for a copy of the LGPLv3 License. +* +**********************************************************************--> +<!DOCTYPE manifest:manifest PUBLIC "-//OpenOffice.org//DTD Manifest 1.0//EN" "Manifest.dtd"> +<manifest:manifest xmlns:manifest="http://openoffice.org/2001/manifest"> + <manifest:file-entry manifest:media-type="application/vnd.sun.xml.writer" manifest:full-path="/"/> + <manifest:file-entry manifest:media-type="text/xml" manifest:full-path="Dialogs/dialog-lc.xml"/> + <manifest:file-entry manifest:media-type="text/xml" manifest:full-path="Dialogs/Standard/dialog-lb.xml"/> + <manifest:file-entry manifest:media-type="text/xml" manifest:full-path="Dialogs/Standard/OptionsDlg.xml"/> + <manifest:file-entry manifest:media-type="" manifest:full-path="Dialogs/Standard/"/> + <manifest:file-entry manifest:media-type="" manifest:full-path="Dialogs/"/> + <manifest:file-entry manifest:media-type="text/xml" manifest:full-path="content.xml"/> + <manifest:file-entry manifest:media-type="text/xml" manifest:full-path="Basic/Standard/Global.xml"/> + <manifest:file-entry manifest:media-type="text/xml" manifest:full-path="Basic/Standard/Events.xml"/> + <manifest:file-entry manifest:media-type="text/xml" manifest:full-path="Basic/Standard/Test_DB.xml"/> + <manifest:file-entry manifest:media-type="text/xml" manifest:full-path="Basic/Standard/script-lb.xml"/> + <manifest:file-entry manifest:media-type="text/xml" manifest:full-path="Basic/Standard/Test_10er.xml"/> + <manifest:file-entry manifest:media-type="text/xml" manifest:full-path="Basic/Standard/Test_Ext.xml"/> + <manifest:file-entry manifest:media-type="" manifest:full-path="Basic/Standard/"/> + <manifest:file-entry manifest:media-type="text/xml" manifest:full-path="Basic/script-lc.xml"/> + <manifest:file-entry manifest:media-type="" manifest:full-path="Basic/"/> + <manifest:file-entry manifest:media-type="text/xml" manifest:full-path="styles.xml"/> + <manifest:file-entry manifest:media-type="text/xml" manifest:full-path="meta.xml"/> + <manifest:file-entry manifest:media-type="text/xml" manifest:full-path="settings.xml"/> +</manifest:manifest> diff --git a/smoketest/data/meta.xml b/smoketest/data/meta.xml new file mode 100644 index 000000000000..43f14295e2b3 --- /dev/null +++ b/smoketest/data/meta.xml @@ -0,0 +1,28 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!--********************************************************************** +* +* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +* +* Copyright 2000, 2010 Oracle and/or its affiliates. +* +* OpenOffice.org - a multi-platform office productivity suite +* +* This file is part of OpenOffice.org. +* +* OpenOffice.org is free software: you can redistribute it and/or modify +* it under the terms of the GNU Lesser General Public License version 3 +* only, as published by the Free Software Foundation. +* +* OpenOffice.org is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU Lesser General Public License version 3 for more details +* (a copy is included in the LICENSE file that accompanied this code). +* +* You should have received a copy of the GNU Lesser General Public License +* version 3 along with OpenOffice.org. If not, see +* <http://www.openoffice.org/license.html> +* for a copy of the LGPLv3 License. +* +**********************************************************************--> +<office:document-meta xmlns:office="http://openoffice.org/2000/office" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:meta="http://openoffice.org/2000/meta" xmlns:ooo="http://openoffice.org/2004/office" xmlns:grddl="http://www.w3.org/2003/g/data-view#" office:version="1.2" grddl:transformation="http://docs.oasis-open.org/office/1.2/xslt/odf2rdf.xsl"><office:meta><meta:generator>Oracle_Open_Office/3.2$Win32 OpenOffice.org_project/300m77$Build-9496$CWS-renaissance2</meta:generator><meta:creation-date>2001-06-08T15:59:03</meta:creation-date><dc:date>2007-01-18T12:45:22</dc:date><dc:language>de-DE</dc:language><meta:editing-cycles>0</meta:editing-cycles><meta:editing-duration>PT0S</meta:editing-duration><meta:user-defined meta:name="Info 0"/><meta:user-defined meta:name="Info 2"/><meta:user-defined meta:name="Info 3"/><meta:user-defined meta:name="Info 4"/><meta:document-statistic meta:table-count="0" meta:image-count="0" meta:object-count="0" meta:page-count="1" meta:paragraph-count="1" meta:word-count="0" meta:character-count="3"/></office:meta></office:document-meta> diff --git a/smoketest/data/script-lb.xml b/smoketest/data/script-lb.xml new file mode 100644 index 000000000000..fc4f6c6370ba --- /dev/null +++ b/smoketest/data/script-lb.xml @@ -0,0 +1,35 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!--********************************************************************** +* +* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +* +* Copyright 2000, 2010 Oracle and/or its affiliates. +* +* OpenOffice.org - a multi-platform office productivity suite +* +* This file is part of OpenOffice.org. +* +* OpenOffice.org is free software: you can redistribute it and/or modify +* it under the terms of the GNU Lesser General Public License version 3 +* only, as published by the Free Software Foundation. +* +* OpenOffice.org is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU Lesser General Public License version 3 for more details +* (a copy is included in the LICENSE file that accompanied this code). +* +* You should have received a copy of the GNU Lesser General Public License +* version 3 along with OpenOffice.org. If not, see +* <http://www.openoffice.org/license.html> +* for a copy of the LGPLv3 License. +* +**********************************************************************--> +<!DOCTYPE library:library PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "library.dtd"> +<library:library xmlns:library="http://openoffice.org/2000/library" library:name="Standard" library:readonly="false" library:passwordprotected="false"> + <library:element library:name="Global"/> + <library:element library:name="Test_10er"/> + <library:element library:name="Test_DB"/> + <library:element library:name="Events"/> + <library:element library:name="Test_Ext"/> +</library:library> diff --git a/smoketest/data/script-lc.xml b/smoketest/data/script-lc.xml new file mode 100644 index 000000000000..e3a5a0e326e4 --- /dev/null +++ b/smoketest/data/script-lc.xml @@ -0,0 +1,31 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!--********************************************************************** +* +* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +* +* Copyright 2000, 2010 Oracle and/or its affiliates. +* +* OpenOffice.org - a multi-platform office productivity suite +* +* This file is part of OpenOffice.org. +* +* OpenOffice.org is free software: you can redistribute it and/or modify +* it under the terms of the GNU Lesser General Public License version 3 +* only, as published by the Free Software Foundation. +* +* OpenOffice.org is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU Lesser General Public License version 3 for more details +* (a copy is included in the LICENSE file that accompanied this code). +* +* You should have received a copy of the GNU Lesser General Public License +* version 3 along with OpenOffice.org. If not, see +* <http://www.openoffice.org/license.html> +* for a copy of the LGPLv3 License. +* +**********************************************************************--> +<!DOCTYPE library:libraries PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "libraries.dtd"> +<library:libraries xmlns:library="http://openoffice.org/2000/library" xmlns:xlink="http://www.w3.org/1999/xlink"> + <library:library library:name="Standard" library:link="false"/> +</library:libraries> diff --git a/smoketest/data/settings.xml b/smoketest/data/settings.xml new file mode 100644 index 000000000000..cd4524b741ff --- /dev/null +++ b/smoketest/data/settings.xml @@ -0,0 +1,28 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!--********************************************************************** +* +* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +* +* Copyright 2000, 2010 Oracle and/or its affiliates. +* +* OpenOffice.org - a multi-platform office productivity suite +* +* This file is part of OpenOffice.org. +* +* OpenOffice.org is free software: you can redistribute it and/or modify +* it under the terms of the GNU Lesser General Public License version 3 +* only, as published by the Free Software Foundation. +* +* OpenOffice.org is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU Lesser General Public License version 3 for more details +* (a copy is included in the LICENSE file that accompanied this code). +* +* You should have received a copy of the GNU Lesser General Public License +* version 3 along with OpenOffice.org. If not, see +* <http://www.openoffice.org/license.html> +* for a copy of the LGPLv3 License. +* +**********************************************************************--> +<office:document-settings xmlns:office="http://openoffice.org/2000/office" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:config="http://openoffice.org/2001/config" xmlns:ooo="http://openoffice.org/2004/office" office:version="1.2"><office:settings><config:config-item-set config:name="view-settings"><config:config-item config:name="ViewAreaTop" config:type="int">0</config:config-item><config:config-item config:name="ViewAreaLeft" config:type="int">0</config:config-item><config:config-item config:name="ViewAreaWidth" config:type="int">36382</config:config-item><config:config-item config:name="ViewAreaHeight" config:type="int">17120</config:config-item><config:config-item config:name="ShowRedlineChanges" config:type="boolean">true</config:config-item><config:config-item config:name="InBrowseMode" config:type="boolean">false</config:config-item><config:config-item-map-indexed config:name="Views"><config:config-item-map-entry><config:config-item config:name="ViewId" config:type="string">view2</config:config-item><config:config-item config:name="ViewLeft" config:type="int">17120</config:config-item><config:config-item config:name="ViewTop" config:type="int">3002</config:config-item><config:config-item config:name="VisibleLeft" config:type="int">0</config:config-item><config:config-item config:name="VisibleTop" config:type="int">0</config:config-item><config:config-item config:name="VisibleRight" config:type="int">36380</config:config-item><config:config-item config:name="VisibleBottom" config:type="int">17119</config:config-item><config:config-item config:name="ZoomType" config:type="short">0</config:config-item><config:config-item config:name="ViewLayoutColumns" config:type="short">0</config:config-item><config:config-item config:name="ViewLayoutBookMode" config:type="boolean">false</config:config-item><config:config-item config:name="ZoomFactor" config:type="short">100</config:config-item><config:config-item config:name="IsSelectedFrame" config:type="boolean">false</config:config-item></config:config-item-map-entry></config:config-item-map-indexed></config:config-item-set><config:config-item-set config:name="configuration-settings"><config:config-item config:name="AddParaSpacingToTableCells" config:type="boolean">false</config:config-item><config:config-item config:name="PrintPaperFromSetup" config:type="boolean">false</config:config-item><config:config-item config:name="IsKernAsianPunctuation" config:type="boolean">false</config:config-item><config:config-item config:name="PrintReversed" config:type="boolean">false</config:config-item><config:config-item config:name="LinkUpdateMode" config:type="short">1</config:config-item><config:config-item config:name="DoNotCaptureDrawObjsOnPage" config:type="boolean">false</config:config-item><config:config-item config:name="SaveVersionOnClose" config:type="boolean">false</config:config-item><config:config-item config:name="PrintEmptyPages" config:type="boolean">true</config:config-item><config:config-item config:name="PrintSingleJobs" config:type="boolean">false</config:config-item><config:config-item config:name="AllowPrintJobCancel" config:type="boolean">true</config:config-item><config:config-item config:name="AddFrameOffsets" config:type="boolean">false</config:config-item><config:config-item config:name="PrintLeftPages" config:type="boolean">true</config:config-item><config:config-item config:name="PrintTables" config:type="boolean">true</config:config-item><config:config-item config:name="ProtectForm" config:type="boolean">false</config:config-item><config:config-item config:name="ChartAutoUpdate" config:type="boolean">true</config:config-item><config:config-item config:name="PrintControls" config:type="boolean">true</config:config-item><config:config-item config:name="PrinterSetup" config:type="base64Binary">GgX+/01pY3Jvc29mdCBYUFMgRG9jdW1lbnQgV3JpdGVyAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAATWljcm9zb2Z0IFhQUyBEb2N1bWVudCBXcml0ZXIAAAAWAAEAPAQAAAAAAAAFAFZUAAAkbQAAM1ROVwIACABNAGkAYwByAG8AcwBvAGYAdAAgAFgAUABTACAARABvAGMAdQBtAGUAbgB0ACAAVwByAGkAdABlAHIAAAAAAAAAAQQABtwAWAMD/wAAAQABAJoLNAhkAAEADwBYAgIAAQBYAgIAAABBADQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAEAAAACAAAAAQAAAP////8AAAAAAAAAAAAAAAAAAAAARElOVSIAEAFMAwwAytL2cgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAJAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAQAQAAU01USgAAAAAQAAABTQBpAGMAcgBvAHMAbwBmAHQAIABYAFAAUwAgAEQAbwBjAHUAbQBlAG4AdAAgAFcAcgBpAHQAZQByAAAASW5wdXRCaW4ARk9STVNPVVJDRQBSRVNETEwAVW5pcmVzRExMAEludGVybGVhdmluZwBPRkYASW1hZ2VUeXBlAEpQRUdNZWQAT3JpZW50YXRpb24AUE9SVFJBSVQAQ29sbGF0ZQBPRkYAUmVzb2x1dGlvbgBPcHRpb24xAFBhcGVyU2l6ZQBMRVRURVIAQ29sb3JNb2RlADI0YnBwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAwAAABNWERXAQEAABIAQ09NUEFUX0RVUExFWF9NT0RFDgBEVVBMRVhfVU5LTk9XTg==</config:config-item><config:config-item config:name="CurrentDatabaseDataSource" config:type="string">Adreßbuch</config:config-item><config:config-item config:name="LoadReadonly" config:type="boolean">false</config:config-item><config:config-item config:name="CurrentDatabaseCommand" config:type="string">adressen</config:config-item><config:config-item config:name="ConsiderTextWrapOnObjPos" config:type="boolean">false</config:config-item><config:config-item config:name="ApplyUserData" config:type="boolean">false</config:config-item><config:config-item config:name="AddParaTableSpacing" config:type="boolean">false</config:config-item><config:config-item config:name="FieldAutoUpdate" config:type="boolean">true</config:config-item><config:config-item config:name="IgnoreFirstLineIndentInNumbering" config:type="boolean">true</config:config-item><config:config-item config:name="TabsRelativeToIndent" config:type="boolean">true</config:config-item><config:config-item config:name="IgnoreTabsAndBlanksForLineCalculation" config:type="boolean">false</config:config-item><config:config-item config:name="PrintAnnotationMode" config:type="short">0</config:config-item><config:config-item config:name="AddParaTableSpacingAtStart" config:type="boolean">false</config:config-item><config:config-item config:name="UseOldPrinterMetrics" config:type="boolean">true</config:config-item><config:config-item config:name="TableRowKeep" config:type="boolean">false</config:config-item><config:config-item config:name="PrinterName" config:type="string">Microsoft XPS Document Writer</config:config-item><config:config-item config:name="PrintFaxName" config:type="string"/><config:config-item config:name="UnxForceZeroExtLeading" config:type="boolean">true</config:config-item><config:config-item config:name="PrintTextPlaceholder" config:type="boolean">false</config:config-item><config:config-item config:name="DoNotJustifyLinesWithManualBreak" config:type="boolean">true</config:config-item><config:config-item config:name="PrintRightPages" config:type="boolean">true</config:config-item><config:config-item config:name="CharacterCompressionType" config:type="short">0</config:config-item><config:config-item config:name="UseFormerTextWrapping" config:type="boolean">true</config:config-item><config:config-item config:name="IsLabelDocument" config:type="boolean">false</config:config-item><config:config-item config:name="AlignTabStopPosition" config:type="boolean">false</config:config-item><config:config-item config:name="PrintHiddenText" config:type="boolean">false</config:config-item><config:config-item config:name="DoNotResetParaAttrsForNumFont" config:type="boolean">true</config:config-item><config:config-item config:name="PrintPageBackground" config:type="boolean">true</config:config-item><config:config-item config:name="CurrentDatabaseCommandType" config:type="int">0</config:config-item><config:config-item config:name="OutlineLevelYieldsNumbering" config:type="boolean">true</config:config-item><config:config-item config:name="PrintProspect" config:type="boolean">false</config:config-item><config:config-item config:name="PrintGraphics" config:type="boolean">true</config:config-item><config:config-item config:name="SaveGlobalDocumentLinks" config:type="boolean">false</config:config-item><config:config-item config:name="PrintProspectRTL" config:type="boolean">false</config:config-item><config:config-item config:name="UseFormerLineSpacing" config:type="boolean">true</config:config-item><config:config-item config:name="AddExternalLeading" config:type="boolean">false</config:config-item><config:config-item config:name="UseFormerObjectPositioning" config:type="boolean">true</config:config-item><config:config-item config:name="RedlineProtectionKey" config:type="base64Binary"/><config:config-item config:name="ClipAsCharacterAnchoredWriterFlyFrames" config:type="boolean">false</config:config-item><config:config-item config:name="UseOldNumbering" config:type="boolean">true</config:config-item><config:config-item config:name="PrintDrawings" config:type="boolean">true</config:config-item><config:config-item config:name="PrinterIndependentLayout" config:type="string">disabled</config:config-item><config:config-item config:name="TabAtLeftIndentForParagraphsInList" config:type="boolean">false</config:config-item><config:config-item config:name="PrintBlackFonts" config:type="boolean">false</config:config-item><config:config-item config:name="UpdateFromTemplate" config:type="boolean">false</config:config-item></config:config-item-set></office:settings></office:document-settings> diff --git a/smoketest/data/styles.xml b/smoketest/data/styles.xml new file mode 100644 index 000000000000..3f8d75fa6db3 --- /dev/null +++ b/smoketest/data/styles.xml @@ -0,0 +1,28 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!--********************************************************************** +* +* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +* +* Copyright 2000, 2010 Oracle and/or its affiliates. +* +* OpenOffice.org - a multi-platform office productivity suite +* +* This file is part of OpenOffice.org. +* +* OpenOffice.org is free software: you can redistribute it and/or modify +* it under the terms of the GNU Lesser General Public License version 3 +* only, as published by the Free Software Foundation. +* +* OpenOffice.org is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU Lesser General Public License version 3 for more details +* (a copy is included in the LICENSE file that accompanied this code). +* +* You should have received a copy of the GNU Lesser General Public License +* version 3 along with OpenOffice.org. If not, see +* <http://www.openoffice.org/license.html> +* for a copy of the LGPLv3 License. +* +**********************************************************************--> +<office:document-styles xmlns:office="http://openoffice.org/2000/office" xmlns:style="http://openoffice.org/2000/style" xmlns:text="http://openoffice.org/2000/text" xmlns:table="http://openoffice.org/2000/table" xmlns:draw="http://openoffice.org/2000/drawing" xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:meta="http://openoffice.org/2000/meta" xmlns:number="http://openoffice.org/2000/datastyle" xmlns:svg="http://www.w3.org/2000/svg" xmlns:chart="http://openoffice.org/2000/chart" xmlns:dr3d="http://openoffice.org/2000/dr3d" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:form="http://openoffice.org/2000/form" xmlns:script="http://openoffice.org/2000/script" xmlns:ooo="http://openoffice.org/2004/office" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:dom="http://www.w3.org/2001/xml-events" xmlns:rpt="http://openoffice.org/2005/report" xmlns:of="urn:oasis:names:tc:opendocument:xmlns:of:1.2" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:grddl="http://www.w3.org/2003/g/data-view#" xmlns:tableooo="http://openoffice.org/2009/table" office:version="1.2" grddl:transformation="http://docs.oasis-open.org/office/1.2/xslt/odf2rdf.xsl"><office:font-decls><style:font-decl style:name="Arial Unicode MS" fo:font-family="'Arial Unicode MS'" style:font-pitch="variable"/><style:font-decl style:name="HG Mincho Light J" fo:font-family="'HG Mincho Light J', 'MS Mincho', 'HG Mincho J', 'HG Mincho L', 'HG Mincho', Mincho, 'MS PMincho', 'MS Gothic', 'HG Gothic J', 'HG Gothic B', 'HG Gothic', Gothic, 'MS PGothic', 'Andale Sans UI', 'Arial Unicode MS', 'Lucida Sans Unicode', Tahoma" style:font-pitch="variable"/><style:font-decl style:name="Thorndale" fo:font-family="Thorndale, 'Times New Roman', Times, 'Lucida Serif', 'Lucida Bright', Timmons, 'New York', Serif" style:font-family-generic="roman" style:font-pitch="variable"/><style:font-decl style:name="Arial" fo:font-family="Arial" style:font-family-generic="swiss" style:font-pitch="variable"/></office:font-decls><office:styles><style:default-style style:family="graphics"><style:properties draw:shadow-offset-x="0.3cm" draw:shadow-offset-y="0.3cm" draw:start-line-spacing-horizontal="0.283cm" draw:start-line-spacing-vertical="0.283cm" draw:end-line-spacing-horizontal="0.283cm" draw:end-line-spacing-vertical="0.283cm" style:text-autospace="ideograph-alpha" style:line-break="strict" style:writing-mode="lr-tb" style:font-independent-line-spacing="false" fo:color="#000000" fo:font-size="12pt" fo:language="de" fo:country="DE" style:font-size-asian="12pt" style:language-asian="zxx" style:country-asian="none" style:font-size-complex="12pt" style:language-complex="zxx" style:country-complex="none"><style:tab-stops/></style:properties></style:default-style><style:default-style style:family="paragraph"><style:properties fo:hyphenation-ladder-count="no-limit" style:text-autospace="ideograph-alpha" style:punctuation-wrap="hanging" style:line-break="strict" style:tab-stop-distance="1.251cm" style:writing-mode="lr-tb" fo:color="#000000" style:font-name="Thorndale" fo:font-size="12pt" fo:language="de" fo:country="DE" style:font-name-asian="HG Mincho Light J" style:font-size-asian="12pt" style:language-asian="zxx" style:country-asian="none" style:font-name-complex="Arial Unicode MS" style:font-size-complex="12pt" style:language-complex="zxx" style:country-complex="none" fo:hyphenate="false" fo:hyphenation-remain-char-count="2" fo:hyphenation-push-char-count="2"/></style:default-style><style:default-style style:family="table"><style:properties table:border-model="separating"/></style:default-style><style:default-style style:family="table-row"><style:properties fo:keep-together="always"/></style:default-style><style:style style:name="Standard" style:family="paragraph" style:class="text"/><style:style style:name="Text body" style:family="paragraph" style:parent-style-name="Standard" style:class="text"><style:properties fo:margin-top="0cm" fo:margin-bottom="0.212cm"/></style:style><style:style style:name="Heading" style:family="paragraph" style:parent-style-name="Standard" style:next-style-name="Text body" style:class="text"><style:properties fo:margin-top="0.423cm" fo:margin-bottom="0.212cm" fo:keep-with-next="true" style:font-name="Arial" fo:font-size="14pt"/></style:style><style:style style:name="List" style:family="paragraph" style:parent-style-name="Text body" style:class="list"/><style:style style:name="Table Contents" style:family="paragraph" style:parent-style-name="Text body" style:class="extra"/><style:style style:name="Table Heading" style:family="paragraph" style:parent-style-name="Table Contents" style:class="extra"><style:properties fo:text-align="center" style:justify-single-word="false" fo:font-style="italic" fo:font-weight="bold"/></style:style><style:style style:name="Caption" style:family="paragraph" style:parent-style-name="Standard" style:class="extra"><style:properties fo:margin-top="0.212cm" fo:margin-bottom="0.212cm" fo:font-size="10pt" fo:font-style="italic"/></style:style><style:style style:name="Index" style:family="paragraph" style:parent-style-name="Standard" style:class="index"/><style:style style:name="Footnote Symbol" style:family="text"/><style:style style:name="Endnote Symbol" style:family="text"/><text:outline-style style:name="Outline"><text:outline-level-style text:level="1" style:num-format=""><style:properties/></text:outline-level-style><text:outline-level-style text:level="2" style:num-format=""><style:properties/></text:outline-level-style><text:outline-level-style text:level="3" style:num-format=""><style:properties/></text:outline-level-style><text:outline-level-style text:level="4" style:num-format=""><style:properties/></text:outline-level-style><text:outline-level-style text:level="5" style:num-format=""><style:properties/></text:outline-level-style><text:outline-level-style text:level="6" style:num-format=""><style:properties/></text:outline-level-style><text:outline-level-style text:level="7" style:num-format=""><style:properties/></text:outline-level-style><text:outline-level-style text:level="8" style:num-format=""><style:properties/></text:outline-level-style><text:outline-level-style text:level="9" style:num-format=""><style:properties/></text:outline-level-style><text:outline-level-style text:level="10" style:num-format=""><style:properties/></text:outline-level-style></text:outline-style><text:footnotes-configuration text:citation-style-name="Footnote Symbol" style:num-format="1" text:start-value="0" text:footnotes-position="page" text:start-numbering-at="page"/><text:endnotes-configuration text:citation-style-name="Endnote Symbol" text:master-page-name="Endnote" style:num-format="1" text:start-value="0"/><text:linenumbering-configuration text:number-lines="false" text:offset="0.499cm" style:num-format="1" text:number-position="left" text:increment="5"/></office:styles><office:automatic-styles><style:page-master style:name="Mpm1"><style:properties fo:page-width="20.999cm" fo:page-height="29.699cm" style:num-format="1" style:print-orientation="portrait" fo:margin-top="2cm" fo:margin-bottom="2cm" fo:margin-left="2cm" fo:margin-right="2cm" style:writing-mode="lr-tb" style:footnote-max-height="0cm"><style:footnote-sep style:width="0.018cm" style:distance-before-sep="0.101cm" style:distance-after-sep="0.101cm" style:adjustment="left" style:rel-width="25%" style:color="#000000"/></style:properties><style:header-style/><style:footer-style/></style:page-master><style:page-master style:name="Mpm2"><style:properties fo:page-width="20.999cm" fo:page-height="29.699cm" style:num-format="1" style:print-orientation="portrait" fo:margin-top="2cm" fo:margin-bottom="2cm" fo:margin-left="2cm" fo:margin-right="2cm" style:writing-mode="lr-tb" style:footnote-max-height="0cm"><style:footnote-sep style:adjustment="left" style:rel-width="25%" style:color="#000000"/></style:properties><style:header-style/><style:footer-style/></style:page-master></office:automatic-styles><office:master-styles><style:master-page style:name="Standard" style:page-master-name="Mpm1"/><style:master-page style:name="Endnote" style:page-master-name="Mpm2"/></office:master-styles></office:document-styles> diff --git a/smoketest/losmoketest b/smoketest/losmoketest new file mode 100755 index 000000000000..b3faee16b817 --- /dev/null +++ b/smoketest/losmoketest @@ -0,0 +1,61 @@ +#!/bin/sh + +# Version: MPL 1.1 / GPLv3+ / LGPLv3+ +# +# The contents of this file are subject to the Mozilla Public License Version +# 1.1 (the "License"); you may not use this file except in compliance with +# the License or as specified alternatively below. You may obtain a copy of +# the License at http://www.mozilla.org/MPL/ +# +# Software distributed under the License is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +# for the specific language governing rights and limitations under the +# License. +# +# Major Contributor(s): +# [ Copyright (C) 2011 Petr Mladek <pmladek@suse.cz> (initial developer) ] +# [ Copyright (C) 2011 Yifan Jiang <yfjiang@suse.com> ] +# +# All Rights Reserved. +# +# For minor contributions see the git repository. +# +# Alternatively, the contents of this file may be used under the terms of +# either the GNU General Public License Version 3 or later (the "GPLv3+"), or +# the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"), +# in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable +# instead of those above. + + +# resolve installation directory +sd_cwd=`pwd` +sd_res=$0 +while [ -h "$sd_res" ] ; do + cd "`dirname "$sd_res"`" + sd_basename=`basename "$sd_res"` + sd_res=`ls -l "$sd_basename" | sed "s/.*$sd_basename -> //g"` +done +cd "`dirname "$sd_res"`" +sd_prog=`pwd` +cd "$sd_cwd" + +user_conf_dir=`grep UserInstallation $sd_prog/bootstraprc | sed -e "s|UserInstallation=||" -e "s|\\$SYSUSERCONFIG|$HOME/.config|"` + +case "`uname -s`" in +Linux) + sd_prog1="$sd_prog" + sd_prog2="$sd_prog/../ure/lib" + LD_LIBRARY_PATH=$sd_prog1:$sd_prog2${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH} + export LD_LIBRARY_PATH + ;; +esac + +exec $sd_prog/cppunittester \ + -env:UNO_SERVICES=file://$sd_prog/../ure/share/misc/services.rdb \ + -env:UNO_TYPES=file://$sd_prog/../ure/share/misc/test/types.rdb \ + -env:arg-soffice=path:$sd_prog/soffice \ + -env:arg-user=$user_conf_dir \ + -env:arg-env=$LD_LIBRARY_PATH \ + -env:arg-testarg.smoketest.doc=$sd_prog/../share/test/smoketestdoc.sxw \ + --protector $sd_prog/unoexceptionprotector.so unoexceptionprotector \ + $sd_prog/libsmoketest.so diff --git a/smoketest/losmoketest.py b/smoketest/losmoketest.py new file mode 100755 index 000000000000..4c8699763fb3 --- /dev/null +++ b/smoketest/losmoketest.py @@ -0,0 +1,645 @@ +#!/usr/bin/env python +# Version: MPL 1.1 / GPLv3+ / LGPLv3+ + +# The contents of this file are subject to the Mozilla Public License Version +# 1.1 (the "License"); you may not use this file except in compliance with +# the License or as specified alternatively below. You may obtain a copy of +# the License at http://www.mozilla.org/MPL/ +# +# Software distributed under the License is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +# for the specific language governing rights and limitations under the +# License. +# +# The Initial Developer of the Original Code is +# Yifan Jiang, SUSE <yfjiang@suse.com> +# Portions created by the Initial Developer are Copyright (C) 2011 the +# Initial Developer. All Rights Reserved. +# +# Major Contributor(s): +# +# Portions created by the Ted are Copyright (C) 2010 Ted. All Rights Reserved. +# +# For minor contributions see the git repository. +# +# Alternatively, the contents of this file may be used under the terms of +# either the GNU General Public License Version 3 or later (the "GPLv3+"), or +# the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"), +# in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable +# instead of those above. +## +# The tool is designed to enable test machine fully automatically run smoketest +# with both daily and pre release build located in dev-build.libreoffice.org. +# +# The tool is named as losmoketest for its purpose, meanwhile it help you to +# check, download and install the latest build. By the fact the installation is +# designed not to be different from manually doing these repeated work, the +# installed libreoffice build can also be good for manual test. + +import sys, os, platform +import datetime, time +import subprocess, shutil +import glob, re +import urllib, urllib2 +import logging, getopt +try: + import ConfigParser as configparser # Python 3.0 change +except ImportError: + import configparser + +# FIXME: make this configurable via options or autodetect it +build_version = "3.5" +tag_version = "3-5" +# devel build +install_dirname="lo-dev" +branding_pack="libo-dev" +basis_pack="libobasis-dev" +ure_pack="lodev" +# stable build +#install_dirname="libreoffice" + build_version +#branding_pack="libreoffice" +#basis_pack="libobasis" +#ure_pack="libreoffice" + +build_check_interval = 5 #seconds + +# Distro list +RPM_DISTRO_LIST = ['SuSE', 'fedora', 'redhat', 'centos', 'mandrake', 'mandriva', 'yellowdog', 'turbolinux'] +DEB_DISTRO_LIST = ['debian', 'ubuntu', 'Ubuntu'] + +# Server urls +SERVER_URL = "http://dev-builds.libreoffice.org" + +# Local dirs +root_dir = os.getcwd() +DOWNLOAD_DIR = os.path.join(root_dir, "_download") +USR_DIR = os.path.join(root_dir, "_libo_smoke_user") +LOCAL_BUILD_INFO_FILE = "build.cfg" + +ROOT_DIR_LIB = os.path.join(root_dir, 'lib') +ROOT_DIR_LIB32 = os.path.join(root_dir, 'lib32') +ROOT_DIR_LIB64 = os.path.join(root_dir, 'lib64') +ROOT_DIR_BIN32 = os.path.join(root_dir, 'bin32') +ROOT_DIR_BIN64 = os.path.join(root_dir, 'bin64') + +CPPUNITTESTER = os.path.join(root_dir, 'cppunittester') + +# INSTALL_DIR = os.path.join(root_dir, "_libo_smoke_installation") +INSTALL_DIR = "" # Installation dir + +# SOFFICE_BIN bin +if platform.system() == "Linux": + SOFFICE_BIN= INSTALL_DIR + os.sep + "opt" + os.sep + install_dirname + os.sep + "program" + os.sep + "soffice" + +# Relative build url +## pre-releases +PR_RPM_X86_PATH = "pre-releases/rpm/x86/" +PR_RPM_X86_64_PATH = "pre-releases/rpm/x86_64/" + +PR_DEB_X86_PATH = "pre-releases/deb/x86/" +PR_DEB_X86_64_PATH = "pre-releases/deb/x86_64/" + +PR_MAC_X86_PATH = "pre-releases/mac/x86/" +PR_MAC_PPC_PATH = "pre-releases/mac/ppc/" + +PR_WIN_X86_PATH = "pre-releases/win/x86/" + +## daily_master +DAILY_MASTER_RPM_X86_PATH = "daily/Linux_x86_Release_Configuration/master/current" +DAILY_MASTER_RPM_X86_64_PATH = "daily/Linux_x86_64_Release_Configuration/master/current" + +DAILY_MASTER_DEB_X86_PATH = "daily/Linux_x86_Release_Configuration/master/current" +DAILY_MASTER_DEB_X86_64_PATH = "daily/Linux_x86_64_Release_Configuration/master/current" # No build yet + +DAILY_MASTER_MAC_X86_PATH = "daily/MacOSX_10.6.7_Intel_no-moz/master/current" +DAILY_MASTER_MAC_PPC_PATH = "^$" # No build yet + +DAILY_MASTER_WIN_X86_PATH = "daily/Windows_Release_Configuration/master/current" + +## daily_branch +DAILY_BRANCH_RPM_X86_PATH = "daily/Linux_x86_Release_Configuration/libreoffice-" + tag_version + "/current" +DAILY_BRANCH_RPM_X86_64_PATH = "daily/Linux_x86_64_Release_Configuration/libreoffice-" + tag_version + "/current" + +DAILY_BRANCH_DEB_X86_PATH = "daily/Linux_x86_Release_Configuration/libreoffice-" + tag_version + "/current" +DAILY_BRANCH_DEB_X86_64_PATH = "daily/Linux_x86_64_Release_Configuration/libreoffice-" + tag_version + "/current" + +DAILY_BRANCH_MAC_X86_PATH = "daily/MacOSX_10.6.7_Intel_no-moz/libreoffice-" + tag_version + "/current" +DAILY_BRANCH_MAC_PPC_PATH = "^$" # No build yet + +DAILY_BRANCH_WIN_X86_PATH = "daily/Windows_Release_Configuration/libreoffice-" + tag_version + "/current" + + + +def platform_info(): + + s = platform.system() + arch_name = platform.machine() + + if arch_name in ['x86', 'i386', 'i586', 'i686']: + arch_name = 'x86' + + if s == "Linux": + if platform.dist()[0] in RPM_DISTRO_LIST: + distro_name = platform.dist()[0] + pck_name = 'rpm' + elif platform.dist()[0] in DEB_DISTRO_LIST: + distro_name = platform.dist()[0] + pck_name = 'deb' + elif s == "Windows": + distro_name = platform.dist()[0] + pck_name = 'exe' + else: + distro_name = platform.dist()[0] + pck_name = 'dmg' + + return distro_name, pck_name, arch_name + +def local_build_info(t): + + if not os.path.exists(LOCAL_BUILD_INFO_FILE): + logger.error("Can't find the file: " + LOCAL_BUILD_INFO_FILE) + sys.exit() + + config = configparser.RawConfigParser() + config.read(LOCAL_BUILD_INFO_FILE) + + try: + build_name = config.get(t, 'build_name').strip('\n') + build_time = datetime.datetime.strptime(config.get(t, 'build_time').strip('\n'), '%d-%b-%Y %H:%M') + except ValueError: + build_name = '' + build_time = datetime.datetime.min + + return build_name, build_time + +def get_url_regexp(t, package, arch): + ''' + return a url containing download links, i.e: + + http://dev-builds.libreoffice.org/pre-releases/rpm/x86_64/ + http://dev-builds.libreoffice.org/daily/Windows_Release_Configuration/libreoffice-3-4/current/ + http://dev-builds.libreoffice.org/daily/Linux_x86_Release_Configuration/libreoffice-3-4/current/ + + meanwhile return a regexp object that matching corresponding downloadable + package and its timestamp ''' + + url = "" + reg = re.compile('^$') + pck = package + arc = arch + + if t == 'pre-releases': + if pck == "rpm" and arc == "x86": + url = SERVER_URL + "/" + PR_RPM_X86_PATH + reg = re.compile('\<a\ href=\"(LibO_\d.*x86_install-rpm.*en-US.*\.gz)\".*(\d{2}\-[a-zA-Z]{3}\-\d{4}).*(\d{2}:\d{2}).*') + elif pck == "rpm" and arc == "x86_64": + url = SERVER_URL + "/" + PR_RPM_X86_64_PATH + reg = re.compile('\<a\ href=\"(LibO_\d.*x86-64_install-rpm.*en-US.*\.gz)\".*(\d{2}\-[a-zA-Z]{3}\-\d{4}).*(\d{2}:\d{2}).*') + elif pck == "deb" and arc == "x86": + url = SERVER_URL + "/" + PR_DEB_X86_PATH + reg = re.compile('\<a\ href=\"(LibO_\d.*x86_install-deb.*en-US.*\.gz)\".*(\d{2}\-[a-zA-Z]{3}\-\d{4}).*(\d{2}:\d{2}).*') + elif pck == "deb" and arc == "x86_64": + url = SERVER_URL + "/" + PR_DEB_X86_64_PATH + reg = re.compile('\<a\ href=\"(LibO_\d.*x86-64_install-deb.*en-US.*\.gz)\".*(\d{2}\-[a-zA-Z]{3}\-\d{4}).*(\d{2}:\d{2}).*') + elif pck == "exe" and arc == "x86": + url = SERVER_URL + "/" + PR_WIN_X86_PATH + reg = re.compile('\<a\ href=\"(LibO_\d.*Win_x86_install_multi.exe)\".*(\d{2}\-[a-zA-Z]{3}\-\d{4}).*(\d{2}:\d{2}).*') + elif pck == "dmg" and arc == "x86": + url = SERVER_URL + "/" + PR_MAC_X86_PATH + reg = re.compile('\<a\ href=\"(LibO_\d.*MacOS_x86_install_en-US.dmg)\".*(\d{2}\-[a-zA-Z]{3}\-\d{4}).*(\d{2}:\d{2}).*') + elif pck == "dmg" and arc == "ppc": + url = SERVER_URL + "/" + PR_MAC_PPC_PATH + reg = re.compile('\<a\ href=\"(LibO_\d.*MacOS_PPC_install_en-US.dmg)\".*(\d{2}\-[a-zA-Z]{3}\-\d{4}).*(\d{2}:\d{2}).*') + else: + logger.error("Unable to handle the system or arch!") + elif t == 'daily_master': + if pck == "rpm" and arc == "x86": + url = SERVER_URL + "/" + DAILY_MASTER_RPM_X86_PATH + reg = re.compile('\<a\ href=\"(master\~\d.*LibO-Dev_.*x86_install-rpm_en-US.tar.gz)\".*(\d{2}\-[a-zA-Z]{3}\-\d{4}).*(\d{2}:\d{2}).*') + elif pck == "rpm" and arc == "x86_64": + url = SERVER_URL + "/" + DAILY_MASTER_RPM_X86_64_PATH + reg = re.compile('\<a\ href=\"(master\~\d.*LibO-Dev_.*x86-64_install-rpm_en-US.tar.gz)\".*(\d{2}\-[a-zA-Z]{3}\-\d{4}).*(\d{2}:\d{2}).*') + elif pck == "deb" and arc == "x86": + url = SERVER_URL + "/" + DAILY_MASTER_DEB_X86_PATH + reg = re.compile('\<a\ href=\"(master\~\d.*LibO-Dev_.*x86_install-deb_en-US.tar.gz)\".*(\d{2}\-[a-zA-Z]{3}\-\d{4}).*(\d{2}:\d{2}).*') + elif pck == "deb" and arc == "x86_64": + url = SERVER_URL + "/" + DAILY_MASTER_DEB_X86_64_PATH + reg = re.compile('^$') # No build yet + elif pck == "exe" and arc == "x86": + url = SERVER_URL + "/" + DAILY_MASTER_WIN_X86_PATH + reg = re.compile('^$') # No build yet + elif pck == "dmg" and arc == "x86": + url = SERVER_URL + "/" + DAILY_MASTER_MAC_X86_PATH + reg = re.compile('\<a\ href=\"(master\~\d.*LibO-Dev_.*x86_install_en-US.dmg)\".*(\d{2}\-[a-zA-Z]{3}\-\d{4}).*(\d{2}:\d{2}).*') + elif pck == "dmg" and arc == "ppc": + url = SERVER_URL + "/" + DAILY_MASTER_MAC_PPC_PATH + reg = re.compile('^$') # No build yet + else: + logger.error("Unable to handle the system or arch!") + elif t == 'daily_branch': + if pck == "rpm" and arc == "x86": + url = SERVER_URL + "/" + DAILY_BRANCH_RPM_X86_PATH + reg = re.compile('\<a\ href=\"(.*LibO_.*x86_install-rpm_en-US\.tar\.gz)\".*(\d{2}\-[a-zA-Z]{3}\-\d{4}).*(\d{2}:\d{2}).*') + elif pck == "rpm" and arc == "x86_64": + url = SERVER_URL + "/" + DAILY_BRANCH_RPM_X86_64_PATH + reg = re.compile('\<a\ href=\"(.*LibO_.*x86-64_install-rpm_en-US\.tar\.gz)\".*(\d{2}\-[a-zA-Z]{3}\-\d{4}).*(\d{2}:\d{2}).*') + elif pck == "deb" and arc == "x86": + url = SERVER_URL + "/" + DAILY_BRANCH_DEB_X86_PATH + reg = re.compile('\<a\ href=\"(.*LibO_.*x86_install-deb_en-US\.tar\.gz)\".*(\d{2}\-[a-zA-Z]{3}\-\d{4}).*(\d{2}:\d{2}).*') + elif pck == "deb" and arc == "x86_64": + url = SERVER_URL + "/" + DAILY_BRANCH_DEB_X86_64_PATH + reg = re.compile('\<a\ href=\"(.*LibO_.*x86-64_install-deb_en-US\.tar\.gz)\".*(\d{2}\-[a-zA-Z]{3}\-\d{4}).*(\d{2}:\d{2}).*') + elif pck == "exe" and arc == "x86": + url = SERVER_URL + "/" + DAILY_BRANCH_WIN_X86_PATH + reg = re.compile('\<a\ href=\"(.*LibO_.*install_.*\.exe)\".*(\d{2}\-[a-zA-Z]{3}\-\d{4}).*(\d{2}:\d{2}).*') + elif pck == "dmg" and arc == "x86": + url = SERVER_URL + "/" + DAILY_BRANCH_MAC_X86_PATH + reg = re.compile('^$') # No build yet + elif pck == "dmg" and arc == "ppc": + url = SERVER_URL + "/" + DAILY_BRANCH_MAC_PPC_PATH + reg = re.compile('^$') # No build yet + else: + logger.error("Unable to handle the system or arch!") + else: + logger.error("Error build type! The build type has to be:\n pre-releases, daily_master, daily_branch") + + return url, reg + +def remote_build_info(url_reg): + ''' Get the latest proper build info (build_name, build_time) from + url. ''' + + p = platform_info() + pck = p[1] + arc = p[2] + r = url_reg[1] + + f = urllib2.urlopen(url_reg[0]) + c = ''.join(f.readlines()) + f.close() + + build_list = r.findall(c) + + build_name = '' + build_time = datetime.datetime.min + + for b in build_list: + if datetime.datetime.strptime(b[1] + ' ' + b[2], '%d-%b-%Y %H:%M') > build_time: + build_name = b[0] + try: + build_time = datetime.datetime.strptime(b[1] + ' ' + b[2], '%d-%b-%Y %H:%M') + except: + print "remote_build_info: wrong time date&format" + + return build_name, build_time + +# return True when something was downloaded +def download(url_reg, build_type): + logger.info('Checking new build ...') + + try: + remote_build = remote_build_info(url_reg) + local_build = local_build_info(build_type) + +# print 'remote_build[1]=' + remote_build[1].isoformat() +# print 'local_build[1]=' + local_build[1].isoformat() + if remote_build[1] > local_build[1]: + logger.info('Found New build: ' + remote_build[0]) + if fetch_build(url_reg[0], remote_build[0]): + set_build_config(build_type, 'build_name', remote_build[0]) + set_build_config(build_type, 'build_time', datetime.datetime.strftime(remote_build[1], '%d-%b-%Y %H:%M')) + else: + logger.error('Download build failed!') + else: + return False + + except urllib2.URLError, HTTPError: + logger.error('Error fetch remote build info.') + return False + except KeyboardInterrupt: + sys.exit() + except: + print "Some Error" + return False + + return True + + +def fetch_build(url, filename): + ''' Download a build from address url/filename ''' + + logger.info("Downloading ... " + filename) + + u = urllib2.urlopen(url + '/' + filename) + + try: + f = open(DOWNLOAD_DIR + '/' + filename, 'wb') + f.write(u.read()) + finally: + f.close() + + return True + +def set_build_config(section, option, value): + + config = configparser.RawConfigParser() + config.readfp(open(LOCAL_BUILD_INFO_FILE)) + config.set(section, option, value) + with open(LOCAL_BUILD_INFO_FILE, 'wb') as cfgfile: + config.write(cfgfile) + +def uninstall(): + ''' Kill libreoffice processes and uninstall all previously installed + libreoffice packages ''' + + logger.info("Uninstalling ...") + + pck = platform_info()[1] + + if pck == 'rpm': + cmd_query = ["rpm", "-qa"] + cmd_filter = ["grep", "-e", branding_pack+build_version, "-e", basis_pack+build_version, "-e", ure_pack+build_version] + + P_query = subprocess.Popen(cmd_query, stdout = subprocess.PIPE) + P_filter = subprocess.Popen(cmd_filter, stdin = P_query.stdout, stdout = subprocess.PIPE) + P_query.stdout.close() # protection when P_filter exit before P_query + str_filter = P_filter.communicate()[0] + + if str_filter == "": + logger.warning("Nothing to uninstall") + return + else: + cmd = ["sudo", "rpm", "-e"] + str_filter.split() + elif pck == 'deb': + cmd_query = ["dpkg", "--get-selections", branding_pack+build_version+"*", basis_pack+build_version+"*", ure_pack+build_version+"*"] + cmd_filter = ["cut", "-f", "1"] + + P_query = subprocess.Popen(cmd_query, stdout = subprocess.PIPE) + P_filter = subprocess.Popen(cmd_filter, stdin = P_query.stdout, stdout = subprocess.PIPE) + P_query.stdout.close() + str_filter = P_filter.communicate()[0] + + if str_filter == "": + logger.warning("Nothing to uninstall") + return + else: + cmd = ["sudo", "dpkg ", "-P"] + str_filter.split() + elif pck == 'exe': + pass + elif pck == 'dmg': + pass + else: + logger.warning("Non supported package system") + + subprocess.check_call(cmd) + +def init_testing(): + logger.info("Initializing ...") + + post_testing() + + if not os.path.exists(DOWNLOAD_DIR): + os.mkdir(DOWNLOAD_DIR) + + if not os.path.exists(USR_DIR): + os.mkdir(USR_DIR) + + # create set up links + try: + if platform.system() == "Linux": + # remove old symlinks if they exists + for p in ROOT_DIR_LIB, CPPUNITTESTER: + if os.path.exists(p) and os.path.islink(p): + os.remove(p) + + if platform_info()[2] == "x86": + os.symlink(ROOT_DIR_LIB32, ROOT_DIR_LIB) + os.symlink(os.path.join(ROOT_DIR_BIN32, 'cppunittester'), CPPUNITTESTER) + elif platform_info()[2] == "x86_64": + os.symlink(ROOT_DIR_LIB64, ROOT_DIR_LIB) + os.symlink(os.path.join(ROOT_DIR_BIN64, 'cppunittester'), CPPUNITTESTER) + else: + pass + + elif platform.system() == "Windows" and platform_info()[2] == "x86": + pass + else: + pass + + except OSError: + pass + +def post_testing(): + logger.info("Cleaning up ...") + + # clean up the extracted installer dir + for r in os.walk(DOWNLOAD_DIR): + if r[0] == DOWNLOAD_DIR: + for d in r[1]: + shutil.rmtree(os.path.join(r[0], d)) + +def install(filename): + ''' filename: local file path of tar.gz, dmg or exe. The script will + extract the package and then install it ''' + + logger.info("Installing ... " + filename) + + def _is_not_filtered(s): + ''' True if the package s is not intended to installed. ''' + filter_pattern_list = ['.*kde.*', '.*gnome.*', '.*desktop.*', '!.*\.rpm$', '!.*\.deb$'] + for p in filter_pattern_list: + r = re.compile(p) + if r.match(s): + return False + return True + + fn, ext = os.path.splitext(filename) + pcklist = [] + + if ext == '.exe': + # extract + installer_dir = os.path.join(DOWNLOAD_DIR, filename.strip(ext)) + subprocess.check_call([filename, '/EXTRACTONLY=ON', '/S', '/D='+installer_dir]) + # install + installer = glob.glob(os.path.join(installer_dir, 'libreoffice*msi'))[0] + subprocess.check_call(['msiexec', '-i', installer, '-passive', 'ADDLOCAL=all']) + elif ext == '.dmg': + return + elif ext == '.gz': + # extract + subprocess.check_call(['tar', 'xzf', filename, '-C', DOWNLOAD_DIR]) + + # get a filtered install list + for root, dirs, files in os.walk(DOWNLOAD_DIR): + if 'RPMS' in root or 'DEBS' in root: + pcklist = pcklist + [os.path.join(root_dir, root, f) for f in files] + pcklist = filter(_is_not_filtered, pcklist) + + # install + if platform_info()[1] == 'rpm': + install_cmd = ["sudo", "rpm", "-iv"] + pcklist + elif platform_info()[1] == 'deb': + install_cmd = ["sudo", "dpkg", "-i"] + pcklist + else: + logger.error('Cannot generate install command') + return + + subprocess.check_call(install_cmd) + + else: + logger.info("Unrecognized file extension") + +def verify_smoketest(headless): + logger.info("Testing ...") + + s = platform.system() + p = platform_info() + pck = p[1] + arc = p[2] + + if s == "Linux": + if headless: + os.environ['SAL_USE_VCLPLUGIN'] = "svp" + os.environ['LD_LIBRARY_PATH'] = "" + os.environ['LD_LIBRARY_PATH'] = ':'.join([os.path.join(root_dir, 'lib'), INSTALL_DIR + '/opt/' + install_dirname + '/ure/lib', os.environ['LD_LIBRARY_PATH']]) + cmd_cppu = [ + CPPUNITTESTER, + "-env:UNO_SERVICES=file://"+ INSTALL_DIR + "/opt/" + install_dirname + "/ure/share/misc/services.rdb", + "-env:UNO_TYPES=" + os.path.join(os.path.join(root_dir, 'lib'), "types.rdb"), + "-env:arg-soffice=path:" + SOFFICE_BIN, + "-env:arg-user=" + USR_DIR, + "-env:arg-env=" + os.environ['LD_LIBRARY_PATH'], + "-env:arg-testarg.smoketest.doc=" + os.path.join(root_dir, "doc/smoketestdoc.sxw"), + "--protector", + os.path.join(root_dir, "lib/unoexceptionprotector.so"), "unoexceptionprotector", + os.path.join(root_dir, "lib/libsmoketest.so") + ] + else: + logger.warning('The smoketest does not support this platform yet!') + + try: + subprocess.check_call(cmd_cppu) + logger.info(" Smoketest PASSED") + except: + logger.error(" Smoketest FAILED") + + +def usage(): + + print "\n[Usage]\n\n -f Force testing without asking \n\ + -t Testing type pre-release/daily \n\ + -l Download and test last builds in a loop \n\ + -v Run smoketest verification directly \n\ + -s Use the headless mode when running the tests \n\ + -i Install the latest build in the DOWNLOAD directory \n\ + -u Uninstall any existed libreoffice build \n\ + -d Download the latest build for the given test type \n\ +" + +def main(): + + interactive = True + build_type = "pre-releases" + + package_type = platform_info()[1] + arch_type = platform_info()[2] + + loop = False + interactive = True + headless = False + build_type = "pre-releases" + + # Handling options and arguments + try: + opts, args = getopt.getopt(sys.argv[1:], "dluihfvst:", ["download", "loop", "uninstall", "install", "help", "force", "verify", "headless", "type="]) + except getopt.GetoptError, err: + logger.error(str(err)) + usage() + sys.exit(2) + + for o, a in opts: + if ("-t" in o) or ("--type" in o): + build_type = a + elif o in ("-s", "--headless"): + headless = True + + url_reg = get_url_regexp(build_type, package_type, arch_type) + + for o, a in opts: + if o in ("-f", "--force"): + interactive = False + elif o in ("-t", "--type"): + pass + elif o in ("-s", "--headless"): + pass + elif o in ("-h", "--help"): + usage() + sys.exit() + elif o in ("-v", "--verify"): + init_testing() + verify_smoketest(headless) + sys.exit() + elif o in ("-i", "--install"): + init_testing() + uninstall() + install(DOWNLOAD_DIR + os.sep + local_build_info(build_type)[0]) + sys.exit() + elif o in ("-u", "--uninstall"): + uninstall() + sys.exit() + elif o in ("-d", "--download"): + download(url_reg, build_type) + sys.exit() + elif o in ("-l", "--loop"): + loop = True + else: + assert False, "Unhandled option: " + o + + if interactive == True: + key = raw_input("The testing will OVERRIDE existed libreoffice, continue(y/N)? ") + if not (key == "y" or key == "Y" or key == "yes"): + sys.exit() + + init_testing() + first_run = True + while loop or first_run: + if download(url_reg, build_type): + try: + # FIXME: uninstall script fails but it need not break the whole game; so try it twice + try: + uninstall() + except: + logger.error("Some errors happend during uninstall. Trying once again.") + uninstall() + + install(DOWNLOAD_DIR + os.sep + local_build_info(build_type)[0]) + verify_smoketest(headless) + + except KeyboardInterrupt: + sys.exit() + except: + pass + + if loop: + time.sleep(build_check_interval) + + first_run = False + + +if __name__ == '__main__': + + # logging + logger = logging.getLogger('') + logger.setLevel(logging.DEBUG) + + fh = logging.FileHandler('losmoketest.log') + ch = logging.StreamHandler() + + formatter = logging.Formatter('%(asctime)s - %(levelname)s - %(message)s') + ch.setFormatter(formatter) + fh.setFormatter(formatter) + + logger.addHandler(ch) + logger.addHandler(fh) + + main() diff --git a/smoketest/losmoketest.readme b/smoketest/losmoketest.readme new file mode 100644 index 000000000000..88091339d8d6 --- /dev/null +++ b/smoketest/losmoketest.readme @@ -0,0 +1,186 @@ +losmoketest.py +-------------- +Yifan Jiang <yfjiang@suse.com> +http://dev-builds.libreoffice.org/ + +The tool is designed to enable test machine fully automatically run smoketest +with both daily and pre release build located in dev-build.libreoffice.org. + +The purpose of daily build testing is obvious, we want to catch bugs as early +as possible:) some ideas canbe found here: + + http://wiki.documentfoundation.org/Testing_Daily_Builds#Is_parallel_installation_possible_.2F_planned.3F + +For the purpose of smoketest for pre release testing, currently there is an +about 24 hrs lag syncing RC build from dev-build to official site. We need to +guarantee at least the very basic function working before more people download +the RC build from official site and play with it, in as short as 24 hrs. + +The tool is named as losmoketest for its purpose, meanwhile it help you to +check, download and install the latest build. By the fact the installation is +designed not to be different from manually doing these repeated work, the +installed libreoffice build can also be good for manual test. + +Quick Start +----------- + +This chapter describe step by step tutorials for a typical quick use of the +tool. More functions can be discovered in section "The Tool -> Usage". + +[Linux] + + 0. If you do not have a python environment, firstly download python here: + + http://www.python.org/download/ + + 1. Download binary: + + http://dev-builds.libreoffice.org/daily/losmoketest-0.2.tar.bz2 + + 2. Unpack it to, for example, your home directory: + + tar xvjf losmoketest-0.2.tar.bz2 -C $HOME + + 3. Open a terminal + + 4. In the terminal, input (there's an Enter between each lines): + + su - + (enter your root password when it prompts) + cp /etc/sudoers /etc/sudoers.ori + echo "$USER ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers + exit + + 5. In the terminal, input (there's an Enter between each lines): + + cd $HOME/losmoketest-0.2 + python ./losmoketest.py + + A msg OK(1) would be shown When the result successfully + finished. Otherwise, please send the 'log' file to the author or mailing + list libreoffice-qa@lists.freedesktop.org for more investigation. + + 6. After finish testing, recover the sudoers file by (there's an Enter + between each lines), + + su - + (enter your root password) + cp /etc/sudoers.ori /etc/sudoers + exit + +[Windows] + + 0. If you do not have a python environment, firstly download python here: + + http://www.python.org/download/ + + 1. Download binary: + + http://dev-builds.libreoffice.org/daily/losmoketest-0.2.tar.bz2 + + 2. Unpack it to, for example, C:\ + + 3. Open a console by clicking Start menu -> Run ... + + 4. Input 'cmd' and press Enter + + 5. In the terminal, input (there's an Enter between each lines): + + cd C:\losmoketest-0.2 + .\losmoketest.py + + A msg OK(1) would be shown When the result successfully + finished. Otherwise, please send the 'log' file to the author or mailing + list libreoffice-qa@lists.freedesktop.org for more investigation. + + +The tool +-------- + +[Prerequisite] + + - Python > 2.6 + http://www.python.org/download/ + + - A machine free to play (The test may *override* your existed + libreoffice3.4 installation). + + - On Linux, add the following line in /etc/sudoer: + + $USER ALL=(ALL) NOPASSWD: ALL + + where $USER is your real user name. With this line, every command + initialed with `sudo` will not be asked to input a password. Please + consider the security risk brought by it. + +[Features Availability] + + Full features are implemented on Linux x86 and x86_64, rpm and deb: + + - Checking and dowloading the latest build + - Install the latest build + - Run smoke test on the build (not stable) + + Partial features are implemented on Windows: + + - Checking and dowloading the latest build + - Install the latest build (Thanks *blip* help find out the command for silent install) + + Partial features are implemented on Mac: + + - Checking and dowloading the latest build + +[Usages] + + 1. Test the latest pre releases build: + + $ cd /path/to/losmoketest + $ ./losmoketest.py # Test the latest pre releases build: + $ ./losmoketest.py -t daily_master # Test the latest daily master build + $ ./losmoketest.py -t daily_branch # Test the latest daily branch build (now 3.4) + + 2. Just Install the latest LOCAL build: + + $ cd /path/to/losmoketest + $ ./losmoketest.py -i # Install the latest pre releases build in losmoketest/_download + $ ./losmoketest.py -i -t daily_master # Install the latest daily master build in losmoketest/_download + $ ./losmoketest.py -i -t daily_branch # Install the latest daily branch build (now 3.4) in losmoketest/_download + + 3. Just Verify the installed build: + + $ cd /path/to/losmoketest + $ ./losmoketest.py -v + + 4. More tips in: + + $ cd /path/to/losmoketest + $ ./losmoketest.py -h + +[Tested on] + + - SLED 11 sp1 x86 + - SLED 11 sp1 x86_64 + - OpenSuSE 11.4 x86 + - Ubuntu 10.10 x86 + +[TODO] + + 1. verify_smoketest() improvement (replace it with more simple script + rather than complicated cppunittester) + + 2. 'git' it when we have a stable code base + + 3. handling mac and windows build + +[Known issue] + + 1. The cppunittest performs not quite stable in different libreoffice + build, some times it just hangs there without noticing :( + + 2. The version tag is desired to get dynamically. The current hard coded + 3.4 is not reliable, especially not reliable when verify_smoketest() + tries to set LD_LIBRARY_PATH. + + 3. Parallel installation with official build has a dependancy on Tinderbox + improvement (the dev-build is ideally to be installed on something like + /opt/lo-dev). diff --git a/smoketest/makefile.mk b/smoketest/makefile.mk new file mode 100755 index 000000000000..0549eff0bd37 --- /dev/null +++ b/smoketest/makefile.mk @@ -0,0 +1,49 @@ +#************************************************************************* +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# Copyright 2000, 2010 Oracle and/or its affiliates. +# +# OpenOffice.org - a multi-platform office productivity suite +# +# This file is part of OpenOffice.org. +# +# OpenOffice.org is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License version 3 +# only, as published by the Free Software Foundation. +# +# OpenOffice.org is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Lesser General Public License version 3 for more details +# (a copy is included in the LICENSE file that accompanied this code). +# +# You should have received a copy of the GNU Lesser General Public License +# version 3 along with OpenOffice.org. If not, see +# <http://www.openoffice.org/license.html> +# for a copy of the LGPLv3 License. +#***********************************************************************/ + +PRJ = . +PRJNAME = smoketestoo_native +TARGET = smoketest + +ENABLE_EXCEPTIONS = TRUE +VISIBILITY_HIDDEN = TRUE + +ABORT_ON_ASSERTION = TRUE + +.INCLUDE: settings.mk + +CFLAGSCXX += $(CPPUNIT_CFLAGS) + +SLOFILES = $(SHL1OBJS) + +SHL1IMPLIB = i$(SHL1TARGET) +SHL1TARGET = smoketest +SHL1OBJS = $(SLO)/smoketest.obj +SHL1RPATH = NONE +SHL1STDLIBS = $(CPPUHELPERLIB) $(CPPULIB) $(CPPUNITLIB) $(SALLIB) $(UNOTESTLIB) +SHL1USE_EXPORTS = name +DEF1NAME = $(SHL1TARGET) + +ALLTAR : $(SHL1TARGETN) diff --git a/smoketest/prj/build.lst b/smoketest/prj/build.lst new file mode 100644 index 000000000000..abec637a7f52 --- /dev/null +++ b/smoketest/prj/build.lst @@ -0,0 +1,4 @@ +smt smoketest :: codemaker javaunohelper soltools test unoil NULL +smt smoketest\com\sun\star\comp\smoketest nmake - all smoketest_com_sun_star_comp_smoketest NULL +smt smoketest\data nmake - all smoketest_data NULL +smt smoketest nmake - all smoketest_mk smoketest_com_sun_star_comp_smoketest smoketest_data NULL diff --git a/smoketest/prj/d.lst b/smoketest/prj/d.lst new file mode 100644 index 000000000000..4da25c205f22 --- /dev/null +++ b/smoketest/prj/d.lst @@ -0,0 +1,4 @@ +..\losmoketest %_DEST%\bin\losmoketest +..\%__SRC%\bin\smoketestdoc.sxw %_DEST%\bin\smoketestdoc.sxw +..\%__SRC%\bin\TestExtension.oxt %_DEST%\bin\TestExtension.oxt +..\%__SRC%\lib\libsmoketest.* %_DEST%\lib\libsmoketest.* diff --git a/smoketest/smoketest.cxx b/smoketest/smoketest.cxx new file mode 100644 index 000000000000..b0a709761f2f --- /dev/null +++ b/smoketest/smoketest.cxx @@ -0,0 +1,221 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* +* +* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +* +* Copyright 2000, 2010 Oracle and/or its affiliates. +* +* OpenOffice.org - a multi-platform office productivity suite +* +* This file is part of OpenOffice.org. +* +* OpenOffice.org is free software: you can redistribute it and/or modify +* it under the terms of the GNU Lesser General Public License version 3 +* only, as published by the Free Software Foundation. +* +* OpenOffice.org is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU Lesser General Public License version 3 for more details +* (a copy is included in the LICENSE file that accompanied this code). +* +* You should have received a copy of the GNU Lesser General Public License +* version 3 along with OpenOffice.org. If not, see +* <http://www.openoffice.org/license.html> +* for a copy of the LGPLv3 License. +* +************************************************************************/ + +#include "sal/config.h" +#include "sal/precppunit.hxx" + +#include "boost/noncopyable.hpp" +#include "com/sun/star/awt/AsyncCallback.hpp" +#include "com/sun/star/awt/XCallback.hpp" +#include "com/sun/star/beans/PropertyState.hpp" +#include "com/sun/star/beans/PropertyValue.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/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/EventObject.hpp" +#include "com/sun/star/uno/Any.hxx" +#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/util/URL.hpp" +#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/time.h" +#include "rtl/oustringostreaminserter.hxx" +#include "rtl/ustring.h" +#include "rtl/ustring.hxx" +#include "unotest/gettestargument.hxx" +#include "unotest/officeconnection.hxx" +#include "unotest/toabsolutefileurl.hxx" + +namespace { + +namespace css = com::sun::star; + +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 Callback: public cppu::WeakImplHelper1< css::awt::XCallback > { +public: + Callback( + css::uno::Reference< css::frame::XNotifyingDispatch > const & dispatch, + css::util::URL const & url, + css::uno::Sequence< css::beans::PropertyValue > const & arguments, + css::uno::Reference< css::frame::XDispatchResultListener > const & + listener): + dispatch_(dispatch), url_(url), arguments_(arguments), + listener_(listener) + { OSL_ASSERT(dispatch.is()); } + +private: + virtual void SAL_CALL notify(css::uno::Any const &) + throw (css::uno::RuntimeException) + { dispatch_->dispatchWithNotification(url_, arguments_, listener_); } + + css::uno::Reference< css::frame::XNotifyingDispatch > dispatch_; + css::util::URL url_; + css::uno::Sequence< css::beans::PropertyValue > arguments_; + css::uno::Reference< css::frame::XDispatchResultListener > listener_; +}; + +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(); + + test::OfficeConnection connection_; +}; + +void Test::setUp() { + connection_.setUp(); +} + +void Test::tearDown() { + connection_.tearDown(); +} + +void Test::test() { + rtl::OUString doc; + CPPUNIT_ASSERT( + test::getTestArgument( + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("smoketest.doc")), &doc)); + css::uno::Sequence< css::beans::PropertyValue > args(2); + 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; + args[1].Name = rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM("ReadOnly")); + args[1].Handle = -1; + args[1].Value <<= sal_True; + args[1].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")); + css::uno::Reference< css::frame::XNotifyingDispatch > disp( + css::uno::Reference< css::frame::XDispatchProvider >( + css::uno::Reference< css::frame::XController >( + css::uno::Reference< css::frame::XModel >( + css::uno::Reference< css::frame::XComponentLoader >( + (connection_.getComponentContext()-> + getServiceManager()->createInstanceWithContext( + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.frame.Desktop")), + connection_.getComponentContext())), + css::uno::UNO_QUERY_THROW)->loadComponentFromURL( + test::toAbsoluteFileUrl(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); + Result result; + // Shifted to main thread to work around potential deadlocks (i112867): + com::sun::star::awt::AsyncCallback::create( + connection_.getComponentContext())->addCallback( + new Callback( + disp, url, css::uno::Sequence< css::beans::PropertyValue >(), + new Listener(&result)), + css::uno::Any()); + // Wait for result.condition or connection_ going stale: + for (;;) { + TimeValue delay = { 1, 0 }; // 1 sec + osl::Condition::Result res = result.condition.wait(&delay); + if (res == osl::Condition::result_ok) { + break; + } + CPPUNIT_ASSERT_EQUAL(osl::Condition::result_timeout, res); + CPPUNIT_ASSERT(connection_.isStillAlive()); + } + CPPUNIT_ASSERT(result.success); + CPPUNIT_ASSERT_EQUAL(rtl::OUString(), result.result); +} + +CPPUNIT_TEST_SUITE_REGISTRATION(Test); + +} + +CPPUNIT_PLUGIN_IMPLEMENT(); + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |