summaryrefslogtreecommitdiff
path: root/qadevOOo/tests/java/mod/_sfx
diff options
context:
space:
mode:
Diffstat (limited to 'qadevOOo/tests/java/mod/_sfx')
-rw-r--r--qadevOOo/tests/java/mod/_sfx/AppDispatchProvider.java104
-rw-r--r--qadevOOo/tests/java/mod/_sfx/DocumentTemplates.java97
-rw-r--r--qadevOOo/tests/java/mod/_sfx/FrameLoader.java103
-rw-r--r--qadevOOo/tests/java/mod/_sfx/SfxMacroLoader.java107
-rw-r--r--qadevOOo/tests/java/mod/_sfx/StandaloneDocumentInfo.java133
5 files changed, 544 insertions, 0 deletions
diff --git a/qadevOOo/tests/java/mod/_sfx/AppDispatchProvider.java b/qadevOOo/tests/java/mod/_sfx/AppDispatchProvider.java
new file mode 100644
index 000000000000..1760354e6108
--- /dev/null
+++ b/qadevOOo/tests/java/mod/_sfx/AppDispatchProvider.java
@@ -0,0 +1,104 @@
+/*************************************************************************
+ *
+ * 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 mod._sfx;
+
+import java.io.PrintWriter;
+
+import lib.Status;
+import lib.StatusException;
+import lib.TestCase;
+import lib.TestEnvironment;
+import lib.TestParameters;
+import util.dbg;
+import util.utils;
+
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.uno.XInterface;
+
+/**
+ * Test for object which is represented by service
+ * <code>com.sun.star.comp.sfx2.SfxMacroLoader</code>. <p>
+ * Object implements the following interfaces :
+ * <ul>
+ * <li> <code>com::sun::star::frame::XDispatchProvider</code></li>
+ * <li> <code>com::sun::star::lang::XInitialization</code></li>
+ * </ul>
+ * This object test <b> is NOT </b> designed to be run in several
+ * threads concurently.
+ * @see com.sun.star.frame.XDispatchProvider
+ * @see com.sun.star.lang.XInitialization
+ * @see ifc.frame._XDispatchProvider
+ * @see ifc.lang._XInitialization
+ */
+public class AppDispatchProvider extends TestCase {
+
+ /**
+ * Creating a Testenvironment for the interfaces to be tested.
+ * Creates an instance of the service
+ * <code>com.sun.star.comp.sfx2.SfxMacroLoader</code>. <p>
+ * Object relations created :
+ * <ul>
+ * <li> <code>'FrameLoader.URL"'</code> for
+ * {@link ifc.frame._XFrameLoader} </li>
+ * </ul>
+ */
+ protected TestEnvironment createTestEnvironment
+ (TestParameters Param, PrintWriter log) {
+ XInterface oObj = null;
+ Object oInterface = null ;
+
+ //now get the OButtonControl
+ try {
+ oInterface = ((XMultiServiceFactory)Param.getMSF()).createInstance
+ ("com.sun.star.comp.sfx2.AppDispatchProvider") ;
+ } catch (com.sun.star.uno.Exception e) {
+ log.println("Couldn't get service");
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't get GridControl", e );
+ }
+
+ if (oInterface == null) {
+ log.println("Service wasn't created") ;
+ throw new StatusException(Status.failed("Service wasn't created")) ;
+ }
+
+ oObj = (XInterface) oInterface ;
+ System.out.println("ImplName: "+utils.getImplName(oObj));
+ dbg.printInterfaces(oObj);
+
+ log.println( "creating a new environment for object" );
+ TestEnvironment tEnv = new TestEnvironment( oObj );
+
+ // adding relation for :XDispatchProvider
+ tEnv.addObjRelation("XDispatchProvider.URL", ".uno:BibliographyComponent") ;
+
+ return tEnv;
+ } // finish method getTestEnvironment
+
+}
+
diff --git a/qadevOOo/tests/java/mod/_sfx/DocumentTemplates.java b/qadevOOo/tests/java/mod/_sfx/DocumentTemplates.java
new file mode 100644
index 000000000000..70a87965dbd6
--- /dev/null
+++ b/qadevOOo/tests/java/mod/_sfx/DocumentTemplates.java
@@ -0,0 +1,97 @@
+/*************************************************************************
+ *
+ * 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 mod._sfx;
+
+import java.io.PrintWriter;
+
+import lib.StatusException;
+import lib.TestCase;
+import lib.TestEnvironment;
+import lib.TestParameters;
+
+import com.sun.star.frame.XStorable;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.text.XTextDocument;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.uno.XInterface;
+
+/**
+ * Test for object which is represented by service
+ * <code>com.sun.star.frame.DocumentTemplates</code>. <p>
+ *
+ * Object implements the following interfaces :
+ * <ul>
+ * <li> <code>com::sun::star::frame::XDocumentTemplates</code></li>
+ * </ul> <p>
+ *
+ */
+public class DocumentTemplates extends TestCase {
+
+ XTextDocument xTextDoc;
+
+ protected void initialize( TestParameters tParam, PrintWriter log ) {
+ String aURL=util.utils.getFullTestURL("report2.stw");
+ xTextDoc = util.WriterTools.loadTextDoc((XMultiServiceFactory)tParam.getMSF(),aURL);
+ }
+
+ protected void cleanup( TestParameters tParam, PrintWriter log ) {
+ log.println( " disposing xTextDoc " );
+ xTextDoc.dispose();
+ }
+
+ /**
+ * Creating a Testenvironment for the interfaces to be tested.
+ * Creates an instance of the service
+ * <code>com.sun.star.frame.DocumentTemplates</code>.
+ */
+ protected TestEnvironment createTestEnvironment
+ (TestParameters tParam, PrintWriter log) {
+
+ XMultiServiceFactory xMSF = (XMultiServiceFactory)tParam.getMSF();
+ XInterface oObj = null;
+ XStorable store = null;
+
+ try {
+ oObj = (XInterface)xMSF.createInstance
+ ("com.sun.star.frame.DocumentTemplates");
+ store = (XStorable) UnoRuntime.queryInterface
+ (XStorable.class,xTextDoc);
+ } catch (com.sun.star.uno.Exception e) {
+ e.printStackTrace(log);
+ throw new StatusException("Unexpected exception", e);
+ }
+
+ String Iname = util.utils.getImplName(oObj);
+ log.println("Implementation Name: "+Iname);
+ TestEnvironment tEnv = new TestEnvironment(oObj);
+ tEnv.addObjRelation("Store",store);
+ return tEnv;
+ }
+
+} // finish class TestCase
+
diff --git a/qadevOOo/tests/java/mod/_sfx/FrameLoader.java b/qadevOOo/tests/java/mod/_sfx/FrameLoader.java
new file mode 100644
index 000000000000..5be24abdd3f2
--- /dev/null
+++ b/qadevOOo/tests/java/mod/_sfx/FrameLoader.java
@@ -0,0 +1,103 @@
+/*************************************************************************
+ *
+ * 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 mod._sfx;
+
+import java.io.PrintWriter;
+
+import lib.Status;
+import lib.StatusException;
+import lib.TestCase;
+import lib.TestEnvironment;
+import lib.TestParameters;
+import util.dbg;
+import util.utils;
+
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.uno.XInterface;
+
+/**
+* Test for object which is represented by service
+* <code>com.sun.star.comp.office.FrameLoader</code>. <p>
+* Object implements the following interfaces :
+* <ul>
+* <li> <code>com::sun::star::frame::XFrameLoader</code></li>
+* </ul>
+* This object test <b> is NOT </b> designed to be run in several
+* threads concurently.
+* @see com.sun.star.frame.FrameLoader
+* @see com.sun.star.frame.XSynchronousFrameLoader
+*/
+public class FrameLoader extends TestCase {
+
+ /**
+ * Creating a Testenvironment for the interfaces to be tested.
+ * Creates an instance of the service
+ * <code>com.sun.star.comp.office.FrameLoader</code>. <p>
+ * Object relations created :
+ * <ul>
+ * <li> <code>'FrameLoader.URL"'</code> for
+ * {@link ifc.frame._XFrameLoader} </li>
+ * </ul>
+ */
+ protected TestEnvironment createTestEnvironment
+ (TestParameters Param, PrintWriter log) {
+ XInterface oObj = null;
+ Object oInterface = null ;
+
+ //now get the OButtonControl
+ try {
+ oInterface = ((XMultiServiceFactory)Param.getMSF()).createInstance
+ ("com.sun.star.comp.office.FrameLoader") ;
+
+ } catch (com.sun.star.uno.Exception e) {
+ log.println("Couldn't get service");
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't get GridControl", e );
+ }
+
+ if (oInterface == null) {
+ log.println("Service wasn't created") ;
+ throw new StatusException
+ (Status.failed("Service wasn't created")) ;
+ }
+
+ oObj = (XInterface) oInterface ;
+ System.out.println("ImplName: "+utils.getImplName(oObj));
+ dbg.printInterfaces(oObj);
+
+ log.println( "creating a new environment for object" );
+ TestEnvironment tEnv = new TestEnvironment( oObj );
+
+ // adding relation for XFrameLoader
+ tEnv.addObjRelation("FrameLoader.URL","private:factory/swriter");
+
+ return tEnv;
+ } // finish method getTestEnvironment
+
+}
+
diff --git a/qadevOOo/tests/java/mod/_sfx/SfxMacroLoader.java b/qadevOOo/tests/java/mod/_sfx/SfxMacroLoader.java
new file mode 100644
index 000000000000..f54d57ac1ace
--- /dev/null
+++ b/qadevOOo/tests/java/mod/_sfx/SfxMacroLoader.java
@@ -0,0 +1,107 @@
+/*************************************************************************
+ *
+ * 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 mod._sfx;
+
+import java.io.PrintWriter;
+
+import lib.Status;
+import lib.StatusException;
+import lib.TestCase;
+import lib.TestEnvironment;
+import lib.TestParameters;
+import util.dbg;
+import util.utils;
+
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.uno.XInterface;
+
+/**
+ * Test for object which is represented by service
+ * <code>com.sun.star.comp.sfx2.SfxMacroLoader</code>. <p>
+ * Object implements the following interfaces :
+ * <ul>
+ * <li> <code>com::sun::star::frame::XDispatchProvider</code></li>
+ * <li> <code>com::sun::star::lang::XInitialization</code></li>
+ * </ul>
+ * This object test <b> is NOT </b> designed to be run in several
+ * threads concurently.
+ * @see com.sun.star.frame.XDispatchProvider
+ * @see com.sun.star.lang.XInitialization
+ * @see ifc.frame._XDispatchProvider
+ * @see ifc.lang._XInitialization
+ */
+public class SfxMacroLoader extends TestCase {
+
+ /**
+ * Creating a Testenvironment for the interfaces to be tested.
+ * Creates an instance of the service
+ * <code>com.sun.star.comp.sfx2.SfxMacroLoader</code>. <p>
+ * Object relations created :
+ * <ul>
+ * <li> <code>'FrameLoader.URL"'</code> for
+ * {@link ifc.frame._XFrameLoader} </li>
+ * </ul>
+ */
+ protected TestEnvironment createTestEnvironment
+ (TestParameters Param, PrintWriter log) {
+ XInterface oObj = null;
+ Object oInterface = null ;
+
+ //now get the OButtonControl
+ try {
+ oInterface = ((XMultiServiceFactory)Param.getMSF()).createInstance
+ ("com.sun.star.comp.sfx2.SfxMacroLoader");
+ } catch (com.sun.star.uno.Exception e) {
+ log.println("Couldn't get service");
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't get GridControl", e );
+ }
+
+ if (oInterface == null) {
+ log.println("Service wasn't created") ;
+ throw new StatusException(Status.failed("Service wasn't created")) ;
+ }
+
+ oObj = (XInterface) oInterface ;
+ System.out.println("ImplName: "+utils.getImplName(oObj));
+ dbg.printInterfaces(oObj);
+
+ log.println( "creating a new environment for object" );
+ TestEnvironment tEnv = new TestEnvironment( oObj );
+
+ // adding relation for XFrameLoader
+ tEnv.addObjRelation("XDispatchProvider.URL",
+ "macro:tools.UCB.CreateFolder(\"" +
+ utils.getOfficeTemp((XMultiServiceFactory)Param.getMSF()) + "/SfxMacroLoader\")") ;
+
+
+ return tEnv;
+ } // finish method getTestEnvironment
+
+}
+
diff --git a/qadevOOo/tests/java/mod/_sfx/StandaloneDocumentInfo.java b/qadevOOo/tests/java/mod/_sfx/StandaloneDocumentInfo.java
new file mode 100644
index 000000000000..715fdc72d371
--- /dev/null
+++ b/qadevOOo/tests/java/mod/_sfx/StandaloneDocumentInfo.java
@@ -0,0 +1,133 @@
+/*************************************************************************
+ *
+ * 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 mod._sfx;
+
+import java.io.PrintWriter;
+
+import lib.StatusException;
+import lib.TestCase;
+import lib.TestEnvironment;
+import lib.TestParameters;
+import util.utils;
+
+import com.sun.star.document.XStandaloneDocumentInfo;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.uno.XInterface;
+
+/**
+ * Test for object which is represented by service
+ * <code>com.sun.star.document.StandaloneDocumentInfo</code>. <p>
+ * Object implements the following interfaces :
+ * <ul>
+ * <li> <code>com::sun::star::lang::XComponent</code></li>
+ * <li> <code>com::sun::star::document::DocumentInfo</code></li>
+ * <li> <code>com::sun::star::document::XDocumentInfo</code></li>
+ * <li> <code>com::sun::star::document::XStandaloneDocumentInfo</code></li>
+ * <li> <code>com::sun::star::beans::XFastPropertySet</code></li>
+ * <li> <code>com::sun::star::beans::XPropertySet</code></li>
+ * </ul> <p>
+ * The following files used by this test :
+ * <ul>
+ * <li><b> SfxStandaloneDocInfoObject.sdw </b> : is copied
+ * to SOffice temporary directory and is used to load and
+ * save its info. </li>
+ * </ul> <p>
+ * This object test <b> is NOT </b> designed to be run in several
+ * threads concurently.
+ *
+ * @see com.sun.star.lang.XComponent
+ * @see com.sun.star.document.DocumentInfo
+ * @see com.sun.star.document.XDocumentInfo
+ * @see com.sun.star.document.XStandaloneDocumentInfo
+ * @see com.sun.star.beans.XFastPropertySet
+ * @see com.sun.star.beans.XPropertySet
+ * @see ifc.lang._XComponent
+ * @see ifc.document._DocumentInfo
+ * @see ifc.document._XDocumentInfo
+ * @see ifc.document._XStandaloneDocumentInfo
+ * @see ifc.beans._XFastPropertySet
+ * @see ifc.beans._XPropertySet
+ */
+public class StandaloneDocumentInfo extends TestCase {
+
+ String destUrl = null ;
+
+ /**
+ * Copies file 'SfxStandaloneDocInfoObject.sdw' to tempopary
+ * location (overwriting the old file if exists).
+ */
+ protected void initialize( TestParameters tParam, PrintWriter log ) {
+ String srcUrl = utils.getFullTestURL("SfxStandaloneDocInfoObject.sdw") ;
+ destUrl = utils.getOfficeTemp((XMultiServiceFactory)tParam.getMSF()) +
+ "SfxStandaloneDocInfoObject.sdw";
+
+ utils.overwriteFile((XMultiServiceFactory)tParam.getMSF(), srcUrl, destUrl) ;
+ }
+
+ /**
+ * Creating a Testenvironment for the interfaces to be tested.
+ * Creates an instance of the service
+ * <code>com.sun.star.document.StandaloneDocumentInfo</code>.
+ * Object relations created :
+ * <ul>
+ * <li> <code>'DOCURL'</code> for
+ * {@link ifc.document._XStandaloneDocumentInfo} :
+ * the Writer file URL in temporary location. </li>
+ * </ul>
+ */
+ protected TestEnvironment createTestEnvironment
+ (TestParameters tParam, PrintWriter log) {
+ XMultiServiceFactory xMSF = (XMultiServiceFactory)tParam.getMSF();
+ XInterface oObj = null;
+
+ try {
+ oObj = (XInterface)xMSF.createInstance
+ ("com.sun.star.document.StandaloneDocumentInfo");
+ } catch (com.sun.star.uno.Exception e) {
+ e.printStackTrace(log);
+ throw new StatusException("Unexpected exception", e);
+ }
+
+ String Iname = util.utils.getImplName(oObj);
+ log.println("Implementation Name: "+Iname);
+ TestEnvironment tEnv = new TestEnvironment(oObj);
+ XStandaloneDocumentInfo the_info = (XStandaloneDocumentInfo)
+ UnoRuntime.queryInterface(XStandaloneDocumentInfo.class, oObj);
+ try {
+ the_info.loadFromURL(destUrl);
+ } catch (com.sun.star.io.IOException e) {
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't load document: " + destUrl,e);
+ }
+ tEnv.addObjRelation("DOCURL",destUrl);
+ return tEnv;
+ }
+
+} // finish class TestCase
+