diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-15 05:54:39 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-15 05:54:39 +0000 |
commit | 267c6f2ac71f92999e969232431ba04678e7437e (patch) | |
tree | 358c9467650e1d0a1d7227a21dac2e3d08b622b2 /qadevOOo/tests/java/mod/_svx | |
parent | Initial commit. (diff) | |
download | libreoffice-267c6f2ac71f92999e969232431ba04678e7437e.tar.xz libreoffice-267c6f2ac71f92999e969232431ba04678e7437e.zip |
Adding upstream version 4:24.2.0.upstream/4%24.2.0
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'qadevOOo/tests/java/mod/_svx')
31 files changed, 4718 insertions, 0 deletions
diff --git a/qadevOOo/tests/java/mod/_svx/AccessibleControlShape.java b/qadevOOo/tests/java/mod/_svx/AccessibleControlShape.java new file mode 100644 index 0000000000..8f55793f09 --- /dev/null +++ b/qadevOOo/tests/java/mod/_svx/AccessibleControlShape.java @@ -0,0 +1,108 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +package mod._svx; + +import java.io.PrintWriter; + +import lib.TestCase; +import lib.TestEnvironment; +import lib.TestParameters; +import util.AccessibilityTools; +import util.FormTools; +import util.SOfficeFactory; +import util.utils; + +import com.sun.star.accessibility.AccessibleRole; +import com.sun.star.accessibility.XAccessible; +import com.sun.star.awt.Size; +import com.sun.star.awt.XWindow; +import com.sun.star.drawing.XShape; +import com.sun.star.frame.XModel; +import com.sun.star.lang.XComponent; +import com.sun.star.uno.UnoRuntime; +import com.sun.star.uno.XInterface; + +public class AccessibleControlShape extends TestCase { + + static XComponent xDrawDoc; + static XModel aModel; + + @Override + protected void initialize( TestParameters tParam, PrintWriter log ) throws Exception { + SOfficeFactory SOF = SOfficeFactory.getFactory( tParam.getMSF() ); + log.println( "creating a drawdoc" ); + xDrawDoc = SOF.createDrawDoc(null); + aModel = UnoRuntime.queryInterface(XModel.class, xDrawDoc); + } + + /** + * Disposes the Draw document loaded before. + */ + @Override + protected void cleanup( TestParameters tParam, PrintWriter log ) { + log.println( " disposing xDrawDoc " ); + util.DesktopTools.closeDoc(xDrawDoc); + } + + @Override + protected TestEnvironment createTestEnvironment + (TestParameters tParam, PrintWriter log) + throws com.sun.star.uno.Exception + { + + XInterface oObj = null; + + log.println( "creating a test environment" ); + + final XShape oShape = FormTools.insertControlShape + (xDrawDoc,3000,4500,15000,1000,"CommandButton"); + + util.utils.waitForEventIdle(tParam.getMSF()); + XWindow xWindow = AccessibilityTools.getCurrentWindow (aModel); + XAccessible xRoot = AccessibilityTools.getAccessibleObject(xWindow); + + AccessibilityTools.getAccessibleObjectForRole(xRoot, AccessibleRole.SHAPE); + + AccessibilityTools.printAccessibleTree(log, xRoot, tParam.getBool(util.PropertyName.DEBUG_IS_ACTIVE)); + + oObj = AccessibilityTools.getAccessibleObjectForRole(xRoot, AccessibleRole.UNKNOWN, "Button"); + + // create test environment here + TestEnvironment tEnv = new TestEnvironment( oObj ); + + tEnv.addObjRelation("EventProducer", + new ifc.accessibility._XAccessibleEventBroadcaster.EventProducer() { + public void fireEvent() { + try { + Size size = oShape.getSize(); + size.Width += 100; + oShape.setSize(size); + } catch(com.sun.star.beans.PropertyVetoException e) { + System.out.println("caught exception: " + e); + } + } + }); + + log.println("Implementation Name: " + utils.getImplName(oObj)); + + return tEnv; + } // finish method getTestEnvironment + +} + diff --git a/qadevOOo/tests/java/mod/_svx/AccessibleEditableTextPara.java b/qadevOOo/tests/java/mod/_svx/AccessibleEditableTextPara.java new file mode 100644 index 0000000000..f54b1dd499 --- /dev/null +++ b/qadevOOo/tests/java/mod/_svx/AccessibleEditableTextPara.java @@ -0,0 +1,134 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +package mod._svx; + +import java.io.PrintWriter; + +import lib.TestCase; +import lib.TestEnvironment; +import lib.TestParameters; +import util.AccessibilityTools; +import util.SOfficeFactory; +import util.utils; + +import com.sun.star.accessibility.AccessibleRole; +import com.sun.star.accessibility.XAccessible; +import com.sun.star.accessibility.XAccessibleContext; +import com.sun.star.accessibility.XAccessibleEditableText; +import com.sun.star.awt.XWindow; +import com.sun.star.frame.XModel; +import com.sun.star.lang.XComponent; +import com.sun.star.uno.UnoRuntime; +import com.sun.star.uno.XInterface; + + +public class AccessibleEditableTextPara extends TestCase { + + static XComponent xSpreadsheetDoc = null; + + /** + * Called to create an instance of <code>TestEnvironment</code> + * with an object to test and related objects. + * Obtains accessible object for the spreadsheet document. + * + * @param Param test parameters + * @param log writer to log information while testing + * + * @see TestEnvironment + * @see #getTestEnvironment + */ + @Override + protected TestEnvironment createTestEnvironment( + TestParameters Param, PrintWriter log) { + + XInterface oObj = null; + + + XModel aModel = UnoRuntime.queryInterface(XModel.class, xSpreadsheetDoc); + + XWindow xWindow = AccessibilityTools.getCurrentWindow(aModel); + XAccessible xRoot = AccessibilityTools.getAccessibleObject(xWindow); + + AccessibilityTools.printAccessibleTree(log, xRoot, Param.getBool(util.PropertyName.DEBUG_IS_ACTIVE)); + + XAccessibleContext InputLine = AccessibilityTools.getAccessibleObjectForRole(xRoot, AccessibleRole.TEXT_FRAME,"Input line"); + try { + oObj = InputLine.getAccessibleChild(0); + XAccessibleEditableText et = UnoRuntime.queryInterface(XAccessibleEditableText.class, oObj); + et.setText("AccessibleEditablePara"); + } catch (com.sun.star.lang.IndexOutOfBoundsException e) { + + } + log.println("ImplementationName " + utils.getImplName(oObj)); + + TestEnvironment tEnv = new TestEnvironment(oObj); + + final XAccessibleEditableText edText = UnoRuntime.queryInterface(XAccessibleEditableText.class,oObj) ; + + tEnv.addObjRelation("EventProducer", + new ifc.accessibility._XAccessibleEventBroadcaster.EventProducer() { + public void fireEvent() { + try { + int l = "AccessibleEditablePara".length(); + edText.deleteText(0, l); + edText.setText("Event"); + edText.setText("AccessibleEditablePara"); + } catch(com.sun.star.lang.IndexOutOfBoundsException e) { + System.out.println("caught exception: " + e); + } + } + }); + + return tEnv; + + } + + /** + * Called while disposing a <code>TestEnvironment</code>. + * Disposes text document. + * @param Param test parameters + * @param log writer to log information while testing + */ + @Override + protected void cleanup( TestParameters Param, PrintWriter log) { + log.println( " disposing xSheetDoc " ); + util.DesktopTools.closeDoc(xSpreadsheetDoc); + } + + /** + * Called while the <code>TestCase</code> initialization. In the + * implementation does nothing. Subclasses can override to initialize + * objects shared among all <code>TestEnvironment</code>s. + * + * @param Param test parameters + * @param log writer to log information while testing + * + * @see #initializeTestCase + */ + @Override + protected void initialize(TestParameters Param, PrintWriter log) throws Exception { + // get a soffice factory object + SOfficeFactory SOF = SOfficeFactory.getFactory( Param.getMSF()); + + log.println("creating a spreadsheetdocument"); + xSpreadsheetDoc = UnoRuntime.queryInterface(XComponent.class,SOF.createCalcDoc(null)); + util.utils.waitForEventIdle(Param.getMSF()); + } + +} diff --git a/qadevOOo/tests/java/mod/_svx/AccessibleGraphicShape.java b/qadevOOo/tests/java/mod/_svx/AccessibleGraphicShape.java new file mode 100644 index 0000000000..73031398a1 --- /dev/null +++ b/qadevOOo/tests/java/mod/_svx/AccessibleGraphicShape.java @@ -0,0 +1,109 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +package mod._svx; + +import java.io.PrintWriter; + +import lib.TestCase; +import lib.TestEnvironment; +import lib.TestParameters; +import util.AccessibilityTools; +import util.DrawTools; +import util.SOfficeFactory; +import util.utils; + +import com.sun.star.accessibility.AccessibleRole; +import com.sun.star.accessibility.XAccessible; +import com.sun.star.awt.Size; +import com.sun.star.awt.XWindow; +import com.sun.star.drawing.XShape; +import com.sun.star.frame.XModel; +import com.sun.star.lang.XComponent; +import com.sun.star.uno.UnoRuntime; +import com.sun.star.uno.XInterface; + +public class AccessibleGraphicShape extends TestCase { + + static XComponent xDrawDoc; + static XModel aModel; + + @Override + protected void initialize( TestParameters tParam, PrintWriter log ) throws Exception { + SOfficeFactory SOF = SOfficeFactory.getFactory( tParam.getMSF() ); + log.println( "creating a drawdoc" ); + xDrawDoc = SOF.createDrawDoc(null); + aModel = UnoRuntime.queryInterface(XModel.class, xDrawDoc); + } + + /** + * Disposes the Draw document loaded before. + */ + @Override + protected void cleanup( TestParameters tParam, PrintWriter log ) { + log.println( " disposing xDrawDoc " ); + util.DesktopTools.closeDoc(xDrawDoc); + } + + @Override + protected TestEnvironment createTestEnvironment + (TestParameters tParam, PrintWriter log) { + + XInterface oObj = null; + + // creation of testobject here + // first we write what we are intend to do to log file + log.println( "creating a test environment" ); + + SOfficeFactory SOF = SOfficeFactory.getFactory( tParam.getMSF()); + final XShape oShape = SOF.createShape(xDrawDoc, + 5000,5000,1500,1000,"GraphicObject"); + + + DrawTools.getShapes(DrawTools.getDrawPage(xDrawDoc,0)).add(oShape); + + XWindow xWindow = AccessibilityTools.getCurrentWindow (aModel); + XAccessible xRoot = AccessibilityTools.getAccessibleObject(xWindow); + + + oObj = AccessibilityTools.getAccessibleObjectForRole(xRoot, AccessibleRole.UNKNOWN, "GraphicObject"); + + // create test environment here + TestEnvironment tEnv = new TestEnvironment( oObj ); + + tEnv.addObjRelation("EventProducer", + new ifc.accessibility._XAccessibleEventBroadcaster.EventProducer() { + public void fireEvent() { + try { + Size size = oShape.getSize(); + size.Width += 100; + oShape.setSize(size); + } catch(com.sun.star.beans.PropertyVetoException e) { + System.out.println("caught exception: " + e); + } + } + }); + + + log.println("Implementation Name: " + utils.getImplName(oObj)); + + return tEnv; + } // finish method getTestEnvironment + +} + diff --git a/qadevOOo/tests/java/mod/_svx/AccessibleOLEShape.java b/qadevOOo/tests/java/mod/_svx/AccessibleOLEShape.java new file mode 100644 index 0000000000..8529515a20 --- /dev/null +++ b/qadevOOo/tests/java/mod/_svx/AccessibleOLEShape.java @@ -0,0 +1,118 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +package mod._svx; + +import java.io.PrintWriter; + +import lib.TestCase; +import lib.TestEnvironment; +import lib.TestParameters; +import util.AccessibilityTools; +import util.DrawTools; +import util.SOfficeFactory; +import util.utils; + +import com.sun.star.accessibility.AccessibleRole; +import com.sun.star.accessibility.XAccessible; +import com.sun.star.awt.Size; +import com.sun.star.awt.XWindow; +import com.sun.star.beans.XPropertySet; +import com.sun.star.drawing.XShape; +import com.sun.star.frame.XModel; +import com.sun.star.lang.XComponent; +import com.sun.star.uno.UnoRuntime; +import com.sun.star.uno.XInterface; + +public class AccessibleOLEShape extends TestCase { + + static XComponent xDrawDoc; + static XModel aModel; + + @Override + protected void initialize( TestParameters tParam, PrintWriter log ) throws Exception { + + SOfficeFactory SOF = SOfficeFactory.getFactory( tParam.getMSF() ); + + log.println( "creating a drawdoc" ); + xDrawDoc = SOF.createDrawDoc(null); + aModel = UnoRuntime.queryInterface(XModel.class, xDrawDoc); + } + + /** + * Disposes the Draw document loaded before. + */ + @Override + protected void cleanup( TestParameters tParam, PrintWriter log ) { + log.println( " disposing xDrawDoc " ); + util.DesktopTools.closeDoc(xDrawDoc); + } + + @Override + protected TestEnvironment createTestEnvironment + (TestParameters tParam, PrintWriter log) throws Exception { + + XInterface oObj = null; + + // creation of testobject here + // first we write what we are intend to do to log file + log.println( "creating a test environment" ); + + SOfficeFactory SOF = SOfficeFactory.getFactory( tParam.getMSF()); + final XShape oShape = SOF.createShape + (xDrawDoc,5000,5000,1500,1000,"OLE2"); + + DrawTools.getShapes(DrawTools.getDrawPage(xDrawDoc,0)).add(oShape); + + XPropertySet shape_props = UnoRuntime.queryInterface(XPropertySet.class,oShape); + + log.println("Inserting a Chart"); + + shape_props. + setPropertyValue("CLSID","12DCAE26-281F-416F-a234-c3086127382e"); + + XWindow xWindow = AccessibilityTools.getCurrentWindow (aModel); + XAccessible xRoot = AccessibilityTools.getAccessibleObject(xWindow); + + AccessibilityTools.printAccessibleTree(log, xRoot, tParam.getBool(util.PropertyName.DEBUG_IS_ACTIVE)); + + oObj = AccessibilityTools.getAccessibleObjectForRole(xRoot, AccessibleRole.UNKNOWN, "OLEShape"); + + // create test environment here + TestEnvironment tEnv = new TestEnvironment( oObj ); + + tEnv.addObjRelation("EventProducer", + new ifc.accessibility._XAccessibleEventBroadcaster.EventProducer() { + public void fireEvent() { + try { + Size size = oShape.getSize(); + size.Width += 100; + oShape.setSize(size); + } catch(com.sun.star.beans.PropertyVetoException e) { + System.out.println("caught exception: " + e); + } + } + }); + + log.println("Implementation Name: " + utils.getImplName(oObj)); + + return tEnv; + } // finish method getTestEnvironment + +} + diff --git a/qadevOOo/tests/java/mod/_svx/AccessiblePageShape.java b/qadevOOo/tests/java/mod/_svx/AccessiblePageShape.java new file mode 100644 index 0000000000..4e05ebb19c --- /dev/null +++ b/qadevOOo/tests/java/mod/_svx/AccessiblePageShape.java @@ -0,0 +1,114 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +package mod._svx; + +import java.io.PrintWriter; + +import lib.TestCase; +import lib.TestEnvironment; +import lib.TestParameters; +import util.AccessibilityTools; +import util.DrawTools; +import util.SOfficeFactory; +import util.utils; + +import com.sun.star.accessibility.AccessibleRole; +import com.sun.star.accessibility.XAccessible; +import com.sun.star.awt.XWindow; +import com.sun.star.beans.XPropertySet; +import com.sun.star.drawing.XDrawPage; +import com.sun.star.frame.XModel; +import com.sun.star.lang.XComponent; +import com.sun.star.uno.UnoRuntime; +import com.sun.star.uno.XInterface; + +public class AccessiblePageShape extends TestCase { + + static XComponent xDrawDoc; + static XModel aModel; + + @Override + protected void initialize( TestParameters tParam, PrintWriter log ) throws Exception { + SOfficeFactory SOF = SOfficeFactory.getFactory( tParam.getMSF() ); + log.println( "creating a drawdoc" ); + xDrawDoc = SOF.createDrawDoc(null); + aModel = UnoRuntime.queryInterface(XModel.class, xDrawDoc); + } + + /** + * Disposes the Draw document loaded before. + */ + @Override + protected void cleanup( TestParameters tParam, PrintWriter log ) { + log.println( " disposing xDrawDoc " ); + util.DesktopTools.closeDoc(xDrawDoc); + } + + @Override + protected TestEnvironment createTestEnvironment + (TestParameters tParam, PrintWriter log) { + + XInterface oObj = null; + //XShape oShape = null; + XDrawPage oPage = null; + + // creation of testobject here + // first we write what we are intend to do to log file + log.println( "creating a test environment" ); + + XWindow xWindow = AccessibilityTools.getCurrentWindow (aModel); + XAccessible xRoot = AccessibilityTools.getAccessibleObject(xWindow); + + AccessibilityTools.printAccessibleTree(log, xRoot, tParam.getBool(util.PropertyName.DEBUG_IS_ACTIVE)); + + oObj = AccessibilityTools.getAccessibleObjectForRole(xRoot, AccessibleRole.UNKNOWN, "PageShape"); + + // create test environment here + TestEnvironment tEnv = new TestEnvironment( oObj ); + + oPage = DrawTools.getDrawPage(xDrawDoc,0); + final XPropertySet PageProps = UnoRuntime.queryInterface(XPropertySet.class, oPage); + + tEnv.addObjRelation("EventProducer", + new ifc.accessibility._XAccessibleEventBroadcaster.EventProducer() { + public void fireEvent() { + try { + PageProps.setPropertyValue("Height",Integer.valueOf(5000)); + } catch (com.sun.star.beans.UnknownPropertyException upe) { + System.out.println("Don't no the Property Height"); + } catch (com.sun.star.beans.PropertyVetoException pve) { + System.out.println( + "PropertyVetoException Exception while changing Height"); + } catch (com.sun.star.lang.IllegalArgumentException iae) { + System.out.println( + "IllegalArgumentException Exception while changing Height"); + } catch (com.sun.star.lang.WrappedTargetException wte) { + System.out.println( + "WrappedTargetException Exception while changing Height"); + } + } + }); + + log.println("Implementation Name: " + utils.getImplName(oObj)); + + return tEnv; + } // finish method getTestEnvironment + +} + diff --git a/qadevOOo/tests/java/mod/_svx/AccessiblePresentationGraphicShape.java b/qadevOOo/tests/java/mod/_svx/AccessiblePresentationGraphicShape.java new file mode 100644 index 0000000000..37a3b8a358 --- /dev/null +++ b/qadevOOo/tests/java/mod/_svx/AccessiblePresentationGraphicShape.java @@ -0,0 +1,122 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +package mod._svx; + +import java.io.PrintWriter; + +import lib.TestCase; +import lib.TestEnvironment; +import lib.TestParameters; +import util.AccessibilityTools; +import util.DrawTools; +import util.SOfficeFactory; +import util.utils; + +import com.sun.star.accessibility.AccessibleRole; +import com.sun.star.accessibility.XAccessible; +import com.sun.star.awt.Size; +import com.sun.star.awt.XWindow; +import com.sun.star.beans.XPropertySet; +import com.sun.star.drawing.XShape; +import com.sun.star.frame.XModel; +import com.sun.star.lang.XComponent; +import com.sun.star.lang.XMultiServiceFactory; +import com.sun.star.uno.UnoRuntime; +import com.sun.star.uno.XInterface; + +public class AccessiblePresentationGraphicShape extends TestCase { + + static XComponent xDoc; + static XModel aModel; + + @Override + protected void initialize( TestParameters tParam, PrintWriter log ) throws Exception { + SOfficeFactory SOF = SOfficeFactory.getFactory( tParam.getMSF() ); + log.println( "creating a drawdoc" ); + xDoc = SOF.createImpressDoc(null); + aModel = UnoRuntime.queryInterface(XModel.class, xDoc); + } + + /** + * Disposes the Draw document loaded before. + */ + @Override + protected void cleanup( TestParameters tParam, PrintWriter log ) { + log.println( " disposing xDrawDoc " ); + util.DesktopTools.closeDoc(xDoc); + } + + @Override + protected TestEnvironment createTestEnvironment + (TestParameters tParam, PrintWriter log) throws Exception { + + XInterface oObj = null; + XShape oShape = null; + + // creation of testobject here + // first we write what we are intend to do to log file + log.println( "creating a test environment" ); + + XMultiServiceFactory docMSF = UnoRuntime.queryInterface(XMultiServiceFactory.class, xDoc); + oShape = UnoRuntime.queryInterface(XShape.class, + docMSF.createInstance + ("com.sun.star.presentation.GraphicObjectShape")); + + DrawTools.getShapes(DrawTools.getDrawPage(xDoc,0)).add(oShape); + + XPropertySet oShapeProps = UnoRuntime.queryInterface(XPropertySet.class,oShape); + try { + oShapeProps.setPropertyValue( + "GraphicURL",util.utils.getFullTestURL("space-metal.jpg")); + oShapeProps.setPropertyValue("IsEmptyPresentationObject", Boolean.FALSE); + } catch (com.sun.star.lang.WrappedTargetException e) { + } catch (com.sun.star.lang.IllegalArgumentException e) { + } catch (com.sun.star.beans.PropertyVetoException e) { + } catch (com.sun.star.beans.UnknownPropertyException e) { + } + + XWindow xWindow = AccessibilityTools.getCurrentWindow (aModel); + XAccessible xRoot = AccessibilityTools.getAccessibleObject(xWindow); + + oObj = AccessibilityTools.getAccessibleObjectForRole(xRoot, AccessibleRole.UNKNOWN, "GraphicObject"); + + // create test environment here + TestEnvironment tEnv = new TestEnvironment( oObj ); + + final XShape fShape = oShape ; + tEnv.addObjRelation("EventProducer", + new ifc.accessibility._XAccessibleEventBroadcaster.EventProducer() { + public void fireEvent() { + try { + Size size = fShape.getSize(); + size.Width += 100; + fShape.setSize(size); + } catch(com.sun.star.beans.PropertyVetoException e) { + System.out.println("caught exception: " + e); + } + } + }); + + log.println("Implementation Name: " + utils.getImplName(oObj)); + + return tEnv; + } // finish method getTestEnvironment + +} + diff --git a/qadevOOo/tests/java/mod/_svx/AccessiblePresentationOLEShape.java b/qadevOOo/tests/java/mod/_svx/AccessiblePresentationOLEShape.java new file mode 100644 index 0000000000..9329506da8 --- /dev/null +++ b/qadevOOo/tests/java/mod/_svx/AccessiblePresentationOLEShape.java @@ -0,0 +1,131 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +package mod._svx; + +import java.io.PrintWriter; + +import lib.TestCase; +import lib.TestEnvironment; +import lib.TestParameters; +import util.AccessibilityTools; +import util.DrawTools; +import util.SOfficeFactory; +import util.utils; + +import com.sun.star.accessibility.AccessibleRole; +import com.sun.star.accessibility.XAccessible; +import com.sun.star.awt.Size; +import com.sun.star.awt.XWindow; +import com.sun.star.beans.XPropertySet; +import com.sun.star.drawing.XShape; +import com.sun.star.frame.XModel; +import com.sun.star.lang.XComponent; +import com.sun.star.lang.XMultiServiceFactory; +import com.sun.star.uno.UnoRuntime; +import com.sun.star.uno.XInterface; + +public class AccessiblePresentationOLEShape extends TestCase { + + static XComponent xDrawDoc; + static XModel aModel; + + @Override + protected void initialize( TestParameters tParam, PrintWriter log ) throws Exception { + SOfficeFactory SOF = SOfficeFactory.getFactory( tParam.getMSF() ); + log.println( "creating a drawdoc" ); + xDrawDoc = SOF.createImpressDoc(null); + aModel = UnoRuntime.queryInterface(XModel.class, xDrawDoc); + } + + /** + * Disposes the Draw document loaded before. + */ + @Override + protected void cleanup( TestParameters tParam, PrintWriter log ) { + log.println( " disposing xDrawDoc " ); + util.DesktopTools.closeDoc(xDrawDoc); + } + + @Override + protected TestEnvironment createTestEnvironment + (TestParameters tParam, PrintWriter log) throws Exception { + + XInterface oObj = null; + XShape oShape = null; + + // creation of testobject here + // first we write what we are intend to do to log file + log.println( "creating a test environment" ); + + XMultiServiceFactory docMSF = UnoRuntime.queryInterface(XMultiServiceFactory.class, xDrawDoc); + oShape = UnoRuntime.queryInterface(XShape.class, + docMSF.createInstance("com.sun.star.presentation.OLE2Shape")); + + + XPropertySet oShapeProps = UnoRuntime.queryInterface(XPropertySet.class,oShape); + try { + oShapeProps.setPropertyValue("IsEmptyPresentationObject", Boolean.FALSE); + } catch (com.sun.star.lang.WrappedTargetException e) { + } catch (com.sun.star.lang.IllegalArgumentException e) { + } catch (com.sun.star.beans.PropertyVetoException e) { + } catch (com.sun.star.beans.UnknownPropertyException e) { + } + + DrawTools.getShapes(DrawTools.getDrawPage(xDrawDoc,0)).add(oShape); + + try { + oShapeProps.setPropertyValue( + "CLSID","12DCAE26-281F-416F-a234-c3086127382e"); + oShapeProps.setPropertyValue("IsEmptyPresentationObject", Boolean.FALSE); + } catch (com.sun.star.lang.WrappedTargetException e) { + } catch (com.sun.star.lang.IllegalArgumentException e) { + } catch (com.sun.star.beans.PropertyVetoException e) { + } catch (com.sun.star.beans.UnknownPropertyException e) { + } + + XWindow xWindow = AccessibilityTools.getCurrentWindow (aModel); + XAccessible xRoot = AccessibilityTools.getAccessibleObject(xWindow); + AccessibilityTools.printAccessibleTree(log, xRoot, tParam.getBool(util.PropertyName.DEBUG_IS_ACTIVE)); + + oObj = AccessibilityTools.getAccessibleObjectForRole(xRoot, AccessibleRole.UNKNOWN, "ImpressOLE"); + + // create test environment here + TestEnvironment tEnv = new TestEnvironment( oObj ); + + final XShape fShape = oShape ; + tEnv.addObjRelation("EventProducer", + new ifc.accessibility._XAccessibleEventBroadcaster.EventProducer() { + public void fireEvent() { + try { + Size size = fShape.getSize(); + size.Width += 100; + fShape.setSize(size); + } catch(com.sun.star.beans.PropertyVetoException e) { + System.out.println("caught exception: " + e); + } + } + }); + + log.println("Implementation Name: " + utils.getImplName(oObj)); + + return tEnv; + } // finish method getTestEnvironment + +} + diff --git a/qadevOOo/tests/java/mod/_svx/AccessiblePresentationShape.java b/qadevOOo/tests/java/mod/_svx/AccessiblePresentationShape.java new file mode 100644 index 0000000000..8828d8acfc --- /dev/null +++ b/qadevOOo/tests/java/mod/_svx/AccessiblePresentationShape.java @@ -0,0 +1,122 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +package mod._svx; + +import java.io.PrintWriter; + +import lib.TestCase; +import lib.TestEnvironment; +import lib.TestParameters; +import util.AccessibilityTools; +import util.DrawTools; +import util.SOfficeFactory; +import util.utils; + +import com.sun.star.accessibility.AccessibleRole; +import com.sun.star.accessibility.XAccessible; +import com.sun.star.awt.Size; +import com.sun.star.awt.XWindow; +import com.sun.star.beans.XPropertySet; +import com.sun.star.drawing.XShape; +import com.sun.star.frame.XModel; +import com.sun.star.lang.XComponent; +import com.sun.star.lang.XMultiServiceFactory; +import com.sun.star.uno.UnoRuntime; +import com.sun.star.uno.XInterface; + +public class AccessiblePresentationShape extends TestCase { + + static XComponent xDrawDoc; + static XModel aModel; + + @Override + protected void initialize( TestParameters tParam, PrintWriter log ) throws Exception { + SOfficeFactory SOF = SOfficeFactory.getFactory( tParam.getMSF() ); + log.println( "creating a drawdoc" ); + xDrawDoc = SOF.createImpressDoc(null); + aModel = UnoRuntime.queryInterface(XModel.class, xDrawDoc); + } + + /** + * Disposes the Draw document loaded before. + */ + @Override + protected void cleanup( TestParameters tParam, PrintWriter log ) { + log.println( " disposing xDrawDoc " ); + util.DesktopTools.closeDoc(xDrawDoc); + } + + @Override + protected TestEnvironment createTestEnvironment + (TestParameters tParam, PrintWriter log) throws Exception { + + XInterface oObj = null; + XShape oShape = null; + + // creation of testobject here + // first we write what we are intend to do to log file + log.println( "creating a test environment" ); + + XMultiServiceFactory docMSF = UnoRuntime.queryInterface(XMultiServiceFactory.class, xDrawDoc); + oShape = UnoRuntime.queryInterface(XShape.class, + docMSF.createInstance + ("com.sun.star.presentation.HandoutShape")); + + + DrawTools.getShapes(DrawTools.getDrawPage(xDrawDoc,0)).add(oShape); + + XPropertySet shapeProps = UnoRuntime.queryInterface(XPropertySet.class, oShape); + + try { + shapeProps.setPropertyValue( + "IsEmptyPresentationObject", Boolean.FALSE); + } catch (Exception e) {} + + XWindow xWindow = AccessibilityTools.getCurrentWindow (aModel); + XAccessible xRoot = AccessibilityTools.getAccessibleObject(xWindow); + + AccessibilityTools.printAccessibleTree(log, xRoot, tParam.getBool(util.PropertyName.DEBUG_IS_ACTIVE)); + oObj = AccessibilityTools.getAccessibleObjectForRole(xRoot, AccessibleRole.UNKNOWN, "ImpressHandout"); + + log.println("Implementation Name: "+utils.getImplName(oObj)); + + // create test environment here + TestEnvironment tEnv = new TestEnvironment( oObj ); + + final XShape fShape = oShape ; + tEnv.addObjRelation("EventProducer", + new ifc.accessibility._XAccessibleEventBroadcaster.EventProducer() { + public void fireEvent() { + try { + Size size = fShape.getSize(); + size.Width += 100; + fShape.setSize(size); + } catch(com.sun.star.beans.PropertyVetoException e) { + System.out.println("caught exception: " + e); + } + } + }); + + log.println("Implementation Name: " + utils.getImplName(oObj)); + + return tEnv; + } // finish method getTestEnvironment + +} + diff --git a/qadevOOo/tests/java/mod/_svx/AccessibleShape.java b/qadevOOo/tests/java/mod/_svx/AccessibleShape.java new file mode 100644 index 0000000000..2e160bb788 --- /dev/null +++ b/qadevOOo/tests/java/mod/_svx/AccessibleShape.java @@ -0,0 +1,110 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +package mod._svx; + +import java.io.PrintWriter; + +import lib.TestCase; +import lib.TestEnvironment; +import lib.TestParameters; +import util.AccessibilityTools; +import util.DrawTools; +import util.SOfficeFactory; +import util.utils; + +import com.sun.star.accessibility.AccessibleRole; +import com.sun.star.accessibility.XAccessible; +import com.sun.star.awt.Size; +import com.sun.star.awt.XWindow; +import com.sun.star.drawing.XShape; +import com.sun.star.frame.XModel; +import com.sun.star.lang.XComponent; +import com.sun.star.uno.UnoRuntime; +import com.sun.star.uno.XInterface; + +public class AccessibleShape extends TestCase { + + static XComponent xDrawDoc; + static XModel aModel; + + @Override + protected void initialize( TestParameters tParam, PrintWriter log ) throws Exception { + + SOfficeFactory SOF = SOfficeFactory.getFactory( tParam.getMSF() ); + + log.println( "creating a drawdoc" ); + xDrawDoc = SOF.createDrawDoc(null); + aModel = UnoRuntime.queryInterface(XModel.class, xDrawDoc); + } + + /** + * Disposes the Draw document loaded before. + */ + @Override + protected void cleanup( TestParameters tParam, PrintWriter log ) { + log.println( " disposing xDrawDoc " ); + util.DesktopTools.closeDoc(xDrawDoc); + } + + @Override + protected TestEnvironment createTestEnvironment + (TestParameters tParam, PrintWriter log) { + + XInterface oObj = null; + + // creation of testobject here + // first we write what we are intend to do to log file + log.println( "creating a test environment" ); + + SOfficeFactory SOF = SOfficeFactory.getFactory( tParam.getMSF()); + final XShape oShape = SOF.createShape(xDrawDoc, + 3000,4500,15000,1000,"Rectangle"); + + DrawTools.getShapes(DrawTools.getDrawPage(xDrawDoc,0)).add(oShape); + + XWindow xWindow = AccessibilityTools.getCurrentWindow (aModel); + XAccessible xRoot = AccessibilityTools.getAccessibleObject(xWindow); + + AccessibilityTools.printAccessibleTree(log, xRoot, tParam.getBool(util.PropertyName.DEBUG_IS_ACTIVE)); + + oObj = AccessibilityTools.getAccessibleObjectForRole(xRoot, AccessibleRole.UNKNOWN, "Rectangle"); + + // create test environment here + TestEnvironment tEnv = new TestEnvironment( oObj ); + + tEnv.addObjRelation("EventProducer", + new ifc.accessibility._XAccessibleEventBroadcaster.EventProducer() { + public void fireEvent() { + try { + Size size = oShape.getSize(); + size.Width += 100; + oShape.setSize(size); + } catch(com.sun.star.beans.PropertyVetoException e) { + System.out.println("caught exception: " + e); + } + } + }); + + log.println("Implementation Name: " + utils.getImplName(oObj)); + + return tEnv; + } // finish method getTestEnvironment + +} + diff --git a/qadevOOo/tests/java/mod/_svx/GraphicExporter.java b/qadevOOo/tests/java/mod/_svx/GraphicExporter.java new file mode 100644 index 0000000000..b47073de9d --- /dev/null +++ b/qadevOOo/tests/java/mod/_svx/GraphicExporter.java @@ -0,0 +1,209 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +package mod._svx; + +import com.sun.star.beans.XPropertySet; +import com.sun.star.document.XExporter; +import com.sun.star.drawing.XShape; +import com.sun.star.lang.XComponent; +import com.sun.star.ucb.XSimpleFileAccess; +import com.sun.star.uno.UnoRuntime; +import com.sun.star.uno.XInterface; +import com.sun.star.util.URL; + +import java.io.PrintWriter; + +import lib.TestCase; +import lib.TestEnvironment; +import lib.TestParameters; + +import util.DrawTools; +import util.SOfficeFactory; +import util.XMLTools; + + +/** + * Test for object which is represented by service + * <code>com.sun.star.drawing.GraphicExportFilter</code>. <p> + * + * Object implements the following interfaces : + * <ul> + * <li> <code>com::sun::star::document::XFilter</code></li> + * <li> <code>com::sun::star::document::XMimeTypeInfo</code></li> + * <li> <code>com::sun::star::document::XExporter</code></li> + * </ul> <p> + * + * The following files used by this test : + * <ul> + * <li><b> space-metal.jpg </b> : the file used for GraphicObject + * creation. This image must be then exported. </li> + * </ul> <p> + * + * This object test <b> is NOT </b> designed to be run in several + * threads concurrently. + * + * @see com.sun.star.document.XFilter + * @see com.sun.star.document.XMimeTypeInfo + * @see com.sun.star.document.XExporter + * @see ifc.document._XFilter + * @see ifc.document._XMimeTypeInfo + * @see ifc.document._XExporter + */ +public class GraphicExporter extends TestCase { + static XComponent xDrawDoc; + + /** + * Creates a new draw document. + */ + @Override + protected void initialize(TestParameters tParam, PrintWriter log) throws Exception { + log.println("creating a drawdoc"); + xDrawDoc = DrawTools.createDrawDoc( + tParam.getMSF()); + } + + /** + * Disposes the draw document created before + */ + @Override + protected void cleanup(TestParameters tParam, PrintWriter log) { + log.println(" disposing xDrawDoc "); + util.DesktopTools.closeDoc(xDrawDoc); + } + + /** + * Creating a TestEnvironment for the interfaces to be tested. + * Creates an instance of the service + * <code>com.sun.star.drawing.GraphicExportFilter</code> as + * a tested component. Then a <code>GraphicObjectShape</code> + * instance is added into the document and its image is obtained + * from JPEG file. This shape content is intended to be exported. + * + * Object relations created : + * <ul> + * <li> <code>'MediaDescriptor'</code> for + * {@link ifc.document._XFilter} : + * descriptor which contains target file name in + * the temporary directory, file type (JPEG) + * </li> + * <li> <code>'XFilter.Checker'</code> for + * {@link ifc.document._XFilter} : + * checks if the target file exists. + * In the case if SOffice is started in 'Hide' mode + * ('soapi.test.hidewindows' test parameter is 'true') + * the checker always returns <code>true</code>. + * </li> + * <li> <code>'SourceDocument'</code> for + * {@link ifc.document._XExporter} : + * the <code>GraphicObjectShape</code> component + * with loaded image. + * </li> + * </ul> + */ + @Override + protected TestEnvironment createTestEnvironment(TestParameters tParam, + PrintWriter log) throws Exception { + XInterface oObj = null; + XShape oShape = null; + Object go = null; + + + // creation of testobject here + // first we write what we are intend to do to log file + log.println("creating a test environment"); + + try { + go = tParam.getMSF().createInstance( + "com.sun.star.drawing.GraphicExportFilter"); + } catch (com.sun.star.uno.Exception e) { + log.println("Couldn't create instance"); + e.printStackTrace(log); + } + + // create testobject here + SOfficeFactory SOF = SOfficeFactory.getFactory( + tParam.getMSF()); + oShape = SOF.createShape(xDrawDoc, 5000, 5000, 1500, 1000, + "GraphicObject"); + DrawTools.getShapes(DrawTools.getDrawPage(xDrawDoc, 0)).add(oShape); + + XPropertySet oShapeProps = UnoRuntime.queryInterface( + XPropertySet.class, oShape); + XComponent xComp = null; + + oShapeProps.setPropertyValue("GraphicURL", + util.utils.getFullTestURL( + "space-metal.jpg")); + xComp = UnoRuntime.queryInterface(XComponent.class, + oShape); + + XExporter xEx = UnoRuntime.queryInterface( + XExporter.class, go); + xEx.setSourceDocument(xComp); + + final URL aURL = new URL(); + aURL.Complete = util.utils.getOfficeTemp( + tParam.getMSF()) + + "picture.jpg"; + + final XSimpleFileAccess fAcc; + + Object oFAcc = tParam.getMSF().createInstance( + "com.sun.star.ucb.SimpleFileAccess"); + fAcc = UnoRuntime.queryInterface( + XSimpleFileAccess.class, oFAcc); + + if (fAcc.exists(aURL.Complete)) { + fAcc.kill(aURL.Complete); + } + + oObj = (XInterface) go; + log.println("ImplName " + util.utils.getImplName(oObj)); + + TestEnvironment tEnv = new TestEnvironment(oObj); + tEnv.addObjRelation("MediaDescriptor", + XMLTools.createMediaDescriptor( + new String[] { + "FilterName", "URL", "MediaType" + }, new Object[] { "JPG", aURL, "image/jpeg" })); + tEnv.addObjRelation("SourceDocument", xComp); + + log.println("adding ObjRelation for XFilter"); + log.println("This Component doesn't really support the cancel method"); + log.println("See #101725"); + tEnv.addObjRelation("NoFilter.cancel()", Boolean.TRUE); + + final String hideMode = (String) tParam.get("soapi.test.hidewindows"); + tEnv.addObjRelation("XFilter.Checker", + new ifc.document._XFilter.FilterChecker() { + public boolean checkFilter() { + try { + if ((hideMode != null) && hideMode.equals("true")) { + return true; + } + + return fAcc.exists(aURL.Complete); + } catch (com.sun.star.uno.Exception e) { + return false; + } + } + }); + + return tEnv; + } // finish method getTestEnvironment +} // finish class GraphicExporter diff --git a/qadevOOo/tests/java/mod/_svx/SvxDrawPage.java b/qadevOOo/tests/java/mod/_svx/SvxDrawPage.java new file mode 100644 index 0000000000..a0d07d0c9f --- /dev/null +++ b/qadevOOo/tests/java/mod/_svx/SvxDrawPage.java @@ -0,0 +1,190 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +package mod._svx; + +import com.sun.star.drawing.XDrawPage; +import com.sun.star.drawing.XDrawPages; +import com.sun.star.drawing.XDrawPagesSupplier; +import com.sun.star.drawing.XShape; +import com.sun.star.lang.XComponent; +import com.sun.star.sheet.XSpreadsheetDocument; +import com.sun.star.uno.AnyConverter; +import com.sun.star.uno.Type; +import com.sun.star.uno.UnoRuntime; +import com.sun.star.uno.XInterface; + +import java.io.PrintWriter; + +import lib.TestCase; +import lib.TestEnvironment; +import lib.TestParameters; +import util.DrawTools; +import util.FormTools; +import util.InstCreator; +import util.SOfficeFactory; +import util.ShapeDsc; + + +/** + * Test for object which is represented by service + * <code>com.sun.star.drawing.DrawPage</code>. <p> + * + * Object implements the following interfaces : + * <ul> + * <li> <code>com::sun::star::drawing::GenericDrawPage</code></li> + * <li> <code>com::sun::star::drawing::XShapeBinder</code></li> + * <li> <code>com::sun::star::drawing::XShapeGrouper</code></li> + * <li> <code>com::sun::star::drawing::XShapes</code></li> + * <li> <code>com::sun::star::lang::XServiceInfo</code></li> + * <li> <code>com::sun::star::beans::XPropertySet</code></li> + * <li> <code>com::sun::star::container::XIndexAccess</code></li> + * <li> <code>com::sun::star::container::XElementAccess</code></li> + * <li> <code>com::sun::star::drawing::XMasterPageTarget</code></li> + * <li> <code>com::sun::star::container::XNamed</code></li> + * <li> <code>com::sun::star::drawing::XShapeCombiner</code></li> + * </ul> <p> + * + * This object test <b> is NOT </b> designed to be run in several + * threads concurrently. + * + * @see com.sun.star.drawing.GenericDrawPage + * @see com.sun.star.drawing.XShapeBinder + * @see com.sun.star.drawing.XShapeGrouper + * @see com.sun.star.drawing.XShapes + * @see com.sun.star.lang.XServiceInfo + * @see com.sun.star.beans.XPropertySet + * @see com.sun.star.container.XIndexAccess + * @see com.sun.star.container.XElementAccess + * @see com.sun.star.drawing.XMasterPageTarget + * @see com.sun.star.container.XNamed + * @see com.sun.star.drawing.XShapeCombiner + * @see ifc.drawing._GenericDrawPage + * @see ifc.drawing._XShapeBinder + * @see ifc.drawing._XShapeGrouper + * @see ifc.drawing._XShapes + * @see ifc.lang._XServiceInfo + * @see ifc.beans._XPropertySet + * @see ifc.container._XIndexAccess + * @see ifc.container._XElementAccess + * @see ifc.drawing._XMasterPageTarget + * @see ifc.container._XNamed + * @see ifc.drawing._XShapeCombiner + */ +public class SvxDrawPage extends TestCase { + static XSpreadsheetDocument xDoc = null; + + /** + * Creates a new Draw document. + */ + @Override + protected void initialize(TestParameters tParam, PrintWriter log) throws Exception { + // get a soffice factory object + SOfficeFactory SOF = SOfficeFactory.getFactory( + tParam.getMSF()); + + log.println("creating a sheetdocument"); + xDoc = SOF.createCalcDoc(null); + } + + /** + * Disposes the Draw document created before + */ + @Override + protected void cleanup(TestParameters tParam, PrintWriter log) { + log.println(" disposing xSheetDoc "); + util.DesktopTools.closeDoc(xDoc); + } + + /** + * Creating a TestEnvironment for the interfaces to be tested. + * From the Draw document created a collection of its draw + * pages is obtained. Two new pages are inserted. And one + * page is obtained as a testing component. A shape is added + * to this page. <p> + * + * Object relations created : + * <ul> + * <li> <code>'DrawPage'</code> for + * {@link ifc.drawing._XShapeGrouper} : + * the draw page tested. </li> + * <li> <code>'Shape'</code> for + * {@link ifc.drawing._XShapes} : + * the creator which can create instances of + * <code>com.sun.star.drawing.Line</code> service </li> + * </ul> + */ + @Override + protected TestEnvironment createTestEnvironment(TestParameters tParam, + PrintWriter log) throws Exception { + XInterface oObj = null; + XShape oShape = null; + XDrawPages oDP = null; + + XComponent xComp = UnoRuntime.queryInterface( + XComponent.class, xDoc); + + + // creation of testobject here + // first we write what we are intend to do to log file + log.println("creating a test environment"); + + log.println("getting Drawpages"); + + XDrawPagesSupplier oDPS = UnoRuntime.queryInterface( + XDrawPagesSupplier.class, xDoc); + oDP = oDPS.getDrawPages(); + oDP.insertNewByIndex(1); + oDP.insertNewByIndex(2); + oObj = (XDrawPage) AnyConverter.toObject(new Type(XDrawPage.class), + oDP.getByIndex(0)); + + SOfficeFactory SOF = SOfficeFactory.getFactory( + tParam.getMSF()); + + oShape = SOF.createShape(xComp, 5000, 3500, 7500, 5000, + "Rectangle"); + DrawTools.getShapes((XDrawPage) oObj).add(oShape); + + XShape oShape1 = SOF.createShape(xComp, 5000, 5500, 5000, 5000, + "Rectangle"); + DrawTools.getShapes((XDrawPage) oObj).add(oShape1); + + // create test environment here + TestEnvironment tEnv = new TestEnvironment(oObj); + + + //adding a controlButton to have a Form + FormTools.insertControlShape( + UnoRuntime.queryInterface(XComponent.class, xDoc), + 3000, 4500, 15000, 1000, "CommandButton"); + + // relation for XShapes interface + ShapeDsc sDsc = new ShapeDsc(5000, 3500, 7500, 10000, "Line"); + tEnv.addObjRelation("Shape", new InstCreator(xDoc, sDsc)); + + log.println("ImplementationName: " + util.utils.getImplName(oObj)); + + + // adding relation for XShapeGrouper + tEnv.addObjRelation("DrawPage", oObj); + + // adding relation for XMasterPageTarget + + return tEnv; + } // finish method getTestEnvironment +} // finish class SvxDrawPage diff --git a/qadevOOo/tests/java/mod/_svx/SvxGraphCtrlAccessibleContext.java b/qadevOOo/tests/java/mod/_svx/SvxGraphCtrlAccessibleContext.java new file mode 100644 index 0000000000..64eb954aae --- /dev/null +++ b/qadevOOo/tests/java/mod/_svx/SvxGraphCtrlAccessibleContext.java @@ -0,0 +1,210 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +package mod._svx; + +import java.io.PrintWriter; + +import lib.TestCase; +import lib.TestEnvironment; +import lib.TestParameters; +import util.AccessibilityTools; +import util.DrawTools; +import util.SOfficeFactory; +import util.utils; + +import com.sun.star.accessibility.AccessibleRole; +import com.sun.star.accessibility.XAccessible; +import com.sun.star.awt.XExtendedToolkit; +import com.sun.star.awt.XWindow; +import com.sun.star.beans.XPropertySet; +import com.sun.star.drawing.XShape; +import com.sun.star.frame.XController; +import com.sun.star.frame.XDispatch; +import com.sun.star.frame.XDispatchProvider; +import com.sun.star.frame.XModel; +import com.sun.star.lang.XComponent; +import com.sun.star.uno.UnoRuntime; +import com.sun.star.uno.XInterface; +import com.sun.star.util.URL; +import com.sun.star.util.XURLTransformer; +import com.sun.star.view.XSelectionSupplier; + +public class SvxGraphCtrlAccessibleContext extends TestCase{ + + static XComponent xDrawDoc = null; + + /** + * Called to create an instance of <code>TestEnvironment</code> + * with an object to test and related objects. + * Switches the document to Print Preview mode. + * Obtains accessible object for the page view. + * + * @param Param test parameters + * @param log writer to log information while testing + * + * @see TestEnvironment + * @see #getTestEnvironment + */ + @Override + protected TestEnvironment createTestEnvironment( + TestParameters Param, PrintWriter log) throws Exception { + + XInterface oObj = null; + + + XModel aModel = UnoRuntime.queryInterface(XModel.class, xDrawDoc); + + XController xController = aModel.getCurrentController(); + + SOfficeFactory SOF = SOfficeFactory.getFactory( Param.getMSF()); + final XShape oShape = SOF.createShape(xDrawDoc, + 5000,5000,1500,1000,"GraphicObject"); + + + DrawTools.getShapes(DrawTools.getDrawPage(xDrawDoc,0)).add(oShape); + + XPropertySet shapeProps = UnoRuntime.queryInterface(XPropertySet.class, oShape); + + String url = util.utils.getFullTestURL("space-metal.jpg"); + + log.println("Inserting Graphic: "+url); + + try { + shapeProps.setPropertyValue("GraphicURL", url); + } catch (com.sun.star.beans.UnknownPropertyException upe) { + log.println("Property GraphicURL is unknown"); + } catch (com.sun.star.beans.PropertyVetoException pve) { + log.println("Property GraphicURL is read only"); + } catch (com.sun.star.lang.IllegalArgumentException iae) { + log.println("Property GraphicURL tried to set to illegal argument"); + } catch (com.sun.star.lang.WrappedTargetException wte) { + log.println("Wrapped Target Exception was thrown while setting Property GraphicURL"); + } + + + //Opening ImageMapDialog + try { + String aSlotID = ".uno:ImageMapDialog"; + XDispatchProvider xDispProv = UnoRuntime.queryInterface( XDispatchProvider.class, xController ); + XURLTransformer xParser = UnoRuntime.queryInterface(XURLTransformer.class, + Param.getMSF().createInstance("com.sun.star.util.URLTransformer")); + // Because it's an in/out parameter we must use an array of URL objects. + URL[] aParseURL = new URL[1]; + aParseURL[0] = new URL(); + aParseURL[0].Complete = aSlotID; + xParser.parseStrict(aParseURL); + URL aURL = aParseURL[0]; + XDispatch xDispatcher = xDispProv.queryDispatch( aURL,"",0); + if( xDispatcher != null ) + xDispatcher.dispatch( aURL, null ); + utils.shortWait(); + } catch (com.sun.star.uno.Exception e) { + log.println("Couldn't change mode"); + } + + + oObj = (XInterface) Param.getMSF().createInstance + ("com.sun.star.awt.Toolkit") ; + + XExtendedToolkit tk = UnoRuntime.queryInterface(XExtendedToolkit.class,oObj); + + XWindow xWindow = UnoRuntime.queryInterface(XWindow.class,tk.getActiveTopWindow()); + + XAccessible xRoot = AccessibilityTools.getAccessibleObject(xWindow); + + AccessibilityTools.printAccessibleTree(log, xRoot, Param.getBool(util.PropertyName.DEBUG_IS_ACTIVE)); + + oObj = AccessibilityTools.getAccessibleObjectForRole(xRoot, AccessibleRole.PANEL); + + log.println("ImplementationName " + utils.getImplName(oObj)); + + TestEnvironment tEnv = new TestEnvironment(oObj); + + //selecting the inserted shape + final XSelectionSupplier SelSupp = UnoRuntime.queryInterface(XSelectionSupplier.class,xController); + + tEnv.addObjRelation("EventProducer", + new ifc.accessibility._XAccessibleEventBroadcaster.EventProducer() { + public void fireEvent() { + try { + SelSupp.select(oShape); + } catch (com.sun.star.lang.IllegalArgumentException iae) { + System.out.println("Couldn't select shape"); + } + } + }); + + return tEnv; + + } + + /** + * Called while disposing a <code>TestEnvironment</code>. + * Disposes text document. + * @param Param test parameters + * @param log writer to log information while testing + */ + @Override + protected void cleanup( TestParameters Param, PrintWriter log) { + + XModel aModel = UnoRuntime.queryInterface(XModel.class, xDrawDoc); + + XController xController = aModel.getCurrentController(); + + //Closing ImageMapDialog + try { + String aSlotID = "slot:10371"; + XDispatchProvider xDispProv = UnoRuntime.queryInterface( XDispatchProvider.class, xController ); + XURLTransformer xParser = UnoRuntime.queryInterface(XURLTransformer.class, + Param.getMSF().createInstance("com.sun.star.util.URLTransformer")); + // Because it's an in/out parameter we must use an array of URL objects. + URL[] aParseURL = new URL[1]; + aParseURL[0] = new URL(); + aParseURL[0].Complete = aSlotID; + xParser.parseStrict(aParseURL); + URL aURL = aParseURL[0]; + XDispatch xDispatcher = xDispProv.queryDispatch( aURL,"",0); + if( xDispatcher != null ) + xDispatcher.dispatch( aURL, null ); + } catch (com.sun.star.uno.Exception e) { + log.println("Couldn't change mode"); + } + log.println( " disposing xDrawDoc " ); + util.DesktopTools.closeDoc(xDrawDoc); + } + + /** + * Called while the <code>TestCase</code> initialization. In the + * implementation does nothing. Subclasses can override to initialize + * objects shared among all <code>TestEnvironment</code>s. + * + * @param Param test parameters + * @param log writer to log information while testing + * + * @see #initializeTestCase + */ + @Override + protected void initialize(TestParameters Param, PrintWriter log) throws Exception { + // get a soffice factory object + SOfficeFactory SOF = SOfficeFactory.getFactory( Param.getMSF()); + log.println("creating a draw document"); + xDrawDoc = SOF.createDrawDoc(null); + } + +} diff --git a/qadevOOo/tests/java/mod/_svx/SvxGraphicObject.java b/qadevOOo/tests/java/mod/_svx/SvxGraphicObject.java new file mode 100644 index 0000000000..d544d0294f --- /dev/null +++ b/qadevOOo/tests/java/mod/_svx/SvxGraphicObject.java @@ -0,0 +1,253 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +package mod._svx; + +import java.io.PrintWriter; + +import lib.TestCase; +import lib.TestEnvironment; +import lib.TestParameters; +import util.DefaultDsc; +import util.DrawTools; +import util.InstCreator; +import util.SOfficeFactory; + +import com.sun.star.awt.XBitmap; +import com.sun.star.beans.XPropertySet; +import com.sun.star.drawing.XShape; +import com.sun.star.lang.XComponent; +import com.sun.star.lang.XMultiServiceFactory; +import com.sun.star.style.XStyle; +import com.sun.star.uno.AnyConverter; +import com.sun.star.uno.Type; +import com.sun.star.uno.UnoRuntime; +import com.sun.star.uno.XInterface; + +/** + * Test for object which is represented by service + * <code>com.sun.star.drawing.GraphicObject</code>. <p> + * Object implements the following interfaces : + * <ul> + * <li> <code>com::sun::star::drawing::ShadowProperties</code></li> + * <li> <code>com::sun::star::drawing::RotationDescriptor</code></li> + * <li> <code>com::sun::star::text::XSimpleText</code></li> + * <li> <code>com::sun::star::drawing::XShape</code></li> + * <li> <code>com::sun::star::drawing::GraphicObjectShape</code></li> + * <li> <code>com::sun::star::drawing::Shape</code></li> + * <li> <code>com::sun::star::text::XTextRange</code></li> + * <li> <code>com::sun::star::drawing::XGluePointsSupplier</code></li> + * <li> <code>com::sun::star::beans::XPropertySet</code></li> + * <li> <code>com::sun::star::drawing::TextProperties</code></li> + * <li> <code>com::sun::star::style::CharacterProperties</code></li> + * <li> <code>com::sun::star::drawing::XShapeDescriptor</code></li> + * <li> <code>com::sun::star::style::ParagraphProperties</code></li> + * <li> <code>com::sun::star::text::XText</code></li> + * <li> <code>com::sun::star::lang::XComponent</code></li> + * </ul> <p> + * + * This object test <b> is NOT </b> designed to be run in several + * threads concurrently. + * + * @see com.sun.star.drawing.ShadowProperties + * @see com.sun.star.drawing.RotationDescriptor + * @see com.sun.star.text.XSimpleText + * @see com.sun.star.drawing.XShape + * @see com.sun.star.drawing.GraphicObjectShape + * @see com.sun.star.drawing.Shape + * @see com.sun.star.text.XTextRange + * @see com.sun.star.drawing.XGluePointsSupplier + * @see com.sun.star.beans.XPropertySet + * @see com.sun.star.drawing.TextProperties + * @see com.sun.star.style.CharacterProperties + * @see com.sun.star.drawing.XShapeDescriptor + * @see com.sun.star.style.ParagraphProperties + * @see com.sun.star.text.XText + * @see com.sun.star.lang.XComponent + * @see ifc.drawing._ShadowProperties + * @see ifc.drawing._RotationDescriptor + * @see ifc.text._XSimpleText + * @see ifc.drawing._XShape + * @see ifc.drawing._GraphicObjectShape + * @see ifc.drawing._Shape + * @see ifc.text._XTextRange + * @see ifc.drawing._XGluePointsSupplier + * @see ifc.beans._XPropertySet + * @see ifc.drawing._TextProperties + * @see ifc.style._CharacterProperties + * @see ifc.drawing._XShapeDescriptor + * @see ifc.style._ParagraphProperties + * @see ifc.text._XText + * @see ifc.lang._XComponent + */ +public class SvxGraphicObject extends TestCase { + + static XComponent xDrawDoc; + + /** + * Creates a new Draw document. + */ + @Override + protected void initialize( TestParameters tParam, PrintWriter log ) throws Exception { + + log.println( "creating a drawdoc" ); + xDrawDoc = DrawTools.createDrawDoc(tParam.getMSF()); + } + + /** + * Disposes the Draw document created before + */ + @Override + protected void cleanup( TestParameters tParam, PrintWriter log ) { + log.println( " disposing xDrawDoc " ); + util.DesktopTools.closeDoc(xDrawDoc); + } + + /** + * Creating a TestEnvironment for the interfaces to be tested. + * Creates an instance of the service + * <code>com.sun.star.drawing.GraphicObject</code> as a tested + * component and inserts it to one of draw pages of the document. + * <p> + * + * Object relations created : + * <ul> + * <li> <code>'Style1', 'Style2'</code> for + * {@link ifc.drawing._Shape} : + * two values of 'Style' property. The first is taken + * from the shape tested, the second from another + * shape added to the draw page. </li> + * <li> <code>'Bitmap1', 'Bitmap2'</code> for + * {@link ifc.drawing._GraphicObjectShape} :</li> + * two bitmap objects which are created by setting + * 'GraphicURL' property of component tested and + * getting its 'GraphicObjectFillBitmap' property. + * <li> <code>'IMAP'</code> for + * {@link ifc.drawing._GraphicObjectShape} : + * <code>com.sun.star.image.ImageMapRectangleObject</code> + * service instance. </li> + * <li> <code>'XTEXTINFO'</code> for + * {@link ifc.text._XText} : + * creator which can create instances of + * <code>com.sun.star.text.TextField.URL</code> + * service. </li> + * </ul> + */ + @Override + protected TestEnvironment createTestEnvironment(TestParameters tParam, PrintWriter log) { + + XInterface oObj = null; + XShape oShape = null; + Object imap=null; + + // creation of testobject here + // first we write what we are intend to do to log file + log.println( "creating a test environment" ); + + // create testobject here + SOfficeFactory SOF = SOfficeFactory.getFactory( tParam.getMSF()); + oShape = SOF.createShape(xDrawDoc,5000,5000,1500,1000,"GraphicObject"); + DrawTools.getShapes(DrawTools.getDrawPage(xDrawDoc,0)).add(oShape); + oObj = oShape; + + TestEnvironment tEnv = new TestEnvironment( oShape ); + + // adding two styles as ObjRelation for Shape + oShape = SOF.createShape(xDrawDoc,3000,4500,15000,1000,"Ellipse"); + DrawTools.getShapes(DrawTools.getDrawPage(xDrawDoc,0)).add(oShape); + + XPropertySet oShapeProps = UnoRuntime.queryInterface(XPropertySet.class,oObj); + XStyle aStyle = null; + try { + aStyle = (XStyle) AnyConverter.toObject( + new Type(XStyle.class),oShapeProps.getPropertyValue("Style")); + } catch (com.sun.star.lang.WrappedTargetException e) { + } catch (com.sun.star.beans.UnknownPropertyException e) { + } catch (com.sun.star.lang.IllegalArgumentException e) { + } + tEnv.addObjRelation("Style1",aStyle); + + oShapeProps = UnoRuntime.queryInterface(XPropertySet.class,oShape); + try { + aStyle = (XStyle) AnyConverter.toObject( + new Type(XStyle.class),oShapeProps.getPropertyValue("Style")); + } catch (com.sun.star.lang.WrappedTargetException e) { + } catch (com.sun.star.beans.UnknownPropertyException e) { + } catch (com.sun.star.lang.IllegalArgumentException e) { + } + tEnv.addObjRelation("Style2",aStyle); + + + // adding graphic as ObjRelation for GraphicObjectShape + oShapeProps = UnoRuntime.queryInterface(XPropertySet.class,oObj); + XBitmap aBitmap = null; + try { + oShapeProps.setPropertyValue( + "GraphicURL",util.utils.getFullTestURL("space-metal.jpg")); + aBitmap = (XBitmap) AnyConverter.toObject( + new Type(XBitmap.class),oShapeProps.getPropertyValue + ("GraphicObjectFillBitmap")); + } catch (com.sun.star.lang.WrappedTargetException e) { + } catch (com.sun.star.lang.IllegalArgumentException e) { + } catch (com.sun.star.beans.PropertyVetoException e) { + } catch (com.sun.star.beans.UnknownPropertyException e) { + } + + + tEnv.addObjRelation("Bitmap1",aBitmap); + + try { + oShapeProps.setPropertyValue( + "GraphicURL",util.utils.getFullTestURL("crazy-blue.jpg")); + aBitmap = (XBitmap) AnyConverter.toObject( + new Type(XBitmap.class),oShapeProps.getPropertyValue + ("GraphicObjectFillBitmap")); + } catch (com.sun.star.lang.WrappedTargetException e) { + } catch (com.sun.star.lang.IllegalArgumentException e) { + } catch (com.sun.star.beans.PropertyVetoException e) { + } catch (com.sun.star.beans.UnknownPropertyException e) { + } + + tEnv.addObjRelation("Bitmap2",aBitmap); + + try { + XMultiServiceFactory oDocMSF = UnoRuntime.queryInterface(XMultiServiceFactory.class,xDrawDoc); + imap = oDocMSF.createInstance + ( "com.sun.star.image.ImageMapRectangleObject" ); + } catch (com.sun.star.uno.Exception e) { + log.println("Couldn't create instance"); + e.printStackTrace(log); + } + + + tEnv.addObjRelation("IMAP",imap); + tEnv.addObjRelation("ImapObject",imap); + + // adding relation for XText interface + DefaultDsc tDsc = new DefaultDsc("com.sun.star.text.XTextContent", + "com.sun.star.text.TextField.URL"); + log.println( " adding InstCreator object" ); + tEnv.addObjRelation( "XTEXTINFO", new InstCreator( xDrawDoc, tDsc ) ); + + tEnv.addObjRelation("NoShear",Boolean.TRUE); + + return tEnv; + + } // finish method getTestEnvironment + +} // finish class SvxGraphicObject diff --git a/qadevOOo/tests/java/mod/_svx/SvxShape.java b/qadevOOo/tests/java/mod/_svx/SvxShape.java new file mode 100644 index 0000000000..74a4e209be --- /dev/null +++ b/qadevOOo/tests/java/mod/_svx/SvxShape.java @@ -0,0 +1,212 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +package mod._svx; + +import java.io.PrintWriter; + +import lib.TestCase; +import lib.TestEnvironment; +import lib.TestParameters; +import util.DefaultDsc; +import util.DrawTools; +import util.InstCreator; +import util.SOfficeFactory; +import util.utils; + +import com.sun.star.beans.XPropertySet; +import com.sun.star.drawing.XShape; +import com.sun.star.lang.XComponent; +import com.sun.star.style.XStyle; +import com.sun.star.uno.AnyConverter; +import com.sun.star.uno.Type; +import com.sun.star.uno.UnoRuntime; +import com.sun.star.uno.XInterface; + +/** + * Test for object which is represented by service + * <code>com.sun.star.drawing.Shape</code>. <p> + * + * Object implements the following interfaces : + * <ul> + * <li> <code>com::sun::star::style::ParagraphProperties</code></li> + * <li> <code>com::sun::star::drawing::LineProperties</code></li> + * <li> <code>com::sun::star::drawing::FillProperties</code></li> + * <li> <code>com::sun::star::drawing::TextShape</code></li> + * <li> <code>com::sun::star::drawing::ShadowProperties</code></li> + * <li> <code>com::sun::star::drawing::XGluePointsSupplier</code></li> + * <li> <code>com::sun::star::style::CharacterProperties</code></li> + * <li> <code>com::sun::star::drawing::RotationDescriptor</code></li> + * <li> <code>com::sun::star::text::XTextRange</code></li> + * <li> <code>com::sun::star::drawing::XShape</code></li> + * <li> <code>com::sun::star::lang::XComponent</code></li> + * <li> <code>com::sun::star::drawing::TextProperties</code></li> + * <li> <code>com::sun::star::beans::XPropertySet</code></li> + * <li> <code>com::sun::star::text::XText</code></li> + * <li> <code>com::sun::star::drawing::XShapeDescriptor</code></li> + * <li> <code>com::sun::star::text::XSimpleText</code></li> + * <li> <code>com::sun::star::drawing::Shape</code></li> + * </ul> <p> + * + * The following files used by this test : + * <ul> + * <li><b> SvxShape.sxd </b> : this document is loaded for + * adding a shape tested to it. </li> + * </ul> <p> + * + * This object test <b> is NOT </b> designed to be run in several + * threads concurrently. + * + * @see com.sun.star.style.ParagraphProperties + * @see com.sun.star.drawing.LineProperties + * @see com.sun.star.drawing.FillProperties + * @see com.sun.star.drawing.TextShape + * @see com.sun.star.drawing.ShadowProperties + * @see com.sun.star.drawing.XGluePointsSupplier + * @see com.sun.star.style.CharacterProperties + * @see com.sun.star.drawing.RotationDescriptor + * @see com.sun.star.text.XTextRange + * @see com.sun.star.drawing.XShape + * @see com.sun.star.lang.XComponent + * @see com.sun.star.drawing.TextProperties + * @see com.sun.star.beans.XPropertySet + * @see com.sun.star.text.XText + * @see com.sun.star.drawing.XShapeDescriptor + * @see com.sun.star.text.XSimpleText + * @see com.sun.star.drawing.Shape + * @see ifc.style._ParagraphProperties + * @see ifc.drawing._LineProperties + * @see ifc.drawing._FillProperties + * @see ifc.drawing._TextShape + * @see ifc.drawing._ShadowProperties + * @see ifc.drawing._XGluePointsSupplier + * @see ifc.style._CharacterProperties + * @see ifc.drawing._RotationDescriptor + * @see ifc.text._XTextRange + * @see ifc.drawing._XShape + * @see ifc.lang._XComponent + * @see ifc.drawing._TextProperties + * @see ifc.beans._XPropertySet + * @see ifc.text._XText + * @see ifc.drawing._XShapeDescriptor + * @see ifc.text._XSimpleText + * @see ifc.drawing._Shape + */ +public class SvxShape extends TestCase { + + static XComponent xDrawDoc; + + /** + * Loads a Draw document with name 'SvxShape.sxd' from test + * documents directory + */ + @Override + protected void initialize( TestParameters tParam, PrintWriter log ) throws Exception { + + SOfficeFactory SOF = SOfficeFactory.getFactory( tParam.getMSF() ); + + log.println( "creating a drawdoc" ); + xDrawDoc = SOF.loadDocument( + utils.getFullTestURL("SvxShape.sxd")); + } + + /** + * Disposes the Draw document loaded before. + */ + @Override + protected void cleanup( TestParameters tParam, PrintWriter log ) { + log.println( " disposing xDrawDoc " ); + util.DesktopTools.closeDoc(xDrawDoc); + } + + /** + * Creating a TestEnvironment for the interfaces to be tested. + * Creates an instance of the service + * <code>com.sun.star.drawing.EllipseShape</code> as tested component + * and adds it to the document. + * Object relations created : + * <ul> + * <li> <code>'Style1', 'Style2'</code> for + * {@link ifc.drawing._Shape} : + * two values of 'Style' property. The first is taken + * from the shape tested, the second from another + * shape added to the draw page. </li> + * <li> <code>'XTEXTINFO'</code> for + * {@link ifc.text._XText} : + * creator which can create instances of + * <code>com.sun.star.text.TextField.URL</code> + * service. </li> + * </ul> + */ + @Override + protected TestEnvironment createTestEnvironment + (TestParameters tParam, PrintWriter log) { + + XInterface oObj = null; + XShape oShape = null; + + // creation of testobject here + // first we write what we are intend to do to log file + log.println( "creating a test environment" ); + + SOfficeFactory SOF = SOfficeFactory.getFactory( tParam.getMSF()); + oShape = SOF.createShape(xDrawDoc,3000,4500,15000,1000,"Text"); + DrawTools.getShapes(DrawTools.getDrawPage(xDrawDoc,0)).add(oShape); + oObj = oShape ; + + + // create test environment here + TestEnvironment tEnv = new TestEnvironment( oShape ); + + // adding relations for Shape service + oShape = SOF.createShape(xDrawDoc,5000,3500,7500,5000,"Text"); + DrawTools.getShapes(DrawTools.getDrawPage(xDrawDoc,0)).add(oShape); + + log.println( "adding two style as ObjRelation for ShapeDescriptor" ); + XPropertySet oShapeProps = UnoRuntime.queryInterface(XPropertySet.class,oObj); + XStyle aStyle = null; + try { + aStyle = (XStyle) AnyConverter.toObject( + new Type(XStyle.class),oShapeProps.getPropertyValue("Style")); + } catch (com.sun.star.lang.WrappedTargetException e) { + } catch (com.sun.star.beans.UnknownPropertyException e) { + } catch (com.sun.star.lang.IllegalArgumentException e) { + } + tEnv.addObjRelation("Style1",aStyle); + + oShapeProps = UnoRuntime.queryInterface + (XPropertySet.class,oShape); + try { + aStyle = (XStyle) AnyConverter.toObject( + new Type(XStyle.class),oShapeProps.getPropertyValue("Style")); + } catch (com.sun.star.lang.WrappedTargetException e) { + } catch (com.sun.star.beans.UnknownPropertyException e) { + } catch (com.sun.star.lang.IllegalArgumentException e) { + } + tEnv.addObjRelation("Style2",aStyle); + + // adding relation for XText + DefaultDsc tDsc = new DefaultDsc("com.sun.star.text.XTextContent", + "com.sun.star.text.TextField.URL"); + log.println( " adding InstCreator object" ); + tEnv.addObjRelation( "XTEXTINFO", new InstCreator( xDrawDoc, tDsc ) ); + + return tEnv; + } // finish method getTestEnvironment + +} // finish class SvxShape diff --git a/qadevOOo/tests/java/mod/_svx/SvxShapeCircle.java b/qadevOOo/tests/java/mod/_svx/SvxShapeCircle.java new file mode 100644 index 0000000000..63fd2c4ebb --- /dev/null +++ b/qadevOOo/tests/java/mod/_svx/SvxShapeCircle.java @@ -0,0 +1,214 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +package mod._svx; + +import java.io.PrintWriter; + +import lib.TestCase; +import lib.TestEnvironment; +import lib.TestParameters; +import util.DefaultDsc; +import util.DrawTools; +import util.InstCreator; +import util.SOfficeFactory; +import util.utils; + +import com.sun.star.beans.XPropertySet; +import com.sun.star.drawing.XShape; +import com.sun.star.lang.XComponent; +import com.sun.star.style.XStyle; +import com.sun.star.uno.AnyConverter; +import com.sun.star.uno.Type; +import com.sun.star.uno.UnoRuntime; +import com.sun.star.uno.XInterface; + +/** + * Test for object which is represented by service + * <code>com.sun.star.drawing.EllipseShape</code>. <p> + * Object implements the following interfaces : + * <ul> + * <li> <code>com::sun::star::style::ParagraphProperties</code></li> + * <li> <code>com::sun::star::drawing::LineProperties</code></li> + * <li> <code>com::sun::star::drawing::EllipseShape</code></li> + * <li> <code>com::sun::star::drawing::FillProperties</code></li> + * <li> <code>com::sun::star::drawing::ShadowProperties</code></li> + * <li> <code>com::sun::star::drawing::XGluePointsSupplier</code></li> + * <li> <code>com::sun::star::style::CharacterProperties</code></li> + * <li> <code>com::sun::star::drawing::RotationDescriptor</code></li> + * <li> <code>com::sun::star::text::XTextRange</code></li> + * <li> <code>com::sun::star::drawing::XShape</code></li> + * <li> <code>com::sun::star::lang::XComponent</code></li> + * <li> <code>com::sun::star::drawing::TextProperties</code></li> + * <li> <code>com::sun::star::beans::XPropertySet</code></li> + * <li> <code>com::sun::star::text::XText</code></li> + * <li> <code>com::sun::star::drawing::XShapeDescriptor</code></li> + * <li> <code>com::sun::star::text::XSimpleText</code></li> + * <li> <code>com::sun::star::drawing::Shape</code></li> + * </ul> <p> + * The following files used by this test : + * <ul> + * <li><b> SvxShape.sxd </b> : this document is loaded for + * adding a shape tested to it. </li> + * </ul> <p> + * This object test <b> is NOT </b> designed to be run in several + * threads concurrently. + * + * @see com.sun.star.style.ParagraphProperties + * @see com.sun.star.drawing.LineProperties + * @see com.sun.star.drawing.EllipseShape + * @see com.sun.star.drawing.FillProperties + * @see com.sun.star.drawing.ShadowProperties + * @see com.sun.star.drawing.XGluePointsSupplier + * @see com.sun.star.style.CharacterProperties + * @see com.sun.star.drawing.RotationDescriptor + * @see com.sun.star.text.XTextRange + * @see com.sun.star.drawing.XShape + * @see com.sun.star.lang.XComponent + * @see com.sun.star.drawing.TextProperties + * @see com.sun.star.beans.XPropertySet + * @see com.sun.star.text.XText + * @see com.sun.star.drawing.XShapeDescriptor + * @see com.sun.star.text.XSimpleText + * @see com.sun.star.drawing.Shape + * @see ifc.style._ParagraphProperties + * @see ifc.drawing._LineProperties + * @see ifc.drawing._EllipseShape + * @see ifc.drawing._FillProperties + * @see ifc.drawing._ShadowProperties + * @see ifc.drawing._XGluePointsSupplier + * @see ifc.style._CharacterProperties + * @see ifc.drawing._RotationDescriptor + * @see ifc.text._XTextRange + * @see ifc.drawing._XShape + * @see ifc.lang._XComponent + * @see ifc.drawing._TextProperties + * @see ifc.beans._XPropertySet + * @see ifc.text._XText + * @see ifc.drawing._XShapeDescriptor + * @see ifc.text._XSimpleText + * @see ifc.drawing._Shape + */ +public class SvxShapeCircle extends TestCase { + + static XComponent xDrawDoc; + + /** + * Loads a Draw document with name 'SvxShape.sxd' from test + * documents directory + */ + @Override + protected void initialize( TestParameters tParam, PrintWriter log ) throws Exception { + SOfficeFactory SOF = SOfficeFactory.getFactory( tParam.getMSF() ); + log.println( "creating a drawdoc" ); + xDrawDoc = SOF.loadDocument( + utils.getFullTestURL("SvxShape.sxd")); + } + + /** + * Disposes the Draw document loaded before. + */ + @Override + protected void cleanup( TestParameters tParam, PrintWriter log ) { + log.println( " disposing xDrawDoc " ); + util.DesktopTools.closeDoc(xDrawDoc); + } + + + /** + * Creating a TestEnvironment for the interfaces to be tested. + * Creates an instance of the service + * <code>com.sun.star.drawing.EllipseShape</code> as tested component + * and adds it to the document. Then the FULL type of circle is set. + * + * Object relations created : + * <ul> + * <li> <code>'Style1', 'Style2'</code> for + * {@link ifc.drawing._Shape} : + * two values of 'Style' property. The first is taken + * from the shape tested, the second from another + * shape added to the draw page. </li> + * <li> <code>'XTEXTINFO'</code> for + * {@link ifc.text._XText} : + * creator which can create instances of + * <code>com.sun.star.text.TextField.URL</code> + * service. </li> + * </ul> + */ + @Override + protected TestEnvironment createTestEnvironment(TestParameters tParam, PrintWriter log) throws Exception { + + XInterface oObj = null; + XShape oShape = null; + + // creation of testobject here + // first we write what we are intend to do to log file + log.println( "creating a test environment" ); + + SOfficeFactory SOF = SOfficeFactory.getFactory(tParam.getMSF()) ; + oShape = SOF.createShape(xDrawDoc,5000,5000,3000,3000,"Ellipse"); + + XPropertySet props = UnoRuntime.queryInterface + (XPropertySet.class, oShape) ; + + DrawTools.getShapes(DrawTools.getDrawPage(xDrawDoc,0)).add(oShape) ; + props.setPropertyValue("CircleKind", + com.sun.star.drawing.CircleKind.FULL) ; + + oObj = oShape ; + + oShape = SOF.createShape(xDrawDoc,5000,3500,7500,5000,"Line"); + DrawTools.getShapes(DrawTools.getDrawPage(xDrawDoc,0)).add(oShape) ; + + // test environment creation + + TestEnvironment tEnv = new TestEnvironment(oObj); + + log.println( "adding two styles as ObjRelation for ShapeDescriptor" ); + XPropertySet oShapeProps = UnoRuntime.queryInterface(XPropertySet.class,oObj); + XStyle aStyle = null; + + try { + aStyle = (XStyle) AnyConverter.toObject( + new Type(XStyle.class),oShapeProps.getPropertyValue("Style")); + } catch (com.sun.star.lang.WrappedTargetException e) { + } catch (com.sun.star.beans.UnknownPropertyException e) { + } catch (com.sun.star.lang.IllegalArgumentException e) { + } + + tEnv.addObjRelation("Style1",aStyle); + oShapeProps = UnoRuntime.queryInterface(XPropertySet.class,oShape); + try { + aStyle = (XStyle) AnyConverter.toObject( + new Type(XStyle.class),oShapeProps.getPropertyValue("Style")); + } catch (com.sun.star.lang.WrappedTargetException e) { + } catch (com.sun.star.beans.UnknownPropertyException e) { + } catch (com.sun.star.lang.IllegalArgumentException e) { + } + + tEnv.addObjRelation("Style2",aStyle); + + DefaultDsc tDsc = new DefaultDsc("com.sun.star.text.XTextContent", + "com.sun.star.text.TextField.URL"); + log.println( " adding InstCreator object" ); + tEnv.addObjRelation( "XTEXTINFO", new InstCreator( xDrawDoc, tDsc ) ); + + return tEnv; + } // finish method getTestEnvironment + +} // finish class SvxShapeCircle diff --git a/qadevOOo/tests/java/mod/_svx/SvxShapeCollection.java b/qadevOOo/tests/java/mod/_svx/SvxShapeCollection.java new file mode 100644 index 0000000000..5cbad52300 --- /dev/null +++ b/qadevOOo/tests/java/mod/_svx/SvxShapeCollection.java @@ -0,0 +1,133 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +package mod._svx; + +import java.io.PrintWriter; + +import lib.TestCase; +import lib.TestEnvironment; +import lib.TestParameters; +import util.DrawTools; +import util.InstCreator; +import util.SOfficeFactory; +import util.ShapeDsc; + +import com.sun.star.drawing.XShape; +import com.sun.star.drawing.XShapes; +import com.sun.star.lang.XComponent; +import com.sun.star.uno.UnoRuntime; +import com.sun.star.uno.XInterface; + +public class SvxShapeCollection extends TestCase { + + static XComponent xDrawDoc; + + /** + * in general this method creates a testdocument + * + * @param tParam class which contains additional test parameters + * @param log class to log the test state and result + * + * + * @see TestParameters + * @see PrintWriter + * + */ + @Override + protected void initialize( TestParameters tParam, PrintWriter log ) throws Exception { + log.println( "creating a drawdoc" ); + xDrawDoc = DrawTools.createDrawDoc(tParam.getMSF()); + } + + /** + * in general this method disposes the testenvironment and document + * + * @param tParam class which contains additional test parameters + * @param log class to log the test state and result + * + * + * @see TestParameters + * @see PrintWriter + * + */ + @Override + protected void cleanup( TestParameters tParam, PrintWriter log ) { + log.println( " disposing xDrawDoc " ); + util.DesktopTools.closeDoc(xDrawDoc); + } + + + /** + * creating a TestEnvironment for the interfaces to be tested + * + * @param tParam class which contains additional test parameters + * @param log class to log the test state and result + * + * @return Status class + * + * @see TestParameters + * @see PrintWriter + */ + @Override + protected TestEnvironment createTestEnvironment + (TestParameters tParam, PrintWriter log) { + + XInterface oObj = null; + XShape oShape = null; + + // creation of testobject here + // first we write what we are intend to do to log file + log.println( "creating a test environment" ); + + try { + // adding some shapes for testing. + SOfficeFactory SOF = SOfficeFactory.getFactory( tParam.getMSF()); + Object col = tParam.getMSF().createInstance + ("com.sun.star.drawing.ShapeCollection"); + XShapes shapes = UnoRuntime.queryInterface + (XShapes.class,col); + + oShape = SOF.createShape(xDrawDoc,3000,4500,15000,1000,"Ellipse"); + DrawTools.getShapes(DrawTools.getDrawPage(xDrawDoc,0)).add(oShape); + shapes.add(oShape); + + oShape = SOF.createShape(xDrawDoc,5000,3500,7500,5000,"Rectangle"); + DrawTools.getShapes(DrawTools.getDrawPage(xDrawDoc,0)).add(oShape) ; + shapes.add(oShape); + + oObj = (XInterface) col ; + + } + catch (Exception e) { + log.println("Couldn't create instance"); + e.printStackTrace(log); + } + + // test environment creation + + TestEnvironment tEnv = new TestEnvironment(oObj); + System.out.println("IName: "+util.utils.getImplName(oObj)); + ShapeDsc sDsc = new ShapeDsc(5000,3500,7500,10000,"Line"); + tEnv.addObjRelation("Shape", new InstCreator(xDrawDoc, sDsc)) ; + + return tEnv; + } // finish method getTestEnvironment + +} // finish class SvxShapeCollection + diff --git a/qadevOOo/tests/java/mod/_svx/SvxShapeConnector.java b/qadevOOo/tests/java/mod/_svx/SvxShapeConnector.java new file mode 100644 index 0000000000..7236bcc18c --- /dev/null +++ b/qadevOOo/tests/java/mod/_svx/SvxShapeConnector.java @@ -0,0 +1,187 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +package mod._svx; + +import java.io.PrintWriter; + +import lib.TestCase; +import lib.TestEnvironment; +import lib.TestParameters; +import util.DefaultDsc; +import util.DrawTools; +import util.InstCreator; +import util.SOfficeFactory; + +import com.sun.star.beans.XPropertySet; +import com.sun.star.drawing.XShape; +import com.sun.star.lang.XComponent; +import com.sun.star.lang.XMultiServiceFactory; +import com.sun.star.style.XStyle; +import com.sun.star.uno.AnyConverter; +import com.sun.star.uno.Type; +import com.sun.star.uno.UnoRuntime; +import com.sun.star.uno.XInterface; + +/** + * + * initial description + * @see com.sun.star.beans.XPropertySet + * @see com.sun.star.document.LinkTarget + * @see com.sun.star.document.XLinkTargetSupplier + * @see com.sun.star.drawing.ConnectorShapeDescriptor + * @see com.sun.star.drawing.LineShapeDescriptor + * @see com.sun.star.drawing.PolyPolygonDescriptor + * @see com.sun.star.drawing.RotationDescriptor + * @see com.sun.star.drawing.ShadowDescriptor + * @see com.sun.star.drawing.ShapeDescriptor + * @see com.sun.star.drawing.Text + * @see com.sun.star.drawing.XConnectorShape + * @see com.sun.star.drawing.XShape + * @see com.sun.star.drawing.XShapeDescriptor + * @see com.sun.star.lang.XComponent + * @see com.sun.star.style.CharacterProperties + * @see com.sun.star.style.ParagraphProperties + * @see com.sun.star.text.XSimpleText + * @see com.sun.star.text.XText + * @see com.sun.star.text.XTextRange + * + */ +public class SvxShapeConnector extends TestCase { + + static XComponent xDrawDoc; + + /** + * in general this method creates a testdocument + * + * @param tParam class which contains additional test parameters + * @param log class to log the test state and result + * + * + * @see TestParameters + * * @see PrintWriter + * + */ + @Override + protected void initialize( TestParameters tParam, PrintWriter log ) throws Exception { + log.println( "creating a drawdoc" ); + xDrawDoc = DrawTools.createDrawDoc(tParam.getMSF()); + } + + /** + * in general this method disposes the testenvironment and document + * + * @param tParam class which contains additional test parameters + * @param log class to log the test state and result + * + * + * @see TestParameters + * * @see PrintWriter + * + */ + @Override + protected void cleanup( TestParameters tParam, PrintWriter log ) { + log.println( " disposing xDrawDoc " ); + util.DesktopTools.closeDoc(xDrawDoc); + } + + + /** + * * creating a TestEnvironment for the interfaces to be tested + * + * @param tParam class which contains additional test parameters + * @param log class to log the test state and result + * + * @return Status class + * + * @see TestParameters + * * @see PrintWriter + */ + @Override + protected TestEnvironment createTestEnvironment + (TestParameters tParam, PrintWriter log) { + + XInterface oObj = null; + XShape oShape = null; + + // creation of testobject here + // first we write what we are intend to do to log file + log.println( "creating a test environment" ); + try { + XMultiServiceFactory oDocMSF = UnoRuntime.queryInterface(XMultiServiceFactory.class,xDrawDoc); + Object oInt = oDocMSF.createInstance + ( "com.sun.star.drawing.ConnectorShape" ); + + oShape = UnoRuntime.queryInterface( XShape.class, oInt ); + DrawTools.getShapes(DrawTools.getDrawPage(xDrawDoc,0)).add(oShape); + } + catch (Exception e) { + log.println("Couldn't create instance"); + e.printStackTrace(log); + } + + // create testobject here + oObj = oShape; + + TestEnvironment tEnv = new TestEnvironment( oObj ); + + SOfficeFactory SOF = SOfficeFactory.getFactory( tParam.getMSF()); + oShape = SOF.createShape(xDrawDoc,3000,4500,15000,1000,"Ellipse"); + DrawTools.getShapes(DrawTools.getDrawPage(xDrawDoc,0)).add(oShape); + + for (int i=0;i<10;i++) { + DrawTools.getShapes(DrawTools.getDrawPage(xDrawDoc,0)).add( + SOF.createShape(xDrawDoc, + 3000,4500,7510+10*i,5010+10*i,"Rectangle")); + } + + log.println( "adding two style as ObjRelation for ShapeDescriptor" ); + XPropertySet oShapeProps = UnoRuntime.queryInterface(XPropertySet.class,oObj); + XStyle aStyle = null; + try { + aStyle = (XStyle) AnyConverter.toObject( + new Type(XStyle.class),oShapeProps.getPropertyValue("Style")); + } catch (Exception e) {} + + tEnv.addObjRelation("Style1",aStyle); + oShapeProps = UnoRuntime.queryInterface(XPropertySet.class,oShape); + try { + aStyle = (XStyle) AnyConverter.toObject( + new Type(XStyle.class),oShapeProps.getPropertyValue("Style")); + } catch (Exception e) {} + + tEnv.addObjRelation("Style2",aStyle); + + DefaultDsc tDsc = new DefaultDsc("com.sun.star.text.XTextContent", + "com.sun.star.text.TextField.URL"); + log.println( " adding InstCreator object" ); + tEnv.addObjRelation( "XTEXTINFO", new InstCreator( xDrawDoc, tDsc ) ); + tEnv.addObjRelation("NoSetSize","SvxShapeConnector"); + // adding relation for XConnectorShape + XShape oShape1 = SOF.createShape(xDrawDoc,1000,2000,1500,1000,"Line"); + XShape oShape2 = SOF.createShape(xDrawDoc,1000,2000,4000,3000,"Line"); + DrawTools.getShapes(DrawTools.getDrawPage(xDrawDoc,0)).add(oShape1); + DrawTools.getShapes(DrawTools.getDrawPage(xDrawDoc,0)).add(oShape2); + tEnv.addObjRelation("XConnectorShape.Shapes", + new XShape[] {oShape1, oShape2}) ; + System.out.println("IName: "+util.utils.getImplName(oObj)); + return tEnv; + } // finish method getTestEnvironment + +} // finish class SvxShapeConnector + diff --git a/qadevOOo/tests/java/mod/_svx/SvxShapeControl.java b/qadevOOo/tests/java/mod/_svx/SvxShapeControl.java new file mode 100644 index 0000000000..fe07d05789 --- /dev/null +++ b/qadevOOo/tests/java/mod/_svx/SvxShapeControl.java @@ -0,0 +1,145 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +package mod._svx; + +import java.io.PrintWriter; + +import lib.TestCase; +import lib.TestEnvironment; +import lib.TestParameters; +import util.DrawTools; +import util.FormTools; +import util.SOfficeFactory; + +import com.sun.star.beans.XPropertySet; +import com.sun.star.drawing.XShape; +import com.sun.star.lang.XComponent; +import com.sun.star.style.XStyle; +import com.sun.star.uno.AnyConverter; +import com.sun.star.uno.Type; +import com.sun.star.uno.UnoRuntime; +import com.sun.star.uno.XInterface; + +public class SvxShapeControl extends TestCase { + + static XComponent xDrawDoc; + + /** + * in general this method creates a testdocument + * + * @param tParam class which contains additional test parameters + * @param log class to log the test state and result + * + * + * @see TestParameters + * @see PrintWriter + * + */ + @Override + protected void initialize( TestParameters tParam, PrintWriter log ) throws Exception { + log.println( "creating a drawdoc" ); + xDrawDoc = DrawTools.createDrawDoc(tParam.getMSF()); + } + + /** + * in general this method disposes the testenvironment and document + * + * @param tParam class which contains additional test parameters + * @param log class to log the test state and result + * + * + * @see TestParameters + * @see PrintWriter + * + */ + @Override + protected void cleanup( TestParameters tParam, PrintWriter log ) { + log.println( " disposing xDrawDoc " ); + util.DesktopTools.closeDoc(xDrawDoc); + } + + + /** + * creating a TestEnvironment for the interfaces to be tested + * + * @param tParam class which contains additional test parameters + * @param log class to log the test state and result + * + * @return Status class + * + * @see TestParameters + * @see PrintWriter + */ + @Override + protected TestEnvironment createTestEnvironment(TestParameters tParam, PrintWriter log) { + + XInterface oObj = null; + XShape oShape = null; + + // creation of testobject here + // first we write what we are intend to do to log file + log.println( "creating a test environment" ); + + try { + + oShape = FormTools.insertControlShape( + xDrawDoc,3000,4500,15000,1000,"CommandButton"); + + oObj = oShape ; + + SOfficeFactory SOF = SOfficeFactory.getFactory(tParam.getMSF()) ; + oShape = SOF.createShape(xDrawDoc,5000,3500,7500,5000,"Line"); + DrawTools.getShapes(DrawTools.getDrawPage(xDrawDoc,0)).add(oShape) ; + } + catch (Exception e) { + log.println("Couldn't create instance"); + e.printStackTrace(log); + } + + // test environment creation + + TestEnvironment tEnv = new TestEnvironment(oObj); + + log.println( "adding two styles as ObjRelation for ShapeDescriptor" ); + XPropertySet oShapeProps = UnoRuntime.queryInterface(XPropertySet.class,oObj); + XStyle aStyle = null; + try { + aStyle = (XStyle) AnyConverter.toObject( + new Type(XStyle.class),oShapeProps.getPropertyValue("Style")); + } catch (Exception e) { + System.out.println("caught exception: " + e); + } + tEnv.addObjRelation("Style1",aStyle); + oShapeProps = UnoRuntime.queryInterface(XPropertySet.class,oShape); + try { + aStyle = (XStyle) AnyConverter.toObject( + new Type(XStyle.class),oShapeProps.getPropertyValue("Style")); + } catch (Exception e) { + System.out.println("caught exception: " + e); + } + tEnv.addObjRelation("Style2",aStyle); + + log.println( "adding document relation for XControlShape" ); + tEnv.addObjRelation("xDoc", xDrawDoc) ; + + return tEnv; + } // finish method getTestEnvironment + +} // finish class SvxShapeControl + diff --git a/qadevOOo/tests/java/mod/_svx/SvxShapeDimensioning.java b/qadevOOo/tests/java/mod/_svx/SvxShapeDimensioning.java new file mode 100644 index 0000000000..7cccfe0694 --- /dev/null +++ b/qadevOOo/tests/java/mod/_svx/SvxShapeDimensioning.java @@ -0,0 +1,155 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +package mod._svx; + +import java.io.PrintWriter; + +import lib.TestCase; +import lib.TestEnvironment; +import lib.TestParameters; +import util.DefaultDsc; +import util.DrawTools; +import util.InstCreator; +import util.SOfficeFactory; + +import com.sun.star.beans.XPropertySet; +import com.sun.star.drawing.XShape; +import com.sun.star.lang.XComponent; +import com.sun.star.style.XStyle; +import com.sun.star.uno.AnyConverter; +import com.sun.star.uno.Type; +import com.sun.star.uno.UnoRuntime; +import com.sun.star.uno.XInterface; + +public class SvxShapeDimensioning extends TestCase { + + static XComponent xDrawDoc; + + /** + * in general this method creates a testdocument + * + * @param tParam class which contains additional test parameters + * @param log class to log the test state and result + * + * + * @see TestParameters + * @see PrintWriter + * + */ + @Override + protected void initialize( TestParameters tParam, PrintWriter log ) throws Exception { + log.println( "creating a drawdoc" ); + xDrawDoc = DrawTools.createDrawDoc(tParam.getMSF()); + } + + /** + * in general this method disposes the testenvironment and document + * + * @param tParam class which contains additional test parameters + * @param log class to log the test state and result + * + * + * @see TestParameters + * @see PrintWriter + * + */ + @Override + protected void cleanup( TestParameters tParam, PrintWriter log ) { + log.println( " disposing xDrawDoc " ); + util.DesktopTools.closeDoc(xDrawDoc); + } + + + /** + * creating a TestEnvironment for the interfaces to be tested + * + * @param tParam class which contains additional test parameters + * @param log class to log the test state and result + * + * @return Status class + * + * @see TestParameters + * @see PrintWriter + */ + @Override + protected TestEnvironment createTestEnvironment(TestParameters tParam, PrintWriter log) { + + XInterface oObj = null; + XShape oShape = null; + + // creation of testobject here + // first we write what we are intend to do to log file + log.println( "creating a test environment" ); + + try { + + SOfficeFactory SOF = SOfficeFactory.getFactory( tParam.getMSF()); + oShape = SOF.createShape(xDrawDoc,4000,4000,3000,3000,"Measure"); + + DrawTools.getShapes(DrawTools.getDrawPage(xDrawDoc,0)).add(oShape); + + for (int i=0;i<10;i++) { + DrawTools.getShapes(DrawTools.getDrawPage(xDrawDoc,0)).add( + SOF.createShape(xDrawDoc, + 3000,4500,7510+10*i,5010+10*i,"Rectangle")); + } + + oObj = oShape ; + + oShape = SOF.createShape(xDrawDoc,5000,3500,7500,5000,"Line"); + DrawTools.getShapes(DrawTools.getDrawPage(xDrawDoc,0)).add(oShape) ; + } + catch (Exception e) { + log.println("Couldn't create instance"); + e.printStackTrace(log); + } + + // test environment creation + + TestEnvironment tEnv = new TestEnvironment(oObj); + + log.println( "adding two styles as ObjRelation for ShapeDescriptor" ); + XPropertySet oShapeProps = UnoRuntime.queryInterface(XPropertySet.class,oObj); + XStyle aStyle = null; + try { + aStyle = (XStyle) AnyConverter.toObject( + new Type(XStyle.class),oShapeProps.getPropertyValue("Style")); + } catch (Exception e) { + System.out.println("caught exception: " + e); + } + tEnv.addObjRelation("Style1",aStyle); + oShapeProps = UnoRuntime.queryInterface(XPropertySet.class,oShape); + try { + aStyle = (XStyle) AnyConverter.toObject( + new Type(XStyle.class),oShapeProps.getPropertyValue("Style")); + } catch (Exception e) { + System.out.println("caught exception: " + e); + } + tEnv.addObjRelation("Style2",aStyle); + + DefaultDsc tDsc = new DefaultDsc("com.sun.star.text.XTextContent", + "com.sun.star.text.TextField.URL"); + log.println( " adding InstCreator object" ); + tEnv.addObjRelation( "XTEXTINFO", new InstCreator( xDrawDoc, tDsc ) ); + + return tEnv; + } // finish method getTestEnvironment + +} // finish class SvxShapeDimensioning + diff --git a/qadevOOo/tests/java/mod/_svx/SvxShapeGroup.java b/qadevOOo/tests/java/mod/_svx/SvxShapeGroup.java new file mode 100644 index 0000000000..d49200a00a --- /dev/null +++ b/qadevOOo/tests/java/mod/_svx/SvxShapeGroup.java @@ -0,0 +1,163 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +package mod._svx; + +import java.io.PrintWriter; + +import lib.TestCase; +import lib.TestEnvironment; +import lib.TestParameters; +import util.InstCreator; +import util.SOfficeFactory; +import util.ShapeDsc; + +import com.sun.star.beans.XPropertySet; +import com.sun.star.container.XIndexAccess; +import com.sun.star.drawing.XDrawPage; +import com.sun.star.drawing.XDrawPages; +import com.sun.star.drawing.XDrawPagesSupplier; +import com.sun.star.drawing.XShape; +import com.sun.star.drawing.XShapeGrouper; +import com.sun.star.drawing.XShapes; +import com.sun.star.lang.XComponent; +import com.sun.star.style.XStyle; +import com.sun.star.uno.AnyConverter; +import com.sun.star.uno.Type; +import com.sun.star.uno.UnoRuntime; +import com.sun.star.uno.XInterface; + +/** + * + * initial description + * + * @see com.sun.star.drawing._XDrawPage + * + */ + +public class SvxShapeGroup extends TestCase { + + static XComponent xDrawDoc; + + /** + * in general this method initializes the document + */ + @Override + protected void initialize(TestParameters Param, PrintWriter log) + throws Exception { + // get a soffice factory object + SOfficeFactory SOF = SOfficeFactory.getFactory(Param.getMSF()); + log.println("creating a draw document"); + xDrawDoc = SOF.createDrawDoc(null); + } + + /** + * in general this method disposes the document + */ + @Override + protected void cleanup(TestParameters Param, PrintWriter log) { + + log.println("disposing xDrawDoc"); + util.DesktopTools.closeDoc(xDrawDoc); + + } + + /** + * creating a TestEnvironment for the interfaces to be tested + */ + @Override + public TestEnvironment createTestEnvironment(TestParameters Param, + PrintWriter log) throws Exception { + + XInterface oObj = null; + XShapes oShapes = null; + + // creation of testobject here + // first we write what we are intend to do to log file + log.println("creating a test environment"); + + SOfficeFactory SOF = SOfficeFactory.getFactory(Param.getMSF()); + + // get the drawpage of drawing here + log.println("getting Drawpage"); + XDrawPagesSupplier oDPS = UnoRuntime.queryInterface( + XDrawPagesSupplier.class, xDrawDoc); + XDrawPages oDPn = oDPS.getDrawPages(); + XIndexAccess oDPi = UnoRuntime.queryInterface(XIndexAccess.class, oDPn); + oObj = (XDrawPage) AnyConverter.toObject(new Type(XDrawPage.class), + oDPi.getByIndex(0)); + + if (oObj == null) { + System.out.println("**************************"); + System.out.println(" XDrawPage is NULL"); + System.out.println("**************************"); + } + + // put something on the drawpage + log.println("inserting some Shapes"); + oShapes = UnoRuntime.queryInterface(XShapes.class, oObj); + XShape Shape1 = SOF.createShape(xDrawDoc, 3000, 4500, 15000, 1000, + "Ellipse"); + oShapes.add(SOF.createShape(xDrawDoc, 2000, 1500, 1000, 1000, "Line")); + oShapes.add(Shape1); + XShape Shape2 = SOF.createShape(xDrawDoc, 5000, 3500, 7500, 5000, + "Rectangle"); + oShapes.add(Shape2); + + log.println("adding two style as ObjRelation for ShapeDescriptor"); + XPropertySet oShapeProps = UnoRuntime.queryInterface( + XPropertySet.class, Shape1); + XStyle aStyle1 = null; + try { + aStyle1 = (XStyle) AnyConverter.toObject(new Type(XStyle.class), + oShapeProps.getPropertyValue("Style")); + } catch (Exception e) { + } + oShapeProps = UnoRuntime.queryInterface(XPropertySet.class, Shape2); + XStyle aStyle2 = null; + try { + aStyle2 = (XStyle) AnyConverter.toObject(new Type(XStyle.class), + oShapeProps.getPropertyValue("Style")); + } catch (Exception e) { + } + + // get the XShapeGrouper + log.println("get XShapeGroup"); + XShapeGrouper oSG = UnoRuntime + .queryInterface(XShapeGrouper.class, oObj); + oObj = oSG.group(oShapes); + + log.println("creating a new environment for drawpage object"); + TestEnvironment tEnv = new TestEnvironment(oObj); + + ShapeDsc sDsc = new ShapeDsc(5000, 3500, 7500, 10000, "Rectangle"); + log.println("adding Shape as mod relation to environment"); + tEnv.addObjRelation("Shape", new InstCreator(xDrawDoc, sDsc)); + + tEnv.addObjRelation("Style1", aStyle1); + tEnv.addObjRelation("Style2", aStyle2); + for (int i = 0; i < 6; i++) { + Shape2 = SOF.createShape(xDrawDoc, 5000 + 100 * i, 3500 + 100 * i, + 7500 + 100 * i, 5000 + 100 * i, "Rectangle"); + oShapes.add(Shape2); + } + return tEnv; + } // finish method createTestEnvironment + +} // finish class SvxShapeGroup + diff --git a/qadevOOo/tests/java/mod/_svx/SvxShapePolyPolygon.java b/qadevOOo/tests/java/mod/_svx/SvxShapePolyPolygon.java new file mode 100644 index 0000000000..d5a43870a5 --- /dev/null +++ b/qadevOOo/tests/java/mod/_svx/SvxShapePolyPolygon.java @@ -0,0 +1,250 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +package mod._svx; + +import java.io.PrintWriter; + +import lib.TestCase; +import lib.TestEnvironment; +import lib.TestParameters; +import util.DefaultDsc; +import util.DrawTools; +import util.InstCreator; +import util.SOfficeFactory; +import util.utils; + +import com.sun.star.awt.Point; +import com.sun.star.awt.Size; +import com.sun.star.beans.XPropertySet; +import com.sun.star.drawing.XShape; +import com.sun.star.lang.XComponent; +import com.sun.star.lang.XMultiServiceFactory; +import com.sun.star.style.XStyle; +import com.sun.star.uno.AnyConverter; +import com.sun.star.uno.Type; +import com.sun.star.uno.UnoRuntime; +import com.sun.star.uno.XInterface; + +/** + * Test for object which is represented by service + * <code>com.sun.star.drawing.PolyPolygonShape</code>. <p> + * Object implements the following interfaces : + * <ul> + * <li> <code>com::sun::star::style::ParagraphProperties</code></li> + * <li> <code>com::sun::star::drawing::LineProperties</code></li> + * <li> <code>com::sun::star::drawing::FillProperties</code></li> + * <li> <code>com::sun::star::drawing::PolyPolygonDescriptor</code></li> + * <li> <code>com::sun::star::drawing::ShadowProperties</code></li> + * <li> <code>com::sun::star::drawing::XGluePointsSupplier</code></li> + * <li> <code>com::sun::star::style::CharacterProperties</code></li> + * <li> <code>com::sun::star::drawing::RotationDescriptor</code></li> + * <li> <code>com::sun::star::text::XTextRange</code></li> + * <li> <code>com::sun::star::drawing::XShape</code></li> + * <li> <code>com::sun::star::lang::XComponent</code></li> + * <li> <code>com::sun::star::drawing::TextProperties</code></li> + * <li> <code>com::sun::star::beans::XPropertySet</code></li> + * <li> <code>com::sun::star::text::XText</code></li> + * <li> <code>com::sun::star::drawing::XShapeDescriptor</code></li> + * <li> <code>com::sun::star::text::XSimpleText</code></li> + * <li> <code>com::sun::star::drawing::Shape</code></li> + * </ul> <p> + * The following files used by this test : + * <ul> + * <li><b> TransparencyChart.sxs </b> : to load predefined chart + * document where two 'automatic' transparency styles exists : + * 'Transparency 1' and 'Transparency 2'.</li> + * </ul> <p> + * + * This object test <b> is NOT </b> designed to be run in several + * threads concurrently. + * + * @see com.sun.star.style.ParagraphProperties + * @see com.sun.star.drawing.LineProperties + * @see com.sun.star.drawing.FillProperties + * @see com.sun.star.drawing.PolyPolygonDescriptor + * @see com.sun.star.drawing.ShadowProperties + * @see com.sun.star.drawing.XGluePointsSupplier + * @see com.sun.star.style.CharacterProperties + * @see com.sun.star.drawing.RotationDescriptor + * @see com.sun.star.text.XTextRange + * @see com.sun.star.drawing.XShape + * @see com.sun.star.lang.XComponent + * @see com.sun.star.drawing.TextProperties + * @see com.sun.star.beans.XPropertySet + * @see com.sun.star.text.XText + * @see com.sun.star.drawing.XShapeDescriptor + * @see com.sun.star.text.XSimpleText + * @see com.sun.star.drawing.Shape + * @see ifc.style._ParagraphProperties + * @see ifc.drawing._LineProperties + * @see ifc.drawing._FillProperties + * @see ifc.drawing._PolyPolygonDescriptor + * @see ifc.drawing._ShadowProperties + * @see ifc.drawing._XGluePointsSupplier + * @see ifc.style._CharacterProperties + * @see ifc.drawing._RotationDescriptor + * @see ifc.text._XTextRange + * @see ifc.drawing._XShape + * @see ifc.lang._XComponent + * @see ifc.drawing._TextProperties + * @see ifc.beans._XPropertySet + * @see ifc.text._XText + * @see ifc.drawing._XShapeDescriptor + * @see ifc.text._XSimpleText + * @see ifc.drawing._Shape + */ +public class SvxShapePolyPolygon extends TestCase { + + static XComponent xDrawDoc; + + /** + * in general this method creates a testdocument + * + * @param tParam class which contains additional test parameters + * @param log class to log the test state and result + * + * + * @see TestParameters + * * @see PrintWriter + * + */ + @Override + protected void initialize( TestParameters tParam, PrintWriter log ) throws Exception { + // get a soffice factory object + SOfficeFactory SOF = SOfficeFactory.getFactory( tParam.getMSF()); + log.println( "creating a chartdocument" ); + xDrawDoc = SOF.loadDocument( + utils.getFullTestURL("SvxShape.sxd")); + } + + /** + * in general this method disposes the testenvironment and document + * + * @param tParam class which contains additional test parameters + * @param log class to log the test state and result + * + * + * @see TestParameters + * * @see PrintWriter + * + */ + @Override + protected void cleanup( TestParameters tParam, PrintWriter log ) { + log.println( " disposing xDrawDoc " ); + util.DesktopTools.closeDoc(xDrawDoc); + } + + + /** + * * creating a TestEnvironment for the interfaces to be tested + * + * @param tParam class which contains additional test parameters + * @param log class to log the test state and result + * + * @return Status class + * + * @see TestParameters + * * @see PrintWriter + */ + @Override + protected TestEnvironment createTestEnvironment + (TestParameters tParam, PrintWriter log) { + + XInterface oObj = null; + XShape oShape = null; + + // creation of testobject here + // first we write what we are intend to do to log file + log.println( "creating a test environment" ); + + try { + // adding some shapes for testing. + XMultiServiceFactory xMSF = UnoRuntime.queryInterface(XMultiServiceFactory.class, xDrawDoc) ; + XInterface oInst = (XInterface) xMSF.createInstance + ("com.sun.star.drawing.PolyPolygonShape") ; + oShape = UnoRuntime.queryInterface + (XShape.class, oInst) ; + + oShape.setSize(new Size(0,0)) ; + oShape.setPosition(new Point(0,0)) ; + + DrawTools.getShapes(DrawTools.getDrawPage(xDrawDoc,0)).add(oShape); + + Point[] square1 = new Point[] { + new Point(5000, 5000), + new Point(10000, 5000), + new Point(10000, 10000), + new Point(5000, 10000)} ; + + Point[] square2 = new Point[] { + new Point(6500, 6500), + new Point(8500, 6500), + new Point(8500, 8500), + new Point(6500, 8500)} ; + + Point[][] polygon = new Point[][] {square1, square2}; + + UnoRuntime.queryInterface(XPropertySet.class, + oShape).setPropertyValue("PolyPolygon", polygon) ; + + oObj = oShape ; + + SOfficeFactory SOF = SOfficeFactory.getFactory(tParam.getMSF()) ; + oShape = SOF.createShape(xDrawDoc,5000,3500,7500,5000,"Line"); + DrawTools.getShapes(DrawTools.getDrawPage(xDrawDoc,0)).add(oShape) ; + } + catch (Exception e) { + log.println("Couldn't create instance"); + e.printStackTrace(log); + } + + // test environment creation + + TestEnvironment tEnv = new TestEnvironment(oObj); + + log.println( "adding two styles as ObjRelation for ShapeDescriptor" ); + XPropertySet oShapeProps = UnoRuntime.queryInterface(XPropertySet.class,oObj); + XStyle aStyle = null; + try { + aStyle = (XStyle) AnyConverter.toObject( + new Type(XStyle.class),oShapeProps.getPropertyValue("Style")); + } catch (Exception e) { + System.out.println("caught exception: " + e); + } + tEnv.addObjRelation("Style1",aStyle); + oShapeProps = UnoRuntime.queryInterface(XPropertySet.class,oShape); + try { + aStyle = (XStyle) AnyConverter.toObject( + new Type(XStyle.class),oShapeProps.getPropertyValue("Style")); + } catch (Exception e) { + System.out.println("caught exception: " + e); + } + tEnv.addObjRelation("Style2",aStyle); + + // adding relation for XText + DefaultDsc tDsc = new DefaultDsc("com.sun.star.text.XTextContent", + "com.sun.star.text.TextField.URL"); + log.println( " adding InstCreator object" ); + tEnv.addObjRelation( "XTEXTINFO", new InstCreator( xDrawDoc, tDsc ) ); + + return tEnv; + } // finish method getTestEnvironment + +} // finish class SvxShapeCollection + diff --git a/qadevOOo/tests/java/mod/_svx/SvxShapePolyPolygonBezier.java b/qadevOOo/tests/java/mod/_svx/SvxShapePolyPolygonBezier.java new file mode 100644 index 0000000000..f053a2e0f1 --- /dev/null +++ b/qadevOOo/tests/java/mod/_svx/SvxShapePolyPolygonBezier.java @@ -0,0 +1,264 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +package mod._svx; + +import java.io.PrintWriter; + +import lib.TestCase; +import lib.TestEnvironment; +import lib.TestParameters; +import util.DrawTools; +import util.InstCreator; +import util.SOfficeFactory; +import util.utils; + +import com.sun.star.awt.Point; +import com.sun.star.awt.Size; +import com.sun.star.beans.XPropertySet; +import com.sun.star.drawing.PolyPolygonBezierCoords; +import com.sun.star.drawing.PolygonFlags; +import com.sun.star.drawing.XShape; +import com.sun.star.lang.XComponent; +import com.sun.star.lang.XMultiServiceFactory; +import com.sun.star.style.XStyle; +import com.sun.star.uno.AnyConverter; +import com.sun.star.uno.Type; +import com.sun.star.uno.UnoRuntime; +import com.sun.star.uno.XInterface; + +/** + * Test for object which is represented by service + * <code>com.sun.star.drawing.ClosedBezierShape</code>. <p> + * Object implements the following interfaces : + * <ul> + * <li> <code>com::sun::star::style::ParagraphProperties</code></li> + * <li> <code>com::sun::star::drawing::PolyPolygonBezierDescriptor</code></li> + * <li> <code>com::sun::star::drawing::LineProperties</code></li> + * <li> <code>com::sun::star::drawing::FillProperties</code></li> + * <li> <code>com::sun::star::drawing::ShadowProperties</code></li> + * <li> <code>com::sun::star::drawing::XGluePointsSupplier</code></li> + * <li> <code>com::sun::star::style::CharacterProperties</code></li> + * <li> <code>com::sun::star::drawing::RotationDescriptor</code></li> + * <li> <code>com::sun::star::text::XTextRange</code></li> + * <li> <code>com::sun::star::drawing::XShape</code></li> + * <li> <code>com::sun::star::lang::XComponent</code></li> + * <li> <code>com::sun::star::drawing::TextProperties</code></li> + * <li> <code>com::sun::star::beans::XPropertySet</code></li> + * <li> <code>com::sun::star::text::XText</code></li> + * <li> <code>com::sun::star::drawing::XShapeDescriptor</code></li> + * <li> <code>com::sun::star::text::XSimpleText</code></li> + * <li> <code>com::sun::star::drawing::Shape</code></li> + * </ul> <p> + * + * The following files used by this test : + * <ul> + * <li><b> TransparencyChart.sxs </b> : to load predefined chart + * document where two 'automatic' transparency styles exists : + * 'Transparency 1' and 'Transparency 2'.</li> + * </ul> <p> + * + * This object test <b> is NOT </b> designed to be run in several + * threads concurrently. + * + * @see com.sun.star.style.ParagraphProperties + * @see com.sun.star.drawing.PolyPolygonBezierDescriptor + * @see com.sun.star.drawing.LineProperties + * @see com.sun.star.drawing.FillProperties + * @see com.sun.star.drawing.ShadowProperties + * @see com.sun.star.drawing.XGluePointsSupplier + * @see com.sun.star.style.CharacterProperties + * @see com.sun.star.drawing.RotationDescriptor + * @see com.sun.star.text.XTextRange + * @see com.sun.star.drawing.XShape + * @see com.sun.star.lang.XComponent + * @see com.sun.star.drawing.TextProperties + * @see com.sun.star.beans.XPropertySet + * @see com.sun.star.text.XText + * @see com.sun.star.drawing.XShapeDescriptor + * @see com.sun.star.text.XSimpleText + * @see com.sun.star.drawing.Shape + * @see ifc.style._ParagraphProperties + * @see ifc.drawing._PolyPolygonBezierDescriptor + * @see ifc.drawing._LineProperties + * @see ifc.drawing._FillProperties + * @see ifc.drawing._ShadowProperties + * @see ifc.drawing._XGluePointsSupplier + * @see ifc.style._CharacterProperties + * @see ifc.drawing._RotationDescriptor + * @see ifc.text._XTextRange + * @see ifc.drawing._XShape + * @see ifc.lang._XComponent + * @see ifc.drawing._TextProperties + * @see ifc.beans._XPropertySet + * @see ifc.text._XText + * @see ifc.drawing._XShapeDescriptor + * @see ifc.text._XSimpleText + * @see ifc.drawing._Shape + */ +public class SvxShapePolyPolygonBezier extends TestCase { + + static XComponent xDrawDoc; + + /** + * in general this method creates a testdocument + * + * @param tParam class which contains additional test parameters + * @param log class to log the test state and result + * + * + * @see TestParameters + * * @see PrintWriter + * + */ + @Override + protected void initialize( TestParameters tParam, PrintWriter log ) throws Exception { + // get a soffice factory object + SOfficeFactory SOF = SOfficeFactory.getFactory( tParam.getMSF()); + log.println( "creating a chartdocument" ); + xDrawDoc = SOF.loadDocument( + utils.getFullTestURL("SvxShape.sxd")); + } + + /** + * in general this method disposes the testenvironment and document + * + * @param tParam class which contains additional test parameters + * @param log class to log the test state and result + * + * + * @see TestParameters + * * @see PrintWriter + * + */ + @Override + protected void cleanup( TestParameters tParam, PrintWriter log ) { + log.println( " disposing xDrawDoc " ); + util.DesktopTools.closeDoc(xDrawDoc); + } + + + /** + * * creating a TestEnvironment for the interfaces to be tested + * + * @param tParam class which contains additional test parameters + * @param log class to log the test state and result + * + * @return Status class + * + * @see TestParameters + * * @see PrintWriter + */ + @Override + protected TestEnvironment createTestEnvironment + (TestParameters tParam, PrintWriter log) { + + XInterface oObj = null; + XShape oShape = null; + + // creation of testobject here + // first we write what we are intend to do to log file + log.println( "creating a test environment" ); + + try { + + SOfficeFactory SOF = SOfficeFactory.getFactory( tParam.getMSF()); + + XMultiServiceFactory xMSF = UnoRuntime.queryInterface(XMultiServiceFactory.class, xDrawDoc) ; + + XInterface oInst = (XInterface) xMSF.createInstance + ("com.sun.star.drawing.ClosedBezierShape") ; + oShape = UnoRuntime.queryInterface + (XShape.class, oInst) ; + + Point[] points = new Point[2]; + points[0] = new Point(); + points[0].X = 50; + points[0].Y = 50; + points[1] = new Point(); + points[1].X = 5000; + points[1].Y = 5000; + + Point[][] the_points = new Point[1][2]; + the_points[0] = points; + + PolygonFlags[] flags = new PolygonFlags[2]; + flags[0] = PolygonFlags.NORMAL; + flags[1] = PolygonFlags.NORMAL; + + PolygonFlags[][] the_flags = new PolygonFlags[1][2]; + the_flags[0] = flags; + + PolyPolygonBezierCoords coords = new PolyPolygonBezierCoords(); + coords.Coordinates=the_points; + coords.Flags = the_flags; + + DrawTools.getShapes(DrawTools.getDrawPage(xDrawDoc,0)).add(oShape); + + oShape.setSize(new Size(3000,3000)) ; + oShape.setPosition(new Point(4000,4000)) ; + + oObj = oShape ; + + XPropertySet shapeProps = UnoRuntime.queryInterface + (XPropertySet.class, oObj); + + shapeProps.setPropertyValue("PolyPolygonBezier",coords); + + oShape = SOF.createShape(xDrawDoc,5000,3500,7500,5000,"Line"); + DrawTools.getShapes(DrawTools.getDrawPage(xDrawDoc,0)).add(oShape) ; + } + catch (Exception e) { + log.println("Couldn't create instance"); + e.printStackTrace(log); + } + + // test environment creation + + TestEnvironment tEnv = new TestEnvironment(oObj); + + log.println( "adding two styles as ObjRelation for ShapeDescriptor" ); + XPropertySet oShapeProps = UnoRuntime.queryInterface(XPropertySet.class,oObj); + XStyle aStyle = null; + try { + aStyle = (XStyle) AnyConverter.toObject( + new Type(XStyle.class),oShapeProps.getPropertyValue("Style")); + } catch (Exception e) { + System.out.println("caught exception: " + e); + } + tEnv.addObjRelation("Style1",aStyle); + oShapeProps = UnoRuntime.queryInterface(XPropertySet.class,oShape); + try { + aStyle = (XStyle) AnyConverter.toObject( + new Type(XStyle.class),oShapeProps.getPropertyValue("Style")); + } catch (Exception e) { + System.out.println("caught exception: " + e); + } + tEnv.addObjRelation("Style2",aStyle); + + // adding relation for XText + util.DefaultDsc tDsc = new util.DefaultDsc + ("com.sun.star.text.XTextContent", + "com.sun.star.text.TextField.URL"); + log.println( " adding InstCreator object" ); + tEnv.addObjRelation( "XTEXTINFO", new InstCreator( xDrawDoc, tDsc ) ); + + return tEnv; + } // finish method getTestEnvironment + +} // finish class SvxShapePolyPolygonBezier diff --git a/qadevOOo/tests/java/mod/_svx/SvxUnoNumberingRules.java b/qadevOOo/tests/java/mod/_svx/SvxUnoNumberingRules.java new file mode 100644 index 0000000000..10a076e0b3 --- /dev/null +++ b/qadevOOo/tests/java/mod/_svx/SvxUnoNumberingRules.java @@ -0,0 +1,78 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +package mod._svx; + +import com.sun.star.container.XIndexAccess; +import com.sun.star.lang.XComponent; +import com.sun.star.lang.XMultiServiceFactory; +import com.sun.star.uno.UnoRuntime; +import com.sun.star.uno.XInterface; + +import java.io.PrintWriter; + +import lib.TestCase; +import lib.TestEnvironment; +import lib.TestParameters; +import util.DrawTools; + + +public class SvxUnoNumberingRules extends TestCase { + static XComponent xDrawDoc; + + @Override + protected void initialize(TestParameters tParam, PrintWriter log) throws Exception { + log.println("creating a drawdoc"); + xDrawDoc = DrawTools.createDrawDoc( + tParam.getMSF()); + } + + @Override + protected TestEnvironment createTestEnvironment(TestParameters tParam, + PrintWriter log) throws Exception { + XMultiServiceFactory docMSF = UnoRuntime.queryInterface( + XMultiServiceFactory.class, + xDrawDoc); + XInterface oObj = (XInterface) docMSF.createInstance( + "com.sun.star.text.NumberingRules"); + + TestEnvironment tEnv = new TestEnvironment(oObj); + + log.println("Implementationname: " + util.utils.getImplName(oObj)); + + Object NewRules=null; + + try{ + XIndexAccess xIA = UnoRuntime.queryInterface(XIndexAccess.class, oObj); + NewRules = xIA.getByIndex(2); + } catch (com.sun.star.lang.IndexOutOfBoundsException e) { + log.println("Couldn't get new Rules for XIndexReplace"); + } catch (com.sun.star.lang.WrappedTargetException e) { + log.println("Couldn't get new Rules for XIndexReplace"); + } + + tEnv.addObjRelation("INSTANCE1",NewRules); + + return tEnv; + } + + @Override + protected void cleanup(TestParameters tParam, PrintWriter log) { + log.println(" disposing xDrawDoc "); + util.DesktopTools.closeDoc(xDrawDoc); + } +} diff --git a/qadevOOo/tests/java/mod/_svx/SvxUnoText.java b/qadevOOo/tests/java/mod/_svx/SvxUnoText.java new file mode 100644 index 0000000000..19fb1ef326 --- /dev/null +++ b/qadevOOo/tests/java/mod/_svx/SvxUnoText.java @@ -0,0 +1,156 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +package mod._svx; + +import com.sun.star.text.XText; +import java.io.PrintWriter; + +import lib.TestCase; +import lib.TestEnvironment; +import lib.TestParameters; +import util.DefaultDsc; +import util.DrawTools; +import util.InstCreator; +import util.SOfficeFactory; + +import com.sun.star.drawing.XShape; +import com.sun.star.lang.XComponent; +import com.sun.star.text.ControlCharacter; +import com.sun.star.text.XSimpleText; +import com.sun.star.text.XTextCursor; +import com.sun.star.text.XTextRange; +import com.sun.star.uno.UnoRuntime; +import com.sun.star.uno.XInterface; + +public class SvxUnoText extends TestCase { + + static XComponent xDrawDoc; + + /** + * in general this method creates a testdocument + * + * @param tParam class which contains additional test parameters + * @param log class to log the test state and result + * + * + * @see TestParameters + * * @see PrintWriter + * + */ + @Override + protected void initialize( TestParameters tParam, PrintWriter log ) throws Exception { + log.println( "creating a drawdoc" ); + xDrawDoc = DrawTools.createDrawDoc(tParam.getMSF()); + } + + /** + * in general this method disposes the testenvironment and document + * + * @param tParam class which contains additional test parameters + * @param log class to log the test state and result + * + * + * @see TestParameters + * * @see PrintWriter + * + */ + @Override + protected void cleanup( TestParameters tParam, PrintWriter log ) { + log.println( " disposing xDrawDoc " ); + util.DesktopTools.closeDoc(xDrawDoc); + } + + + /** + * * creating a TestEnvironment for the interfaces to be tested + * + * @param tParam class which contains additional test parameters + * @param log class to log the test state and result + * + * @return Status class + * Object relations created : + * <ul> + * <li> <code>'RangeForMove'</code> for + * {@link ifc.text._XTextRangeMover} (the range to be moved)</li> + * <li> <code>'XTextRange'</code> for + * {@link ifc.text._XTextRangeMover} (the range that includes moving + * range)</li> + * </ul> + * @see TestParameters + * * @see PrintWriter + */ + @Override + protected TestEnvironment createTestEnvironment + (TestParameters tParam, PrintWriter log) { + + XInterface oObj = null; + // create testobject here + XTextRange aRange = null; + XShape oShape = null; + + try { + SOfficeFactory SOF = SOfficeFactory.getFactory(tParam.getMSF()) ; + oShape = SOF.createShape + (xDrawDoc,5000,3500,7500,5000,"Text"); + DrawTools.getShapes(DrawTools.getDrawPage(xDrawDoc,0)).add(oShape); + + XSimpleText text = UnoRuntime.queryInterface + (XSimpleText.class, oShape) ; + + XTextCursor cursor = text.createTextCursor() ; + text.insertString(cursor, "Paragraph 1", false) ; + text.insertControlCharacter(cursor, + ControlCharacter.PARAGRAPH_BREAK, false) ; + cursor.setString("TextForMove"); + aRange = cursor; + XTextCursor cursor1 = text.createTextCursorByRange(text.getEnd()); + text.insertControlCharacter(cursor1, + ControlCharacter.PARAGRAPH_BREAK, false) ; + text.insertString(cursor1, "Paragraph 2", false); + text.insertControlCharacter(cursor1, + ControlCharacter.PARAGRAPH_BREAK, false) ; + text.insertString(cursor1, "Paragraph 3", false) ; + text.insertControlCharacter(cursor1, + ControlCharacter.PARAGRAPH_BREAK, false) ; + oObj = text.getText() ; + } catch (Exception e) { + log.println("Can't create test object") ; + e.printStackTrace(log) ; + } + + // create test environment here + TestEnvironment tEnv = new TestEnvironment( oObj ); + // adding relation for XText + DefaultDsc tDsc = new DefaultDsc("com.sun.star.text.XTextContent", + "com.sun.star.text.TextField.DateTime"); + log.println( " adding InstCreator object" ); + tEnv.addObjRelation( "XTEXTINFO", new InstCreator( xDrawDoc, tDsc ) ); + + // adding relation for XTextRangeMover + tEnv.addObjRelation("RangeForMove", aRange); + tEnv.addObjRelation("XTextRange", oObj); + + // adding relation for XTextRangeCompare + tEnv.addObjRelation("TEXT", UnoRuntime.queryInterface(XText.class, oShape)) ; + + return tEnv; + } // finish method getTestEnvironment + +} // finish class SvxUnoText + diff --git a/qadevOOo/tests/java/mod/_svx/SvxUnoTextContent.java b/qadevOOo/tests/java/mod/_svx/SvxUnoTextContent.java new file mode 100644 index 0000000000..3550663a4a --- /dev/null +++ b/qadevOOo/tests/java/mod/_svx/SvxUnoTextContent.java @@ -0,0 +1,130 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +package mod._svx; + +import java.io.PrintWriter; + +import lib.TestCase; +import lib.TestEnvironment; +import lib.TestParameters; +import util.DrawTools; +import util.SOfficeFactory; + +import com.sun.star.container.XEnumerationAccess; +import com.sun.star.drawing.XShape; +import com.sun.star.lang.XComponent; +import com.sun.star.text.ControlCharacter; +import com.sun.star.text.XSimpleText; +import com.sun.star.text.XTextCursor; +import com.sun.star.uno.AnyConverter; +import com.sun.star.uno.Type; +import com.sun.star.uno.UnoRuntime; +import com.sun.star.uno.XInterface; + +public class SvxUnoTextContent extends TestCase { + + static XComponent xDrawDoc; + + /** + * in general this method creates a testdocument + * + * @param tParam class which contains additional test parameters + * @param log class to log the test state and result + * + * + * @see TestParameters + * @see PrintWriter + * + */ + @Override + protected void initialize( TestParameters tParam, PrintWriter log ) throws Exception { + log.println( "creating a drawdoc" ); + xDrawDoc = DrawTools.createDrawDoc(tParam.getMSF()); + } + + /** + * in general this method disposes the testenvironment and document + * + * @param tParam class which contains additional test parameters + * @param log class to log the test state and result + * + * + * @see TestParameters + * @see PrintWriter + * + */ + @Override + protected void cleanup( TestParameters tParam, PrintWriter log ) { + log.println( " disposing xDrawDoc " ); + util.DesktopTools.closeDoc(xDrawDoc); + } + + + /** + * creating a TestEnvironment for the interfaces to be tested + * + * @param tParam class which contains additional test parameters + * @param log class to log the test state and result + * + * @return Status class + * + * @see TestParameters + * @see PrintWriter + */ + @Override + protected TestEnvironment createTestEnvironment(TestParameters tParam, PrintWriter log) throws Exception { + + XInterface oObj = null; + // create testobject here + + XEnumerationAccess xEA = null ; + SOfficeFactory SOF = SOfficeFactory.getFactory(tParam.getMSF()) ; + XShape oShape = SOF.createShape(xDrawDoc, + 5000,3500,7500,5000,"Text"); + DrawTools.getShapes(DrawTools.getDrawPage(xDrawDoc,0)).add(oShape) ; + + XSimpleText text = UnoRuntime.queryInterface + (XSimpleText.class, oShape) ; + + XTextCursor cursor = text.createTextCursor() ; + + text.insertString(cursor, "Paragraph 1", false) ; + text.insertControlCharacter(cursor, + ControlCharacter.PARAGRAPH_BREAK, false) ; + text.insertString(cursor, "Paragraph 2", false) ; + text.insertControlCharacter(cursor, + ControlCharacter.PARAGRAPH_BREAK, false) ; + text.insertString(cursor, "Paragraph 3", false) ; + text.insertControlCharacter(cursor, + ControlCharacter.PARAGRAPH_BREAK, false) ; + + xEA = UnoRuntime.queryInterface + (XEnumerationAccess.class, text) ; + + oObj = (XInterface) AnyConverter.toObject( + new Type(XInterface.class),xEA.createEnumeration().nextElement()); + + // create test environment here + TestEnvironment tEnv = new TestEnvironment( oObj ); + + return tEnv; + } // finish method getTestEnvironment + +} + diff --git a/qadevOOo/tests/java/mod/_svx/SvxUnoTextContentEnum.java b/qadevOOo/tests/java/mod/_svx/SvxUnoTextContentEnum.java new file mode 100644 index 0000000000..b640c95d60 --- /dev/null +++ b/qadevOOo/tests/java/mod/_svx/SvxUnoTextContentEnum.java @@ -0,0 +1,133 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +package mod._svx; + +import java.io.PrintWriter; + +import lib.StatusException; +import lib.TestCase; +import lib.TestEnvironment; +import lib.TestParameters; +import util.DrawTools; +import util.SOfficeFactory; + +import com.sun.star.container.XEnumerationAccess; +import com.sun.star.drawing.XShape; +import com.sun.star.lang.XComponent; +import com.sun.star.text.ControlCharacter; +import com.sun.star.text.XSimpleText; +import com.sun.star.text.XTextCursor; +import com.sun.star.uno.UnoRuntime; +import com.sun.star.uno.XInterface; + +public class SvxUnoTextContentEnum extends TestCase { + + static XComponent xDrawDoc; + + /** + * in general this method creates a testdocument + * + * @param tParam class which contains additional test parameters + * @param log class to log the test state and result + * + * + * @see TestParameters + * @see PrintWriter + * + */ + @Override + protected void initialize( TestParameters tParam, PrintWriter log ) throws Exception { + log.println( "creating a drawdoc" ); + xDrawDoc = DrawTools.createDrawDoc(tParam.getMSF()); + } + + /** + * in general this method disposes the testenvironment and document + * + * @param tParam class which contains additional test parameters + * @param log class to log the test state and result + * + * + * @see TestParameters + * @see PrintWriter + * + */ + @Override + protected void cleanup( TestParameters tParam, PrintWriter log ) { + log.println( " disposing xDrawDoc " ); + util.DesktopTools.closeDoc(xDrawDoc); + } + + + /** + * creating a TestEnvironment for the interfaces to be tested + * + * @param tParam class which contains additional test parameters + * @param log class to log the test state and result + * + * @return Status class + * + * @see TestParameters + * @see PrintWriter + */ + @Override + public TestEnvironment createTestEnvironment( TestParameters tParam, + PrintWriter log ) + throws StatusException { + + XInterface oObj = null; + // create testobject here + + XEnumerationAccess xEA = null ; + SOfficeFactory SOF = SOfficeFactory.getFactory(tParam.getMSF()) ; + XShape oShape = SOF.createShape + (xDrawDoc,5000,3500,7500,5000,"Text"); + DrawTools.getShapes(DrawTools.getDrawPage(xDrawDoc,0)).add(oShape) ; + + XSimpleText text = UnoRuntime.queryInterface + (XSimpleText.class, oShape) ; + + XTextCursor cursor = text.createTextCursor() ; + + text.insertString(cursor, "Paragraph 1", false) ; + text.insertControlCharacter(cursor, + ControlCharacter.PARAGRAPH_BREAK, false) ; + text.insertString(cursor, "Paragraph 2", false) ; + text.insertControlCharacter(cursor, + ControlCharacter.PARAGRAPH_BREAK, false) ; + text.insertString(cursor, "Paragraph 3", false) ; + text.insertControlCharacter(cursor, + ControlCharacter.PARAGRAPH_BREAK, false) ; + + xEA = UnoRuntime.queryInterface + (XEnumerationAccess.class, text) ; + + oObj = xEA.createEnumeration() ; + + // create test environment here + TestEnvironment tEnv = new TestEnvironment( oObj ); + + // adding relation for XEnumeration test + tEnv.addObjRelation("ENUM", xEA) ; + + return tEnv; + } // finish method getTestEnvironment + +} + diff --git a/qadevOOo/tests/java/mod/_svx/SvxUnoTextCursor.java b/qadevOOo/tests/java/mod/_svx/SvxUnoTextCursor.java new file mode 100644 index 0000000000..ec367094a2 --- /dev/null +++ b/qadevOOo/tests/java/mod/_svx/SvxUnoTextCursor.java @@ -0,0 +1,131 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +package mod._svx; + +import java.io.PrintWriter; + +import lib.StatusException; +import lib.TestCase; +import lib.TestEnvironment; +import lib.TestParameters; +import util.DrawTools; +import util.SOfficeFactory; + +import com.sun.star.drawing.XShape; +import com.sun.star.lang.XComponent; +import com.sun.star.text.ControlCharacter; +import com.sun.star.text.XText; +import com.sun.star.text.XTextCursor; +import com.sun.star.uno.UnoRuntime; +import com.sun.star.uno.XInterface; + +public class SvxUnoTextCursor extends TestCase { + + static XComponent xDrawDoc; + + /** + * in general this method creates a testdocument + * + * @param tParam class which contains additional test parameters + * @param log class to log the test state and result + * + * + * @see TestParameters + * @see PrintWriter + * + */ + @Override + protected void initialize( TestParameters tParam, PrintWriter log ) throws Exception { + log.println( "creating a drawdoc" ); + xDrawDoc = DrawTools.createDrawDoc(tParam.getMSF()); + } + + /** + * in general this method disposes the testenvironment and document + * + * @param tParam class which contains additional test parameters + * @param log class to log the test state and result + * + * + * @see TestParameters + * @see PrintWriter + * + */ + @Override + protected void cleanup( TestParameters tParam, PrintWriter log ) { + log.println( " disposing xDrawDoc " ); + util.DesktopTools.closeDoc(xDrawDoc); + } + + + /** + * creating a TestEnvironment for the interfaces to be tested + * + * @param tParam class which contains additional test parameters + * @param log class to log the test state and result + * + * @return Status class + * + * @see TestParameters + * @see PrintWriter + */ + @Override + public TestEnvironment createTestEnvironment( TestParameters tParam, + PrintWriter log ) + throws StatusException { + + XInterface oObj = null; + // create testobject here + + try { + SOfficeFactory SOF = SOfficeFactory.getFactory(tParam.getMSF()) ; + XShape oShape = SOF.createShape + (xDrawDoc,5000,3500,7500,5000,"Text"); + DrawTools.getShapes(DrawTools.getDrawPage(xDrawDoc,0)).add(oShape) ; + + XText text = UnoRuntime.queryInterface(XText.class, oShape) ; + + XTextCursor cursor = text.createTextCursor() ; + + text.insertString(cursor, "Paragraph 1", false) ; + text.insertControlCharacter(cursor, + ControlCharacter.PARAGRAPH_BREAK, false) ; + text.insertString(cursor, "Paragraph 2", false) ; + text.insertControlCharacter(cursor, + ControlCharacter.PARAGRAPH_BREAK, false) ; + text.insertString(cursor, "Paragraph 3", false) ; + text.insertControlCharacter(cursor, + ControlCharacter.PARAGRAPH_BREAK, false) ; + + oObj = cursor ; + + } catch (Exception e) { + log.println("Can't create test object") ; + e.printStackTrace(log) ; + } + + // create test environment here + TestEnvironment tEnv = new TestEnvironment( oObj ); + + + return tEnv; + } // finish method getTestEnvironment + +} // finish class SvxUnoTextCursor + diff --git a/qadevOOo/tests/java/mod/_svx/SvxUnoTextField.java b/qadevOOo/tests/java/mod/_svx/SvxUnoTextField.java new file mode 100644 index 0000000000..f9ffe6726b --- /dev/null +++ b/qadevOOo/tests/java/mod/_svx/SvxUnoTextField.java @@ -0,0 +1,129 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +package mod._svx; + +import java.io.PrintWriter; + +import lib.TestCase; +import lib.TestEnvironment; +import lib.TestParameters; +import util.DrawTools; +import util.SOfficeFactory; + +import com.sun.star.drawing.XShape; +import com.sun.star.lang.XComponent; +import com.sun.star.lang.XMultiServiceFactory; +import com.sun.star.text.XText; +import com.sun.star.text.XTextContent; +import com.sun.star.text.XTextCursor; +import com.sun.star.uno.UnoRuntime; +import com.sun.star.uno.XInterface; + +/** + * + * initial description + * @see ifc._XComponent + * @see ifc._TextContent + * @see ifc._XTextContent + * @see ifc._XTextField + * + */ +public class SvxUnoTextField extends TestCase { + + static XComponent xDrawDoc; + + /** + * in general this method creates a testdocument + * + * @param tParam class which contains additional test parameters + * @param log class to log the test state and result + * + * + * @see TestParameters + * @see PrintWriter + * + */ + @Override + protected void initialize( TestParameters tParam, PrintWriter log ) throws Exception { + log.println( "creating a drawdoc" ); + xDrawDoc = DrawTools.createDrawDoc( tParam.getMSF()); + } + + /** + * in general this method disposes the testenvironment and document + * + * @param tParam class which contains additional test parameters + * @param log class to log the test state and result + * + * + * @see TestParameters + * @see PrintWriter + * + */ + @Override + protected void cleanup( TestParameters tParam, PrintWriter log ) { + log.println( " disposing xDrawDoc " ); + util.DesktopTools.closeDoc(xDrawDoc); + } + /** + * creating a TestEnvironment for the interfaces to be tested + * + * @param tParam class which contains additional test parameters + * @param log class to log the test state and result + * + * @return Status class + * + * @see TestParameters + * @see PrintWriter + */ + @Override + protected TestEnvironment createTestEnvironment(TestParameters tParam, PrintWriter log) throws Exception { + + XInterface oObj = null; + XShape oShape = null; + + // creation of testobject here + // first we write what we are intend to do to log file + log.println( "creating a test environment" ); + SOfficeFactory SOF = SOfficeFactory.getFactory( tParam.getMSF()); + oShape = SOF.createShape(xDrawDoc,5000,3500,7500,5000,"Rectangle"); + DrawTools.getShapes(DrawTools.getDrawPage(xDrawDoc,0)).add(oShape); + + XTextCursor the_Cursor = null; + + // create testobject here + XText the_Text = UnoRuntime.queryInterface(XText.class,oShape); + XMultiServiceFactory oDocMSF = UnoRuntime.queryInterface( XMultiServiceFactory.class, xDrawDoc ); + the_Cursor = the_Text.createTextCursor(); + oObj = (XInterface) + oDocMSF.createInstance( "com.sun.star.text.TextField.DateTime" ); + XTextContent the_Field = UnoRuntime.queryInterface(XTextContent.class,oObj); + + + the_Text.insertTextContent(the_Cursor,the_Field,false); + + log.println( "creating a new environment for FieldMaster object" ); + TestEnvironment tEnv = new TestEnvironment( oObj ); + tEnv.addObjRelation("RANGE", the_Cursor); + + return tEnv; + } // finish method getTestEnvironment + +} // finish class SvxUnoTextField + diff --git a/qadevOOo/tests/java/mod/_svx/SvxUnoTextRange.java b/qadevOOo/tests/java/mod/_svx/SvxUnoTextRange.java new file mode 100644 index 0000000000..313921f29c --- /dev/null +++ b/qadevOOo/tests/java/mod/_svx/SvxUnoTextRange.java @@ -0,0 +1,142 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +package mod._svx; + +import java.io.PrintWriter; + +import lib.TestCase; +import lib.TestEnvironment; +import lib.TestParameters; +import util.DrawTools; +import util.SOfficeFactory; + +import com.sun.star.container.XEnumerationAccess; +import com.sun.star.drawing.XShape; +import com.sun.star.lang.XComponent; +import com.sun.star.text.ControlCharacter; +import com.sun.star.text.XSimpleText; +import com.sun.star.text.XTextCursor; +import com.sun.star.uno.AnyConverter; +import com.sun.star.uno.Type; +import com.sun.star.uno.UnoRuntime; +import com.sun.star.uno.XInterface; + +public class SvxUnoTextRange extends TestCase { + + static XComponent xDrawDoc; + + /** + * in general this method creates a testdocument + * + * @param tParam class which contains additional test parameters + * @param log class to log the test state and result + * + * + * @see TestParameters + * @see PrintWriter + * + */ + @Override + protected void initialize( TestParameters tParam, PrintWriter log ) throws Exception { + log.println( "creating a drawdoc" ); + xDrawDoc = DrawTools.createDrawDoc(tParam.getMSF()); + } + + /** + * in general this method disposes the testenvironment and document + * + * @param tParam class which contains additional test parameters + * @param log class to log the test state and result + * + * + * @see TestParameters + * @see PrintWriter + * + */ + @Override + protected void cleanup( TestParameters tParam, PrintWriter log ) { + log.println( " disposing xDrawDoc " ); + util.DesktopTools.closeDoc(xDrawDoc); + } + + + /** + * creating a TestEnvironment for the interfaces to be tested + * + * @param tParam class which contains additional test parameters + * @param log class to log the test state and result + * + * @return Status class + * + * @see TestParameters + * @see PrintWriter + */ + @Override + protected TestEnvironment createTestEnvironment(TestParameters tParam, PrintWriter log) { + + XInterface oObj = null; + // create testobject here + + XEnumerationAccess xEA = null ; + try { + SOfficeFactory SOF = SOfficeFactory.getFactory(tParam.getMSF()) ; + XShape oShape = SOF.createShape + (xDrawDoc,5000,3500,7500,5000,"Text"); + DrawTools.getShapes(DrawTools.getDrawPage(xDrawDoc,0)).add(oShape) ; + + XSimpleText text = UnoRuntime.queryInterface + (XSimpleText.class, oShape) ; + + XTextCursor cursor = text.createTextCursor() ; + + text.insertString(cursor, "Paragraph 1", false) ; + text.insertControlCharacter(cursor, + ControlCharacter.PARAGRAPH_BREAK, false) ; + text.insertString(cursor, "Paragraph 2", false) ; + text.insertControlCharacter(cursor, + ControlCharacter.PARAGRAPH_BREAK, false) ; + text.insertString(cursor, "Paragraph 3", false) ; + text.insertControlCharacter(cursor, + ControlCharacter.PARAGRAPH_BREAK, false) ; + + xEA = UnoRuntime.queryInterface + (XEnumerationAccess.class, text) ; + + XInterface oTextContent = (XInterface) AnyConverter.toObject( + new Type(XInterface.class),xEA.createEnumeration().nextElement()); + + xEA = UnoRuntime.queryInterface + (XEnumerationAccess.class, oTextContent) ; + + oObj = (XInterface) AnyConverter.toObject( + new Type(XInterface.class),xEA.createEnumeration().nextElement()); + + } catch (Exception e) { + log.println("Can't create test object") ; + e.printStackTrace(log) ; + } + + // create test environment here + TestEnvironment tEnv = new TestEnvironment( oObj ); + + return tEnv; + } // finish method getTestEnvironment + +} + diff --git a/qadevOOo/tests/java/mod/_svx/SvxUnoTextRangeEnumeration.java b/qadevOOo/tests/java/mod/_svx/SvxUnoTextRangeEnumeration.java new file mode 100644 index 0000000000..8fe1915429 --- /dev/null +++ b/qadevOOo/tests/java/mod/_svx/SvxUnoTextRangeEnumeration.java @@ -0,0 +1,143 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +package mod._svx; + +import java.io.PrintWriter; + +import lib.TestCase; +import lib.TestEnvironment; +import lib.TestParameters; +import util.DrawTools; +import util.SOfficeFactory; + +import com.sun.star.container.XEnumerationAccess; +import com.sun.star.drawing.XShape; +import com.sun.star.lang.XComponent; +import com.sun.star.text.ControlCharacter; +import com.sun.star.text.XSimpleText; +import com.sun.star.text.XTextCursor; +import com.sun.star.uno.AnyConverter; +import com.sun.star.uno.Type; +import com.sun.star.uno.UnoRuntime; +import com.sun.star.uno.XInterface; + +public class SvxUnoTextRangeEnumeration extends TestCase { + + static XComponent xDrawDoc; + + /** + * in general this method creates a testdocument + * + * @param tParam class which contains additional test parameters + * @param log class to log the test state and result + * + * + * @see TestParameters + * @see PrintWriter + * + */ + @Override + protected void initialize( TestParameters tParam, PrintWriter log ) throws Exception { + log.println( "creating a drawdoc" ); + xDrawDoc = DrawTools.createDrawDoc(tParam.getMSF()); + } + + /** + * in general this method disposes the testenvironment and document + * + * @param tParam class which contains additional test parameters + * @param log class to log the test state and result + * + * + * @see TestParameters + * @see PrintWriter + * + */ + @Override + protected void cleanup( TestParameters tParam, PrintWriter log ) { + log.println( " disposing xDrawDoc " ); + util.DesktopTools.closeDoc(xDrawDoc); + } + + + /** + * creating a TestEnvironment for the interfaces to be tested + * + * @param tParam class which contains additional test parameters + * @param log class to log the test state and result + * + * @return Status class + * + * @see TestParameters + * @see PrintWriter + */ + @Override + protected TestEnvironment createTestEnvironment(TestParameters tParam, PrintWriter log) { + + XInterface oObj = null; + // create testobject here + + XEnumerationAccess xEA = null ; + try { + SOfficeFactory SOF = SOfficeFactory.getFactory(tParam.getMSF()) ; + XShape oShape = SOF.createShape + (xDrawDoc,5000,3500,7500,5000,"Text"); + DrawTools.getShapes(DrawTools.getDrawPage(xDrawDoc,0)).add(oShape) ; + + XSimpleText text = UnoRuntime.queryInterface + (XSimpleText.class, oShape) ; + + XTextCursor cursor = text.createTextCursor() ; + + text.insertString(cursor, "Paragraph 1", false) ; + text.insertControlCharacter(cursor, + ControlCharacter.PARAGRAPH_BREAK, false) ; + text.insertString(cursor, "Paragraph 2", false) ; + text.insertControlCharacter(cursor, + ControlCharacter.PARAGRAPH_BREAK, false) ; + text.insertString(cursor, "Paragraph 3", false) ; + text.insertControlCharacter(cursor, + ControlCharacter.PARAGRAPH_BREAK, false) ; + + xEA = UnoRuntime.queryInterface + (XEnumerationAccess.class, text) ; + + XInterface oTextContent = (XInterface) AnyConverter.toObject( + new Type(XInterface.class),xEA.createEnumeration().nextElement()); + + xEA = UnoRuntime.queryInterface + (XEnumerationAccess.class, oTextContent) ; + + oObj = xEA.createEnumeration(); + + } catch (Exception e) { + log.println("Can't create test object") ; + e.printStackTrace(log) ; + } + + // create test environment here + TestEnvironment tEnv = new TestEnvironment( oObj ); + + tEnv.addObjRelation("ENUM", xEA); + + return tEnv; + } // finish method getTestEnvironment + +} + diff --git a/qadevOOo/tests/java/mod/_svx/package.html b/qadevOOo/tests/java/mod/_svx/package.html new file mode 100644 index 0000000000..a4961d2bf7 --- /dev/null +++ b/qadevOOo/tests/java/mod/_svx/package.html @@ -0,0 +1,23 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN"> +<!-- + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . +--> +<HTML> +<BODY> +<P>Contains all test cases for the module 'svx'.</P> +</BODY> +</HTML> |