diff options
Diffstat (limited to 'qadevOOo/tests/java/mod/_toolkit')
74 files changed, 9864 insertions, 0 deletions
diff --git a/qadevOOo/tests/java/mod/_toolkit/AccessibleButton.java b/qadevOOo/tests/java/mod/_toolkit/AccessibleButton.java new file mode 100644 index 000000000..299e366dc --- /dev/null +++ b/qadevOOo/tests/java/mod/_toolkit/AccessibleButton.java @@ -0,0 +1,195 @@ +/* + * 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._toolkit; + +import com.sun.star.accessibility.AccessibleRole; +import com.sun.star.accessibility.XAccessible; +import com.sun.star.accessibility.XAccessibleAction; +import com.sun.star.accessibility.XAccessibleComponent; +import com.sun.star.accessibility.XAccessibleText; +import com.sun.star.awt.XExtendedToolkit; +import com.sun.star.awt.XWindow; +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.XMultiServiceFactory; +import com.sun.star.text.XTextDocument; +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 java.io.PrintWriter; + +import lib.TestEnvironment; +import lib.TestParameters; +import util.AccessibilityTools; +import util.SOfficeFactory; +import util.utils; + +/** + * Object implements the following interfaces : + * <ul> + * <li> + * <code>::com::sun::star::accessibility::XAccessibleExtendedComponent</code></li> + * <li> + * <code>::com::sun::star::accessibility::XAccessibleEventBroadcaster</code></li> + * <li> <code>::com::sun::star::accessibility::XAccessibleComponent</code></li> + * <li> <code>::com::sun::star::accessibility::XAccessibleValue</code></li> + * <li> <code>::com::sun::star::accessibility::XAccessibleAction</code></li> + * <li> <code>::com::sun::star::accessibility::XAccessibleContext</code></li> + * <li> <code>::com::sun::star::accessibility::XAccessibleText</code></li> + * </ul> + * <p> + * + * @see com.sun.star.accessibility.XAccessibleExtendedComponent + * @see com.sun.star.accessibility.XAccessibleEventBroadcaster + * @see com.sun.star.accessibility.XAccessibleComponent + * @see com.sun.star.accessibility.XAccessibleValue + * @see com.sun.star.accessibility.XAccessibleAction + * @see com.sun.star.accessibility.XAccessibleContext + * @see com.sun.star.accessibility.XAccessibleText + * @see ifc.accessibility._XAccessibleExtendedComponent + * @see ifc.accessibility._XAccessibleEventBroadcaster + * @see ifc.accessibility._XAccessibleComponent + * @see ifc.accessibility._XAccessibleValue + * @see ifc.accessibility._XAccessibleAction + * @see ifc.accessibility._XAccessibleContext + * @see ifc.accessibility._XAccessibleText + */ +public class AccessibleButton extends lib.TestCase { + private static XTextDocument xTextDoc = null; + private static XAccessibleAction action = null; + + /** + * Opens 'Printer Settings' dialog using document dispatch provider running + * in a separate thread. Finds active top window (the dialog window) and + * finds accessible button 'OK' walking through the accessible component + * tree. + */ + @Override + protected TestEnvironment createTestEnvironment(TestParameters Param, + PrintWriter log) throws Exception { + XInterface oObj = null; + XMultiServiceFactory msf = Param.getMSF(); + + oObj = (XInterface) msf.createInstance("com.sun.star.awt.Toolkit"); + + XExtendedToolkit tk = UnoRuntime.queryInterface(XExtendedToolkit.class, + oObj); + + util.utils.waitForEventIdle(Param.getMSF()); + + XModel aModel = UnoRuntime.queryInterface(XModel.class, xTextDoc); + + XController xController = aModel.getCurrentController(); + + // Opening PrinterSetupDialog + String aSlotID = ".uno:Zoom"; + XDispatchProvider xDispProv = UnoRuntime.queryInterface( + XDispatchProvider.class, xController); + XURLTransformer xParser = UnoRuntime.queryInterface( + XURLTransformer.class, + msf.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[] { new URL() }; + aParseURL[0].Complete = aSlotID; + xParser.parseStrict(aParseURL); + + XDispatch xDispatcher = xDispProv.queryDispatch(aParseURL[0], "", 0); + if (xDispatcher != null) { + xDispatcher.dispatch(aParseURL[0], null); + } + + util.utils.waitForEventIdle(msf); + + Object atw = tk.getActiveTopWindow(); + + XWindow xWindow = UnoRuntime.queryInterface(XWindow.class, atw); + + XAccessible xRoot = AccessibilityTools.getAccessibleObject(xWindow); + + AccessibilityTools.printAccessibleTree(log, xRoot, + Param.getBool(util.PropertyName.DEBUG_IS_ACTIVE)); + oObj = AccessibilityTools.getAccessibleObjectForRole(xRoot, + AccessibleRole.PUSH_BUTTON, "Cancel"); + + log.println("ImplementationName " + utils.getImplName(oObj)); + + TestEnvironment tEnv = new TestEnvironment(oObj); + + action = UnoRuntime.queryInterface(XAccessibleAction.class, oObj); + + final XAccessibleComponent acomp = UnoRuntime.queryInterface( + XAccessibleComponent.class, oObj); + + tEnv.addObjRelation( + "EventProducer", + new ifc.accessibility._XAccessibleEventBroadcaster.EventProducer() { + public void fireEvent() { + System.out.println("Grabbing focus ... "); + acomp.grabFocus(); + } + }); + + XAccessibleText text = UnoRuntime.queryInterface(XAccessibleText.class, + oObj); + + tEnv.addObjRelation("XAccessibleText.Text", text.getText()); + + tEnv.addObjRelation("EditOnly", + "This method isn't supported in this component"); + + tEnv.addObjRelation("LimitedBounds", "yes"); + + return tEnv; + } + + /** + * Closes the dialog using accessible button 'OK' found in + * <code>createTestEnvironment()</code>. + */ + @Override + protected void cleanup(TestParameters Param, PrintWriter log) { + log.println(" disposing xTextDoc "); + + try { + action.doAccessibleAction(0); + } catch (com.sun.star.lang.IndexOutOfBoundsException ioe) { + log.println("Couldn't close dialog"); + } catch (com.sun.star.lang.DisposedException de) { + log.println("Dialog already disposed"); + } + + util.DesktopTools.closeDoc(xTextDoc); + } + + /** + * Opens new writer document. + */ + @Override + protected void initialize(TestParameters Param, PrintWriter log) + throws Exception { + SOfficeFactory SOF = SOfficeFactory.getFactory(Param.getMSF()); + xTextDoc = SOF.createTextDoc(null); + } + +}
\ No newline at end of file diff --git a/qadevOOo/tests/java/mod/_toolkit/AccessibleCheckBox.java b/qadevOOo/tests/java/mod/_toolkit/AccessibleCheckBox.java new file mode 100644 index 000000000..8c737225a --- /dev/null +++ b/qadevOOo/tests/java/mod/_toolkit/AccessibleCheckBox.java @@ -0,0 +1,207 @@ +/* + * 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._toolkit; + +import com.sun.star.accessibility.AccessibleRole; +import com.sun.star.accessibility.XAccessible; +import com.sun.star.accessibility.XAccessibleAction; +import com.sun.star.accessibility.XAccessibleComponent; +import com.sun.star.accessibility.XAccessibleText; +import com.sun.star.awt.XExtendedToolkit; +import com.sun.star.awt.XWindow; +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.XMultiServiceFactory; +import com.sun.star.text.XTextDocument; +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 java.io.PrintWriter; + +import lib.TestCase; +import lib.TestEnvironment; +import lib.TestParameters; +import util.AccessibilityTools; +import util.SOfficeFactory; +import util.utils; + +/** + * Test for object which is represented by accessible component of check box in + * 'InsertTable' dialog. + * <p> + * + * Object implements the following interfaces : + * <ul> + * <li> + * <code>::com::sun::star::accessibility::XAccessibleExtendedComponent</code></li> + * <li> + * <code>::com::sun::star::accessibility::XAccessibleEventBroadcaster</code></li> + * <li> <code>::com::sun::star::accessibility::XAccessibleComponent</code></li> + * <li> <code>::com::sun::star::accessibility::XAccessibleValue</code></li> + * <li> <code>::com::sun::star::accessibility::XAccessibleAction</code></li> + * <li> <code>::com::sun::star::accessibility::XAccessibleContext</code></li> + * <li> <code>::com::sun::star::accessibility::XAccessibleText</code></li> + * </ul> + * <p> + * + * @see com.sun.star.accessibility.XAccessibleExtendedComponent + * @see com.sun.star.accessibility.XAccessibleEventBroadcaster + * @see com.sun.star.accessibility.XAccessibleComponent + * @see com.sun.star.accessibility.XAccessibleValue + * @see com.sun.star.accessibility.XAccessibleAction + * @see com.sun.star.accessibility.XAccessibleContext + * @see com.sun.star.accessibility.XAccessibleText + * @see ifc.accessibility._XAccessibleExtendedComponent + * @see ifc.accessibility._XAccessibleEventBroadcaster + * @see ifc.accessibility._XAccessibleComponent + * @see ifc.accessibility._XAccessibleValue + * @see ifc.accessibility._XAccessibleAction + * @see ifc.accessibility._XAccessibleContext + * @see ifc.accessibility._XAccessibleText + */ +public class AccessibleCheckBox extends TestCase { + private static XTextDocument xTextDoc = null; + private static XAccessibleAction action = null; + + /** + * Opens 'Insert Table' dialog using document dispatch provider running in a + * separate thread. Finds active top window (the dialog window) and finds + * first accessible check box walking through the accessible component tree. + */ + @Override + protected TestEnvironment createTestEnvironment(TestParameters Param, + PrintWriter log) throws Exception { + XMultiServiceFactory msf = Param.getMSF(); + log.println("Creating text document"); + + if (xTextDoc == null) { + SOfficeFactory SOF = SOfficeFactory.getFactory(msf); + xTextDoc = SOF.createTextDoc(null); + } + + util.utils.waitForEventIdle(Param.getMSF()); + + XInterface oObj = null; + + log.println("getting toolkit"); + + oObj = (XInterface) msf.createInstance("com.sun.star.awt.Toolkit"); + + XExtendedToolkit tk = UnoRuntime.queryInterface(XExtendedToolkit.class, + oObj); + + util.utils.waitForEventIdle(Param.getMSF()); + + log.println("Opening Dialog in second thread"); + + XModel aModel = UnoRuntime.queryInterface(XModel.class, xTextDoc); + + XController xController = aModel.getCurrentController(); + + // Opening PrinterSetupDialog + String aSlotID = ".uno:InsertTable"; + XDispatchProvider xDispProv = UnoRuntime.queryInterface( + XDispatchProvider.class, xController); + XURLTransformer xParser = UnoRuntime.queryInterface( + XURLTransformer.class, + msf.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[] { new URL() }; + aParseURL[0].Complete = aSlotID; + xParser.parseStrict(aParseURL); + + XDispatch xDispatcher = xDispProv.queryDispatch(aParseURL[0], "", 0); + if (xDispatcher != null) { + xDispatcher.dispatch(aParseURL[0], null); + } + + util.utils.waitForEventIdle(msf); + + log.println("Getting the active TopWindow"); + + 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.PUSH_BUTTON, "Cancel"); + + action = UnoRuntime.queryInterface(XAccessibleAction.class, oObj); + + oObj = AccessibilityTools.getAccessibleObjectForRole(xRoot, + AccessibleRole.CHECK_BOX); + + log.println("ImplementationName " + utils.getImplName(oObj)); + + TestEnvironment tEnv = new TestEnvironment(oObj); + + final XAccessibleComponent acomp = UnoRuntime.queryInterface( + XAccessibleComponent.class, oObj); + + tEnv.addObjRelation( + "EventProducer", + new ifc.accessibility._XAccessibleEventBroadcaster.EventProducer() { + public void fireEvent() { + System.out.println("Grabbing focus ... "); + acomp.grabFocus(); + } + }); + + XAccessibleText text = UnoRuntime.queryInterface(XAccessibleText.class, + oObj); + + tEnv.addObjRelation("XAccessibleText.Text", text.getText()); + + tEnv.addObjRelation("EditOnly", + "This method isn't supported in this component"); + + tEnv.addObjRelation("LimitedBounds", "yes"); + + return tEnv; + } + + /** + * Closes the dialog using accessible button 'Cancel' found in + * <code>createTestEnvironment()</code>. + */ + @Override + protected void cleanup(TestParameters Param, PrintWriter log) { + try { + log.println("closing dialog"); + action.doAccessibleAction(0); + log.println("closing the document"); + util.DesktopTools.closeDoc(xTextDoc); + log.println("reinitialize the variable"); + xTextDoc = null; + } catch (com.sun.star.lang.IndexOutOfBoundsException ioe) { + log.println("Couldn't close dialog"); + } catch (com.sun.star.lang.DisposedException de) { + log.println("Dialog already disposed"); + } + } + +} diff --git a/qadevOOo/tests/java/mod/_toolkit/AccessibleComboBox.java b/qadevOOo/tests/java/mod/_toolkit/AccessibleComboBox.java new file mode 100644 index 000000000..5e04b73da --- /dev/null +++ b/qadevOOo/tests/java/mod/_toolkit/AccessibleComboBox.java @@ -0,0 +1,194 @@ +/* + * 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._toolkit; + +import com.sun.star.accessibility.AccessibleRole; +import com.sun.star.accessibility.XAccessible; +import com.sun.star.accessibility.XAccessibleAction; +import com.sun.star.accessibility.XAccessibleComponent; +import com.sun.star.accessibility.XAccessibleSelection; +import com.sun.star.awt.XExtendedToolkit; +import com.sun.star.awt.XWindow; +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.text.XTextDocument; +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 java.io.PrintWriter; + +import lib.TestCase; +import lib.TestEnvironment; +import lib.TestParameters; +import util.AccessibilityTools; +import util.SOfficeFactory; +import util.utils; + +/** + * Test for object which is represented by accessible component of the 'Font' + * combo box in Format->Character... dialog box. + * <p> + * + * Object implements the following interfaces : + * <ul> + * <li> + * <code>::com::sun::star::accessibility::XAccessibleExtendedComponent</code></li> + * <li> + * <code>::com::sun::star::accessibility::XAccessibleEventBroadcaster</code></li> + * <li> <code>::com::sun::star::accessibility::XAccessibleComponent</code></li> + * <li> <code>::com::sun::star::accessibility::XAccessibleContext</code></li> + * </ul> + * <p> + * + * @see com.sun.star.accessibility.XAccessibleExtendedComponent + * @see com.sun.star.accessibility.XAccessibleEventBroadcaster + * @see com.sun.star.accessibility.XAccessibleComponent + * @see com.sun.star.accessibility.XAccessibleContext + * @see ifc.accessibility._XAccessibleExtendedComponent + * @see ifc.accessibility._XAccessibleEventBroadcaster + * @see ifc.accessibility._XAccessibleComponent + * @see ifc.accessibility._XAccessibleContext + */ +public class AccessibleComboBox extends TestCase { + private static XTextDocument xTextDoc = null; + private static XAccessibleAction action = null; + + /** + * Opens CharacterStyle dialog and finds AccessibleComboBox walking through + * the accessible component tree. + */ + @Override + protected TestEnvironment createTestEnvironment(TestParameters Param, + PrintWriter log) throws Exception { + XInterface oObj = null; + + oObj = (XInterface) Param.getMSF().createInstance( + "com.sun.star.awt.Toolkit"); + + XExtendedToolkit tk = UnoRuntime.queryInterface(XExtendedToolkit.class, + oObj); + + XModel aModel = UnoRuntime.queryInterface(XModel.class, xTextDoc); + + XController xController = aModel.getCurrentController(); + + // Opening PrinterSetupDialog + String aSlotID = ".uno:FontDialog"; + 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[] { new URL() }; + aParseURL[0].Complete = aSlotID; + xParser.parseStrict(aParseURL); + + XDispatch xDispatcher = xDispProv.queryDispatch(aParseURL[0], "", 0); + if (xDispatcher != null) { + xDispatcher.dispatch(aParseURL[0], null); + } + + util.utils.waitForEventIdle(Param.getMSF()); + + Object atw = tk.getActiveTopWindow(); + + XWindow xWindow = UnoRuntime.queryInterface(XWindow.class, atw); + + XAccessible xRoot = AccessibilityTools.getAccessibleObject(xWindow); + + oObj = AccessibilityTools.getAccessibleObjectForRole(xRoot, + AccessibleRole.PUSH_BUTTON, "Cancel"); + action = UnoRuntime.queryInterface(XAccessibleAction.class, oObj); + + oObj = AccessibilityTools.getAccessibleObjectForRole(xRoot, + AccessibleRole.PAGE_TAB_LIST); + + XAccessibleSelection xAccSel = UnoRuntime.queryInterface( + XAccessibleSelection.class, oObj); + + try { + xAccSel.selectAccessibleChild(0); + } catch (com.sun.star.lang.IndexOutOfBoundsException e) { + e.printStackTrace(log); + } + util.utils.waitForEventIdle(Param.getMSF()); + + AccessibilityTools.printAccessibleTree(log, xRoot, + Param.getBool(util.PropertyName.DEBUG_IS_ACTIVE)); + oObj = AccessibilityTools.getAccessibleObjectForRole(xRoot, + AccessibleRole.PANEL, "", "AccessibleComboBox"); + + log.println("ImplementationName " + utils.getImplName(oObj)); + + TestEnvironment tEnv = new TestEnvironment(oObj); + + final XAccessibleComponent acomp = UnoRuntime.queryInterface( + XAccessibleComponent.class, oObj); + final XAccessibleComponent acomp1 = UnoRuntime.queryInterface( + XAccessibleComponent.class, action); + + tEnv.addObjRelation( + "EventProducer", + new ifc.accessibility._XAccessibleEventBroadcaster.EventProducer() { + public void fireEvent() { + acomp1.grabFocus(); + acomp.grabFocus(); + } + }); + + return tEnv; + } + + /** + * Closes the dialog using accessible button 'Cancel' found in + * <code>createTestEnvironment()</code>. + */ + @Override + protected void cleanup(TestParameters Param, PrintWriter log) { + log.println(" closing dialog "); + + try { + action.doAccessibleAction(0); + } catch (com.sun.star.lang.IndexOutOfBoundsException ioe) { + log.println("Couldn't close dialog"); + } catch (com.sun.star.lang.DisposedException de) { + log.println("Dialog already disposed"); + } + + util.DesktopTools.closeDoc(xTextDoc); + } + + /** + * Creates writer doc + */ + @Override + protected void initialize(TestParameters Param, PrintWriter log) + throws Exception { + SOfficeFactory SOF = SOfficeFactory.getFactory(Param.getMSF()); + xTextDoc = SOF.createTextDoc(null); + } + +} diff --git a/qadevOOo/tests/java/mod/_toolkit/AccessibleDropDownComboBox.java b/qadevOOo/tests/java/mod/_toolkit/AccessibleDropDownComboBox.java new file mode 100644 index 000000000..d1b465c0e --- /dev/null +++ b/qadevOOo/tests/java/mod/_toolkit/AccessibleDropDownComboBox.java @@ -0,0 +1,123 @@ +/* + * 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._toolkit; + +import com.sun.star.accessibility.AccessibleRole; +import com.sun.star.accessibility.XAccessible; +import com.sun.star.accessibility.XAccessibleAction; +import com.sun.star.awt.XWindow; +import com.sun.star.text.XTextDocument; +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.AccessibilityTools; +import util.SOfficeFactory; +import util.utils; + + +/** + * Test for object which is represented by accessible component + * of the URL locator combo box located in the left upper corner + * of a document. <p> + * + * Object implements the following interfaces : + * <ul> + * <li> <code>::com::sun::star::accessibility::XAccessibleExtendedComponent</code></li> + * <li> <code>::com::sun::star::accessibility::XAccessibleEventBroadcaster</code></li> + * <li> <code>::com::sun::star::accessibility::XAccessibleComponent</code></li> + * <li> <code>::com::sun::star::accessibility::XAccessibleAction</code></li> + * <li> <code>::com::sun::star::accessibility::XAccessibleContext</code></li> + * </ul> <p> + * + * @see com.sun.star.accessibility.XAccessibleExtendedComponent + * @see com.sun.star.accessibility.XAccessibleEventBroadcaster + * @see com.sun.star.accessibility.XAccessibleComponent + * @see com.sun.star.accessibility.XAccessibleAction + * @see com.sun.star.accessibility.XAccessibleContext + * @see ifc.accessibility._XAccessibleExtendedComponent + * @see ifc.accessibility._XAccessibleEventBroadcaster + * @see ifc.accessibility._XAccessibleComponent + * @see ifc.accessibility._XAccessibleAction + * @see ifc.accessibility._XAccessibleContext + */ +public class AccessibleDropDownComboBox extends TestCase { + private static XTextDocument xTextDoc = null; + + /** + * Finds AccessibleDropDownComboBox walking through the + * accessible component tree of a writer document. + */ + @Override + protected TestEnvironment createTestEnvironment(TestParameters Param, + PrintWriter log) { + XInterface oObj = null; + + XWindow xWindow = AccessibilityTools.getCurrentContainerWindow( + xTextDoc); + + XAccessible xRoot = AccessibilityTools.getAccessibleObject(xWindow); + + oObj = AccessibilityTools.getAccessibleObjectForRole(xRoot, AccessibleRole.COMBO_BOX, + "", "AccessibleDropDownComboBox"); + + log.println("ImplementationName " + utils.getImplName(oObj)); + + TestEnvironment tEnv = new TestEnvironment(oObj); + + final XAccessibleAction editAction = UnoRuntime.queryInterface( + XAccessibleAction.class, + oObj); + + tEnv.addObjRelation("EventProducer", + new ifc.accessibility._XAccessibleEventBroadcaster.EventProducer() { + public void fireEvent() { + try { + editAction.doAccessibleAction(0); + } catch (com.sun.star.lang.IndexOutOfBoundsException e) { + e.printStackTrace(); + } + } + }); + + return tEnv; + } + + /** + * Creates writer document. + */ + @Override + protected void initialize(TestParameters Param, PrintWriter log) throws Exception { + SOfficeFactory SOF = SOfficeFactory.getFactory( + Param.getMSF()); + xTextDoc = SOF.createTextDoc(null); + } + + /** + * Disposes writer document. + */ + @Override + protected void cleanup(TestParameters Param, PrintWriter log) { + util.DesktopTools.closeDoc(xTextDoc); + } +}
\ No newline at end of file diff --git a/qadevOOo/tests/java/mod/_toolkit/AccessibleDropDownListBox.java b/qadevOOo/tests/java/mod/_toolkit/AccessibleDropDownListBox.java new file mode 100644 index 000000000..7adcc1c2e --- /dev/null +++ b/qadevOOo/tests/java/mod/_toolkit/AccessibleDropDownListBox.java @@ -0,0 +1,127 @@ +/* + * 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._toolkit; + +import com.sun.star.accessibility.AccessibleRole; +import com.sun.star.accessibility.XAccessible; +import com.sun.star.accessibility.XAccessibleAction; +import com.sun.star.awt.XWindow; +import com.sun.star.text.XTextDocument; +import com.sun.star.uno.UnoRuntime; +import com.sun.star.uno.XInterface; + +import java.io.PrintWriter; + +import lib.StatusException; +import lib.TestCase; +import lib.TestEnvironment; +import lib.TestParameters; + +import util.AccessibilityTools; +import util.DesktopTools; +import util.SOfficeFactory; +import util.utils; + + +/** + * Test for object which is represented by style list box + * on toolbar of a document. <p> + * + * Object implements the following interfaces : + * <ul> + * <li> <code>::com::sun::star::accessibility::XAccessibleExtendedComponent</code></li> + * <li> <code>::com::sun::star::accessibility::XAccessibleEventBroadcaster</code></li> + * <li> <code>::com::sun::star::accessibility::XAccessibleComponent</code></li> + * <li> <code>::com::sun::star::accessibility::XAccessibleAction</code></li> + * <li> <code>::com::sun::star::accessibility::XAccessibleContext</code></li> + * </ul> <p> + * + * @see com.sun.star.accessibility.XAccessibleExtendedComponent + * @see com.sun.star.accessibility.XAccessibleEventBroadcaster + * @see com.sun.star.accessibility.XAccessibleComponent + * @see com.sun.star.accessibility.XAccessibleAction + * @see com.sun.star.accessibility.XAccessibleContext + * @see ifc.accessibility._XAccessibleExtendedComponent + * @see ifc.accessibility._XAccessibleEventBroadcaster + * @see ifc.accessibility._XAccessibleComponent + * @see ifc.accessibility._XAccessibleAction + * @see ifc.accessibility._XAccessibleContext + */ +public class AccessibleDropDownListBox extends TestCase { + private static XTextDocument xTextDoc = null; + /** + * Finds AccessibleDropDownListBox walking through the + * accessible component tree of a writer document. + */ + @Override + protected TestEnvironment createTestEnvironment(TestParameters Param, + PrintWriter log) { + XInterface oObj = null; + + util.utils.waitForEventIdle(Param.getMSF()); + + XWindow xWindow = AccessibilityTools.getCurrentWindow( + xTextDoc); + + XAccessible xRoot = AccessibilityTools.getAccessibleObject(xWindow); + + AccessibilityTools.printAccessibleTree(log, xRoot, Param.getBool(util.PropertyName.DEBUG_IS_ACTIVE)); + + oObj = AccessibilityTools.getAccessibleObjectForRole(xRoot, AccessibleRole.COMBO_BOX, + "", "AccessibleDropDownListBox"); + + log.println("ImplementationName " + utils.getImplName(oObj)); + + TestEnvironment tEnv = new TestEnvironment(oObj); + + final XAccessibleAction acomp = UnoRuntime.queryInterface( + XAccessibleAction.class, oObj); + tEnv.addObjRelation("EventProducer", + new ifc.accessibility._XAccessibleEventBroadcaster.EventProducer() { + public void fireEvent() { + try { + acomp.doAccessibleAction(0); + } catch (com.sun.star.lang.IndexOutOfBoundsException e) { + throw new StatusException("Can't perform action 0", e); + } + } + }); + + return tEnv; + } + + /** + * Creates writer document. + */ + @Override + protected void initialize(TestParameters Param, PrintWriter log) throws Exception { + SOfficeFactory SOF = SOfficeFactory.getFactory( + Param.getMSF()); + // Dock the Navigator to supply an AccessibleDropDownListBox + DesktopTools.dockNavigator(Param.getMSF()); + xTextDoc = SOF.createTextDoc(null); + } + + /** + * Disposes writer document. + */ + @Override + protected void cleanup(TestParameters Param, PrintWriter log) { + util.DesktopTools.closeDoc(xTextDoc); + } +} diff --git a/qadevOOo/tests/java/mod/_toolkit/AccessibleEdit.java b/qadevOOo/tests/java/mod/_toolkit/AccessibleEdit.java new file mode 100644 index 000000000..d28592b6c --- /dev/null +++ b/qadevOOo/tests/java/mod/_toolkit/AccessibleEdit.java @@ -0,0 +1,194 @@ +/* + * 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._toolkit; + +import com.sun.star.accessibility.AccessibleRole; +import com.sun.star.accessibility.XAccessible; +import com.sun.star.accessibility.XAccessibleAction; +import com.sun.star.accessibility.XAccessibleEditableText; +import com.sun.star.accessibility.XAccessibleText; +import com.sun.star.awt.XExtendedToolkit; +import com.sun.star.awt.XWindow; +import com.sun.star.beans.PropertyValue; +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.text.XTextDocument; +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 java.io.PrintWriter; + +import lib.TestCase; +import lib.TestEnvironment; +import lib.TestParameters; +import util.AccessibilityTools; +import util.SOfficeFactory; +import util.utils; + + +/** + * Test for object which is represented by edit field + * of 'Insert Hyperlink' dialog. <p> + * + * Object implements the following interfaces : + * <ul> + * <li> <code>::com::sun::star::accessibility::XAccessibleExtendedComponent</code></li> + * <li> <code>::com::sun::star::accessibility::XAccessibleEventBroadcaster</code></li> + * <li> <code>::com::sun::star::accessibility::XAccessibleEditableText</code></li> + * <li> <code>::com::sun::star::accessibility::XAccessibleComponent</code></li> + * <li> <code>::com::sun::star::accessibility::XAccessibleContext</code></li> + * <li> <code>::com::sun::star::accessibility::XAccessibleText</code></li> + * </ul> <p> + * + * @see com.sun.star.accessibility.XAccessibleExtendedComponent + * @see com.sun.star.accessibility.XAccessibleEventBroadcaster + * @see com.sun.star.accessibility.XAccessibleEditableText + * @see com.sun.star.accessibility.XAccessibleComponent + * @see com.sun.star.accessibility.XAccessibleContext + * @see com.sun.star.accessibility.XAccessibleText + * @see ifc.accessibility._XAccessibleExtendedComponent + * @see ifc.accessibility._XAccessibleEventBroadcaster + * @see ifc.accessibility._XAccessibleEditableText + * @see ifc.accessibility._XAccessibleComponent + * @see ifc.accessibility._XAccessibleContext + * @see ifc.accessibility._XAccessibleText + */ +public class AccessibleEdit extends TestCase { + private static XTextDocument xTextDoc = null; + private static XAccessibleAction action = null; + + /** + * Opens 'Insert Hyperlink' dialog using document dispatch provider. + * Finds active top window (the dialog + * window) and finds first accessible edit field and + * button 'Close' (for closing this dialog when disposing) + * walking through the accessible component tree. + */ + @Override + protected TestEnvironment createTestEnvironment(TestParameters Param, + PrintWriter log) throws Exception { + XInterface oObj = null; + + oObj = (XInterface) Param.getMSF().createInstance( + "com.sun.star.awt.Toolkit"); + + XExtendedToolkit tk = UnoRuntime.queryInterface( + XExtendedToolkit.class, oObj); + + XModel aModel1 = UnoRuntime.queryInterface(XModel.class, + xTextDoc); + + XController secondController = aModel1.getCurrentController(); + + XDispatchProvider aProv = UnoRuntime.queryInterface( + XDispatchProvider.class, + secondController); + + XURLTransformer urlTransf = null; + + XInterface transf = (XInterface) Param.getMSF().createInstance( + "com.sun.star.util.URLTransformer"); + urlTransf = UnoRuntime.queryInterface( + XURLTransformer.class, transf); + + XDispatch getting = null; + log.println("opening HyperlinkDialog"); + + URL[] url = new URL[1]; + url[0] = new URL(); + url[0].Complete = ".uno:HyperlinkDialog"; + urlTransf.parseStrict(url); + getting = aProv.queryDispatch(url[0], "", 0); + + PropertyValue[] noArgs = new PropertyValue[0]; + getting.dispatch(url[0], noArgs); + + util.utils.waitForEventIdle(Param.getMSF()); + + XWindow xWindow = UnoRuntime.queryInterface(XWindow.class, + tk.getActiveTopWindow()); + + XAccessible xRoot = AccessibilityTools.getAccessibleObject(xWindow); + + oObj = AccessibilityTools.getAccessibleObjectForRole(xRoot, AccessibleRole.PUSH_BUTTON, + "Close"); + action = UnoRuntime.queryInterface( + XAccessibleAction.class, oObj); + + oObj = AccessibilityTools.getAccessibleObjectForRole(xRoot, AccessibleRole.TEXT); + + log.println("ImplementationName " + utils.getImplName(oObj)); + + TestEnvironment tEnv = new TestEnvironment(oObj); + + final XAccessibleEditableText edText = UnoRuntime.queryInterface( + XAccessibleEditableText.class, + oObj); + edText.setText("AccessibleEdit"); + + tEnv.addObjRelation("EventProducer", + new ifc.accessibility._XAccessibleEventBroadcaster.EventProducer() { + public void fireEvent() { + edText.setText("firing event ..."); + edText.setText("firing event ... 2"); + edText.setText("AccessibleEdit"); + } + }); + + XAccessibleText text = UnoRuntime.queryInterface( + XAccessibleText.class, oObj); + + tEnv.addObjRelation("XAccessibleText.Text", text.getText()); + + tEnv.addObjRelation("XAccessibleEditableText.hasAttr", Boolean.FALSE); + + return tEnv; + } + + /** + * Closes dialog using action of button 'Close' + */ + @Override + protected void cleanup(TestParameters Param, PrintWriter log) { + log.println(" Closing dialog ... "); + + try { + action.doAccessibleAction(0); + } catch (com.sun.star.lang.IndexOutOfBoundsException ioe) { + log.println("Couldn't close dialog"); + } catch (com.sun.star.lang.DisposedException de) { + log.println("Dialog already disposed"); + } + + util.DesktopTools.closeDoc(xTextDoc); + } + + /** + * Creates writer document + */ + @Override + protected void initialize(TestParameters Param, PrintWriter log) throws Exception { + SOfficeFactory SOF = SOfficeFactory.getFactory( + Param.getMSF()); + xTextDoc = SOF.createTextDoc(null); + } +}
\ No newline at end of file diff --git a/qadevOOo/tests/java/mod/_toolkit/AccessibleFixedText.java b/qadevOOo/tests/java/mod/_toolkit/AccessibleFixedText.java new file mode 100644 index 000000000..f7a756685 --- /dev/null +++ b/qadevOOo/tests/java/mod/_toolkit/AccessibleFixedText.java @@ -0,0 +1,189 @@ +/* + * 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._toolkit; + +import com.sun.star.accessibility.AccessibleRole; +import com.sun.star.accessibility.XAccessible; +import com.sun.star.accessibility.XAccessibleText; +import com.sun.star.awt.PosSize; +import com.sun.star.awt.XControl; +import com.sun.star.awt.XControlContainer; +import com.sun.star.awt.XControlModel; +import com.sun.star.awt.XFixedText; +import com.sun.star.awt.XWindow; +import com.sun.star.awt.XLayoutConstrains; +import com.sun.star.awt.Size; +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.AccessibilityTools; +import util.utils; + + +/** + * Test for object which is represented by accessible component + * of the fixed text label in 'Hyperlink' Dialog. <p> + * + * Object implements the following interfaces : + * <ul> + * <li> <code>::com::sun::star::accessibility::XAccessibleExtendedComponent</code></li> + * <li> <code>::com::sun::star::accessibility::XAccessibleEventBroadcaster</code></li> + * <li> <code>::com::sun::star::accessibility::XAccessibleComponent</code></li> + * <li> <code>::com::sun::star::accessibility::XAccessibleContext</code></li> + * <li> <code>::com::sun::star::accessibility::XAccessibleText</code></li> + * </ul> <p> + * + * @see com.sun.star.accessibility.XAccessibleExtendedComponent + * @see com.sun.star.accessibility.XAccessibleEventBroadcaster + * @see com.sun.star.accessibility.XAccessibleComponent + * @see com.sun.star.accessibility.XAccessibleContext + * @see com.sun.star.accessibility.XAccessibleText + * @see ifc.accessibility._XAccessibleExtendedComponent + * @see ifc.accessibility._XAccessibleEventBroadcaster + * @see ifc.accessibility._XAccessibleComponent + * @see ifc.accessibility._XAccessibleContext + * @see ifc.accessibility._XAccessibleText + */ +public class AccessibleFixedText extends TestCase { + private static XWindow xWinDlg = null; + + /** + * Creates a new dialog adds fixed text control to it and + * displays it. Then the text's accessible component is + * obtained. + */ + @Override + protected TestEnvironment createTestEnvironment(TestParameters Param, + PrintWriter log) throws Exception { + XInterface oObj = null; + XMultiServiceFactory xMSF = Param.getMSF(); + XControlModel dlgModel = null; + + XControl txtControl = null; + XControlModel txtModel = null; + + try { + dlgModel = UnoRuntime.queryInterface( + XControlModel.class, + xMSF.createInstance( + "com.sun.star.awt.UnoControlDialogModel")); + + XControl dlgControl = UnoRuntime.queryInterface( + XControl.class, + xMSF.createInstance( + "com.sun.star.awt.UnoControlDialog")); + + dlgControl.setModel(dlgModel); + + txtModel = UnoRuntime.queryInterface( + XControlModel.class, + xMSF.createInstance( + "com.sun.star.awt.UnoControlFixedTextModel")); + + txtControl = UnoRuntime.queryInterface(XControl.class, + xMSF.createInstance( + "com.sun.star.awt.UnoControlFixedText")); + + txtControl.setModel(txtModel); + + XFixedText xFT = UnoRuntime.queryInterface( + XFixedText.class, txtControl); + xFT.setText("FxedText"); + + /* Set the text control to its preferred size, otherwise it + * defaults to the size hard coded in its constructor (100 x 12) */ + XLayoutConstrains xLCTxt = UnoRuntime.queryInterface( + XLayoutConstrains.class, txtControl); + Size textSize = xLCTxt.getPreferredSize(); + XWindow xWinTxt = UnoRuntime.queryInterface( + XWindow.class, txtControl); + xWinTxt.setPosSize(0, 0, textSize.Width, textSize.Height, + PosSize.SIZE); + + XControlContainer ctrlCont = UnoRuntime.queryInterface( + XControlContainer.class, + dlgControl); + + ctrlCont.addControl("Text", txtControl); + + xWinDlg = UnoRuntime.queryInterface(XWindow.class, + dlgControl); + + xWinDlg.setVisible(true); + + xWinDlg.setPosSize(0, 0, 200, 100, PosSize.SIZE); + } catch (com.sun.star.uno.Exception e) { + log.println("Error creating dialog :"); + e.printStackTrace(log); + } + + oObj = (XInterface) Param.getMSF().createInstance( + "com.sun.star.awt.Toolkit"); + + util.utils.waitForEventIdle(Param.getMSF()); + + XAccessible xRoot = AccessibilityTools.getAccessibleObject(xWinDlg); + + AccessibilityTools.printAccessibleTree(log, xRoot, Param.getBool(util.PropertyName.DEBUG_IS_ACTIVE)); + + oObj = AccessibilityTools.getAccessibleObjectForRole(xRoot, AccessibleRole.LABEL); + + log.println("ImplementationName " + utils.getImplName(oObj)); + + TestEnvironment tEnv = new TestEnvironment(oObj); + + final XWindow xWin = UnoRuntime.queryInterface(XWindow.class, + txtControl); + + tEnv.addObjRelation("EventProducer", + new ifc.accessibility._XAccessibleEventBroadcaster.EventProducer() { + public void fireEvent() { + xWin.setEnable(false); + xWin.setEnable(true); + } + }); + + XAccessibleText text = UnoRuntime.queryInterface( + XAccessibleText.class, oObj); + + tEnv.addObjRelation("XAccessibleText.Text", text.getText()); + + tEnv.addObjRelation("EditOnly", + "This method isn't supported in this component"); + + tEnv.addObjRelation("LimitedBounds", "yes"); + + return tEnv; + } + + /** + * Closes dialog using action of button 'Close' + */ + @Override + protected void cleanup(TestParameters Param, PrintWriter log) { + log.println(" Closing dialog ... "); + if (xWinDlg != null) + xWinDlg.dispose(); + } +} diff --git a/qadevOOo/tests/java/mod/_toolkit/AccessibleList.java b/qadevOOo/tests/java/mod/_toolkit/AccessibleList.java new file mode 100644 index 000000000..f88b7dbe1 --- /dev/null +++ b/qadevOOo/tests/java/mod/_toolkit/AccessibleList.java @@ -0,0 +1,191 @@ +/* + * 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._toolkit; + +import com.sun.star.accessibility.AccessibleRole; +import com.sun.star.accessibility.XAccessible; +import com.sun.star.accessibility.XAccessibleAction; +import com.sun.star.accessibility.XAccessibleComponent; +import com.sun.star.accessibility.XAccessibleContext; +import com.sun.star.accessibility.XAccessibleSelection; +import com.sun.star.awt.XExtendedToolkit; +import com.sun.star.awt.XWindow; +import com.sun.star.beans.PropertyValue; +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.XMultiServiceFactory; +import com.sun.star.text.XTextDocument; +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 java.io.PrintWriter; + +import lib.TestCase; +import lib.TestEnvironment; +import lib.TestParameters; +import util.AccessibilityTools; +import util.SOfficeFactory; +import util.utils; + + +public class AccessibleList extends TestCase { + private static XTextDocument xTextDoc = null; + private static XAccessibleAction action = null; + private static XMultiServiceFactory msf = null; + + /** + * Opens 'Insert Hyperlink' dialog using document dispatch provider. + * Finds active top window (the dialog + * window) and finds button 'Close' (for closing this dialog when + * disposing) walking through the accessible component tree. + * Then the TREE component is found and the 'New Document' tab is + * selected to make list box visible. After that list box is obtained. + */ + @Override + protected TestEnvironment createTestEnvironment(TestParameters Param, + PrintWriter log) throws Exception { + XInterface oObj = (XInterface) msf.createInstance("com.sun.star.awt.Toolkit"); + + XExtendedToolkit tk = UnoRuntime.queryInterface( + XExtendedToolkit.class, oObj); + + util.utils.waitForEventIdle(Param.getMSF()); + + XModel aModel1 = UnoRuntime.queryInterface(XModel.class, + xTextDoc); + + XController secondController = aModel1.getCurrentController(); + + XDispatchProvider aProv = UnoRuntime.queryInterface( + XDispatchProvider.class, + secondController); + + XURLTransformer urlTransf = null; + + XInterface transf = (XInterface) msf.createInstance( + "com.sun.star.util.URLTransformer"); + urlTransf = UnoRuntime.queryInterface( + XURLTransformer.class, transf); + + XDispatch getting = null; + log.println("opening HyperlinkDialog"); + + URL[] url = new URL[1]; + url[0] = new URL(); + url[0].Complete = ".uno:HyperlinkDialog"; + urlTransf.parseStrict(url); + getting = aProv.queryDispatch(url[0], "", 0); + + PropertyValue[] noArgs = new PropertyValue[0]; + getting.dispatch(url[0], noArgs); + + XWindow xWindow = UnoRuntime.queryInterface(XWindow.class, + tk.getActiveTopWindow()); + + XAccessible xRoot = AccessibilityTools.getAccessibleObject(xWindow); + + + AccessibilityTools.printAccessibleTree(log, xRoot, Param.getBool(util.PropertyName.DEBUG_IS_ACTIVE)); + // obtaining 'Close' button + oObj = AccessibilityTools.getAccessibleObjectForRole(xRoot, AccessibleRole.PUSH_BUTTON, + "Close"); + action = UnoRuntime.queryInterface( + XAccessibleAction.class, oObj); + + // Selecting 'New Document' tab + oObj = AccessibilityTools.getAccessibleObjectForRole(xRoot, AccessibleRole.TREE); + + XAccessibleSelection xAccSel = UnoRuntime.queryInterface( + XAccessibleSelection.class, + oObj); + xAccSel.selectAccessibleChild(3); + util.utils.waitForEventIdle(Param.getMSF()); + + log.println("# Getting the ListBox"); + + XAccessibleContext parent = AccessibilityTools.getAccessibleObjectForRole(xRoot, + AccessibleRole.PANEL, + "", + "com.sun.star.comp.toolkit.AccessibleListBox"); + + log.println("# Getting the first child"); + + try { + oObj = parent.getAccessibleChild(0); + } catch (com.sun.star.lang.IndexOutOfBoundsException e) { + } + + log.println("ImplementationName " + utils.getImplName(oObj)); + + TestEnvironment tEnv = new TestEnvironment(oObj); + + tEnv.addObjRelation("XAccessibleSelection.multiSelection", + Boolean.FALSE); + + final XAccessibleComponent acomp = UnoRuntime.queryInterface( + XAccessibleComponent.class, + oObj); + final XAccessibleComponent acomp1 = UnoRuntime.queryInterface( + XAccessibleComponent.class, + action); + + tEnv.addObjRelation("EventProducer", + new ifc.accessibility._XAccessibleEventBroadcaster.EventProducer() { + public void fireEvent() { + System.out.println("Grabbing focus ... "); + acomp1.grabFocus(); + acomp.grabFocus(); + } + }); + + return tEnv; + } + + /** + * Closes dialog using action of button 'Close' + */ + @Override + protected void cleanup(TestParameters Param, PrintWriter log) { + log.println(" Closing dialog ... "); + + try { + action.doAccessibleAction(0); + } catch (com.sun.star.lang.IndexOutOfBoundsException ioe) { + log.println("Couldn't close dialog"); + } catch (com.sun.star.lang.DisposedException de) { + log.println("Dialog already disposed"); + } + + util.DesktopTools.closeDoc(xTextDoc); + } + + /** + * Creates writer document + */ + @Override + protected void initialize(TestParameters Param, PrintWriter log) throws Exception { + msf = Param.getMSF(); + + SOfficeFactory SOF = SOfficeFactory.getFactory(msf); + xTextDoc = SOF.createTextDoc(null); + } +}
\ No newline at end of file diff --git a/qadevOOo/tests/java/mod/_toolkit/AccessibleListBox.java b/qadevOOo/tests/java/mod/_toolkit/AccessibleListBox.java new file mode 100644 index 000000000..dcbef787f --- /dev/null +++ b/qadevOOo/tests/java/mod/_toolkit/AccessibleListBox.java @@ -0,0 +1,205 @@ +/* + * 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._toolkit; + +import com.sun.star.accessibility.AccessibleRole; +import com.sun.star.accessibility.XAccessible; +import com.sun.star.accessibility.XAccessibleAction; +import com.sun.star.accessibility.XAccessibleComponent; +import com.sun.star.accessibility.XAccessibleSelection; +import com.sun.star.awt.XExtendedToolkit; +import com.sun.star.awt.XWindow; +import com.sun.star.beans.PropertyValue; +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.text.XTextDocument; +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 java.io.PrintWriter; + +import lib.TestCase; +import lib.TestEnvironment; +import lib.TestParameters; +import util.AccessibilityTools; +import util.SOfficeFactory; +import util.utils; + + +/** + * Test for object which is represented accessible component + * of 'File type' list box situated in 'Insert Hyperlink' + * dialog on tab 'New Document'. <p> + * + * Object implements the following interfaces : + * <ul> + * <li> <code>::com::sun::star::accessibility::XAccessibleExtendedComponent</code></li> + * <li> <code>::com::sun::star::accessibility::XAccessibleEventBroadcaster</code></li> + * <li> <code>::com::sun::star::accessibility::XAccessibleComponent</code></li> + * <li> <code>::com::sun::star::accessibility::XAccessibleSelection</code></li> + * <li> <code>::com::sun::star::accessibility::XAccessibleContext</code></li> + * </ul> <p> + * + * @see com.sun.star.accessibility.XAccessibleExtendedComponent + * @see com.sun.star.accessibility.XAccessibleEventBroadcaster + * @see com.sun.star.accessibility.XAccessibleComponent + * @see com.sun.star.accessibility.XAccessibleSelection + * @see com.sun.star.accessibility.XAccessibleContext + * @see ifc.accessibility._XAccessibleExtendedComponent + * @see ifc.accessibility._XAccessibleEventBroadcaster + * @see ifc.accessibility._XAccessibleComponent + * @see ifc.accessibility._XAccessibleSelection + * @see ifc.accessibility._XAccessibleContext + */ +public class AccessibleListBox extends TestCase { + private static XTextDocument xTextDoc = null; + private static XAccessibleAction action = null; + + /** + * Opens 'Insert Hyperlink' dialog using document dispatch provider. + * Finds active top window (the dialog + * window) and finds button 'Close' (for closing this dialog when + * disposing) walking through the accessible component tree. + * Then the TREE component is found and the 'New Document' tab is + * selected to make list box visible. After that list box is obtained. + */ + @Override + protected TestEnvironment createTestEnvironment(TestParameters Param, + PrintWriter log) throws Exception { + XInterface oObj = (XInterface) Param.getMSF().createInstance( + "com.sun.star.awt.Toolkit"); + + XExtendedToolkit tk = UnoRuntime.queryInterface( + XExtendedToolkit.class, oObj); + + util.utils.waitForEventIdle(Param.getMSF()); + + XModel aModel1 = UnoRuntime.queryInterface(XModel.class, + xTextDoc); + + XController secondController = aModel1.getCurrentController(); + + XDispatchProvider aProv = UnoRuntime.queryInterface( + XDispatchProvider.class, + secondController); + + XURLTransformer urlTransf = null; + + XInterface transf = (XInterface) Param.getMSF().createInstance( + "com.sun.star.util.URLTransformer"); + urlTransf = UnoRuntime.queryInterface( + XURLTransformer.class, transf); + + XDispatch getting = null; + log.println("opening HyperlinkDialog"); + + URL[] url = new URL[1]; + url[0] = new URL(); + url[0].Complete = ".uno:HyperlinkDialog"; + urlTransf.parseStrict(url); + getting = aProv.queryDispatch(url[0], "", 0); + + PropertyValue[] noArgs = new PropertyValue[0]; + getting.dispatch(url[0], noArgs); + + util.utils.waitForEventIdle(Param.getMSF()); + + XWindow xWindow = UnoRuntime.queryInterface(XWindow.class, + tk.getActiveTopWindow()); + + XAccessible xRoot = AccessibilityTools.getAccessibleObject(xWindow); + + AccessibilityTools.printAccessibleTree(log, xRoot, Param.getBool(util.PropertyName.DEBUG_IS_ACTIVE)); + + + // obtaining 'Close' button + oObj = AccessibilityTools.getAccessibleObjectForRole(xRoot, AccessibleRole.PUSH_BUTTON, + "Close"); + action = UnoRuntime.queryInterface( + XAccessibleAction.class, oObj); + + // Selecting 'New Document' tab + oObj = AccessibilityTools.getAccessibleObjectForRole(xRoot, AccessibleRole.TREE); + + XAccessibleSelection xAccSel = UnoRuntime.queryInterface( + XAccessibleSelection.class, + oObj); + xAccSel.selectAccessibleChild(3); + util.utils.waitForEventIdle(Param.getMSF()); + + oObj = AccessibilityTools.getAccessibleObjectForRole(xRoot, AccessibleRole.PANEL, "", + "com.sun.star.comp.toolkit.AccessibleListBox"); + + Object list = AccessibilityTools.getAccessibleObjectForRole(AccessibilityTools.SearchedAccessible, + AccessibleRole.LIST); + + log.println("ImplementationName " + utils.getImplName(oObj)); + + TestEnvironment tEnv = new TestEnvironment(oObj); + + final XAccessibleComponent acomp = UnoRuntime.queryInterface( + XAccessibleComponent.class, + list); + final XAccessibleComponent acomp1 = UnoRuntime.queryInterface( + XAccessibleComponent.class, + action); + + tEnv.addObjRelation("EventProducer", + new ifc.accessibility._XAccessibleEventBroadcaster.EventProducer() { + public void fireEvent() { + System.out.println("Grabbing focus ... "); + acomp1.grabFocus(); + acomp.grabFocus(); + } + }); + + return tEnv; + } + + /** + * Closes dialog using action of button 'Close' + */ + @Override + protected void cleanup(TestParameters Param, PrintWriter log) { + log.println(" Closing dialog ... "); + + try { + action.doAccessibleAction(0); + } catch (com.sun.star.lang.IndexOutOfBoundsException ioe) { + log.println("Couldn't close dialog"); + } catch (com.sun.star.lang.DisposedException de) { + log.println("Dialog already disposed"); + } + + util.DesktopTools.closeDoc(xTextDoc); + } + + /** + * Creates writer document + */ + @Override + protected void initialize(TestParameters Param, PrintWriter log) throws Exception { + SOfficeFactory SOF = SOfficeFactory.getFactory( + Param.getMSF()); + xTextDoc = SOF.createTextDoc(null); + } +}
\ No newline at end of file diff --git a/qadevOOo/tests/java/mod/_toolkit/AccessibleListItem.java b/qadevOOo/tests/java/mod/_toolkit/AccessibleListItem.java new file mode 100644 index 000000000..58726c366 --- /dev/null +++ b/qadevOOo/tests/java/mod/_toolkit/AccessibleListItem.java @@ -0,0 +1,197 @@ +/* + * 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._toolkit; + +import com.sun.star.accessibility.AccessibleRole; +import com.sun.star.accessibility.XAccessible; +import com.sun.star.accessibility.XAccessibleAction; +import com.sun.star.accessibility.XAccessibleComponent; +import com.sun.star.accessibility.XAccessibleSelection; +import com.sun.star.awt.XExtendedToolkit; +import com.sun.star.awt.XWindow; +import com.sun.star.beans.PropertyValue; +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.XMultiServiceFactory; +import com.sun.star.text.XTextDocument; +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 java.io.PrintWriter; + +import lib.TestCase; +import lib.TestEnvironment; +import lib.TestParameters; +import util.AccessibilityTools; +import util.SOfficeFactory; +import util.utils; + + +/** + * Test for object which is represented accessible component + * of 'File type' list box item situated in 'Insert Hyperlink' + * dialog on tab 'New Document'. <p> + * + * Object implements the following interfaces : + * <ul> + * <li> <code>::com::sun::star::accessibility::XAccessibleEventBroadcaster</code></li> + * <li> <code>::com::sun::star::accessibility::XAccessibleComponent</code></li> + * <li> <code>::com::sun::star::accessibility::XAccessibleContext</code></li> + * <li> <code>::com::sun::star::accessibility::XAccessibleText</code></li> + * </ul> <p> + * + * @see com.sun.star.accessibility.XAccessibleEventBroadcaster + * @see com.sun.star.accessibility.XAccessibleComponent + * @see com.sun.star.accessibility.XAccessibleContext + * @see com.sun.star.accessibility.XAccessibleText + * @see ifc.accessibility._XAccessibleEventBroadcaster + * @see ifc.accessibility._XAccessibleComponent + * @see ifc.accessibility._XAccessibleContext + * @see ifc.accessibility._XAccessibleText + */ +public class AccessibleListItem extends TestCase { + private static XTextDocument xTextDoc = null; + private static XAccessibleAction action = null; + + /** + * Opens 'Insert Hyperlink' dialog using document dispatch provider. + * Finds active top window (the dialog + * window) and finds button 'Close' (for closing this dialog when + * disposing) walking through the accessible component tree. + * Then the TREE component is found and the 'New Document' tab is + * selected to make list box visible. After that listbox item is obtained. + */ + @Override + protected TestEnvironment createTestEnvironment(TestParameters Param, + PrintWriter log) throws Exception { + XMultiServiceFactory msf = Param.getMSF(); + XInterface oObj = (XInterface) msf.createInstance("com.sun.star.awt.Toolkit"); + + XExtendedToolkit tk = UnoRuntime.queryInterface( + XExtendedToolkit.class, oObj); + + util.utils.waitForEventIdle(Param.getMSF()); + + XModel aModel1 = UnoRuntime.queryInterface(XModel.class, + xTextDoc); + + XController secondController = aModel1.getCurrentController(); + + XDispatchProvider aProv = UnoRuntime.queryInterface( + XDispatchProvider.class, + secondController); + + XURLTransformer urlTransf = null; + + XInterface transf = (XInterface) msf.createInstance( + "com.sun.star.util.URLTransformer"); + urlTransf = UnoRuntime.queryInterface( + XURLTransformer.class, transf); + + XDispatch getting = null; + log.println("opening HyperlinkDialog"); + + URL[] url = new URL[1]; + url[0] = new URL(); + url[0].Complete = ".uno:HyperlinkDialog"; + urlTransf.parseStrict(url); + getting = aProv.queryDispatch(url[0], "", 0); + + PropertyValue[] noArgs = new PropertyValue[0]; + getting.dispatch(url[0], noArgs); + + util.utils.waitForEventIdle(Param.getMSF()); + + XWindow xWindow = UnoRuntime.queryInterface(XWindow.class, + tk.getActiveTopWindow()); + + XAccessible xRoot = AccessibilityTools.getAccessibleObject(xWindow); + + + AccessibilityTools.printAccessibleTree(log, xRoot, Param.getBool(util.PropertyName.DEBUG_IS_ACTIVE)); + // obtaining 'Close' button + oObj = AccessibilityTools.getAccessibleObjectForRole(xRoot, AccessibleRole.PUSH_BUTTON, + "Close"); + action = UnoRuntime.queryInterface( + XAccessibleAction.class, oObj); + + // Selecting 'New Document' tab + oObj = AccessibilityTools.getAccessibleObjectForRole(xRoot, AccessibleRole.TREE); + + XAccessibleSelection xAccSel = UnoRuntime.queryInterface( + XAccessibleSelection.class, + oObj); + xAccSel.selectAccessibleChild(3); + util.utils.waitForEventIdle(Param.getMSF()); + + oObj = AccessibilityTools.getAccessibleObjectForRole(xRoot, AccessibleRole.LIST_ITEM,"Spr"); + + log.println("ImplementationName " + utils.getImplName(oObj)); + + TestEnvironment tEnv = new TestEnvironment(oObj); + + tEnv.addObjRelation("EditOnly", + "This method isn't supported in this component"); + + tEnv.addObjRelation("LimitedBounds", "yes"); + + final XAccessibleComponent acomp = UnoRuntime.queryInterface( + XAccessibleComponent.class, + oObj); + tEnv.addObjRelation("EventProducer", + new ifc.accessibility._XAccessibleEventBroadcaster.EventProducer() { + public void fireEvent() { + acomp.grabFocus(); + } + }); + + return tEnv; + } + + /** + * Closes dialog using action of button 'Close' + */ + @Override + protected void cleanup(TestParameters Param, PrintWriter log) { + log.println(" Closing dialog ... "); + + try { + action.doAccessibleAction(0); + } catch (com.sun.star.lang.IndexOutOfBoundsException ioe) { + log.println("Couldn't close dialog"); + } catch (com.sun.star.lang.DisposedException de) { + log.println("Dialog already disposed"); + } + + util.DesktopTools.closeDoc(xTextDoc); + } + + /** + * Creates writer document + */ + @Override + protected void initialize(TestParameters Param, PrintWriter log) throws Exception { + SOfficeFactory SOF = SOfficeFactory.getFactory( + Param.getMSF()); + xTextDoc = SOF.createTextDoc(null); + } +}
\ No newline at end of file diff --git a/qadevOOo/tests/java/mod/_toolkit/AccessibleMenu.java b/qadevOOo/tests/java/mod/_toolkit/AccessibleMenu.java new file mode 100644 index 000000000..b050f6108 --- /dev/null +++ b/qadevOOo/tests/java/mod/_toolkit/AccessibleMenu.java @@ -0,0 +1,158 @@ +/* + * 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._toolkit; + +import com.sun.star.accessibility.AccessibleRole; +import com.sun.star.accessibility.XAccessible; +import com.sun.star.accessibility.XAccessibleAction; +import com.sun.star.accessibility.XAccessibleContext; +import com.sun.star.accessibility.XAccessibleText; +import com.sun.star.awt.XWindow; +import com.sun.star.frame.XModel; +import com.sun.star.lang.XMultiServiceFactory; +import com.sun.star.text.XTextDocument; +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.AccessibilityTools; +import util.SOfficeFactory; +import util.utils; + + +/** + * Test for object which is represented accessible component of + * main menu of a document. <p> + * + * Object implements the following interfaces : + * <ul> + * <li> <code>::com::sun::star::accessibility::XAccessibleEventBroadcaster</code></li> + * <li> <code>::com::sun::star::accessibility::XAccessibleAction</code></li> + * <li> <code>::com::sun::star::accessibility::XAccessibleSelection</code></li> + * <li> <code>::com::sun::star::accessibility::XAccessibleValue</code></li> + * <li> <code>::com::sun::star::accessibility::XAccessibleExtendedComponent</code></li> + * <li> <code>::com::sun::star::accessibility::XAccessibleComponent</code></li> + * <li> <code>::com::sun::star::accessibility::XAccessibleText</code></li> + * <li> <code>::com::sun::star::accessibility::XAccessibleContext</code></li> + * </ul> <p> + * + * @see com.sun.star.accessibility.XAccessibleEventBroadcaster + * @see com.sun.star.accessibility.XAccessibleAction + * @see com.sun.star.accessibility.XAccessibleSelection + * @see com.sun.star.accessibility.XAccessibleValue + * @see com.sun.star.accessibility.XAccessibleExtendedComponent + * @see com.sun.star.accessibility.XAccessibleComponent + * @see com.sun.star.accessibility.XAccessibleText + * @see com.sun.star.accessibility.XAccessibleContext + * @see ifc.accessibility._XAccessibleEventBroadcaster + * @see ifc.accessibility._XAccessibleAction + * @see ifc.accessibility._XAccessibleSelection + * @see ifc.accessibility._XAccessibleValue + * @see ifc.accessibility._XAccessibleExtendedComponent + * @see ifc.accessibility._XAccessibleComponent + * @see ifc.accessibility._XAccessibleText + * @see ifc.accessibility._XAccessibleContext + */ +public class AccessibleMenu extends TestCase { + private static XTextDocument xTextDoc = null; + /** + * Finds accessible component with role <code>MENU</code> + * walking through the accessible component tree of a document. + */ + @Override + protected TestEnvironment createTestEnvironment(final TestParameters Param, + PrintWriter log) throws Exception { + XMultiServiceFactory msf = Param.getMSF(); + + SOfficeFactory SOF = SOfficeFactory.getFactory(msf); + xTextDoc = SOF.createTextDoc(null); + + util.utils.waitForEventIdle(Param.getMSF()); + + XWindow xWindow = UnoRuntime.queryInterface(XModel.class, xTextDoc). + getCurrentController().getFrame().getContainerWindow(); + + XAccessible xRoot = AccessibilityTools.getAccessibleObject(xWindow); + + AccessibilityTools.printAccessibleTree(log, xRoot, Param.getBool(util.PropertyName.DEBUG_IS_ACTIVE)); + XAccessibleContext menubar = AccessibilityTools.getAccessibleObjectForRole(xRoot, + AccessibleRole.MENU_BAR); + XInterface oObj = null; + Object menu2 = null; + + try { + oObj = menubar.getAccessibleChild(2); + menu2 = menubar.getAccessibleChild(1); + } catch (com.sun.star.lang.IndexOutOfBoundsException e) { + } + + log.println("ImplementationName " + utils.getImplName(oObj)); + + TestEnvironment tEnv = new TestEnvironment(oObj); + + final XAccessibleAction act1 = UnoRuntime.queryInterface( + XAccessibleAction.class, oObj); + final XAccessibleAction act2 = UnoRuntime.queryInterface( + XAccessibleAction.class, menu2); + + tEnv.addObjRelation("EventProducer", + new ifc.accessibility._XAccessibleEventBroadcaster.EventProducer() { + public void fireEvent() { + try { + act2.doAccessibleAction(0); + + util.utils.waitForEventIdle(Param.getMSF()); + + act1.doAccessibleAction(0); + } catch (com.sun.star.lang.IndexOutOfBoundsException e) { + } + } + }); + + XAccessibleText text = UnoRuntime.queryInterface( + XAccessibleText.class, oObj); + + tEnv.addObjRelation("XAccessibleText.Text", text.getText()); + + tEnv.addObjRelation("EditOnly", "Can't change or select Text in Menu"); + + tEnv.addObjRelation("LimitedBounds", "yes"); + + tEnv.addObjRelation("XAccessibleSelection.OneAlwaysSelected", + Boolean.FALSE); + + tEnv.addObjRelation("XAccessibleSelection.multiSelection", + Boolean.FALSE); + + return tEnv; + } + + @Override + protected void cleanup(TestParameters Param, PrintWriter log) { + try { + util.DesktopTools.closeDoc(xTextDoc); + } catch (com.sun.star.lang.DisposedException e) { + log.println("Object already disposed"); + } + } + +}
\ No newline at end of file diff --git a/qadevOOo/tests/java/mod/_toolkit/AccessibleMenuBar.java b/qadevOOo/tests/java/mod/_toolkit/AccessibleMenuBar.java new file mode 100644 index 000000000..d50050394 --- /dev/null +++ b/qadevOOo/tests/java/mod/_toolkit/AccessibleMenuBar.java @@ -0,0 +1,126 @@ +/* + * 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._toolkit; + +import com.sun.star.accessibility.AccessibleRole; +import com.sun.star.accessibility.XAccessible; +import com.sun.star.accessibility.XAccessibleComponent; +import com.sun.star.awt.XWindow; +import com.sun.star.frame.XModel; +import com.sun.star.text.XTextDocument; +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.AccessibilityTools; +import util.SOfficeFactory; +import util.utils; + + +/** + * Test for object which is represented accessible component of + * menu bar of a document. <p> + * + * Object implements the following interfaces : + * <ul> + * <li> <code>::com::sun::star::accessibility::XAccessibleExtendedComponent</code></li> + * <li> <code>::com::sun::star::accessibility::XAccessibleEventBroadcaster</code></li> + * <li> <code>::com::sun::star::accessibility::XAccessibleComponent</code></li> + * <li> <code>::com::sun::star::accessibility::XAccessibleSelection</code></li> + * <li> <code>::com::sun::star::accessibility::XAccessibleContext</code></li> + * </ul> <p> + * + * @see com.sun.star.accessibility.XAccessibleExtendedComponent + * @see com.sun.star.accessibility.XAccessibleEventBroadcaster + * @see com.sun.star.accessibility.XAccessibleComponent + * @see com.sun.star.accessibility.XAccessibleSelection + * @see com.sun.star.accessibility.XAccessibleContext + * @see ifc.accessibility._XAccessibleExtendedComponent + * @see ifc.accessibility._XAccessibleEventBroadcaster + * @see ifc.accessibility._XAccessibleComponent + * @see ifc.accessibility._XAccessibleSelection + * @see ifc.accessibility._XAccessibleContext + */ +public class AccessibleMenuBar extends TestCase { + private static XTextDocument xTextDoc = null; + /** + * Finds accessible component with role <code>MENUBAR</code> + * walking through the accessible component tree of a document. + */ + @Override + protected TestEnvironment createTestEnvironment(TestParameters Param, + PrintWriter log) { + util.utils.waitForEventIdle(Param.getMSF()); + + XWindow xWindow = UnoRuntime.queryInterface(XModel.class, xTextDoc). + getCurrentController().getFrame().getContainerWindow(); + + XAccessible xRoot = AccessibilityTools.getAccessibleObject(xWindow); + + + AccessibilityTools.printAccessibleTree(log, xRoot, Param.getBool(util.PropertyName.DEBUG_IS_ACTIVE)); + XInterface oObj = AccessibilityTools.getAccessibleObjectForRole(xRoot, AccessibleRole.MENU_BAR); + + log.println("ImplementationName " + utils.getImplName(oObj)); + + TestEnvironment tEnv = new TestEnvironment(oObj); + + final XAccessibleComponent acomp = UnoRuntime.queryInterface( + XAccessibleComponent.class, + oObj); + + tEnv.addObjRelation("EventProducer", + new ifc.accessibility._XAccessibleEventBroadcaster.EventProducer() { + public void fireEvent() { + System.out.println("Grabbing focus ... "); + acomp.grabFocus(); + } + }); + + tEnv.addObjRelation("XAccessibleSelection.OneAlwaysSelected", + Boolean.FALSE); + + tEnv.addObjRelation("XAccessibleSelection.multiSelection", + Boolean.FALSE); + + return tEnv; + } + + /** + * Creates writer document. + */ + @Override + protected void initialize(TestParameters Param, PrintWriter log) throws Exception { + SOfficeFactory SOF = SOfficeFactory.getFactory( + Param.getMSF()); + xTextDoc = SOF.createTextDoc(null); + } + + /** + * Disposes document. + */ + @Override + protected void cleanup(TestParameters Param, PrintWriter log) { + util.DesktopTools.closeDoc(xTextDoc); + } +}
\ No newline at end of file diff --git a/qadevOOo/tests/java/mod/_toolkit/AccessibleMenuItem.java b/qadevOOo/tests/java/mod/_toolkit/AccessibleMenuItem.java new file mode 100644 index 000000000..0e9fa36ea --- /dev/null +++ b/qadevOOo/tests/java/mod/_toolkit/AccessibleMenuItem.java @@ -0,0 +1,165 @@ +/* + * 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._toolkit; + +import com.sun.star.accessibility.AccessibleRole; +import com.sun.star.accessibility.XAccessible; +import com.sun.star.accessibility.XAccessibleAction; +import com.sun.star.accessibility.XAccessibleContext; +import com.sun.star.accessibility.XAccessibleText; +import com.sun.star.awt.XExtendedToolkit; +import com.sun.star.awt.XWindow; +import com.sun.star.lang.XMultiServiceFactory; +import com.sun.star.text.XTextDocument; +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.AccessibilityTools; +import util.SOfficeFactory; +import util.utils; + + +/** + * Test for object which is represented by accessible component + * of a menu item in main menu of a document. <p> + * + * Object implements the following interfaces : + * <ul> + * <li> <code>::com::sun::star::accessibility::XAccessibleExtendedComponent</code></li> + * <li> <code>::com::sun::star::accessibility::XAccessibleEventBroadcaster</code></li> + * <li> <code>::com::sun::star::accessibility::XAccessibleComponent</code></li> + * <li> <code>::com::sun::star::accessibility::XAccessibleValue</code></li> + * <li> <code>::com::sun::star::accessibility::XAccessibleAction</code></li> + * <li> <code>::com::sun::star::accessibility::XAccessibleContext</code></li> + * <li> <code>::com::sun::star::accessibility::XAccessibleText</code></li> + * </ul> <p> + * + * @see com.sun.star.accessibility.XAccessibleExtendedComponent + * @see com.sun.star.accessibility.XAccessibleEventBroadcaster + * @see com.sun.star.accessibility.XAccessibleComponent + * @see com.sun.star.accessibility.XAccessibleValue + * @see com.sun.star.accessibility.XAccessibleAction + * @see com.sun.star.accessibility.XAccessibleContext + * @see com.sun.star.accessibility.XAccessibleText + * @see ifc.accessibility._XAccessibleExtendedComponent + * @see ifc.accessibility._XAccessibleEventBroadcaster + * @see ifc.accessibility._XAccessibleComponent + * @see ifc.accessibility._XAccessibleValue + * @see ifc.accessibility._XAccessibleAction + * @see ifc.accessibility._XAccessibleContext + * @see ifc.accessibility._XAccessibleText + */ +public class AccessibleMenuItem extends TestCase { + private static XTextDocument xTextDoc = null; + private static XMultiServiceFactory msf = null; + + /** + * Finds first accessible component with role <code>MENUITEM</code> + * walking through the accessible component tree of a document. + */ + @Override + protected TestEnvironment createTestEnvironment(TestParameters Param, + PrintWriter log) throws Exception { + XInterface oObj = (XInterface) msf.createInstance("com.sun.star.awt.Toolkit"); + + XExtendedToolkit tk = UnoRuntime.queryInterface( + XExtendedToolkit.class, oObj); + + util.utils.waitForEventIdle(Param.getMSF()); + + Object atw = tk.getActiveTopWindow(); + + XWindow xWindow = UnoRuntime.queryInterface(XWindow.class, + atw); + + XAccessible xRoot = AccessibilityTools.getAccessibleObject(xWindow); + + AccessibilityTools.printAccessibleTree(log, xRoot, Param.getBool(util.PropertyName.DEBUG_IS_ACTIVE)); + XAccessibleContext MenuBar = AccessibilityTools.getAccessibleObjectForRole(xRoot, + AccessibleRole.MENU_BAR); + + try { + //activate Edit-Menu + XAccessible Menu = MenuBar.getAccessibleChild(1); + XAccessibleAction act = UnoRuntime.queryInterface( + XAccessibleAction.class, Menu); + act.doAccessibleAction(0); + util.utils.waitForEventIdle(Param.getMSF()); + + //get a menu-item + oObj = Menu.getAccessibleContext().getAccessibleChild(11); + } catch (com.sun.star.lang.IndexOutOfBoundsException e) { + } + + + log.println("ImplementationName " + utils.getImplName(oObj)); + + TestEnvironment tEnv = new TestEnvironment(oObj); + + final XAccessibleAction action = UnoRuntime.queryInterface( + XAccessibleAction.class, oObj); + + tEnv.addObjRelation("EventProducer", + new ifc.accessibility._XAccessibleEventBroadcaster.EventProducer() { + public void fireEvent() { + try { + action.doAccessibleAction(0); + } catch (com.sun.star.lang.IndexOutOfBoundsException e) { + } + } + }); + + XAccessibleText text = UnoRuntime.queryInterface( + XAccessibleText.class, oObj); + + tEnv.addObjRelation("XAccessibleText.Text", text.getText()); + + tEnv.addObjRelation("EditOnly", + "Can't change or select Text in MenuBarItem"); + + tEnv.addObjRelation("Destroy", Boolean.TRUE); + + tEnv.addObjRelation("LimitedBounds", "yes"); + + return tEnv; + } + + /** + * Creates writer document. + */ + @Override + protected void initialize(TestParameters Param, PrintWriter log) throws Exception { + msf = Param.getMSF(); + + SOfficeFactory SOF = SOfficeFactory.getFactory(msf); + xTextDoc = SOF.createTextDoc(null); + } + + /** + * Disposes document. + */ + @Override + protected void cleanup(TestParameters Param, PrintWriter log) { + util.DesktopTools.closeDoc(xTextDoc); + } +}
\ No newline at end of file diff --git a/qadevOOo/tests/java/mod/_toolkit/AccessibleMenuSeparator.java b/qadevOOo/tests/java/mod/_toolkit/AccessibleMenuSeparator.java new file mode 100644 index 000000000..48e14436f --- /dev/null +++ b/qadevOOo/tests/java/mod/_toolkit/AccessibleMenuSeparator.java @@ -0,0 +1,141 @@ +/* + * 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._toolkit; + +import com.sun.star.accessibility.AccessibleRole; +import com.sun.star.accessibility.XAccessible; +import com.sun.star.accessibility.XAccessibleAction; +import com.sun.star.accessibility.XAccessibleContext; +import com.sun.star.awt.XWindow; +import com.sun.star.frame.XModel; +import com.sun.star.lang.XMultiServiceFactory; +import com.sun.star.text.XTextDocument; +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.AccessibilityTools; +import util.SOfficeFactory; +import util.utils; + + +/** + * Test for object which is represented by accessible component + * of a menu separator in main menu of a document. <p> + * + * Object implements the following interfaces : + * <ul> + * <li> <code>::com::sun::star::accessibility::XAccessibleExtendedComponent</code></li> + * <li> <code>::com::sun::star::accessibility::XAccessibleEventBroadcaster</code></li> + * <li> <code>::com::sun::star::accessibility::XAccessibleComponent</code></li> + * <li> <code>::com::sun::star::accessibility::XAccessibleContext</code></li> + * </ul> <p> + * + * @see com.sun.star.accessibility.XAccessibleExtendedComponent + * @see com.sun.star.accessibility.XAccessibleEventBroadcaster + * @see com.sun.star.accessibility.XAccessibleComponent + * @see com.sun.star.accessibility.XAccessibleContext + * @see ifc.accessibility._XAccessibleExtendedComponent + * @see ifc.accessibility._XAccessibleEventBroadcaster + * @see ifc.accessibility._XAccessibleComponent + * @see ifc.accessibility._XAccessibleContext + */ +public class AccessibleMenuSeparator extends TestCase { + private static XTextDocument xTextDoc = null; + private static XMultiServiceFactory msf = null; + + /** + * Finds first accessible component with role <code>SEPARATOR</code> + * and implementation name <code>AccessibleMenuSeparator</code> + * walking through the accessible component tree of a document. + */ + @Override + protected TestEnvironment createTestEnvironment(TestParameters Param, + PrintWriter log) { + util.utils.waitForEventIdle(Param.getMSF()); + + XWindow xWindow = UnoRuntime.queryInterface(XModel.class, xTextDoc). + getCurrentController().getFrame().getContainerWindow(); + + XAccessible xRoot = AccessibilityTools.getAccessibleObject(xWindow); + + AccessibilityTools.printAccessibleTree(log, xRoot, Param.getBool(util.PropertyName.DEBUG_IS_ACTIVE)); + XAccessibleContext MenuBar = AccessibilityTools.getAccessibleObjectForRole(xRoot, + AccessibleRole.MENU_BAR); + XAccessibleAction act = null; + XInterface oObj = null; + + try { + //activate Edit-Menu + XAccessible Menu = MenuBar.getAccessibleChild(1); + act = UnoRuntime.queryInterface( + XAccessibleAction.class, Menu); + act.doAccessibleAction(0); + + util.utils.waitForEventIdle(Param.getMSF()); + + //get a menu-separator + oObj = Menu.getAccessibleContext().getAccessibleChild(3); + } catch (com.sun.star.lang.IndexOutOfBoundsException e) { + e.printStackTrace(log); + } + + log.println("ImplementationName " + utils.getImplName(oObj)); + + TestEnvironment tEnv = new TestEnvironment(oObj); + + final XAccessibleAction aAct = act; + + tEnv.addObjRelation("EventProducer", + new ifc.accessibility._XAccessibleEventBroadcaster.EventProducer() { + public void fireEvent() { + try { + aAct.doAccessibleAction(0); + } catch (com.sun.star.lang.IndexOutOfBoundsException e) { + e.printStackTrace(); + } + } + }); + + return tEnv; + } + + /** + * Creates writer document. + */ + @Override + protected void initialize(TestParameters Param, PrintWriter log) throws Exception { + msf = Param.getMSF(); + + SOfficeFactory SOF = SOfficeFactory.getFactory(msf); + xTextDoc = SOF.createTextDoc(null); + } + + /** + * Disposes document. + */ + @Override + protected void cleanup(TestParameters Param, PrintWriter log) { + util.DesktopTools.closeDoc(xTextDoc); + } +}
\ No newline at end of file diff --git a/qadevOOo/tests/java/mod/_toolkit/AccessiblePopupMenu.java b/qadevOOo/tests/java/mod/_toolkit/AccessiblePopupMenu.java new file mode 100644 index 000000000..ed60cb7dc --- /dev/null +++ b/qadevOOo/tests/java/mod/_toolkit/AccessiblePopupMenu.java @@ -0,0 +1,191 @@ +/* + * 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._toolkit; + +import com.sun.star.accessibility.AccessibleRole; +import com.sun.star.accessibility.XAccessible; +import com.sun.star.accessibility.XAccessibleComponent; +import com.sun.star.accessibility.XAccessibleSelection; +import com.sun.star.awt.Point; +import com.sun.star.awt.Rectangle; +import com.sun.star.awt.XExtendedToolkit; +import com.sun.star.awt.XWindow; +import com.sun.star.frame.XModel; +import com.sun.star.text.XTextDocument; +import com.sun.star.uno.UnoRuntime; +import com.sun.star.uno.XInterface; + +import java.awt.Robot; +import java.awt.event.InputEvent; +import java.io.PrintWriter; + +import lib.TestCase; +import lib.TestEnvironment; +import lib.TestParameters; +import util.AccessibilityTools; +import util.SOfficeFactory; + +public class AccessiblePopupMenu extends TestCase { + private static XTextDocument xTextDoc; + private static Point point; + + /** + * Disposes the document, if exists, created in + * <code>createTestEnvironment</code> method. + */ + @Override + protected void cleanup(TestParameters Param, PrintWriter log) { + + log.println("release the popup menu"); + try { + Robot rob = new Robot(); + int x = point.X; + int y = point.Y; + rob.mouseMove(x, y); + rob.mousePress(InputEvent.BUTTON1_MASK); + rob.mouseRelease(InputEvent.BUTTON1_MASK); + } catch (java.awt.AWTException e) { + log.println("couldn't press mouse button"); + } + + log.println("disposing xTextDoc"); + + if (xTextDoc != null) { + closeDoc(); + } + } + + /** + * Creates a text document. Then obtains an accessible object with the role + * <code>AccessibleRole.PUSHBUTTON</code> and with the name + * <code>"Bold"</code>. Object relations created : + * <ul> + * <li> <code>'EventProducer'</code> for + * {@link ifc.accessibility._XAccessibleEventBroadcaster}</li> + * <li> <code>'XAccessibleText.Text'</code> for + * {@link ifc.accessibility._XAccessibleText}: the name of button</li> + * </ul> + * + * @param tParam + * test parameters + * @param log + * writer to log information while testing + * + * @see com.sun.star.awt.Toolkit + * @see com.sun.star.accessibility.AccessibleRole + * @see ifc.accessibility._XAccessibleEventBroadcaster + * @see ifc.accessibility._XAccessibleText + * @see com.sun.star.accessibility.XAccessibleEventBroadcaster + * @see com.sun.star.accessibility.XAccessibleText + */ + @Override + protected TestEnvironment createTestEnvironment(TestParameters tParam, + PrintWriter log) throws Exception{ + log.println("creating a test environment"); + + if (xTextDoc != null) { + closeDoc(); + } + + // get a soffice factory object + SOfficeFactory SOF = SOfficeFactory.getFactory(tParam.getMSF()); + + XInterface toolkit = null; + + log.println("creating a text document"); + xTextDoc = SOF.createTextDoc(null); + toolkit = (XInterface) tParam.getMSF().createInstance( + "com.sun.star.awt.Toolkit"); + + XModel aModel = UnoRuntime.queryInterface(XModel.class, xTextDoc); + + XInterface oObj = null; + + XWindow xWindow = AccessibilityTools.getCurrentWindow(aModel); + + XAccessible xRoot = AccessibilityTools.getAccessibleObject(xWindow); + + oObj = AccessibilityTools.getAccessibleObjectForRole(xRoot, + AccessibleRole.PANEL); + + XAccessibleComponent window = UnoRuntime.queryInterface( + XAccessibleComponent.class, oObj); + + point = window.getLocationOnScreen(); + Rectangle rect = window.getBounds(); + + try { + Robot rob = new Robot(); + int x = point.X + (rect.Width / 2); + int y = point.Y + (rect.Height / 2); + rob.mouseMove(x, y); + rob.mousePress(InputEvent.BUTTON3_MASK); + rob.mouseRelease(InputEvent.BUTTON3_MASK); + } catch (java.awt.AWTException e) { + log.println("couldn't press mouse button"); + } + + util.utils.shortWait(); + + XExtendedToolkit tk = UnoRuntime.queryInterface(XExtendedToolkit.class, + toolkit); + + try { + xWindow = UnoRuntime.queryInterface(XWindow.class, + tk.getTopWindow(0)); + + xRoot = AccessibilityTools.getAccessibleObject(xWindow); + + AccessibilityTools.printAccessibleTree(log, xRoot, + tParam.getBool(util.PropertyName.DEBUG_IS_ACTIVE)); + } catch (com.sun.star.lang.IndexOutOfBoundsException e) { + log.println("Couldn't get Window"); + } + + oObj = AccessibilityTools.getAccessibleObjectForRole(xRoot, + AccessibleRole.POPUP_MENU); + + log.println("ImplementationName: " + util.utils.getImplName(oObj)); + + TestEnvironment tEnv = new TestEnvironment(oObj); + + tEnv.addObjRelation("XAccessibleSelection.multiSelection", + Boolean.FALSE); + + final XAccessibleSelection sel = UnoRuntime.queryInterface( + XAccessibleSelection.class, oObj); + + tEnv.addObjRelation( + "EventProducer", + new ifc.accessibility._XAccessibleEventBroadcaster.EventProducer() { + public void fireEvent() { + try { + sel.selectAccessibleChild(2); + } catch (com.sun.star.lang.IndexOutOfBoundsException e) { + System.out.println("Couldn't fire event"); + } + } + }); + + return tEnv; + } + + protected void closeDoc() { + util.DesktopTools.closeDoc(xTextDoc); + } +} diff --git a/qadevOOo/tests/java/mod/_toolkit/AccessibleRadioButton.java b/qadevOOo/tests/java/mod/_toolkit/AccessibleRadioButton.java new file mode 100644 index 000000000..29cdbc71e --- /dev/null +++ b/qadevOOo/tests/java/mod/_toolkit/AccessibleRadioButton.java @@ -0,0 +1,266 @@ +/* + * 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._toolkit; + +import com.sun.star.accessibility.AccessibleRole; +import com.sun.star.accessibility.XAccessible; +import com.sun.star.accessibility.XAccessibleAction; +import com.sun.star.accessibility.XAccessibleComponent; +import com.sun.star.accessibility.XAccessibleContext; +import com.sun.star.accessibility.XAccessibleSelection; +import com.sun.star.accessibility.XAccessibleValue; +import com.sun.star.awt.XExtendedToolkit; +import com.sun.star.awt.XWindow; +import com.sun.star.beans.PropertyValue; +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.text.XTextDocument; +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 java.io.PrintWriter; + +import lib.TestCase; +import lib.TestEnvironment; +import lib.TestParameters; +import util.AccessibilityTools; +import util.SOfficeFactory; + + +/** + * Test for object that implements the following interfaces : + * <ul> + * <li><code> + * ::com::sun::star::accessibility::XAccessibleContext</code></li> + * <li><code> + * ::com::sun::star::accessibility::XAccessibleEventBroadcaster + * </code></li> + * <li><code> + * ::com::sun::star::accessibility::XAccessibleComponent</code></li> + * <li><code> + * ::com::sun::star::accessibility::XAccessibleExtendedComponent + * </code></li> + * <li><code> + * ::com::sun::star::accessibility::XAccessibleValue</code></li> + * <li><code> + * ::com::sun::star::accessibility::XAccessibleText</code></li> + * </ul> <p> + * + * @see com.sun.star.accessibility.XAccessibleEventBroadcaster + * @see com.sun.star.accessibility.XAccessibleContext + * @see com.sun.star.accessibility.XAccessibleComponent + * @see com.sun.star.accessibility.XAccessibleExtendedComponent + * @see com.sun.star.accessibility.XAccessibleValue + * @see com.sun.star.accessibility.XAccessibleText + * @see ifc.accessibility._XAccessibleEventBroadcaster + * @see ifc.accessibility._XAccessibleContext + * @see ifc.accessibility._XAccessibleComponent + * @see ifc.accessibility._XAccessibleExtendedComponent + * @see ifc.accessibility._XAccessibleValue + * @see ifc.accessibility._XAccessibleText + */ +public class AccessibleRadioButton extends TestCase { + private static XTextDocument xTextDoc; + private static XAccessibleAction accCloseButton; + + /** + * Closes a hyperlink dialog, disposes the document, if exists, created in + * <code>createTestEnvironment</code> method. + */ + @Override + protected void cleanup(TestParameters Param, PrintWriter log) { + try { + if (accCloseButton != null) { + log.println("closing HyperlinkDialog"); + accCloseButton.doAccessibleAction(0); + } + } catch (com.sun.star.lang.IndexOutOfBoundsException e) { + e.printStackTrace(log); + } catch (com.sun.star.lang.DisposedException de) { + log.println("Already disposed"); + } + + log.println("disposing xTextDoc"); + + if (xTextDoc != null) { + closeDoc(); + } + } + + /** + * Creates a text document, opens a hyperlink dialog, selects a first item + * in IconChoiceCtrl. + * Then obtains an accessible object with + * the role <code>AccessibleRole.RADIOBUTTON</code> with the name <code> + * "Internet"</code>. + * Object relations created : + * <ul> + * <li> <code>'EventProducer'</code> for + * {@link ifc.accessibility._XAccessibleEventBroadcaster}: + * grabs focus </li> + * <li> <code>'XAccessibleText.Text'</code> for + * {@link ifc.accessibility._XAccessibleText}: + * the text of the component </li> + * <li> <code>'XAccessibleValue.anotherFromGroup'</code> for + * {@link ifc.accessibility._XAccessibleValue}: + * <code>'FTP'</code> button </li> + * </ul> + * + * @param tParam test parameters + * @param log writer to log information while testing + * + * @see com.sun.star.awt.Toolkit + * @see com.sun.star.accessibility.AccessibleRole + * @see ifc.accessibility._XAccessibleEventBroadcaster + * @see ifc.accessibility._XAccessibleText + * @see com.sun.star.accessibility.XAccessibleEventBroadcaster + * @see com.sun.star.accessibility.XAccessibleText + */ + @Override + protected TestEnvironment createTestEnvironment(TestParameters tParam, + PrintWriter log) throws Exception { + log.println("creating a test environment"); + + // get a soffice factory object + SOfficeFactory SOF = SOfficeFactory.getFactory( + tParam.getMSF()); + + log.println("creating a text document"); + xTextDoc = SOF.createTextDoc(null); + + util.utils.waitForEventIdle(tParam.getMSF()); + + XModel aModel1 = UnoRuntime.queryInterface(XModel.class, + xTextDoc); + + XController secondController = aModel1.getCurrentController(); + + XDispatchProvider aProv = UnoRuntime.queryInterface( + XDispatchProvider.class, + secondController); + + XURLTransformer urlTransf = null; + + XInterface transf = (XInterface) tParam.getMSF().createInstance( + "com.sun.star.util.URLTransformer"); + urlTransf = UnoRuntime.queryInterface( + XURLTransformer.class, transf); + + XDispatch getting = null; + log.println("opening HyperlinkDialog"); + + URL[] url = new URL[1]; + url[0] = new URL(); + url[0].Complete = ".uno:HyperlinkDialog"; + urlTransf.parseStrict(url); + getting = aProv.queryDispatch(url[0], "", 0); + + PropertyValue[] noArgs = new PropertyValue[0]; + getting.dispatch(url[0], noArgs); + + util.utils.waitForEventIdle(tParam.getMSF()); + + XInterface oObj = (XInterface) tParam.getMSF().createInstance( + "com.sun.star.awt.Toolkit"); + + XExtendedToolkit tk = UnoRuntime.queryInterface( + XExtendedToolkit.class, oObj); + + util.utils.waitForEventIdle(tParam.getMSF()); + + XWindow xWindow = UnoRuntime.queryInterface(XWindow.class, + tk.getActiveTopWindow()); + + XAccessible xRoot = AccessibilityTools.getAccessibleObject(xWindow); + + XAccessibleContext iconChoiceCtrl = AccessibilityTools.getAccessibleObjectForRole( + xRoot, AccessibleRole.TREE, + "IconChoiceControl"); + + XAccessibleSelection sel = UnoRuntime.queryInterface( + XAccessibleSelection.class, + iconChoiceCtrl); + + try { + sel.selectAccessibleChild(0); + } catch (com.sun.star.lang.IndexOutOfBoundsException e) { + log.println("Unexpected exception"); + e.printStackTrace(log); + } + + AccessibilityTools.printAccessibleTree(log,xRoot, tParam.getBool(util.PropertyName.DEBUG_IS_ACTIVE)); + + oObj = AccessibilityTools.getAccessibleObjectForRole(xRoot, + AccessibleRole.RADIO_BUTTON, + "Web"); + + XAccessibleContext anotherButton = AccessibilityTools.getAccessibleObjectForRole(xRoot, + AccessibleRole.RADIO_BUTTON, + "FTP"); + + XAccessibleContext closeButton = AccessibilityTools.getAccessibleObjectForRole(xRoot, + AccessibleRole.PUSH_BUTTON, + "Close"); + + + accCloseButton = UnoRuntime.queryInterface( + XAccessibleAction.class, closeButton); + + log.println("ImplementationName: " + util.utils.getImplName(oObj)); + + TestEnvironment tEnv = new TestEnvironment(oObj); + + tEnv.addObjRelation("EditOnly", + "This method isn't supported in this component"); + + tEnv.addObjRelation("LimitedBounds", "yes"); + + final XAccessibleComponent acomp = UnoRuntime.queryInterface( + XAccessibleComponent.class, + oObj); + + tEnv.addObjRelation("EventProducer", + new ifc.accessibility._XAccessibleEventBroadcaster.EventProducer() { + public void fireEvent() { + acomp.grabFocus(); + } + }); + + tEnv.addObjRelation("XAccessibleText.Text", "Web"); + + tEnv.addObjRelation("EditOnly", + "Can't change or select Text in AccessibleRadioButton"); + + XAccessibleValue anotherButtonValue = UnoRuntime.queryInterface( + XAccessibleValue.class, + anotherButton); + + tEnv.addObjRelation("XAccessibleValue.anotherFromGroup", + anotherButtonValue); + + return tEnv; + } + + protected void closeDoc() { + util.DesktopTools.closeDoc(xTextDoc); + } +} diff --git a/qadevOOo/tests/java/mod/_toolkit/AccessibleScrollBar.java b/qadevOOo/tests/java/mod/_toolkit/AccessibleScrollBar.java new file mode 100644 index 000000000..e06c73423 --- /dev/null +++ b/qadevOOo/tests/java/mod/_toolkit/AccessibleScrollBar.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._toolkit; + +import com.sun.star.accessibility.AccessibleRole; +import com.sun.star.accessibility.XAccessible; +import com.sun.star.accessibility.XAccessibleAction; +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; + +import java.io.PrintWriter; + +import lib.TestCase; +import lib.TestEnvironment; +import lib.TestParameters; +import util.AccessibilityTools; +import util.SOfficeFactory; + + +/** + * Test for object that implements the following interfaces : + * <ul> + * <li><code> + * ::com::sun::star::accessibility::XAccessibleContext</code></li> + * <li><code> + * ::com::sun::star::accessibility::XAccessibleEventBroadcaster + * </code></li> + * <li><code> + * ::com::sun::star::accessibility::XAccessibleComponent</code></li> + * <li><code> + * ::com::sun::star::accessibility::XAccessibleExtendedComponent + * </code></li> + * <li><code> + * ::com::sun::star::accessibility::XAccessibleValue</code></li> + * <li><code> + * ::com::sun::star::accessibility::XAccessibleAction</code></li> + * </ul> <p> + * + * @see com.sun.star.accessibility.XAccessibleEventBroadcaster + * @see com.sun.star.accessibility.XAccessibleContext + * @see com.sun.star.accessibility.XAccessibleComponent + * @see com.sun.star.accessibility.XAccessibleExtendedComponent + * @see com.sun.star.accessibility.XAccessibleValue + * @see com.sun.star.accessibility.XAccessibleAction + * @see ifc.accessibility._XAccessibleEventBroadcaster + * @see ifc.accessibility._XAccessibleContext + * @see ifc.accessibility._XAccessibleComponent + * @see ifc.accessibility._XAccessibleExtendedComponent + * @see ifc.accessibility._XAccessibleValue + * @see ifc.accessibility._XAccessibleAction + */ +public class AccessibleScrollBar extends TestCase { + private static XComponent xDoc; + + /** + * Disposes the document, if exists, created in + * <code>createTestEnvironment</code> method. + */ + @Override + protected void cleanup(TestParameters Param, PrintWriter log) { + log.println("disposing xTextDoc"); + + if (xDoc != null) { + closeDoc(); + } + } + + /** + * Creates a text document. + * Then obtains an accessible object with + * the role <code>AccessibleRole.SCROLLBAR</code>. + * Object relations created : + * <ul> + * <li> <code>'EventProducer'</code> for + * {@link ifc.accessibility._XAccessibleEventBroadcaster}: + * grabs focus </li> + * </ul> + * + * @param tParam test parameters + * @param log writer to log information while testing + * + * @see com.sun.star.awt.Toolkit + * @see com.sun.star.accessibility.AccessibleRole + * @see ifc.accessibility._XAccessibleEventBroadcaster + * @see com.sun.star.accessibility.XAccessibleEventBroadcaster + */ + @Override + protected TestEnvironment createTestEnvironment(TestParameters tParam, + PrintWriter log) throws Exception { + log.println("creating a test environment"); + + if (xDoc != null) { + closeDoc(); + } + + // get a soffice factory object + SOfficeFactory SOF = SOfficeFactory.getFactory( + tParam.getMSF()); + + log.println("creating a text document"); + xDoc = SOF.createDrawDoc(null); + + XModel aModel = UnoRuntime.queryInterface(XModel.class, xDoc); + + XInterface oObj = null; + + XWindow xWindow = AccessibilityTools.getCurrentWindow( + aModel); + + XAccessible xRoot = AccessibilityTools.getAccessibleObject(xWindow); + + oObj = AccessibilityTools.getAccessibleObjectForRole(xRoot, AccessibleRole.SCROLL_BAR); + + final XAccessibleAction act = UnoRuntime.queryInterface( + XAccessibleAction.class, oObj); + + log.println("ImplementationName: " + util.utils.getImplName(oObj)); + + TestEnvironment tEnv = new TestEnvironment(oObj); + + tEnv.addObjRelation("EventProducer", + new ifc.accessibility._XAccessibleEventBroadcaster.EventProducer() { + public void fireEvent() { + try { + act.doAccessibleAction(1); + } catch (Exception e) { + } + } + }); + + return tEnv; + } + + protected void closeDoc() { + util.DesktopTools.closeDoc(xDoc); + } +} diff --git a/qadevOOo/tests/java/mod/_toolkit/AccessibleStatusBar.java b/qadevOOo/tests/java/mod/_toolkit/AccessibleStatusBar.java new file mode 100644 index 000000000..db248108d --- /dev/null +++ b/qadevOOo/tests/java/mod/_toolkit/AccessibleStatusBar.java @@ -0,0 +1,160 @@ +/* + * 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._toolkit; + +import com.sun.star.accessibility.AccessibleRole; +import com.sun.star.accessibility.XAccessible; +import com.sun.star.awt.PosSize; +import com.sun.star.awt.Rectangle; +import com.sun.star.awt.XExtendedToolkit; +import com.sun.star.awt.XWindow; +import com.sun.star.frame.XModel; +import com.sun.star.text.XTextDocument; +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.AccessibilityTools; +import util.SOfficeFactory; + + +/** + * Test for object that implements the following interfaces : + * <ul> + * <li><code> + * ::com::sun::star::accessibility::XAccessibleContext</code></li> + * <li><code> + * ::com::sun::star::accessibility::XAccessibleEventBroadcaster + * </code></li> + * <li><code> + * ::com::sun::star::accessibility::XAccessibleComponent</code></li> + * <li><code> + * ::com::sun::star::accessibility::XAccessibleExtendedComponent + * </code></li> + * <li><code> + * ::com::sun::star::accessibility::XAccessibleValue</code></li> + * <li><code> + * ::com::sun::star::accessibility::XAccessibleAction</code></li> + * </ul> <p> + * + * @see com.sun.star.accessibility.XAccessibleEventBroadcaster + * @see com.sun.star.accessibility.XAccessibleContext + * @see com.sun.star.accessibility.XAccessibleComponent + * @see com.sun.star.accessibility.XAccessibleExtendedComponent + * @see com.sun.star.accessibility.XAccessibleValue + * @see com.sun.star.accessibility.XAccessibleAction + * @see ifc.accessibility._XAccessibleEventBroadcaster + * @see ifc.accessibility._XAccessibleContext + * @see ifc.accessibility._XAccessibleComponent + * @see ifc.accessibility._XAccessibleExtendedComponent + * @see ifc.accessibility._XAccessibleValue + * @see ifc.accessibility._XAccessibleAction + */ +public class AccessibleStatusBar extends TestCase { + private static XTextDocument xTextDoc; + + /** + * Disposes the document, if exists, created in + * <code>createTestEnvironment</code> method. + */ + @Override + protected void cleanup(TestParameters Param, PrintWriter log) { + log.println("disposing xTextDoc"); + + if (xTextDoc != null) { + util.DesktopTools.closeDoc(xTextDoc); + } + } + + /** + * Creates a text document. + * Then obtains an accessible object with + * the role <code>AccessibleRole.SCROLLBAR</code>. + * Object relations created : + * <ul> + * <li> <code>'EventProducer'</code> for + * {@link ifc.accessibility._XAccessibleEventBroadcaster}: + * grabs focus </li> + * </ul> + * + * @param tParam test parameters + * @param log writer to log information while testing + * + * @see com.sun.star.awt.Toolkit + * @see com.sun.star.accessibility.AccessibleRole + * @see ifc.accessibility._XAccessibleEventBroadcaster + * @see com.sun.star.accessibility.XAccessibleEventBroadcaster + */ + @Override + protected TestEnvironment createTestEnvironment(TestParameters tParam, + PrintWriter log) throws Exception { + log.println("creating a test environment"); + + if (xTextDoc != null) { + util.DesktopTools.closeDoc(xTextDoc); + } + + // get a soffice factory object + SOfficeFactory SOF = SOfficeFactory.getFactory( + tParam.getMSF()); + + XInterface toolkit = null; + + log.println("creating a text document"); + xTextDoc = SOF.createTextDoc(null); + toolkit = (XInterface) tParam.getMSF().createInstance( + "com.sun.star.awt.Toolkit"); + + XInterface oObj = null; + + final XWindow xWindow = + UnoRuntime.queryInterface(XModel.class, xTextDoc). + getCurrentController().getFrame().getContainerWindow(); + + XAccessible xRoot = AccessibilityTools.getAccessibleObject(xWindow); + + oObj = AccessibilityTools.getAccessibleObjectForRole(xRoot, AccessibleRole.STATUS_BAR); + + log.println("ImplementationName: " + util.utils.getImplName(oObj)); + + TestEnvironment tEnv = new TestEnvironment(oObj); + + UnoRuntime.queryInterface( + XExtendedToolkit.class, toolkit); + + tEnv.addObjRelation("EventProducer", + new ifc.accessibility._XAccessibleEventBroadcaster.EventProducer() { + public void fireEvent() { + Rectangle newPosSize = xWindow.getPosSize(); + newPosSize.Width = newPosSize.Width - 20; + newPosSize.Height = newPosSize.Height - 20; + newPosSize.X = newPosSize.X + 20; + newPosSize.Y = newPosSize.Y + 20; + xWindow.setPosSize( + newPosSize.X, newPosSize.Y, newPosSize.Width, + newPosSize.Height, PosSize.POSSIZE); + } + }); + + return tEnv; + } +}
\ No newline at end of file diff --git a/qadevOOo/tests/java/mod/_toolkit/AccessibleStatusBarItem.java b/qadevOOo/tests/java/mod/_toolkit/AccessibleStatusBarItem.java new file mode 100644 index 000000000..aa10a8b00 --- /dev/null +++ b/qadevOOo/tests/java/mod/_toolkit/AccessibleStatusBarItem.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._toolkit; + +import com.sun.star.accessibility.AccessibleRole; +import com.sun.star.accessibility.XAccessible; +import com.sun.star.accessibility.XAccessibleContext; +import com.sun.star.awt.XWindow; +import com.sun.star.frame.XModel; +import com.sun.star.text.XTextDocument; +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.AccessibilityTools; +import util.SOfficeFactory; + + +/** + * Test for object that implements the following interfaces : + * <ul> + * <li><code> + * ::com::sun::star::accessibility::XAccessibleContext</code></li> + * <li><code> + * ::com::sun::star::accessibility::XAccessibleEventBroadcaster + * </code></li> + * <li><code> + * ::com::sun::star::accessibility::XAccessibleComponent</code></li> + * <li><code> + * ::com::sun::star::accessibility::XAccessibleExtendedComponent + * </code></li> + * <li><code> + * ::com::sun::star::accessibility::XAccessibleValue</code></li> + * <li><code> + * ::com::sun::star::accessibility::XAccessibleAction</code></li> + * </ul> <p> + * + * @see com.sun.star.accessibility.XAccessibleEventBroadcaster + * @see com.sun.star.accessibility.XAccessibleContext + * @see com.sun.star.accessibility.XAccessibleComponent + * @see com.sun.star.accessibility.XAccessibleExtendedComponent + * @see com.sun.star.accessibility.XAccessibleValue + * @see com.sun.star.accessibility.XAccessibleAction + * @see ifc.accessibility._XAccessibleEventBroadcaster + * @see ifc.accessibility._XAccessibleContext + * @see ifc.accessibility._XAccessibleComponent + * @see ifc.accessibility._XAccessibleExtendedComponent + * @see ifc.accessibility._XAccessibleValue + * @see ifc.accessibility._XAccessibleAction + */ +public class AccessibleStatusBarItem extends TestCase { + private static XTextDocument xTextDoc; + + /** + * Disposes the document, if exists, created in + * <code>createTestEnvironment</code> method. + */ + @Override + protected void cleanup(TestParameters Param, PrintWriter log) { + log.println("disposing xTextDoc"); + + if (xTextDoc != null) { + util.DesktopTools.closeDoc(xTextDoc); + } + } + + /** + * Creates a text document. + * Then obtains an accessible object with + * the role <code>AccessibleRole.SCROLLBAR</code>. + * Object relations created : + * <ul> + * <li> <code>'EventProducer'</code> for + * {@link ifc.accessibility._XAccessibleEventBroadcaster}: + * grabs focus </li> + * </ul> + * + * @param tParam test parameters + * @param log writer to log information while testing + * + * @see com.sun.star.awt.Toolkit + * @see com.sun.star.accessibility.AccessibleRole + * @see ifc.accessibility._XAccessibleEventBroadcaster + * @see com.sun.star.accessibility.XAccessibleEventBroadcaster + */ + @Override + protected TestEnvironment createTestEnvironment(TestParameters tParam, + PrintWriter log) throws Exception { + log.println("creating a test environment"); + + if (xTextDoc != null) { + util.DesktopTools.closeDoc(xTextDoc); + } + + // get a soffice factory object + SOfficeFactory SOF = SOfficeFactory.getFactory( + tParam.getMSF()); + + log.println("creating a text document"); + xTextDoc = SOF.createTextDoc(null); + + XModel aModel = UnoRuntime.queryInterface(XModel.class, + xTextDoc); + + XInterface oObj = null; + XInterface secondItem = null; + + XWindow xWindow = AccessibilityTools.getCurrentContainerWindow( + aModel); + + XAccessible xRoot = AccessibilityTools.getAccessibleObject(xWindow); + + AccessibilityTools.printAccessibleTree(log, xRoot, tParam.getBool(util.PropertyName.DEBUG_IS_ACTIVE)); + XAccessibleContext statusbar = AccessibilityTools.getAccessibleObjectForRole(xRoot, + AccessibleRole.STATUS_BAR); + + try { + oObj = statusbar.getAccessibleChild(6); + secondItem = statusbar.getAccessibleChild(1); + } catch (com.sun.star.lang.IndexOutOfBoundsException e) { + } + + log.println("ImplementationName: " + util.utils.getImplName(oObj)); + + TestEnvironment tEnv = new TestEnvironment(oObj); + + tEnv.addObjRelation("EditOnly", + "Can't change or select Text in StatusBarItem"); + tEnv.addObjRelation("XAccessibleText", secondItem); + + tEnv.addObjRelation("LimitedBounds", "yes"); + + final XTextDocument doc = xTextDoc; + + tEnv.addObjRelation("EventProducer", + new ifc.accessibility._XAccessibleEventBroadcaster.EventProducer() { + public void fireEvent() { + doc.getText().setString("AccessibleStatusBarItem"); + } + }); + + return tEnv; + } +}
\ No newline at end of file diff --git a/qadevOOo/tests/java/mod/_toolkit/AccessibleTabControl.java b/qadevOOo/tests/java/mod/_toolkit/AccessibleTabControl.java new file mode 100644 index 000000000..f73b34894 --- /dev/null +++ b/qadevOOo/tests/java/mod/_toolkit/AccessibleTabControl.java @@ -0,0 +1,225 @@ +/* + * 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._toolkit; + +import com.sun.star.accessibility.AccessibleRole; +import com.sun.star.accessibility.XAccessible; +import com.sun.star.accessibility.XAccessibleAction; +import com.sun.star.accessibility.XAccessibleContext; +import com.sun.star.accessibility.XAccessibleSelection; +import com.sun.star.awt.XExtendedToolkit; +import com.sun.star.awt.XWindow; +import com.sun.star.beans.PropertyValue; +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.text.XTextDocument; +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 java.io.PrintWriter; + +import lib.TestCase; +import lib.TestEnvironment; +import lib.TestParameters; +import util.AccessibilityTools; +import util.SOfficeFactory; + + +/** + * Test for object that implements the following interfaces : + * <ul> + * <li><code> + * ::com::sun::star::accessibility::XAccessibleContext</code></li> + * <li><code> + * ::com::sun::star::accessibility::XAccessibleEventBroadcaster + * </code></li> + * <li><code> + * ::com::sun::star::accessibility::XAccessibleComponent</code></li> + * <li><code> + * ::com::sun::star::accessibility::XAccessibleExtendedComponent + * </code></li> + * <li><code> + * ::com::sun::star::accessibility::XAccessibleSelection + * </code></li> + * </ul> <p> + * + * @see com.sun.star.accessibility.XAccessibleEventBroadcaster + * @see com.sun.star.accessibility.XAccessibleContext + * @see com.sun.star.accessibility.XAccessibleComponent + * @see com.sun.star.accessibility.XAccessibleExtendedComponent + * @see com.sun.star.accessibility.XAccessibleSelection + * @see ifc.accessibility._XAccessibleEventBroadcaster + * @see ifc.accessibility._XAccessibleContext + * @see ifc.accessibility._XAccessibleComponent + * @see ifc.accessibility._XAccessibleExtendedComponent + * @see ifc.accessibility._XAccessibleSelection + */ +public class AccessibleTabControl extends TestCase { + private static XTextDocument xTextDoc; + private static XAccessibleAction accCloseButton = null; + + /** + * Closes an InsertFields dialog, disposes the document, if exists, created in + * <code>createTestEnvironment</code> method. + */ + @Override + protected void cleanup(TestParameters Param, PrintWriter log) { + try { + if (accCloseButton != null) { + log.println("closing InsertFields Dialog"); + accCloseButton.doAccessibleAction(0); + } + } catch (com.sun.star.lang.IndexOutOfBoundsException e) { + e.printStackTrace(log); + } + + log.println("disposing xTextDoc"); + + if (xTextDoc != null) { + util.DesktopTools.closeDoc(xTextDoc); + } + } + + /** + * Creates a text document, opens an InsertField dialog. + * Then obtains an accessible object with + * the role <code>AccessibleRole.PAGETABLIST</code>. + * Object relations created : + * <ul> + * <li> <code>'EventProducer'</code> for + * {@link ifc.accessibility._XAccessibleEventBroadcaster}: + * selects items </li> + * <li> <code>'XAccessibleSelection.multiSelection'</code> + * of type <code>Boolean</code> for + * {@link ifc.accessibility._XAccessibleSelection}: + * indicates that component supports single selection mode.</li> + * </ul> + * + * @param tParam test parameters + * @param log writer to log information while testing + * + * @see com.sun.star.awt.Toolkit + * @see com.sun.star.accessibility.AccessibleRole + * @see ifc.accessibility._XAccessibleEventBroadcaster + * @see ifc.accessibility._XAccessibleSelection + * @see com.sun.star.accessibility.XAccessibleEventBroadcaster + * @see com.sun.star.accessibility.XAccessibleSelection + */ + @Override + protected TestEnvironment createTestEnvironment(TestParameters tParam, + PrintWriter log) throws Exception { + log.println("creating a test environment"); + + if (xTextDoc != null) { + util.DesktopTools.closeDoc(xTextDoc); + } + + // get a soffice factory object + SOfficeFactory SOF = SOfficeFactory.getFactory( + tParam.getMSF()); + + log.println("creating a text document"); + xTextDoc = SOF.createTextDoc(null); + + util.utils.waitForEventIdle(tParam.getMSF()); + + XModel aModel1 = UnoRuntime.queryInterface(XModel.class, + xTextDoc); + + XController secondController = aModel1.getCurrentController(); + + XDispatchProvider aProv = UnoRuntime.queryInterface( + XDispatchProvider.class, + secondController); + + XURLTransformer urlTransf = null; + + XInterface transf = (XInterface) tParam.getMSF().createInstance( + "com.sun.star.util.URLTransformer"); + urlTransf = UnoRuntime.queryInterface( + XURLTransformer.class, transf); + + XDispatch getting = null; + log.println("opening InsertField dialog"); + + URL[] url = new URL[1]; + url[0] = new URL(); + url[0].Complete = ".uno:InsertField"; + urlTransf.parseStrict(url); + getting = aProv.queryDispatch(url[0], "", 0); + + PropertyValue[] noArgs = new PropertyValue[0]; + getting.dispatch(url[0], noArgs); + + util.utils.waitForEventIdle(tParam.getMSF()); + + XInterface oObj = (XInterface) tParam.getMSF().createInstance( + "com.sun.star.awt.Toolkit"); + + XExtendedToolkit tk = UnoRuntime.queryInterface( + XExtendedToolkit.class, oObj); + + util.utils.waitForEventIdle(tParam.getMSF()); + + XWindow xWindow = UnoRuntime.queryInterface(XWindow.class, + tk.getActiveTopWindow()); + + XAccessible xRoot = AccessibilityTools.getAccessibleObject(xWindow); + + oObj = AccessibilityTools.getAccessibleObjectForRole(xRoot, + AccessibleRole.PAGE_TAB_LIST); + + XAccessibleContext closeButton = AccessibilityTools.getAccessibleObjectForRole(xRoot, + AccessibleRole.PUSH_BUTTON, + "Close"); + + accCloseButton = UnoRuntime.queryInterface( + XAccessibleAction.class, closeButton); + + log.println("ImplementationName: " + util.utils.getImplName(oObj)); + + TestEnvironment tEnv = new TestEnvironment(oObj); + + final XAccessibleSelection selection = UnoRuntime.queryInterface( + XAccessibleSelection.class, + oObj); + + tEnv.addObjRelation("EventProducer", + new ifc.accessibility._XAccessibleEventBroadcaster.EventProducer() { + public void fireEvent() { + try { + selection.selectAccessibleChild(1); + selection.selectAccessibleChild(0); + } catch (com.sun.star.lang.IndexOutOfBoundsException e) { + } + } + }); + + tEnv.addObjRelation("XAccessibleSelection.OneAlwaysSelected", + Boolean.TRUE); + + tEnv.addObjRelation("XAccessibleSelection.multiSelection", + Boolean.FALSE); + + return tEnv; + } +} diff --git a/qadevOOo/tests/java/mod/_toolkit/AccessibleTabPage.java b/qadevOOo/tests/java/mod/_toolkit/AccessibleTabPage.java new file mode 100644 index 000000000..f31182703 --- /dev/null +++ b/qadevOOo/tests/java/mod/_toolkit/AccessibleTabPage.java @@ -0,0 +1,237 @@ +/* + * 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._toolkit; + +import com.sun.star.accessibility.AccessibleRole; +import com.sun.star.accessibility.XAccessible; +import com.sun.star.accessibility.XAccessibleAction; +import com.sun.star.accessibility.XAccessibleComponent; +import com.sun.star.accessibility.XAccessibleContext; +import com.sun.star.awt.XExtendedToolkit; +import com.sun.star.awt.XWindow; +import com.sun.star.beans.PropertyValue; +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.text.XTextDocument; +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 java.io.PrintWriter; + +import lib.TestCase; +import lib.TestEnvironment; +import lib.TestParameters; +import util.AccessibilityTools; +import util.SOfficeFactory; + + +/** + * Test for object that implements the following interfaces : + * <ul> + * <li><code> + * ::com::sun::star::accessibility::XAccessibleContext</code></li> + * <li><code> + * ::com::sun::star::accessibility::XAccessibleEventBroadcaster + * </code></li> + * <li><code> + * ::com::sun::star::accessibility::XAccessibleComponent</code></li> + * <li><code> + * ::com::sun::star::accessibility::XAccessibleExtendedComponent + * </code></li> + * </ul> <p> + * + * @see com.sun.star.accessibility.XAccessibleEventBroadcaster + * @see com.sun.star.accessibility.XAccessibleContext + * @see com.sun.star.accessibility.XAccessibleComponent + * @see com.sun.star.accessibility.XAccessibleExtendedComponent + * @see ifc.accessibility._XAccessibleEventBroadcaster + * @see ifc.accessibility._XAccessibleContext + * @see ifc.accessibility._XAccessibleComponent + * @see ifc.accessibility._XAccessibleExtendedComponent + */ +public class AccessibleTabPage extends TestCase { + private static XTextDocument xTextDoc; + private static XAccessibleAction accCloseButton = null; + + /** + * Closes an InsertFields dialog, disposes the document, if exists, created in + * <code>createTestEnvironment</code> method. + */ + @Override + protected void cleanup(TestParameters Param, PrintWriter log) { + try { + if (accCloseButton != null) { + log.println("closing InsertFields Dialog"); + accCloseButton.doAccessibleAction(0); + util.utils.waitForEventIdle(Param.getMSF()); + } + } catch (com.sun.star.lang.IndexOutOfBoundsException e) { + e.printStackTrace(log); + } catch (com.sun.star.lang.DisposedException e) { + log.println("Couldn't close dialog " + e.getMessage()); + } + + log.println("disposing xTextDoc"); + + if (xTextDoc != null) { + closeDoc(); + } + } + + /** + * Creates a text document, opens an InsertField dialog. + * Then obtains an accessible object with + * the role <code>AccessibleRole.PAGETAB</code>. + * Object relations created : + * <ul> + * <li> <code>'EventProducer'</code> for + * {@link ifc.accessibility._XAccessibleEventBroadcaster}: + * grabs focus </li> + * </ul> + * + * @param tParam test parameters + * @param log writer to log information while testing + * + * @see com.sun.star.awt.Toolkit + * @see com.sun.star.accessibility.AccessibleRole + * @see ifc.accessibility._XAccessibleEventBroadcaster + * @see com.sun.star.accessibility.XAccessibleEventBroadcaster + */ + @Override + protected TestEnvironment createTestEnvironment(TestParameters tParam, + PrintWriter log) throws Exception { + log.println("creating a test environment"); + + try { + if (accCloseButton != null) { + log.println("closing InsertFields Dialog"); + accCloseButton.doAccessibleAction(0); + util.utils.waitForEventIdle(tParam.getMSF()); + } + } catch (com.sun.star.lang.IndexOutOfBoundsException e) { + e.printStackTrace(log); + } catch (com.sun.star.lang.DisposedException e) { + log.println("Couldn't close dialog " + e.getMessage()); + } + + log.println("disposing xTextDoc"); + + if (xTextDoc != null) { + closeDoc(); + } + + // get a soffice factory object + SOfficeFactory SOF = SOfficeFactory.getFactory( + tParam.getMSF()); + + log.println("creating a text document"); + xTextDoc = SOF.createTextDoc(null); + + util.utils.waitForEventIdle(tParam.getMSF()); + + XModel aModel1 = UnoRuntime.queryInterface(XModel.class, + xTextDoc); + + XController secondController = aModel1.getCurrentController(); + + XDispatchProvider aProv = UnoRuntime.queryInterface( + XDispatchProvider.class, + secondController); + + XURLTransformer urlTransf = null; + + XInterface transf = (XInterface) tParam.getMSF().createInstance( + "com.sun.star.util.URLTransformer"); + urlTransf = UnoRuntime.queryInterface( + XURLTransformer.class, transf); + + XDispatch getting = null; + log.println("opening InsertField dialog"); + + URL[] url = new URL[1]; + url[0] = new URL(); + url[0].Complete = ".uno:InsertField"; + urlTransf.parseStrict(url); + getting = aProv.queryDispatch(url[0], "", 0); + + PropertyValue[] noArgs = new PropertyValue[0]; + getting.dispatch(url[0], noArgs); + + util.utils.waitForEventIdle(tParam.getMSF()); + + XInterface oObj = null; + + oObj = (XInterface) tParam.getMSF().createInstance( + "com.sun.star.awt.Toolkit"); + + XExtendedToolkit tk = UnoRuntime.queryInterface( + XExtendedToolkit.class, oObj); + + util.utils.waitForEventIdle(tParam.getMSF()); + + XWindow xWindow = UnoRuntime.queryInterface(XWindow.class, + tk.getActiveTopWindow()); + + XAccessible xRoot = AccessibilityTools.getAccessibleObject(xWindow); + + XAccessibleContext closeButton = AccessibilityTools.getAccessibleObjectForRole(xRoot, + AccessibleRole.PUSH_BUTTON, + "Close"); + + accCloseButton = UnoRuntime.queryInterface( + XAccessibleAction.class, closeButton); + + oObj = AccessibilityTools.getAccessibleObjectForRole(xRoot, AccessibleRole.PAGE_TAB); + + log.println("ImplementationName: " + util.utils.getImplName(oObj)); + + TestEnvironment tEnv = new TestEnvironment(oObj); + + tEnv.addObjRelation("EditOnly", "toolkit.AccessibleTabPage"); + tEnv.addObjRelation("LimitedBounds", "toolkit.AccessibleTabPage"); + + XAccessibleComponent accComp = UnoRuntime.queryInterface( + XAccessibleComponent.class, + oObj); + accComp.getLocationOnScreen(); + + util.utils.waitForEventIdle(tParam.getMSF()); + + XInterface xEventInt = AccessibilityTools.getAccessibleObjectForRole(xRoot, AccessibleRole.PAGE_TAB, "Variables"); + final XAccessibleComponent eventAccComp = UnoRuntime.queryInterface( + XAccessibleComponent.class, + xEventInt); + + tEnv.addObjRelation("EventProducer", + new ifc.accessibility._XAccessibleEventBroadcaster.EventProducer() { + public void fireEvent() { + eventAccComp.grabFocus(); + } + }); + + return tEnv; + } + + protected void closeDoc() { + util.DesktopTools.closeDoc(xTextDoc); + } +} diff --git a/qadevOOo/tests/java/mod/_toolkit/AccessibleToolBox.java b/qadevOOo/tests/java/mod/_toolkit/AccessibleToolBox.java new file mode 100644 index 000000000..868eac149 --- /dev/null +++ b/qadevOOo/tests/java/mod/_toolkit/AccessibleToolBox.java @@ -0,0 +1,159 @@ +/* + * 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._toolkit; + +import com.sun.star.accessibility.AccessibleRole; +import com.sun.star.accessibility.XAccessible; +import com.sun.star.accessibility.XAccessibleAction; +import com.sun.star.awt.XWindow; +import com.sun.star.frame.XModel; +import com.sun.star.lang.XMultiServiceFactory; +import com.sun.star.text.XTextDocument; +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.AccessibilityTools; +import util.SOfficeFactory; + +/** + * Test for object that implements the following interfaces : + * <ul> + * <li><code> + * ::com::sun::star::accessibility::XAccessibleContext</code></li> + * <li><code> + * ::com::sun::star::accessibility::XAccessibleEventBroadcaster + * </code></li> + * <li><code> + * ::com::sun::star::accessibility::XAccessibleComponent</code></li> + * <li><code> + * ::com::sun::star::accessibility::XAccessibleExtendedComponent</code></li> + * </ul> <p> + * + * @see com.sun.star.accessibility.XAccessibleEventBroadcaster + * @see com.sun.star.accessibility.XAccessibleContext + * @see com.sun.star.accessibility.XAccessibleComponent + * @see com.sun.star.accessibility.XAccessibleExtendedComponent + * @see ifc.accessibility._XAccessibleEventBroadcaster + * @see ifc.accessibility._XAccessibleContext + * @see ifc.accessibility._XAccessibleComponent + * @see ifc.accessibility._XAccessibleExtendedComponent + */ +public class AccessibleToolBox extends TestCase { + private XTextDocument xTextDoc; + + /** + * Disposes the document, if exists, created in + * <code>createTestEnvironment</code> method. + */ + @Override + protected void cleanup(TestParameters Param, PrintWriter log) { + log.println("disposing xTextDoc"); + + if (xTextDoc != null) { + util.DesktopTools.closeDoc(xTextDoc); + } + } + + /** + * Creates a text document. + * Then obtains an accessible object with + * the role <code>AccessibleRole.TOOLBAR</code>. + * Object relations created : + * <ul> + * <li> <code>'EventProducer'</code> for + * {@link ifc.accessibility._XAccessibleEventBroadcaster}: + * grabs focus + * </li> + * </ul> + * + * @param tParam test parameters + * @param log writer to log information while testing + * + * @see com.sun.star.awt.Toolkit + * @see com.sun.star.accessibility.AccessibleRole + * @see ifc.accessibility._XAccessibleEventBroadcaster + * @see com.sun.star.accessibility.XAccessibleEventBroadcaster + */ + @Override + protected TestEnvironment createTestEnvironment(TestParameters tParam, + PrintWriter log) throws Exception { + log.println("creating a test environment"); + + if (xTextDoc != null) { + util.DesktopTools.closeDoc(xTextDoc); + } + + XMultiServiceFactory msf = tParam.getMSF(); + + // get a soffice factory object + SOfficeFactory SOF = SOfficeFactory.getFactory(msf); + + log.println("creating a text document"); + xTextDoc = SOF.createTextDoc(null); + + XInterface oObj = null; + + XWindow xWindow = UnoRuntime.queryInterface(XModel.class, xTextDoc). + getCurrentController().getFrame().getContainerWindow(); + + XAccessible xRoot = AccessibilityTools.getAccessibleObject(xWindow); + + AccessibilityTools.printAccessibleTree(log, xRoot, tParam.getBool(util.PropertyName.DEBUG_IS_ACTIVE)); + + oObj = AccessibilityTools.getAccessibleObjectForRole(xRoot, AccessibleRole.TOOL_BAR); + + log.println("ImplementationName: " + util.utils.getImplName(oObj)); + + TestEnvironment tEnv = new TestEnvironment(oObj); + + tEnv.addObjRelation("LimitedBounds", "yes"); + + XAccessible acc = AccessibilityTools.getAccessibleObject(oObj); + XAccessible child = null; + + try { + child = acc.getAccessibleContext().getAccessibleChild(0); + } catch (com.sun.star.lang.IndexOutOfBoundsException e) { + } + + util.dbg.printInterfaces(child); + + final XAccessibleAction action = UnoRuntime.queryInterface( + XAccessibleAction.class, + child); + + tEnv.addObjRelation("EventProducer", + new ifc.accessibility._XAccessibleEventBroadcaster.EventProducer() { + public void fireEvent() { + try { + action.doAccessibleAction(0); + } catch (com.sun.star.lang.IndexOutOfBoundsException e) { + System.out.println("Couldn't fire event"); + } + } + }); + + return tEnv; + } +} diff --git a/qadevOOo/tests/java/mod/_toolkit/AccessibleToolBoxItem.java b/qadevOOo/tests/java/mod/_toolkit/AccessibleToolBoxItem.java new file mode 100644 index 000000000..c92a14b61 --- /dev/null +++ b/qadevOOo/tests/java/mod/_toolkit/AccessibleToolBoxItem.java @@ -0,0 +1,176 @@ +/* + * 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._toolkit; + +import com.sun.star.accessibility.AccessibleRole; +import com.sun.star.accessibility.XAccessible; +import com.sun.star.accessibility.XAccessibleAction; +import com.sun.star.awt.XWindow; +import com.sun.star.frame.XModel; +import com.sun.star.text.XTextDocument; +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.AccessibilityTools; +import util.SOfficeFactory; + + +/** + * Test for object that implements the following interfaces : + * <ul> + * <li><code> + * ::com::sun::star::accessibility::XAccessibleContext</code></li> + * <li><code> + * ::com::sun::star::accessibility::XAccessibleEventBroadcaster + * </code></li> + * <li><code> + * ::com::sun::star::accessibility::XAccessibleComponent</code></li> + * <li><code> + * ::com::sun::star::accessibility::XAccessibleExtendedComponent + * </code></li> + * <li><code> + * ::com::sun::star::accessibility::XAccessibleAction</code></li> + * <li><code> + * ::com::sun::star::accessibility::XAccessibleText</code></li> + * <li><code> + * ::com::sun::star::accessibility::XAccessibleValue</code></li> + * </ul> <p> + * + * @see com.sun.star.accessibility.XAccessibleEventBroadcaster + * @see com.sun.star.accessibility.XAccessibleContext + * @see com.sun.star.accessibility.XAccessibleComponent + * @see com.sun.star.accessibility.XAccessibleExtendedComponent + * @see com.sun.star.accessibility.XAccessibleAction + * @see com.sun.star.accessibility.XAccessibleText + * @see com.sun.star.accessibility.XAccessibleValue + * @see ifc.accessibility._XAccessibleEventBroadcaster + * @see ifc.accessibility._XAccessibleContext + * @see ifc.accessibility._XAccessibleComponent + * @see ifc.accessibility._XAccessibleExtendedComponent + * @see ifc.accessibility._XAccessibleAction + * @see ifc.accessibility._XAccessibleText + * @see ifc.accessibility._XAccessibleValue + */ +public class AccessibleToolBoxItem extends TestCase { + private static XTextDocument xTextDoc; + + /** + * Disposes the document, if exists, created in + * <code>createTestEnvironment</code> method. + */ + @Override + protected void cleanup(TestParameters Param, PrintWriter log) { + log.println("disposing xTextDoc"); + + if (xTextDoc != null) { + closeDoc(); + } + } + + /** + * Creates a text document. + * Then obtains an accessible object with + * the role <code>AccessibleRole.PUSHBUTTON</code> and with the name + * <code>"Bold"</code>. + * Object relations created : + * <ul> + * <li> <code>'EventProducer'</code> for + * {@link ifc.accessibility._XAccessibleEventBroadcaster}</li> + * <li> <code>'XAccessibleText.Text'</code> for + * {@link ifc.accessibility._XAccessibleText}: the name of button</li> + * </ul> + * + * @param tParam test parameters + * @param log writer to log information while testing + * + * @see com.sun.star.awt.Toolkit + * @see com.sun.star.accessibility.AccessibleRole + * @see ifc.accessibility._XAccessibleEventBroadcaster + * @see ifc.accessibility._XAccessibleText + * @see com.sun.star.accessibility.XAccessibleEventBroadcaster + * @see com.sun.star.accessibility.XAccessibleText + */ + @Override + protected TestEnvironment createTestEnvironment(TestParameters tParam, + PrintWriter log) throws Exception { + log.println("creating a test environment"); + + if (xTextDoc != null) { + closeDoc(); + } + + // get a soffice factory object + SOfficeFactory SOF = SOfficeFactory.getFactory( + tParam.getMSF()); + + log.println("creating a text document"); + xTextDoc = SOF.createTextDoc(null); + + XModel aModel = UnoRuntime.queryInterface(XModel.class, + xTextDoc); + + XInterface oObj = null; + + XWindow xWindow = AccessibilityTools.getCurrentContainerWindow( + aModel); + + XAccessible xRoot = AccessibilityTools.getAccessibleObject(xWindow); + + + AccessibilityTools.printAccessibleTree(log, xRoot, tParam.getBool(util.PropertyName.DEBUG_IS_ACTIVE)); + oObj = AccessibilityTools.getAccessibleObjectForRole(xRoot, + AccessibleRole.TOGGLE_BUTTON, + "Bold"); + + log.println("ImplementationName: " + util.utils.getImplName(oObj)); + + TestEnvironment tEnv = new TestEnvironment(oObj); + + tEnv.addObjRelation("EditOnly", + "This method isn't supported in this dialog"); + + tEnv.addObjRelation("LimitedBounds", "yes"); + + final XAccessibleAction oAction = UnoRuntime.queryInterface( + XAccessibleAction.class, + oObj); + + tEnv.addObjRelation("EventProducer", + new ifc.accessibility._XAccessibleEventBroadcaster.EventProducer() { + public void fireEvent() { + try { + oAction.doAccessibleAction(0); + } catch (com.sun.star.lang.IndexOutOfBoundsException e) { + } + } + }); + + tEnv.addObjRelation("XAccessibleText.Text", "Bold"); + + return tEnv; + } + + protected void closeDoc() { + util.DesktopTools.closeDoc(xTextDoc); + } +} diff --git a/qadevOOo/tests/java/mod/_toolkit/AccessibleWindow.java b/qadevOOo/tests/java/mod/_toolkit/AccessibleWindow.java new file mode 100644 index 000000000..ff3f63c84 --- /dev/null +++ b/qadevOOo/tests/java/mod/_toolkit/AccessibleWindow.java @@ -0,0 +1,173 @@ +/* + * 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._toolkit; + +import com.sun.star.accessibility.AccessibleRole; +import com.sun.star.accessibility.XAccessible; +import com.sun.star.awt.PosSize; +import com.sun.star.awt.Rectangle; +import com.sun.star.awt.XExtendedToolkit; +import com.sun.star.awt.XWindow; +import com.sun.star.frame.XModel; +import com.sun.star.text.XTextDocument; +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.AccessibilityTools; +import util.SOfficeFactory; + + +/** + * Test for object that implements the following interfaces : + * <ul> + * <li><code> + * ::com::sun::star::accessibility::XAccessibleContext</code></li> + * <li><code> + * ::com::sun::star::accessibility::XAccessibleEventBroadcaster + * </code></li> + * <li><code> + * ::com::sun::star::accessibility::XAccessibleComponent</code></li> + * <li><code> + * ::com::sun::star::accessibility::XAccessibleExtendedComponent + * </code></li> + * <li><code> + * ::com::sun::star::accessibility::XAccessibleAction</code></li> + * <li><code> + * ::com::sun::star::accessibility::XAccessibleText</code></li> + * <li><code> + * ::com::sun::star::accessibility::XAccessibleValue</code></li> + * </ul> <p> + * + * @see com.sun.star.accessibility.XAccessibleEventBroadcaster + * @see com.sun.star.accessibility.XAccessibleContext + * @see com.sun.star.accessibility.XAccessibleComponent + * @see com.sun.star.accessibility.XAccessibleExtendedComponent + * @see com.sun.star.accessibility.XAccessibleAction + * @see com.sun.star.accessibility.XAccessibleText + * @see com.sun.star.accessibility.XAccessibleValue + * @see ifc.accessibility._XAccessibleEventBroadcaster + * @see ifc.accessibility._XAccessibleContext + * @see ifc.accessibility._XAccessibleComponent + * @see ifc.accessibility._XAccessibleExtendedComponent + * @see ifc.accessibility._XAccessibleAction + * @see ifc.accessibility._XAccessibleText + * @see ifc.accessibility._XAccessibleValue + */ +public class AccessibleWindow extends TestCase { + private static XTextDocument xTextDoc; + + /** + * Disposes the document, if exists, created in + * <code>createTestEnvironment</code> method. + */ + @Override + protected void cleanup(TestParameters Param, PrintWriter log) { + log.println("disposing xTextDoc"); + + if (xTextDoc != null) { + util.DesktopTools.closeDoc(xTextDoc); + } + } + + /** + * Creates a text document. + * Then obtains an accessible object with + * the role <code>AccessibleRole.PUSHBUTTON</code> and with the name + * <code>"Bold"</code>. + * Object relations created : + * <ul> + * <li> <code>'EventProducer'</code> for + * {@link ifc.accessibility._XAccessibleEventBroadcaster}</li> + * <li> <code>'XAccessibleText.Text'</code> for + * {@link ifc.accessibility._XAccessibleText}: the name of button</li> + * </ul> + * + * @param tParam test parameters + * @param log writer to log information while testing + * + * @see com.sun.star.awt.Toolkit + * @see com.sun.star.accessibility.AccessibleRole + * @see ifc.accessibility._XAccessibleEventBroadcaster + * @see ifc.accessibility._XAccessibleText + * @see com.sun.star.accessibility.XAccessibleEventBroadcaster + * @see com.sun.star.accessibility.XAccessibleText + */ + @Override + protected TestEnvironment createTestEnvironment(TestParameters tParam, + PrintWriter log) throws Exception { + log.println("creating a test environment"); + + if (xTextDoc != null) { + util.DesktopTools.closeDoc(xTextDoc); + } + + // get a soffice factory object + SOfficeFactory SOF = SOfficeFactory.getFactory( + tParam.getMSF()); + + XInterface toolkit = null; + + log.println("creating a text document"); + xTextDoc = SOF.createTextDoc(null); + toolkit = (XInterface) tParam.getMSF().createInstance( + "com.sun.star.awt.Toolkit"); + + XModel aModel = UnoRuntime.queryInterface(XModel.class, + xTextDoc); + + XInterface oObj = null; + + 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.PANEL); + + log.println("ImplementationName: " + util.utils.getImplName(oObj)); + + TestEnvironment tEnv = new TestEnvironment(oObj); + + final XExtendedToolkit tk = UnoRuntime.queryInterface( + XExtendedToolkit.class, toolkit); + + tEnv.addObjRelation("EventProducer", + new ifc.accessibility._XAccessibleEventBroadcaster.EventProducer() { + public void fireEvent() { + XWindow xWin = UnoRuntime.queryInterface( + XWindow.class, tk.getActiveTopWindow()); + Rectangle newPosSize = xWin.getPosSize(); + newPosSize.Width = newPosSize.Width - 20; + newPosSize.Height = newPosSize.Height - 20; + newPosSize.X = newPosSize.X + 20; + newPosSize.Y = newPosSize.Y + 20; + xWin.setPosSize(newPosSize.X, newPosSize.Y, newPosSize.Width, + newPosSize.Height, PosSize.POSSIZE); + } + }); + + return tEnv; + } +}
\ No newline at end of file diff --git a/qadevOOo/tests/java/mod/_toolkit/MutableTreeDataModel.java b/qadevOOo/tests/java/mod/_toolkit/MutableTreeDataModel.java new file mode 100644 index 000000000..10a5f2d1d --- /dev/null +++ b/qadevOOo/tests/java/mod/_toolkit/MutableTreeDataModel.java @@ -0,0 +1,98 @@ +/* + * 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._toolkit; + +import com.sun.star.awt.tree.XMutableTreeDataModel; +import com.sun.star.awt.tree.XMutableTreeNode; +import com.sun.star.text.XTextDocument; +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.WriterTools; +import util.utils; + + +public class MutableTreeDataModel extends TestCase { + private static XTextDocument xTextDoc; + private static XInterface oObj = null; + + /** + * Creates StarOffice Writer document. + */ + @Override + protected void initialize(TestParameters tParam, PrintWriter log) throws Exception { + log.println("creating a textdocument"); + xTextDoc = WriterTools.createTextDoc( + tParam.getMSF()); + } + + /** + * Disposes StarOffice Writer document. + */ + @Override + protected void cleanup(TestParameters tParam, PrintWriter log) { + log.println(" disposing xTextDoc "); + + util.DesktopTools.closeDoc(xTextDoc); + } + + @Override + protected TestEnvironment createTestEnvironment(TestParameters Param, + PrintWriter log) { + + try { + oObj = (XInterface) Param.getMSF().createInstance( + "com.sun.star.awt.tree.MutableTreeDataModel"); + } catch (Exception e) { + } + + log.println( + "creating a new environment for MutableTreeDataModel object"); + + TestEnvironment tEnv = new TestEnvironment(oObj); + + tEnv.addObjRelation("OBJNAME", "toolkit.MutableTreeDataModel"); + log.println("ImplementationName: " + utils.getImplName(oObj)); + + tEnv.addObjRelation("XTreeDataModelListenerEvent", new XTreeDataModelListenerEvent()); + + return tEnv; + } // finish method getTestEnvironment + + private class XTreeDataModelListenerEvent implements ifc.awt.tree._XTreeDataModel.XTreeDataModelListenerEvent{ + + public void fireEvent(){ + + XMutableTreeDataModel xModel = UnoRuntime.queryInterface(XMutableTreeDataModel.class, oObj); + XMutableTreeNode node = xModel.createNode("EventNode", true); + try { + xModel.setRoot(node); + } catch (com.sun.star.lang.IllegalArgumentException ex) { + log.println("ERROR: could not perform event: " + ex.toString()); + ex.printStackTrace(); + } + + } + } +} // finish class UnoControlListBoxModel diff --git a/qadevOOo/tests/java/mod/_toolkit/MutableTreeNode.java b/qadevOOo/tests/java/mod/_toolkit/MutableTreeNode.java new file mode 100644 index 000000000..e08d2dd65 --- /dev/null +++ b/qadevOOo/tests/java/mod/_toolkit/MutableTreeNode.java @@ -0,0 +1,153 @@ +/* + * 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._toolkit; + +import com.sun.star.awt.tree.XMutableTreeDataModel; +import com.sun.star.awt.tree.XMutableTreeNode; +import com.sun.star.lang.XMultiServiceFactory; +import com.sun.star.ucb.CommandAbortedException; +import com.sun.star.ucb.XSimpleFileAccess; +import com.sun.star.uno.UnoRuntime; +import com.sun.star.uno.XInterface; + +import ifc.awt.tree._XMutableTreeNode.XMutableTreeNodeCreator; + +import java.io.PrintWriter; + +import lib.TestCase; +import lib.TestEnvironment; +import lib.TestParameters; +import util.utils; + + +public class MutableTreeNode extends TestCase { + private static XInterface oObj = null; + private static XMutableTreeDataModel mXTreeDataModel; + private static XMultiServiceFactory mxMSF; + + /** + * Creates StarOffice Writer document. + */ + @Override + protected void initialize(TestParameters tParam, PrintWriter log) throws Exception { + mxMSF = tParam.getMSF(); + } + + @Override + protected TestEnvironment createTestEnvironment(TestParameters Param, + PrintWriter log) throws Exception { + XMutableTreeNode xNode; + + mXTreeDataModel = UnoRuntime.queryInterface(XMutableTreeDataModel.class, + mxMSF.createInstance("com.sun.star.awt.tree.MutableTreeDataModel")); + + xNode = mXTreeDataModel.createNode("UnoTreeControl", false); + + String sDisplayValue = "UnoTreeControl"; + String sExpandedGraphicURL = "private:graphicrepository/sd/res/triangle_down.png"; + String sCollapsedGraphicURL = "private:graphicrepository/sd/res/triangle_right.png"; + String sNodeGraphicURL = "private:graphicrepository/sw/res/nc20010.png"; + + xNode.setDisplayValue( sDisplayValue); + xNode.setDataValue(sDisplayValue); + xNode.setExpandedGraphicURL(sExpandedGraphicURL); + xNode.setCollapsedGraphicURL(sCollapsedGraphicURL); + xNode.setNodeGraphicURL(sNodeGraphicURL); + xNode.setHasChildrenOnDemand(true); + + fillNode(xNode); + + TestEnvironment tEnv = new TestEnvironment(xNode); + + tEnv.addObjRelation("OBJNAME", "toolkit.MutableTreeDataModel"); + log.println("ImplementationName: " + utils.getImplName(oObj)); + + tEnv.addObjRelation("XTreeNode_DisplayValue", sDisplayValue); + tEnv.addObjRelation("XTreeNode_ExpandedGraphicURL", sExpandedGraphicURL); + tEnv.addObjRelation("XTreeNode_CollapsedGraphicURL", sCollapsedGraphicURL); + tEnv.addObjRelation("XTreeNode_NodeGraphicURL", sNodeGraphicURL); + + tEnv.addObjRelation("XMutableTreeNode_NodeToAppend", + mXTreeDataModel.createNode("XMutableTreeNode_NodeToAppend", true)); + + tEnv.addObjRelation("XMutableTreeNodeCreator", new XMutableTreeNodeCreator(){ + public XMutableTreeNode createNode(String name){ + return mXTreeDataModel.createNode(name, true); + } + }); + + return tEnv; + } // finish method getTestEnvironment + + private void fillNode( XMutableTreeNode xNode ) throws com.sun.star.uno.Exception { + + if( xNode.getChildCount() == 0 ) + { + xNode.getDataValue(); + + String officeUserPath = utils.getOfficeUserPath(mxMSF); + Object fileacc = mxMSF.createInstance("com.sun.star.comp.ucb.SimpleFileAccess"); + UnoRuntime.queryInterface(XSimpleFileAccess.class,fileacc); + + + dirlist(officeUserPath, xNode); + } + } + + private void dirlist(String dir, XMutableTreeNode xNode){ + + Object fileacc = null; + try { + fileacc = mxMSF.createInstance("com.sun.star.comp.ucb.SimpleFileAccess"); + } catch (com.sun.star.uno.Exception ex) { + ex.printStackTrace(); + } + XSimpleFileAccess sfa = UnoRuntime.queryInterface(XSimpleFileAccess.class,fileacc); + XMutableTreeNode xChildNode = null; + try { + xChildNode = mXTreeDataModel.createNode(dir.substring(dir.lastIndexOf("/")+1, dir.length()), sfa.isFolder(dir)); + xChildNode.setDataValue(dir); + sfa.isFolder(dir); + if (sfa.isFolder(dir)){ + xChildNode.setExpandedGraphicURL( "private:graphicrepository/sd/res/triangle_down.png"); + xChildNode.setCollapsedGraphicURL("private:graphicrepository/sd/res/triangle_right.png"); + String[] children = sfa.getFolderContents(dir, true); + if (children != null){ + for (int i=0; i<children.length; i++) { + // Get filename of file or directory + String filename = children[i]; + dirlist( filename , xChildNode); + } + } + } + else{ + xChildNode.setNodeGraphicURL( "private:graphicrepository/sw/res/nc20010.png"); + } + } catch (CommandAbortedException ex) { + ex.printStackTrace(); + } catch (com.sun.star.uno.Exception ex) { + ex.printStackTrace(); + } + + try { + xNode.appendChild( xChildNode ); + } catch (com.sun.star.lang.IllegalArgumentException ex) { + ex.printStackTrace(); + } + } +} // finish class UnoControlListBoxModel diff --git a/qadevOOo/tests/java/mod/_toolkit/TabController.java b/qadevOOo/tests/java/mod/_toolkit/TabController.java new file mode 100644 index 000000000..0f483bb04 --- /dev/null +++ b/qadevOOo/tests/java/mod/_toolkit/TabController.java @@ -0,0 +1,126 @@ +/* + * 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._toolkit; + +import com.sun.star.awt.XControl; +import com.sun.star.awt.XControlContainer; +import com.sun.star.awt.XControlModel; +import com.sun.star.awt.XTabControllerModel; +import com.sun.star.drawing.XControlShape; +import com.sun.star.form.XForm; +import com.sun.star.text.XTextDocument; +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 com.sun.star.view.XControlAccess; + +import java.io.PrintWriter; + +import lib.TestCase; +import lib.TestEnvironment; +import lib.TestParameters; + +import util.FormTools; +import util.WriterTools; +import util.utils; + + +public class TabController extends TestCase { + private static XTextDocument xTextDoc = null; + + @Override + protected void initialize(TestParameters Param, PrintWriter log) throws Exception { + log.println("creating a textdocument"); + xTextDoc = WriterTools.createTextDoc( + Param.getMSF()); + } + + @Override + protected void cleanup(TestParameters param, PrintWriter log) { + log.println("disposing xTextDoc"); + util.DesktopTools.closeDoc(xTextDoc); + } + + @Override + public TestEnvironment createTestEnvironment(TestParameters param, + PrintWriter log) + throws com.sun.star.uno.Exception + { + XInterface oObj = null; + XControl xCtrl1 = null; + XTabControllerModel tabCtrlModel = null; + XControlContainer aCtrlContainer = null; + + + // create object relations + FormTools.insertForm(xTextDoc, + FormTools.getForms(WriterTools.getDrawPage( + xTextDoc)), "MyForm"); + + XControlShape aShape = FormTools.createUnoControlShape(xTextDoc, 3000, + 4500, 15000, + 10000, + "CommandButton", + "UnoControlButton"); + WriterTools.getDrawPage(xTextDoc).add(aShape); + + XControlModel model = aShape.getControl(); + XControlAccess access = UnoRuntime.queryInterface( + XControlAccess.class, + xTextDoc.getCurrentController()); + + try { + xCtrl1 = access.getControl(model); + } catch (Exception e) { + } + + XForm form = null; + + try { + Object temp = FormTools.getForms( WriterTools.getDrawPage(xTextDoc) ).getByName("MyForm"); + form = (XForm) AnyConverter.toObject(new Type(XForm.class), temp); + } catch (Exception e) { + log.println("Couldn't get Form"); + e.printStackTrace(log); + } + + tabCtrlModel = UnoRuntime.queryInterface( + XTabControllerModel.class, form); + + aCtrlContainer = UnoRuntime.queryInterface( + XControlContainer.class, xCtrl1.getContext()); + + // create object + try { + oObj = (XInterface) param.getMSF().createInstance( + "com.sun.star.awt.TabController"); + } catch (Exception e) { + } + + TestEnvironment tEnv = new TestEnvironment(oObj); + + String objName = "TabController"; + tEnv.addObjRelation("OBJNAME", "toolkit." + objName); + tEnv.addObjRelation("MODEL", tabCtrlModel); + tEnv.addObjRelation("CONTAINER", aCtrlContainer); + System.out.println("ImplementationName: " + utils.getImplName(oObj)); + + return tEnv; + } +} diff --git a/qadevOOo/tests/java/mod/_toolkit/TabControllerModel.java b/qadevOOo/tests/java/mod/_toolkit/TabControllerModel.java new file mode 100644 index 000000000..1c227f0b3 --- /dev/null +++ b/qadevOOo/tests/java/mod/_toolkit/TabControllerModel.java @@ -0,0 +1,83 @@ +/* + * 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._toolkit; + +import com.sun.star.drawing.XControlShape; +import com.sun.star.text.XTextDocument; +import com.sun.star.uno.XInterface; + +import java.io.PrintWriter; + +import lib.TestCase; +import lib.TestEnvironment; +import lib.TestParameters; +import util.FormTools; +import util.WriterTools; +import util.utils; + + +public class TabControllerModel extends TestCase { + private static XTextDocument xTextDoc; + + @Override + protected void initialize(TestParameters Param, PrintWriter log) throws Exception { + log.println("creating a textdocument"); + xTextDoc = WriterTools.createTextDoc(Param.getMSF()); + } + + @Override + protected void cleanup(TestParameters param, PrintWriter log) { + log.println("disposing xTextDoc"); + util.DesktopTools.closeDoc(xTextDoc); + } + + @Override + public TestEnvironment createTestEnvironment(TestParameters param, + PrintWriter log) throws Exception { + XInterface oObj = null; + + log.println("inserting some ControlShapes"); + + XControlShape shape1 = FormTools.createControlShape(xTextDoc, 3000, + 4500, 15000, 1000, + "CommandButton"); + XControlShape shape2 = FormTools.createControlShape(xTextDoc, 5000, + 3500, 7500, 5000, + "TextField"); + + oObj = (XInterface) param.getMSF().createInstance( + "com.sun.star.awt.TabControllerModel"); + + log.println("creating a new environment for TabControllerModel"); + + TestEnvironment tEnv = new TestEnvironment(oObj); + + tEnv.addObjRelation("OBJNAME", + "stardiv.vcl.controlmodel.TabController"); + tEnv.addObjRelation("Model1", shape1.getControl()); + tEnv.addObjRelation("Model2", shape2.getControl()); + + + //Object Relation for XPersistObject + tEnv.addObjRelation("noPS", Boolean.TRUE); + + System.out.println("ImplementationName: " + utils.getImplName(oObj)); + + return tEnv; + } // finish method getTestEnvironment +} // finish class TabControllerModel diff --git a/qadevOOo/tests/java/mod/_toolkit/Toolkit.java b/qadevOOo/tests/java/mod/_toolkit/Toolkit.java new file mode 100644 index 000000000..346ef21f5 --- /dev/null +++ b/qadevOOo/tests/java/mod/_toolkit/Toolkit.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._toolkit; + +import com.sun.star.awt.XControlModel; +import com.sun.star.awt.XWindow; +import com.sun.star.awt.XWindowPeer; +import com.sun.star.drawing.XControlShape; +import com.sun.star.frame.XController; +import com.sun.star.frame.XModel; +import com.sun.star.text.XTextDocument; +import com.sun.star.uno.UnoRuntime; +import com.sun.star.uno.XInterface; +import com.sun.star.view.XControlAccess; + +import java.io.PrintWriter; + +import lib.TestCase; +import lib.TestEnvironment; +import lib.TestParameters; + +import util.FormTools; +import util.SOfficeFactory; +import util.WriterTools; +import util.utils; + + +/** +* Test for <code>com.sun.star.awt.Toolkit</code> service. +*/ +public class Toolkit extends TestCase { + private static XTextDocument xTextDoc; + + @Override + protected void initialize(TestParameters Param, PrintWriter log) throws Exception { + SOfficeFactory SOF = SOfficeFactory.getFactory( + Param.getMSF()); + + log.println("creating a textdocument"); + xTextDoc = SOF.createTextDoc(null); + } + + @Override + protected void cleanup(TestParameters tParam, PrintWriter log) { + log.println(" disposing xTextDoc "); + util.DesktopTools.closeDoc(xTextDoc); + } + + /** + * Creating a TestEnvironment for the interfaces to be tested. + * Creates <code>com.sun.star.awt.Toolkit</code> service. + */ + @Override + public TestEnvironment createTestEnvironment(TestParameters Param, + PrintWriter log) + throws Exception { + XInterface oObj = null; + XWindowPeer the_win = null; + XWindow win = null; + + //Insert a ControlShape and get the ControlModel + XControlShape aShape = FormTools.createControlShape(xTextDoc, 3000, + 4500, 15000, 10000, + "CommandButton"); + + WriterTools.getDrawPage(xTextDoc).add(aShape); + + XControlModel the_Model = aShape.getControl(); + + //Try to query XControlAccess + XControlAccess the_access = UnoRuntime.queryInterface( + XControlAccess.class, + xTextDoc.getCurrentController()); + XController cntrlr = UnoRuntime.queryInterface( + XController.class, + xTextDoc.getCurrentController()); + + //now get the toolkit + win = cntrlr.getFrame().getContainerWindow(); + + the_win = the_access.getControl(the_Model).getPeer(); + oObj = (XInterface) Param.getMSF().createInstance( + "com.sun.star.awt.Toolkit"); + + XModel xModel = UnoRuntime.queryInterface(XModel.class, xTextDoc); + + log.println(" creating a new environment for toolkit object"); + + TestEnvironment tEnv = new TestEnvironment(oObj); + + log.println("Implementation Name: " + utils.getImplName(oObj)); + + tEnv.addObjRelation("WINPEER", the_win); + + tEnv.addObjRelation("XModel", xModel); + + + // adding relation for XDataTransferProviderAccess + tEnv.addObjRelation("XDataTransferProviderAccess.XWindow", win); + + return tEnv; + } // finish method getTestEnvironment +} // finish class Toolkit diff --git a/qadevOOo/tests/java/mod/_toolkit/UnoControlButton.java b/qadevOOo/tests/java/mod/_toolkit/UnoControlButton.java new file mode 100644 index 000000000..3522c9629 --- /dev/null +++ b/qadevOOo/tests/java/mod/_toolkit/UnoControlButton.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._toolkit; + +import com.sun.star.awt.XControlModel; +import com.sun.star.awt.XDevice; +import com.sun.star.awt.XGraphics; +import com.sun.star.awt.XToolkit; +import com.sun.star.awt.XWindow; +import com.sun.star.awt.XWindowPeer; +import com.sun.star.drawing.XControlShape; +import com.sun.star.frame.XController; +import com.sun.star.frame.XFrame; +import com.sun.star.text.XTextDocument; +import com.sun.star.uno.UnoRuntime; +import com.sun.star.uno.XInterface; +import com.sun.star.view.XControlAccess; + +import java.io.PrintWriter; + +import lib.TestCase; +import lib.TestEnvironment; +import lib.TestParameters; +import util.FormTools; +import util.SOfficeFactory; +import util.WriterTools; +import util.utils; + + +public class UnoControlButton extends TestCase { + private static XTextDocument xTextDoc; + private static XTextDocument xTD2; + + @Override + protected void initialize(TestParameters Param, PrintWriter log) throws Exception { + SOfficeFactory SOF = SOfficeFactory.getFactory( + Param.getMSF()); + + log.println("creating a textdocument"); + xTextDoc = SOF.createTextDoc(null); + xTD2 = WriterTools.createTextDoc( + Param.getMSF()); + } + + @Override + protected void cleanup(TestParameters tParam, PrintWriter log) { + log.println(" disposing xTextDoc "); + + util.DesktopTools.closeDoc(xTextDoc); + util.DesktopTools.closeDoc(xTD2); + } + + @Override + public TestEnvironment createTestEnvironment(TestParameters Param, + PrintWriter log) throws Exception { + XInterface oObj = null; + XWindowPeer the_win = null; + XToolkit the_kit = null; + XDevice aDevice = null; + XGraphics aGraphic = null; + XWindow anotherWindow = null; + + //Insert a ControlShape and get the ControlModel + XControlShape aShape = FormTools.createUnoControlShape(xTextDoc, 3000, + 4500, 15000, + 10000, + "CommandButton", + "UnoControlButton"); + + WriterTools.getDrawPage(xTextDoc).add(aShape); + + XControlModel the_Model = aShape.getControl(); + + //Try to query XControlAccess + XControlAccess the_access = UnoRuntime.queryInterface( + XControlAccess.class, + xTextDoc.getCurrentController()); + + //get the ButtonControl for the needed Object relations + oObj = the_access.getControl(the_Model); + the_win = the_access.getControl(the_Model).getPeer(); + the_kit = the_win.getToolkit(); + aDevice = the_kit.createScreenCompatibleDevice(200, 200); + aGraphic = aDevice.createGraphics(); + + log.println("creating a new environment for UnoControlButton object"); + + TestEnvironment tEnv = new TestEnvironment(oObj); + + + //Adding ObjRelation for XView + tEnv.addObjRelation("GRAPHICS", aGraphic); + + + //Adding ObjRelation for XControl + tEnv.addObjRelation("CONTEXT", xTextDoc); + tEnv.addObjRelation("WINPEER", the_win); + tEnv.addObjRelation("TOOLKIT", the_kit); + tEnv.addObjRelation("MODEL", the_Model); + + System.out.println("ImplementationName: " + utils.getImplName(oObj)); + + XController aController = xTD2.getCurrentController(); + XFrame aFrame = aController.getFrame(); + anotherWindow = aFrame.getComponentWindow(); + + + // Object Relation for XWindow + tEnv.addObjRelation("XWindow.AnotherWindow", anotherWindow); + tEnv.addObjRelation("XWindow.ControlShape", aShape); + + return tEnv; + } // finish method getTestEnvironment +} // finish class UnoControlButton diff --git a/qadevOOo/tests/java/mod/_toolkit/UnoControlButtonModel.java b/qadevOOo/tests/java/mod/_toolkit/UnoControlButtonModel.java new file mode 100644 index 000000000..24be3535d --- /dev/null +++ b/qadevOOo/tests/java/mod/_toolkit/UnoControlButtonModel.java @@ -0,0 +1,71 @@ +/* + * 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._toolkit; + +import com.sun.star.text.XTextDocument; +import com.sun.star.uno.XInterface; + +import java.io.PrintWriter; + +import lib.TestCase; +import lib.TestEnvironment; +import lib.TestParameters; +import util.WriterTools; +import util.utils; + + +public class UnoControlButtonModel extends TestCase { + private static XTextDocument xTextDoc; + + /** + * Creates StarOffice Writer document. + */ + @Override + protected void initialize(TestParameters tParam, PrintWriter log) throws Exception { + log.println("creating a textdocument"); + xTextDoc = WriterTools.createTextDoc( + tParam.getMSF()); + } + + /** + * Disposes StarOffice Writer document. + */ + @Override + protected void cleanup(TestParameters tParam, PrintWriter log) { + log.println(" disposing xTextDoc "); + + util.DesktopTools.closeDoc(xTextDoc); + } + + @Override + protected TestEnvironment createTestEnvironment(TestParameters Param, + PrintWriter log) throws Exception { + XInterface oObj = (XInterface) Param.getMSF().createInstance( + "com.sun.star.awt.UnoControlButtonModel"); + + log.println( + "creating a new environment for UnoControlButtonModel object"); + + TestEnvironment tEnv = new TestEnvironment(oObj); + + tEnv.addObjRelation("OBJNAME", "stardiv.vcl.controlmodel.Button"); + System.out.println("ImplementationName: " + utils.getImplName(oObj)); + + return tEnv; + } // finish method getTestEnvironment +} // finish class UnoControlButtonModel diff --git a/qadevOOo/tests/java/mod/_toolkit/UnoControlCheckBox.java b/qadevOOo/tests/java/mod/_toolkit/UnoControlCheckBox.java new file mode 100644 index 000000000..0132bd4b0 --- /dev/null +++ b/qadevOOo/tests/java/mod/_toolkit/UnoControlCheckBox.java @@ -0,0 +1,137 @@ +/* + * 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._toolkit; + +import com.sun.star.awt.XCheckBox; +import com.sun.star.awt.XControlModel; +import com.sun.star.awt.XDevice; +import com.sun.star.awt.XGraphics; +import com.sun.star.awt.XToolkit; +import com.sun.star.awt.XWindow; +import com.sun.star.awt.XWindowPeer; +import com.sun.star.drawing.XControlShape; +import com.sun.star.frame.XController; +import com.sun.star.frame.XFrame; +import com.sun.star.text.XTextDocument; +import com.sun.star.uno.UnoRuntime; +import com.sun.star.uno.XInterface; +import com.sun.star.view.XControlAccess; + +import java.io.PrintWriter; + +import lib.TestCase; +import lib.TestEnvironment; +import lib.TestParameters; +import util.FormTools; +import util.SOfficeFactory; +import util.WriterTools; +import util.utils; + + +public class UnoControlCheckBox extends TestCase { + private static XTextDocument xTextDoc; + private static XTextDocument xTD2; + + @Override + protected void initialize(TestParameters Param, PrintWriter log) throws Exception { + SOfficeFactory SOF = SOfficeFactory.getFactory( + Param.getMSF()); + + log.println("creating a textdocument"); + xTextDoc = SOF.createTextDoc(null); + xTD2 = WriterTools.createTextDoc( + Param.getMSF()); + } + + @Override + protected void cleanup(TestParameters tParam, PrintWriter log) { + log.println(" disposing xTextDoc "); + + util.DesktopTools.closeDoc(xTextDoc); + util.DesktopTools.closeDoc(xTD2); + } + + @Override + protected TestEnvironment createTestEnvironment(TestParameters Param, + PrintWriter log) throws Exception { + XInterface oObj = null; + XWindowPeer the_win = null; + XToolkit the_kit = null; + XDevice aDevice = null; + XGraphics aGraphic = null; + XWindow anotherWindow = null; + + //Insert a ControlShape and get the ControlModel + XControlShape aShape = FormTools.createUnoControlShape(xTextDoc, 3000, + 4500, 15000, + 10000, + "CheckBox", + "UnoControlCheckBox"); + + WriterTools.getDrawPage(xTextDoc).add(aShape); + + XControlModel the_Model = aShape.getControl(); + + //Try to query XControlAccess + XControlAccess the_access = UnoRuntime.queryInterface( + XControlAccess.class, + xTextDoc.getCurrentController()); + + //get the CheckBoxControl for the needed Object relations + oObj = the_access.getControl(the_Model); + the_win = the_access.getControl(the_Model).getPeer(); + the_kit = the_win.getToolkit(); + aDevice = the_kit.createScreenCompatibleDevice(200, 200); + aGraphic = aDevice.createGraphics(); + + log.println("creating a new environment for UnoControlCheckBox object"); + + TestEnvironment tEnv = new TestEnvironment(oObj); + + + //Adding ObjRelation for XView + tEnv.addObjRelation("GRAPHICS", aGraphic); + + + //Adding ObjRelation for XControl + tEnv.addObjRelation("CONTEXT", xTextDoc); + tEnv.addObjRelation("WINPEER", the_win); + tEnv.addObjRelation("TOOLKIT", the_kit); + tEnv.addObjRelation("MODEL", the_Model); + + // adding object relation for XItemListener + ifc.awt._XItemListener.TestItemListener listener = + new ifc.awt._XItemListener.TestItemListener(); + XCheckBox check = UnoRuntime.queryInterface( + XCheckBox.class, oObj); + check.addItemListener(listener); + tEnv.addObjRelation("TestItemListener", listener); + + System.out.println("ImplementationName: " + utils.getImplName(oObj)); + + XController aController = xTD2.getCurrentController(); + XFrame aFrame = aController.getFrame(); + anotherWindow = aFrame.getComponentWindow(); + + + // Object Relation for XWindow + tEnv.addObjRelation("XWindow.AnotherWindow", anotherWindow); + + return tEnv; + } // finish method getTestEnvironment +} // finish class UnoControlCheckBox diff --git a/qadevOOo/tests/java/mod/_toolkit/UnoControlCheckBoxModel.java b/qadevOOo/tests/java/mod/_toolkit/UnoControlCheckBoxModel.java new file mode 100644 index 000000000..0a2930756 --- /dev/null +++ b/qadevOOo/tests/java/mod/_toolkit/UnoControlCheckBoxModel.java @@ -0,0 +1,71 @@ +/* + * 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._toolkit; + +import com.sun.star.text.XTextDocument; +import com.sun.star.uno.XInterface; + +import java.io.PrintWriter; + +import lib.TestCase; +import lib.TestEnvironment; +import lib.TestParameters; +import util.WriterTools; +import util.utils; + + +public class UnoControlCheckBoxModel extends TestCase { + private static XTextDocument xTextDoc; + + /** + * Creates StarOffice Writer document. + */ + @Override + protected void initialize(TestParameters tParam, PrintWriter log) throws Exception { + log.println("creating a textdocument"); + xTextDoc = WriterTools.createTextDoc( + tParam.getMSF()); + } + + /** + * Disposes StarOffice Writer document. + */ + @Override + protected void cleanup(TestParameters tParam, PrintWriter log) { + log.println(" disposing xTextDoc "); + + util.DesktopTools.closeDoc(xTextDoc); + } + + @Override + protected TestEnvironment createTestEnvironment(TestParameters Param, + PrintWriter log) throws Exception { + XInterface oObj = (XInterface) Param.getMSF().createInstance( + "com.sun.star.awt.UnoControlCheckBoxModel"); + + log.println( + "creating a new environment for UnoControlCheckBoxModel object"); + + TestEnvironment tEnv = new TestEnvironment(oObj); + + tEnv.addObjRelation("OBJNAME", "stardiv.vcl.controlmodel.CheckBox"); + System.out.println("ImplementationName: " + utils.getImplName(oObj)); + + return tEnv; + } // finish method getTestEnvironment +} // finish class UnoControlCheckBoxModel diff --git a/qadevOOo/tests/java/mod/_toolkit/UnoControlComboBox.java b/qadevOOo/tests/java/mod/_toolkit/UnoControlComboBox.java new file mode 100644 index 000000000..243e90c26 --- /dev/null +++ b/qadevOOo/tests/java/mod/_toolkit/UnoControlComboBox.java @@ -0,0 +1,138 @@ +/* + * 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._toolkit; + +import java.io.PrintWriter; + +import lib.TestCase; +import lib.TestEnvironment; +import lib.TestParameters; +import util.FormTools; +import util.SOfficeFactory; +import util.WriterTools; +import util.utils; + +import com.sun.star.awt.XControl; +import com.sun.star.awt.XControlModel; +import com.sun.star.awt.XDevice; +import com.sun.star.awt.XGraphics; +import com.sun.star.awt.XTextComponent; +import com.sun.star.awt.XToolkit; +import com.sun.star.awt.XWindow; +import com.sun.star.awt.XWindowPeer; +import com.sun.star.drawing.XControlShape; +import com.sun.star.text.XTextDocument; +import com.sun.star.uno.UnoRuntime; +import com.sun.star.uno.XInterface; +import com.sun.star.view.XControlAccess; + + +public class UnoControlComboBox extends TestCase { + private static XTextDocument xTextDoc; + + @Override + protected void initialize(TestParameters Param, PrintWriter log) throws Exception { + SOfficeFactory SOF = SOfficeFactory.getFactory( Param.getMSF()); + + log.println("creating a textdocument"); + xTextDoc = SOF.createTextDoc(null); + } + + @Override + protected void cleanup(TestParameters tParam, PrintWriter log) { + log.println(" disposing xTextDoc "); + +util.DesktopTools.closeDoc(xTextDoc); + } + + @Override + protected TestEnvironment createTestEnvironment(TestParameters Param, + PrintWriter log) throws Exception { + XInterface oObj = null; + XWindowPeer the_win = null; + XToolkit the_kit = null; + XDevice aDevice = null; + XGraphics aGraphic = null; + XControl aControl = null; + + //Insert a ControlShape and get the ControlModel + XControlShape aShape = FormTools.createUnoControlShape(xTextDoc, 3000, + 4500, 15000, + 10000, + "ComboBox", + "UnoControlComboBox"); + + WriterTools.getDrawPage(xTextDoc).add(aShape); + + XControlModel the_Model = aShape.getControl(); + + XControlShape aShape2 = FormTools.createControlShape(xTextDoc, 3000, + 4500, 5000, 10000, + "TextField"); + + WriterTools.getDrawPage(xTextDoc).add(aShape2); + + XControlModel the_Model2 = aShape2.getControl(); + + //Try to query XControlAccess + XControlAccess the_access = UnoRuntime.queryInterface( + XControlAccess.class, + xTextDoc.getCurrentController()); + + //get the ComboBoxControl for the needed Object relations + oObj = the_access.getControl(the_Model); + aControl = the_access.getControl(the_Model2); + the_win = the_access.getControl(the_Model).getPeer(); + the_kit = the_win.getToolkit(); + aDevice = the_kit.createScreenCompatibleDevice(200, 200); + aGraphic = aDevice.createGraphics(); + + log.println("creating a new environment for UnoControlComboBox object"); + + TestEnvironment tEnv = new TestEnvironment(oObj); + + + //Adding ObjRelation for XView + tEnv.addObjRelation("GRAPHICS", aGraphic); + + + //Adding ObjRelation for XControl + tEnv.addObjRelation("CONTEXT", xTextDoc); + tEnv.addObjRelation("WINPEER", the_win); + tEnv.addObjRelation("TOOLKIT", the_kit); + tEnv.addObjRelation("MODEL", the_Model); + + XWindow forObjRel = UnoRuntime.queryInterface(XWindow.class, + aControl); + + tEnv.addObjRelation("XWindow.AnotherWindow", forObjRel); + tEnv.addObjRelation("XWindow.ControlShape", aShape); + + // Adding relation for XTextListener + ifc.awt._XTextListener.TestTextListener listener = + new ifc.awt._XTextListener.TestTextListener(); + XTextComponent textComp = UnoRuntime.queryInterface( + XTextComponent.class, oObj); + textComp.addTextListener(listener); + tEnv.addObjRelation("TestTextListener", listener); + + log.println("ImplementationName: " + utils.getImplName(oObj)); + + return tEnv; + } // finish method getTestEnvironment +} // finish class UnoControlComboBox diff --git a/qadevOOo/tests/java/mod/_toolkit/UnoControlComboBoxModel.java b/qadevOOo/tests/java/mod/_toolkit/UnoControlComboBoxModel.java new file mode 100644 index 000000000..7c6477321 --- /dev/null +++ b/qadevOOo/tests/java/mod/_toolkit/UnoControlComboBoxModel.java @@ -0,0 +1,77 @@ +/* + * 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._toolkit; + +import com.sun.star.text.XTextDocument; +import com.sun.star.uno.XInterface; + +import java.io.PrintWriter; + +import lib.TestCase; +import lib.TestEnvironment; +import lib.TestParameters; + +import util.WriterTools; +import util.utils; + + +public class UnoControlComboBoxModel extends TestCase { + private static XTextDocument xTextDoc; + + /** + * Creates StarOffice Writer document. + */ + @Override + protected void initialize(TestParameters tParam, PrintWriter log) throws Exception { + log.println("creating a textdocument"); + xTextDoc = WriterTools.createTextDoc( + tParam.getMSF()); + } + + /** + * Disposes StarOffice Writer document. + */ + @Override + protected void cleanup(TestParameters tParam, PrintWriter log) { + log.println(" disposing xTextDoc "); + + util.DesktopTools.closeDoc(xTextDoc); + } + + @Override + protected TestEnvironment createTestEnvironment(TestParameters Param, + PrintWriter log) { + XInterface oObj = null; + + try { + oObj = (XInterface) Param.getMSF().createInstance( + "com.sun.star.awt.UnoControlComboBoxModel"); + } catch (Exception e) { + } + + log.println( + "creating a new environment for UnoControlComboBoxModel object"); + + TestEnvironment tEnv = new TestEnvironment(oObj); + + tEnv.addObjRelation("OBJNAME", "stardiv.vcl.controlmodel.ComboBox"); + System.out.println("ImplementationName: " + utils.getImplName(oObj)); + + return tEnv; + } // finish method getTestEnvironment +} // finish class UnoControlComboBoxModel diff --git a/qadevOOo/tests/java/mod/_toolkit/UnoControlContainer.java b/qadevOOo/tests/java/mod/_toolkit/UnoControlContainer.java new file mode 100644 index 000000000..7c872dfaa --- /dev/null +++ b/qadevOOo/tests/java/mod/_toolkit/UnoControlContainer.java @@ -0,0 +1,204 @@ +/* + * 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._toolkit; + +import com.sun.star.awt.PosSize; +import com.sun.star.awt.Rectangle; +import com.sun.star.awt.XControl; +import com.sun.star.awt.XControlContainer; +import com.sun.star.awt.XControlModel; +import com.sun.star.awt.XDevice; +import com.sun.star.awt.XGraphics; +import com.sun.star.awt.XToolkit; +import com.sun.star.awt.XWindow; +import com.sun.star.awt.XWindowPeer; +import com.sun.star.drawing.XControlShape; +import com.sun.star.frame.XController; +import com.sun.star.frame.XFrame; +import com.sun.star.text.XTextDocument; +import com.sun.star.uno.UnoRuntime; +import com.sun.star.uno.XInterface; +import com.sun.star.view.XControlAccess; + +import java.io.PrintWriter; + +import lib.TestCase; +import lib.TestEnvironment; +import lib.TestParameters; +import util.FormTools; +import util.WriterTools; +import util.utils; + + +public class UnoControlContainer extends TestCase { + private static XTextDocument xTextDoc; + private static XTextDocument xTD2; + private static XControl xCtrl1; + private static XControl xCtrl2; + + @Override + protected void initialize(TestParameters Param, PrintWriter log) throws Exception { + log.println("creating a textdocument"); + xTD2 = WriterTools.createTextDoc( + Param.getMSF()); + xTextDoc = WriterTools.createTextDoc( + Param.getMSF()); + } + + @Override + protected void cleanup(TestParameters tParam, PrintWriter log) { + log.println(" disposing xTextDoc "); + + util.DesktopTools.closeDoc(xTextDoc); + util.DesktopTools.closeDoc(xTD2); + } + + @Override + public TestEnvironment createTestEnvironment(TestParameters param, + PrintWriter log) throws Exception { + // create Object Relations ------------------------------------------- + XInterface oObj = null; + XControlShape shape = null; + XControlModel model = null; + XControlAccess access = null; + XWindow anotherWindow = null; + + // for XControl + XWindowPeer the_win = null; + XToolkit the_kit = null; + + XControlContainer ctrlCont = null; + + XGraphics aGraphic = null; + + + // create 3 XControls + // create first XControl + shape = FormTools.createControlShape(xTextDoc, 3000, 4500, 15000, + 10000, "TextField"); + WriterTools.getDrawPage(xTextDoc).add(shape); + model = shape.getControl(); + access = UnoRuntime.queryInterface( + XControlAccess.class, xTextDoc.getCurrentController()); + + access.getControl(model); + + + // create second XControl + shape = FormTools.createControlShape(xTextDoc, 3000, 4500, 15000, + 10000, "TextField"); + WriterTools.getDrawPage(xTextDoc).add(shape); + model = shape.getControl(); + access = UnoRuntime.queryInterface( + XControlAccess.class, xTextDoc.getCurrentController()); + + xCtrl1 = access.getControl(model); + + + // create third XControl + shape = FormTools.createControlShape(xTextDoc, 3000, 4500, 15000, + 10000, "CommandButton"); + WriterTools.getDrawPage(xTextDoc).add(shape); + model = shape.getControl(); + access = UnoRuntime.queryInterface( + XControlAccess.class, xTextDoc.getCurrentController()); + + xCtrl2 = access.getControl(model); + + // create XToolkit, XWindowPeer, XDevice + //Insert a ControlShape and get the ControlModel + XControlShape aShape = FormTools.createUnoControlShape(xTextDoc, 3000, + 4500, 15000, + 10000, + "CommandButton", + "UnoControlButton"); + + WriterTools.getDrawPage(xTD2).add(aShape); + + XControlModel the_Model = aShape.getControl(); + + //Try to query XControlAccess + XControlAccess the_access = UnoRuntime.queryInterface( + XControlAccess.class, + xTD2.getCurrentController()); + + //get the ButtonControl for the needed Object relations + the_win = the_access.getControl(the_Model).getPeer(); + the_kit = the_win.getToolkit(); + + XDevice aDevice = the_kit.createScreenCompatibleDevice(200, 200); + aGraphic = aDevice.createGraphics(); + + XController aController = xTD2.getCurrentController(); + XFrame aFrame = aController.getFrame(); + anotherWindow = aFrame.getComponentWindow(); + + // finished create Object Relations ----------------------------------- + // create the UnoControlContainer + oObj = (XInterface) param.getMSF().createInstance( + "com.sun.star.awt.UnoControlContainer"); + + XControl xCtrl = UnoRuntime.queryInterface( + XControl.class, oObj); + xCtrl.setModel(the_Model); + + ctrlCont = UnoRuntime.queryInterface( + XControlContainer.class, oObj); + ctrlCont.addControl("jupp", access.getControl(aShape.getControl())); + + log.println( + "creating a new environment for UnoControlContainer object"); + + TestEnvironment tEnv = new TestEnvironment(oObj); + + XWindow xWindow = UnoRuntime.queryInterface(XWindow.class, oObj); + Rectangle ps = xWindow.getPosSize(); + xWindow.setPosSize(ps.X+10, ps.Y+10, ps.Width+10, ps.Height+10, PosSize.POSSIZE); + + String objName = "UnoControlContainer"; + tEnv.addObjRelation("OBJNAME", "toolkit." + objName); + + + // Object relation for XContainer + tEnv.addObjRelation("XContainer.Container", ctrlCont); + tEnv.addObjRelation("INSTANCE", xCtrl); + + + //Adding ObjRelation for XView + tEnv.addObjRelation("GRAPHICS", aGraphic); + + + // Object Relation for XControlContainer + tEnv.addObjRelation("CONTROL1", xCtrl1); + tEnv.addObjRelation("CONTROL2", xCtrl2); + + + // Object Relation for XControl + tEnv.addObjRelation("CONTEXT", xTD2); + tEnv.addObjRelation("WINPEER", the_win); + tEnv.addObjRelation("TOOLKIT", the_kit); + tEnv.addObjRelation("MODEL", the_Model); + + + // Object Relation for XWindow + tEnv.addObjRelation("XWindow.AnotherWindow", anotherWindow); + System.out.println("ImplementationName: " + utils.getImplName(oObj)); + + return tEnv; + } +} diff --git a/qadevOOo/tests/java/mod/_toolkit/UnoControlContainerModel.java b/qadevOOo/tests/java/mod/_toolkit/UnoControlContainerModel.java new file mode 100644 index 000000000..cd3845560 --- /dev/null +++ b/qadevOOo/tests/java/mod/_toolkit/UnoControlContainerModel.java @@ -0,0 +1,47 @@ +/* + * 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._toolkit; + +import com.sun.star.uno.XInterface; + +import java.io.PrintWriter; + +import lib.TestCase; +import lib.TestEnvironment; +import lib.TestParameters; +import util.utils; + + +public class UnoControlContainerModel extends TestCase { + @Override + public TestEnvironment createTestEnvironment(TestParameters param, + PrintWriter log) throws Exception { + XInterface oObj = (XInterface) param.getMSF().createInstance( + "com.sun.star.awt.UnoControlContainerModel"); + + log.println( + "creating a new environment for UnoControlContainer object"); + + TestEnvironment tEnv = new TestEnvironment(oObj); + tEnv.addObjRelation("OBJNAME", + "stardiv.vcl.controlmodel.ControlContainer"); + System.out.println("ImplementationName: " + utils.getImplName(oObj)); + + return tEnv; + } +}
\ No newline at end of file diff --git a/qadevOOo/tests/java/mod/_toolkit/UnoControlCurrencyField.java b/qadevOOo/tests/java/mod/_toolkit/UnoControlCurrencyField.java new file mode 100644 index 000000000..60c65000c --- /dev/null +++ b/qadevOOo/tests/java/mod/_toolkit/UnoControlCurrencyField.java @@ -0,0 +1,140 @@ +/* + * 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._toolkit; + +import com.sun.star.awt.XControl; +import com.sun.star.awt.XControlModel; +import com.sun.star.awt.XDevice; +import com.sun.star.awt.XGraphics; +import com.sun.star.awt.XTextComponent; +import com.sun.star.awt.XToolkit; +import com.sun.star.awt.XWindow; +import com.sun.star.awt.XWindowPeer; +import com.sun.star.drawing.XControlShape; +import com.sun.star.text.XTextDocument; +import com.sun.star.uno.UnoRuntime; +import com.sun.star.uno.XInterface; +import com.sun.star.view.XControlAccess; + +import java.io.PrintWriter; + +import lib.TestCase; +import lib.TestEnvironment; +import lib.TestParameters; +import util.FormTools; +import util.SOfficeFactory; +import util.WriterTools; +import util.utils; + + +public class UnoControlCurrencyField extends TestCase { + private static XTextDocument xTextDoc; + + @Override + protected void initialize(TestParameters Param, PrintWriter log) throws Exception { + SOfficeFactory SOF = SOfficeFactory.getFactory( + Param.getMSF()); + + log.println("creating a textdocument"); + xTextDoc = SOF.createTextDoc(null); + } + + @Override + protected void cleanup(TestParameters tParam, PrintWriter log) { + log.println(" disposing xTextDoc "); + + util.DesktopTools.closeDoc(xTextDoc); + } + + @Override + protected TestEnvironment createTestEnvironment(TestParameters Param, + PrintWriter log) throws Exception { + XInterface oObj = null; + XWindowPeer the_win = null; + XToolkit the_kit = null; + XDevice aDevice = null; + XGraphics aGraphic = null; + XControl aControl = null; + + //Insert a ControlShape and get the ControlModel + XControlShape aShape = FormTools.createUnoControlShape(xTextDoc, 3000, + 4500, 15000, + 10000, + "CurrencyField", + "UnoControlCurrencyField"); + + WriterTools.getDrawPage(xTextDoc).add(aShape); + + XControlModel the_Model = aShape.getControl(); + + XControlShape aShape2 = FormTools.createControlShape(xTextDoc, 3000, + 4500, 5000, 10000, + "TextField"); + + WriterTools.getDrawPage(xTextDoc).add(aShape2); + + XControlModel the_Model2 = aShape2.getControl(); + + //Try to query XControlAccess + XControlAccess the_access = UnoRuntime.queryInterface( + XControlAccess.class, + xTextDoc.getCurrentController()); + + //get the CurrencyFieldControl for the needed Object relations + oObj = the_access.getControl(the_Model); + aControl = the_access.getControl(the_Model2); + the_win = the_access.getControl(the_Model).getPeer(); + the_kit = the_win.getToolkit(); + aDevice = the_kit.createScreenCompatibleDevice(200, 200); + aGraphic = aDevice.createGraphics(); + + log.println( + "creating a new environment for UnoControlCurrencyField object"); + + TestEnvironment tEnv = new TestEnvironment(oObj); + + + //Adding ObjRelation for XView + tEnv.addObjRelation("GRAPHICS", aGraphic); + + + //Adding ObjRelation for XControl + tEnv.addObjRelation("CONTEXT", xTextDoc); + tEnv.addObjRelation("WINPEER", the_win); + tEnv.addObjRelation("TOOLKIT", the_kit); + tEnv.addObjRelation("MODEL", the_Model); + + XWindow forObjRel = UnoRuntime.queryInterface(XWindow.class, + aControl); + + tEnv.addObjRelation("XWindow.AnotherWindow", forObjRel); + tEnv.addObjRelation("XWindow.ControlShape", aShape); + + // Adding relation for XTextListener + ifc.awt._XTextListener.TestTextListener listener = + new ifc.awt._XTextListener.TestTextListener(); + XTextComponent textComp = UnoRuntime.queryInterface( + XTextComponent.class, oObj); + textComp.addTextListener(listener); + tEnv.addObjRelation("TestTextListener", listener); + + log.println("ImplementationName: " + utils.getImplName(oObj)); + + return tEnv; + } // finish method getTestEnvironment +} // finish class UnoControlCurrencyField diff --git a/qadevOOo/tests/java/mod/_toolkit/UnoControlCurrencyFieldModel.java b/qadevOOo/tests/java/mod/_toolkit/UnoControlCurrencyFieldModel.java new file mode 100644 index 000000000..65f9b528c --- /dev/null +++ b/qadevOOo/tests/java/mod/_toolkit/UnoControlCurrencyFieldModel.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._toolkit; + +import com.sun.star.text.XTextDocument; +import com.sun.star.uno.XInterface; + +import java.io.PrintWriter; + +import lib.TestCase; +import lib.TestEnvironment; +import lib.TestParameters; + +import util.WriterTools; +import util.utils; + + +public class UnoControlCurrencyFieldModel extends TestCase { + private static XTextDocument xTextDoc; + + /** + * Creates StarOffice Writer document. + */ + @Override + protected void initialize(TestParameters tParam, PrintWriter log) throws Exception { + log.println("creating a textdocument"); + xTextDoc = WriterTools.createTextDoc( + tParam.getMSF()); + } + + /** + * Disposes StarOffice Writer document. + */ + @Override + protected void cleanup(TestParameters tParam, PrintWriter log) { + log.println(" disposing xTextDoc "); + + util.DesktopTools.closeDoc(xTextDoc); + } + + @Override + protected TestEnvironment createTestEnvironment(TestParameters Param, + PrintWriter log) { + XInterface oObj = null; + + try { + oObj = (XInterface) Param.getMSF().createInstance( + "com.sun.star.awt.UnoControlCurrencyFieldModel"); + } catch (Exception e) { + } + + log.println("creating a new environment for " + + "UnoControlCurrencyFieldModel object"); + + TestEnvironment tEnv = new TestEnvironment(oObj); + + tEnv.addObjRelation("OBJNAME", + "stardiv.vcl.controlmodel.CurrencyField"); + System.out.println("ImplementationName: " + utils.getImplName(oObj)); + + return tEnv; + } // finish method getTestEnvironment +} // finish class UnoControlCurrencyFieldModel diff --git a/qadevOOo/tests/java/mod/_toolkit/UnoControlDateField.java b/qadevOOo/tests/java/mod/_toolkit/UnoControlDateField.java new file mode 100644 index 000000000..f9abc3c69 --- /dev/null +++ b/qadevOOo/tests/java/mod/_toolkit/UnoControlDateField.java @@ -0,0 +1,139 @@ +/* + * 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._toolkit; + +import com.sun.star.awt.XControlModel; +import com.sun.star.awt.XDevice; +import com.sun.star.awt.XGraphics; +import com.sun.star.awt.XTextComponent; +import com.sun.star.awt.XToolkit; +import com.sun.star.awt.XWindow; +import com.sun.star.awt.XWindowPeer; +import com.sun.star.drawing.XControlShape; +import com.sun.star.frame.XController; +import com.sun.star.frame.XFrame; +import com.sun.star.text.XTextDocument; +import com.sun.star.uno.UnoRuntime; +import com.sun.star.uno.XInterface; +import com.sun.star.view.XControlAccess; + +import java.io.PrintWriter; + +import lib.TestCase; +import lib.TestEnvironment; +import lib.TestParameters; +import util.FormTools; +import util.SOfficeFactory; +import util.WriterTools; +import util.utils; + + +public class UnoControlDateField extends TestCase { + private static XTextDocument xTextDoc; + private static XTextDocument xTD2; + + @Override + protected void initialize(TestParameters Param, PrintWriter log) throws Exception { + SOfficeFactory SOF = SOfficeFactory.getFactory( + Param.getMSF()); + + log.println("creating a textdocument"); + xTextDoc = SOF.createTextDoc(null); + xTD2 = WriterTools.createTextDoc( + Param.getMSF()); + } + + @Override + protected void cleanup(TestParameters tParam, PrintWriter log) { + log.println(" disposing xTextDoc "); + + util.DesktopTools.closeDoc(xTextDoc); + util.DesktopTools.closeDoc(xTD2); + } + + @Override + protected TestEnvironment createTestEnvironment(TestParameters Param, + PrintWriter log) throws Exception { + XInterface oObj = null; + XWindowPeer the_win = null; + XToolkit the_kit = null; + XDevice aDevice = null; + XGraphics aGraphic = null; + XWindow anotherWindow = null; + + //Insert a ControlShape and get the ControlModel + XControlShape aShape = FormTools.createUnoControlShape(xTextDoc, 3000, + 4500, 15000, + 10000, + "DateField", + "UnoControlDateField"); + + WriterTools.getDrawPage(xTextDoc).add(aShape); + + XControlModel the_Model = aShape.getControl(); + + //Try to query XControlAccess + XControlAccess the_access = UnoRuntime.queryInterface( + XControlAccess.class, + xTextDoc.getCurrentController()); + + //get the DateFieldControl for the needed Object relations + oObj = the_access.getControl(the_Model); + the_win = the_access.getControl(the_Model).getPeer(); + the_kit = the_win.getToolkit(); + aDevice = the_kit.createScreenCompatibleDevice(200, 200); + aGraphic = aDevice.createGraphics(); + + log.println( + "creating a new environment for UnoControlDateField object"); + + TestEnvironment tEnv = new TestEnvironment(oObj); + + + //Adding ObjRelation for XView + tEnv.addObjRelation("GRAPHICS", aGraphic); + + + //Adding ObjRelation for XControl + tEnv.addObjRelation("CONTEXT", xTextDoc); + tEnv.addObjRelation("WINPEER", the_win); + tEnv.addObjRelation("TOOLKIT", the_kit); + tEnv.addObjRelation("MODEL", the_Model); + + System.out.println("ImplementationName: " + utils.getImplName(oObj)); + + XController aController = xTD2.getCurrentController(); + XFrame aFrame = aController.getFrame(); + anotherWindow = aFrame.getComponentWindow(); + + + // Object Relation for XWindow + tEnv.addObjRelation("XWindow.AnotherWindow", anotherWindow); + tEnv.addObjRelation("XWindow.ControlShape", aShape); + + // Adding relation for XTextListener + ifc.awt._XTextListener.TestTextListener listener = + new ifc.awt._XTextListener.TestTextListener(); + XTextComponent textComp = UnoRuntime.queryInterface( + XTextComponent.class, oObj); + textComp.addTextListener(listener); + tEnv.addObjRelation("TestTextListener", listener); + + return tEnv; + } // finish method getTestEnvironment +} // finish class UnoControlDateField diff --git a/qadevOOo/tests/java/mod/_toolkit/UnoControlDateFieldModel.java b/qadevOOo/tests/java/mod/_toolkit/UnoControlDateFieldModel.java new file mode 100644 index 000000000..82344269d --- /dev/null +++ b/qadevOOo/tests/java/mod/_toolkit/UnoControlDateFieldModel.java @@ -0,0 +1,77 @@ +/* + * 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._toolkit; + +import com.sun.star.text.XTextDocument; +import com.sun.star.uno.XInterface; + +import java.io.PrintWriter; + +import lib.TestCase; +import lib.TestEnvironment; +import lib.TestParameters; + +import util.WriterTools; +import util.utils; + + +public class UnoControlDateFieldModel extends TestCase { + private static XTextDocument xTextDoc; + + /** + * Creates StarOffice Writer document. + */ + @Override + protected void initialize(TestParameters tParam, PrintWriter log) throws Exception { + log.println("creating a textdocument"); + xTextDoc = WriterTools.createTextDoc( + tParam.getMSF()); + } + + /** + * Disposes StarOffice Writer document. + */ + @Override + protected void cleanup(TestParameters tParam, PrintWriter log) { + log.println(" disposing xTextDoc "); + + util.DesktopTools.closeDoc(xTextDoc); + } + + @Override + protected TestEnvironment createTestEnvironment(TestParameters Param, + PrintWriter log) { + XInterface oObj = null; + + try { + oObj = (XInterface) Param.getMSF().createInstance( + "com.sun.star.awt.UnoControlDateFieldModel"); + } catch (Exception e) { + } + + log.println( + "creating a new environment for UnoControlDateFieldModel object"); + + TestEnvironment tEnv = new TestEnvironment(oObj); + + tEnv.addObjRelation("OBJNAME", "stardiv.vcl.controlmodel.DateField"); + System.out.println("ImplementationName: " + utils.getImplName(oObj)); + + return tEnv; + } // finish method getTestEnvironment +} // finish class UnoControlDateFieldModel diff --git a/qadevOOo/tests/java/mod/_toolkit/UnoControlDialog.java b/qadevOOo/tests/java/mod/_toolkit/UnoControlDialog.java new file mode 100644 index 000000000..2f0e6ddc7 --- /dev/null +++ b/qadevOOo/tests/java/mod/_toolkit/UnoControlDialog.java @@ -0,0 +1,241 @@ +/* + * 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._toolkit; + +import com.sun.star.awt.PosSize; +import com.sun.star.awt.XControl; +import com.sun.star.awt.XControlContainer; +import com.sun.star.awt.XControlModel; +import com.sun.star.awt.XDevice; +import com.sun.star.awt.XGraphics; +import com.sun.star.awt.XTabController; +import com.sun.star.awt.XToolkit; +import com.sun.star.awt.XWindow; +import com.sun.star.awt.XWindowPeer; +import com.sun.star.lang.XMultiServiceFactory; +import com.sun.star.text.XTextDocument; +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.SOfficeFactory; + + +/** +* Test for object which is represented by service +* <code>com.sun.star.awt.UnoControlDialog</code>. <p> +* Object implements the following interfaces : +* <ul> +* <li> <code>com::sun::star::lang::XComponent</code></li> +* <li> <code>com::sun::star::awt::XWindow</code></li> +* <li> <code>com::sun::star::awt::XDialog</code></li> +* <li> <code>com::sun::star::awt::XControl</code></li> +* <li> <code>com::sun::star::awt::XTopWindow</code></li> +* <li> <code>com::sun::star::awt::XControlContainer</code></li> +* <li> <code>com::sun::star::awt::XView</code></li> +* </ul> +* This object test <b> is NOT </b> designed to be run in several +* threads concurrently. +* @see com.sun.star.lang.XComponent +* @see com.sun.star.awt.XWindow +* @see com.sun.star.awt.XDialog +* @see com.sun.star.awt.XControl +* @see com.sun.star.awt.XTopWindow +* @see com.sun.star.awt.XControlContainer +* @see com.sun.star.awt.XView +* @see ifc.lang._XComponent +* @see ifc.awt._XWindow +* @see ifc.awt._XDialog +* @see ifc.awt._XControl +* @see ifc.awt._XTopWindow +* @see ifc.awt._XControlContainer +* @see ifc.awt._XView +*/ +public class UnoControlDialog extends TestCase { + private static XWindow xWinDlg = null; + private static XTextDocument xTextDoc; + + /** + * Creating a TestEnvironment for the interfaces to be tested. + * Creates a Dialog Control and Model instance defines Model + * for Control, adds to Dialog a button, sets its size and + * sets the dialog visible. <p> + */ + @Override + public TestEnvironment createTestEnvironment(TestParameters Param, + PrintWriter log) { + XInterface oObj = null; + XMultiServiceFactory xMSF = Param.getMSF(); + XControlModel dlgModel = null; + + XWindowPeer the_win = null; + XToolkit the_kit = null; + XDevice aDevice = null; + XGraphics aGraphic = null; + + XControl butControl = null; + XControl butControl1 = null; + XControl butControl2 = null; + XTabController tabControl1 = null; + XTabController tabControl2 = null; + + XControlContainer ctrlCont = null; + + if (xWinDlg != null) { + xWinDlg.dispose(); + } + + try { + dlgModel = UnoRuntime.queryInterface( + XControlModel.class, + xMSF.createInstance( + "com.sun.star.awt.UnoControlDialogModel")); + + XControl dlgControl = UnoRuntime.queryInterface( + XControl.class, + xMSF.createInstance( + "com.sun.star.awt.UnoControlDialog")); + + dlgControl.setModel(dlgModel); + + XControlModel butModel = UnoRuntime.queryInterface( + XControlModel.class, + xMSF.createInstance( + "com.sun.star.awt.UnoControlButtonModel")); + + butControl = UnoRuntime.queryInterface(XControl.class, + xMSF.createInstance( + "com.sun.star.awt.UnoControlButton")); + + butControl.setModel(butModel); + + + // creating additional controls for XUnoControlContainer + tabControl1 = UnoRuntime.queryInterface( + XTabController.class, + xMSF.createInstance( + "com.sun.star.awt.TabController")); + + tabControl2 = UnoRuntime.queryInterface( + XTabController.class, + xMSF.createInstance( + "com.sun.star.awt.TabController")); + + + // creating additional controls for XControlContainer + butModel = UnoRuntime.queryInterface( + XControlModel.class, + xMSF.createInstance( + "com.sun.star.awt.UnoControlButtonModel")); + + butControl1 = UnoRuntime.queryInterface(XControl.class, + xMSF.createInstance( + "com.sun.star.awt.UnoControlButton")); + + butControl1.setModel(butModel); + + butModel = UnoRuntime.queryInterface( + XControlModel.class, + xMSF.createInstance( + "com.sun.star.awt.UnoControlButtonModel")); + + butControl2 = UnoRuntime.queryInterface(XControl.class, + xMSF.createInstance( + "com.sun.star.awt.UnoControlButton")); + + butControl2.setModel(butModel); + + ctrlCont = UnoRuntime.queryInterface( + XControlContainer.class, dlgControl); + + xWinDlg = UnoRuntime.queryInterface(XWindow.class, + dlgControl); + + xWinDlg.setVisible(true); + + xWinDlg.setPosSize(10, 10, 220, 110, PosSize.SIZE); + + the_win = dlgControl.getPeer(); + the_kit = the_win.getToolkit(); + aDevice = the_kit.createScreenCompatibleDevice(220, 220); + aGraphic = aDevice.createGraphics(); + + oObj = dlgControl; + } catch (com.sun.star.uno.Exception e) { + log.println("Error creating dialog :"); + e.printStackTrace(log); + } + + log.println("creating a new environment for object"); + + TestEnvironment tEnv = new TestEnvironment(oObj); + + + //Adding ObjRelation for XView + tEnv.addObjRelation("GRAPHICS", aGraphic); + + + //Adding ObjRelation for XControl + tEnv.addObjRelation("CONTEXT", dlgModel); + tEnv.addObjRelation("WINPEER", the_win); + tEnv.addObjRelation("TOOLKIT", the_kit); + tEnv.addObjRelation("MODEL", dlgModel); + + tEnv.addObjRelation("INSTANCE", butControl); + tEnv.addObjRelation("XContainer.Container", ctrlCont); + + + // adding relations for XUnoControlContainer + tEnv.addObjRelation("TABCONTROL1", tabControl1); + tEnv.addObjRelation("TABCONTROL2", tabControl2); + + + // adding relations for XControlContainer + tEnv.addObjRelation("CONTROL1", butControl1); + tEnv.addObjRelation("CONTROL2", butControl2); + + XWindow forObjRel = xTextDoc.getCurrentController().getFrame() + .getComponentWindow(); + tEnv.addObjRelation("XWindow.AnotherWindow", forObjRel); + + return tEnv; + } // finish method getTestEnvironment + + @Override + protected void cleanup(TestParameters tParam, PrintWriter log) { + log.println("Disposing dialog ..."); + xWinDlg.dispose(); + log.println(" disposing xTextDoc "); + + util.DesktopTools.closeDoc(xTextDoc); + } + + @Override + protected void initialize(TestParameters tParam, PrintWriter log) throws Exception { + SOfficeFactory SOF = SOfficeFactory.getFactory( + tParam.getMSF()); + + log.println("creating a textdocument"); + xTextDoc = SOF.createTextDoc(null); + } +} diff --git a/qadevOOo/tests/java/mod/_toolkit/UnoControlDialogModel.java b/qadevOOo/tests/java/mod/_toolkit/UnoControlDialogModel.java new file mode 100644 index 000000000..8e2aa77b0 --- /dev/null +++ b/qadevOOo/tests/java/mod/_toolkit/UnoControlDialogModel.java @@ -0,0 +1,173 @@ +/* + * 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._toolkit; + +import com.sun.star.awt.XControl; +import com.sun.star.awt.XControlModel; +import com.sun.star.beans.XPropertySet; +import com.sun.star.container.XNameContainer; +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.utils; + + +/** +* Test for object which is represented by service +* <code>com.sun.star.awt.UnoControlDialogModel</code>. <p> +* Object implements the following interfaces : +* <ul> +* <li> <code>com::sun::star::awt::UnoControlDialogModel</code></li> +* <li> <code>com::sun::star::io::XPersistObject</code></li> +* <li> <code>com::sun::star::lang::XComponent</code></li> +* <li> <code>com::sun::star::beans::XPropertySet</code></li> +* <li> <code>com::sun::star::beans::XMultiPropertySet</code></li> +* </ul> +* This object test <b> is NOT </b> designed to be run in several +* threads concurrently. +* @see com.sun.star.awt.UnoControlDialogModel +* @see com.sun.star.io.XPersistObject +* @see com.sun.star.lang.XComponent +* @see com.sun.star.beans.XPropertySet +* @see com.sun.star.beans.XMultiPropertySet +* @see ifc.awt._UnoControlDialogModel +* @see ifc.io._XPersistObject +* @see ifc.lang._XComponent +* @see ifc.beans._XPropertySet +* @see ifc.beans._XMultiPropertySet +*/ +public class UnoControlDialogModel extends TestCase { + /** + * Creating a TestEnvironment for the interfaces to be tested. + * Creates an instance of the service + * <code>com.sun.star.awt.UnoControlDialogModel</code>. + * Object relations created : + * <ul> + * <li> <code>'OBJNAME'</code> for + * {@link ifc.io._XPersistObject} </li> + * </ul> + */ + @Override + protected TestEnvironment createTestEnvironment(TestParameters Param, + PrintWriter log) throws Exception { + XInterface oObj = null; + XInterface dialogModel = null; + String _buttonName = "MyButton"; + String _labelName = "MyLabel"; + String _labelPrefix = "MyLabelPrefix"; + XMultiServiceFactory xMultiServiceFactory = null; + + dialogModel = (XInterface) Param.getMSF().createInstance( + "com.sun.star.awt.UnoControlDialogModel"); + + // create the dialog model and set the properties + XPropertySet xPSetDialog = UnoRuntime.queryInterface( + XPropertySet.class, dialogModel); + xPSetDialog.setPropertyValue("PositionX", Integer.valueOf(100)); + xPSetDialog.setPropertyValue("PositionY", Integer.valueOf(100)); + xPSetDialog.setPropertyValue("Width", Integer.valueOf(150)); + xPSetDialog.setPropertyValue("Height", Integer.valueOf(100)); + xPSetDialog.setPropertyValue("Title", "Runtime Dialog Demo"); + + // get the service manager from the dialog model + xMultiServiceFactory = UnoRuntime.queryInterface( + XMultiServiceFactory.class, + dialogModel); + + // create the button model and set the properties + Object buttonModel = xMultiServiceFactory.createInstance( + "com.sun.star.awt.UnoControlButtonModel"); + XPropertySet xPSetButton = UnoRuntime.queryInterface( + XPropertySet.class, buttonModel); + xPSetButton.setPropertyValue("PositionX", Integer.valueOf(50)); + xPSetButton.setPropertyValue("PositionY", Integer.valueOf(30)); + xPSetButton.setPropertyValue("Width", Integer.valueOf(50)); + xPSetButton.setPropertyValue("Height", Integer.valueOf(14)); + xPSetButton.setPropertyValue("Name", _buttonName); + xPSetButton.setPropertyValue("TabIndex", Short.valueOf((short) 0)); + xPSetButton.setPropertyValue("Label", "Click Me"); + + // create the label model and set the properties + Object labelModel = xMultiServiceFactory.createInstance( + "com.sun.star.awt.UnoControlFixedTextModel"); + XPropertySet xPSetLabel = UnoRuntime.queryInterface( + XPropertySet.class, labelModel); + xPSetLabel.setPropertyValue("PositionX", Integer.valueOf(40)); + xPSetLabel.setPropertyValue("PositionY", Integer.valueOf(60)); + xPSetLabel.setPropertyValue("Width", Integer.valueOf(100)); + xPSetLabel.setPropertyValue("Height", Integer.valueOf(14)); + xPSetLabel.setPropertyValue("Name", _labelName); + xPSetLabel.setPropertyValue("TabIndex", Short.valueOf((short) 1)); + xPSetLabel.setPropertyValue("Label", _labelPrefix); + + // insert the control models into the dialog model + XNameContainer xNameCont = UnoRuntime.queryInterface( + XNameContainer.class, + dialogModel); + xNameCont.insertByName(_buttonName, buttonModel); + xNameCont.insertByName(_labelName, labelModel); + + // create the dialog control and set the model + XControl dialog = UnoRuntime.queryInterface( + XControl.class, + Param.getMSF().createInstance( + "com.sun.star.awt.UnoControlDialog")); + XControl xControl = UnoRuntime.queryInterface( + XControl.class, dialog); + XControlModel xControlModel = UnoRuntime.queryInterface( + XControlModel.class, + dialogModel); + xControl.setModel(xControlModel); + + oObj = dialogModel; + + log.println("creating a new environment for object"); + + UnoRuntime.queryInterface( + XMultiServiceFactory.class, oObj); + + TestEnvironment tEnv = new TestEnvironment(oObj); + + try { + // XNameReplace + tEnv.addObjRelation("INSTANCE1", + xMultiServiceFactory.createInstance( + "com.sun.star.awt.UnoControlFixedTextModel")); + + + //XContainer + tEnv.addObjRelation("INSTANCE", + xMultiServiceFactory.createInstance( + "com.sun.star.awt.UnoControlFixedTextModel")); + } catch (com.sun.star.uno.Exception e) { + log.println("Could not add object relations 'INSTANCEn'"); + e.printStackTrace(log); + } + + tEnv.addObjRelation("OBJNAME", "stardiv.vcl.controlmodel.Dialog"); + System.out.println("ImplementationName: " + utils.getImplName(oObj)); + + return tEnv; + } // finish method getTestEnvironment +} diff --git a/qadevOOo/tests/java/mod/_toolkit/UnoControlEdit.java b/qadevOOo/tests/java/mod/_toolkit/UnoControlEdit.java new file mode 100644 index 000000000..0199acd57 --- /dev/null +++ b/qadevOOo/tests/java/mod/_toolkit/UnoControlEdit.java @@ -0,0 +1,139 @@ +/* + * 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._toolkit; + +import com.sun.star.awt.XControl; +import com.sun.star.awt.XControlModel; +import com.sun.star.awt.XDevice; +import com.sun.star.awt.XGraphics; +import com.sun.star.awt.XTextComponent; +import com.sun.star.awt.XToolkit; +import com.sun.star.awt.XWindow; +import com.sun.star.awt.XWindowPeer; +import com.sun.star.drawing.XControlShape; +import com.sun.star.text.XTextDocument; +import com.sun.star.uno.UnoRuntime; +import com.sun.star.uno.XInterface; +import com.sun.star.view.XControlAccess; + +import java.io.PrintWriter; + +import lib.TestCase; +import lib.TestEnvironment; +import lib.TestParameters; +import util.FormTools; +import util.SOfficeFactory; +import util.WriterTools; +import util.utils; + + +public class UnoControlEdit extends TestCase { + private static XTextDocument xTextDoc; + + @Override + protected void initialize(TestParameters Param, PrintWriter log) throws Exception { + SOfficeFactory SOF = SOfficeFactory.getFactory( + Param.getMSF()); + + log.println("creating a textdocument"); + xTextDoc = SOF.createTextDoc(null); + } + + @Override + protected void cleanup(TestParameters tParam, PrintWriter log) { + log.println(" disposing xTextDoc "); + + util.DesktopTools.closeDoc(xTextDoc); + } + + @Override + protected TestEnvironment createTestEnvironment(TestParameters Param, + PrintWriter log) throws Exception { + XInterface oObj = null; + XWindowPeer the_win = null; + XToolkit the_kit = null; + XDevice aDevice = null; + XGraphics aGraphic = null; + XControl aControl = null; + + //Insert a ControlShape and get the ControlModel + XControlShape aShape = FormTools.createUnoControlShape(xTextDoc, 3000, + 4500, 15000, + 10000, + "TextField", + "UnoControlEdit"); + + WriterTools.getDrawPage(xTextDoc).add(aShape); + + XControlModel the_Model = aShape.getControl(); + + XControlShape aShape2 = FormTools.createControlShape(xTextDoc, 3000, + 4500, 5000, 10000, + "TextField"); + + WriterTools.getDrawPage(xTextDoc).add(aShape2); + + XControlModel the_Model2 = aShape2.getControl(); + + //Try to query XControlAccess + XControlAccess the_access = UnoRuntime.queryInterface( + XControlAccess.class, + xTextDoc.getCurrentController()); + + //get the EditControl for the needed Object relations + oObj = the_access.getControl(the_Model); + aControl = the_access.getControl(the_Model2); + the_win = the_access.getControl(the_Model).getPeer(); + the_kit = the_win.getToolkit(); + aDevice = the_kit.createScreenCompatibleDevice(200, 200); + aGraphic = aDevice.createGraphics(); + + log.println("creating a new environment for UnoControlEdit object"); + + TestEnvironment tEnv = new TestEnvironment(oObj); + + + //Adding ObjRelation for XView + tEnv.addObjRelation("GRAPHICS", aGraphic); + + + //Adding ObjRelation for XControl + tEnv.addObjRelation("CONTEXT", xTextDoc); + tEnv.addObjRelation("WINPEER", the_win); + tEnv.addObjRelation("TOOLKIT", the_kit); + tEnv.addObjRelation("MODEL", the_Model); + + XWindow forObjRel = UnoRuntime.queryInterface(XWindow.class, + aControl); + + tEnv.addObjRelation("XWindow.AnotherWindow", forObjRel); + tEnv.addObjRelation("XWindow.ControlShape", aShape); + + // Adding relation for XTextListener + ifc.awt._XTextListener.TestTextListener listener = + new ifc.awt._XTextListener.TestTextListener(); + XTextComponent textComp = UnoRuntime.queryInterface( + XTextComponent.class, oObj); + textComp.addTextListener(listener); + tEnv.addObjRelation("TestTextListener", listener); + + log.println("ImplementationName: " + utils.getImplName(oObj)); + + return tEnv; + } // finish method getTestEnvironment +} // finish class UnoControlEdit diff --git a/qadevOOo/tests/java/mod/_toolkit/UnoControlEditModel.java b/qadevOOo/tests/java/mod/_toolkit/UnoControlEditModel.java new file mode 100644 index 000000000..e312b64a6 --- /dev/null +++ b/qadevOOo/tests/java/mod/_toolkit/UnoControlEditModel.java @@ -0,0 +1,77 @@ +/* + * 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._toolkit; + +import com.sun.star.text.XTextDocument; +import com.sun.star.uno.XInterface; + +import java.io.PrintWriter; + +import lib.TestCase; +import lib.TestEnvironment; +import lib.TestParameters; + +import util.WriterTools; +import util.utils; + + +public class UnoControlEditModel extends TestCase { + private static XTextDocument xTextDoc; + + /** + * Creates StarOffice Writer document. + */ + @Override + protected void initialize(TestParameters tParam, PrintWriter log) throws Exception { + log.println("creating a textdocument"); + xTextDoc = WriterTools.createTextDoc( + tParam.getMSF()); + } + + /** + * Disposes StarOffice Writer document. + */ + @Override + protected void cleanup(TestParameters tParam, PrintWriter log) { + log.println(" disposing xTextDoc "); + + util.DesktopTools.closeDoc(xTextDoc); + } + + @Override + protected TestEnvironment createTestEnvironment(TestParameters Param, + PrintWriter log) { + XInterface oObj = null; + + try { + oObj = (XInterface) Param.getMSF().createInstance( + "com.sun.star.awt.UnoControlEditModel"); + } catch (Exception e) { + } + + log.println( + "creating a new environment for UnoControlEditModel object"); + + TestEnvironment tEnv = new TestEnvironment(oObj); + + tEnv.addObjRelation("OBJNAME", "stardiv.vcl.controlmodel.Edit"); + System.out.println("ImplementationName: " + utils.getImplName(oObj)); + + return tEnv; + } // finish method getTestEnvironment +} // finish class UnoControlEditModel diff --git a/qadevOOo/tests/java/mod/_toolkit/UnoControlFileControl.java b/qadevOOo/tests/java/mod/_toolkit/UnoControlFileControl.java new file mode 100644 index 000000000..ab4486a70 --- /dev/null +++ b/qadevOOo/tests/java/mod/_toolkit/UnoControlFileControl.java @@ -0,0 +1,140 @@ +/* + * 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._toolkit; + +import com.sun.star.awt.XControl; +import com.sun.star.awt.XControlModel; +import com.sun.star.awt.XDevice; +import com.sun.star.awt.XGraphics; +import com.sun.star.awt.XTextComponent; +import com.sun.star.awt.XToolkit; +import com.sun.star.awt.XWindow; +import com.sun.star.awt.XWindowPeer; +import com.sun.star.drawing.XControlShape; +import com.sun.star.text.XTextDocument; +import com.sun.star.uno.UnoRuntime; +import com.sun.star.uno.XInterface; +import com.sun.star.view.XControlAccess; + +import java.io.PrintWriter; + +import lib.TestCase; +import lib.TestEnvironment; +import lib.TestParameters; +import util.FormTools; +import util.SOfficeFactory; +import util.WriterTools; +import util.utils; + + +public class UnoControlFileControl extends TestCase { + private static XTextDocument xTextDoc; + + @Override + protected void initialize(TestParameters Param, PrintWriter log) throws Exception { + SOfficeFactory SOF = SOfficeFactory.getFactory( + Param.getMSF()); + + log.println("creating a textdocument"); + xTextDoc = SOF.createTextDoc(null); + } + + @Override + protected void cleanup(TestParameters tParam, PrintWriter log) { + log.println(" disposing xTextDoc "); + + util.DesktopTools.closeDoc(xTextDoc); + } + + @Override + protected TestEnvironment createTestEnvironment(TestParameters Param, + PrintWriter log) throws Exception { + XInterface oObj = null; + XWindowPeer the_win = null; + XToolkit the_kit = null; + XDevice aDevice = null; + XGraphics aGraphic = null; + XControl aControl = null; + + //Insert a ControlShape and get the ControlModel + XControlShape aShape = FormTools.createUnoControlShape(xTextDoc, 3000, + 4500, 15000, + 10000, + "FileControl", + "UnoControlFileControl"); + + WriterTools.getDrawPage(xTextDoc).add(aShape); + + XControlModel the_Model = aShape.getControl(); + + XControlShape aShape2 = FormTools.createControlShape(xTextDoc, 3000, + 4500, 5000, 10000, + "TextField"); + + WriterTools.getDrawPage(xTextDoc).add(aShape2); + + XControlModel the_Model2 = aShape2.getControl(); + + //Try to query XControlAccess + XControlAccess the_access = UnoRuntime.queryInterface( + XControlAccess.class, + xTextDoc.getCurrentController()); + + //get the FileControlControl for the needed Object relations + oObj = the_access.getControl(the_Model); + aControl = the_access.getControl(the_Model2); + the_win = the_access.getControl(the_Model).getPeer(); + the_kit = the_win.getToolkit(); + aDevice = the_kit.createScreenCompatibleDevice(200, 200); + aGraphic = aDevice.createGraphics(); + + log.println( + "creating a new environment for UnoControlFileControl object"); + + TestEnvironment tEnv = new TestEnvironment(oObj); + + + //Adding ObjRelation for XView + tEnv.addObjRelation("GRAPHICS", aGraphic); + + + //Adding ObjRelation for XControl + tEnv.addObjRelation("CONTEXT", xTextDoc); + tEnv.addObjRelation("WINPEER", the_win); + tEnv.addObjRelation("TOOLKIT", the_kit); + tEnv.addObjRelation("MODEL", the_Model); + + XWindow forObjRel = UnoRuntime.queryInterface(XWindow.class, + aControl); + + tEnv.addObjRelation("XWindow.AnotherWindow", forObjRel); + tEnv.addObjRelation("XWindow.ControlShape", aShape); + + // Adding relation for XTextListener + ifc.awt._XTextListener.TestTextListener listener = + new ifc.awt._XTextListener.TestTextListener(); + XTextComponent textComp = UnoRuntime.queryInterface( + XTextComponent.class, oObj); + textComp.addTextListener(listener); + tEnv.addObjRelation("TestTextListener", listener); + + log.println("ImplementationName: " + utils.getImplName(oObj)); + + return tEnv; + } // finish method getTestEnvironment +} // finish class UnoControlFileControl diff --git a/qadevOOo/tests/java/mod/_toolkit/UnoControlFileControlModel.java b/qadevOOo/tests/java/mod/_toolkit/UnoControlFileControlModel.java new file mode 100644 index 000000000..63f2a8309 --- /dev/null +++ b/qadevOOo/tests/java/mod/_toolkit/UnoControlFileControlModel.java @@ -0,0 +1,77 @@ +/* + * 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._toolkit; + +import com.sun.star.text.XTextDocument; +import com.sun.star.uno.XInterface; + +import java.io.PrintWriter; + +import lib.TestCase; +import lib.TestEnvironment; +import lib.TestParameters; + +import util.WriterTools; +import util.utils; + + +public class UnoControlFileControlModel extends TestCase { + private static XTextDocument xTextDoc; + + /** + * Creates StarOffice Writer document. + */ + @Override + protected void initialize(TestParameters tParam, PrintWriter log) throws Exception { + log.println("creating a textdocument"); + xTextDoc = WriterTools.createTextDoc( + tParam.getMSF()); + } + + /** + * Disposes StarOffice Writer document. + */ + @Override + protected void cleanup(TestParameters tParam, PrintWriter log) { + log.println(" disposing xTextDoc "); + + util.DesktopTools.closeDoc(xTextDoc); + } + + @Override + public TestEnvironment createTestEnvironment(TestParameters Param, + PrintWriter log) { + XInterface oObj = null; + + try { + oObj = (XInterface) Param.getMSF().createInstance( + "com.sun.star.awt.UnoControlFileControlModel"); + } catch (Exception e) { + } + + log.println( + "creating a new environment for UnoControlFileControlModel object"); + + TestEnvironment tEnv = new TestEnvironment(oObj); + + tEnv.addObjRelation("OBJNAME", "stardiv.vcl.controlmodel.FileControl"); + System.out.println("ImplementationName: " + utils.getImplName(oObj)); + + return tEnv; + } // finish method getTestEnvironment +} // finish class UnoControlFileControlModel diff --git a/qadevOOo/tests/java/mod/_toolkit/UnoControlFixedLineModel.java b/qadevOOo/tests/java/mod/_toolkit/UnoControlFixedLineModel.java new file mode 100644 index 000000000..fffcca77b --- /dev/null +++ b/qadevOOo/tests/java/mod/_toolkit/UnoControlFixedLineModel.java @@ -0,0 +1,88 @@ +/* + * 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._toolkit; + +import com.sun.star.uno.XInterface; + +import java.io.PrintWriter; + +import lib.StatusException; +import lib.TestCase; +import lib.TestEnvironment; +import lib.TestParameters; + +import util.utils; + + +/** +* Test for object which is represented by service +* <code>com.sun.star.awt.UnoControlFixedLineModel</code>. <p> +* Object implements the following interfaces : +* <ul> +* <li> <code>com::sun::star::awt::UnoControlFixedLineModel</code></li> +* <li> <code>com::sun::star::io::XPersistObject</code></li> +* <li> <code>com::sun::star::lang::XComponent</code></li> +* <li> <code>com::sun::star::beans::XPropertySet</code></li> +* <li> <code>com::sun::star::beans::XMultiPropertySet</code></li> +* </ul> +* This object test <b> is NOT </b> designed to be run in several +* threads concurrently. +* @see com.sun.star.awt.UnoControlFixedLineModel +* @see com.sun.star.io.XPersistObject +* @see com.sun.star.lang.XComponent +* @see com.sun.star.beans.XPropertySet +* @see com.sun.star.beans.XMultiPropertySet +* @see ifc.awt._UnoControlFixedLineModel +* @see ifc.io._XPersistObject +* @see ifc.lang._XComponent +* @see ifc.beans._XPropertySet +* @see ifc.beans._XMultiPropertySet +*/ +public class UnoControlFixedLineModel extends TestCase { + /** + * Creating a TestEnvironment for the interfaces to be tested. + * Creates an instance of the service + * <code>com.sun.star.awt.UnoControlFixedLineModel</code>. + * Object relations created : + * <ul> + * <li> <code>'OBJNAME'</code> for + * {@link ifc.io._XPersistObject} </li> + * </ul> + */ + @Override + public TestEnvironment createTestEnvironment(TestParameters Param, + PrintWriter log) + throws StatusException { + XInterface oObj = null; + + try { + oObj = (XInterface) Param.getMSF().createInstance( + "com.sun.star.awt.UnoControlFixedLineModel"); + } catch (Exception e) { + } + + log.println("creating a new environment for object"); + + TestEnvironment tEnv = new TestEnvironment(oObj); + + tEnv.addObjRelation("OBJNAME", "stardiv.vcl.controlmodel.FixedLine"); + System.out.println("ImplementationName: " + utils.getImplName(oObj)); + + return tEnv; + } // finish method getTestEnvironment +}
\ No newline at end of file diff --git a/qadevOOo/tests/java/mod/_toolkit/UnoControlFixedText.java b/qadevOOo/tests/java/mod/_toolkit/UnoControlFixedText.java new file mode 100644 index 000000000..16951a36c --- /dev/null +++ b/qadevOOo/tests/java/mod/_toolkit/UnoControlFixedText.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._toolkit; + +import com.sun.star.awt.XControl; +import com.sun.star.awt.XControlModel; +import com.sun.star.awt.XDevice; +import com.sun.star.awt.XGraphics; +import com.sun.star.awt.XToolkit; +import com.sun.star.awt.XWindow; +import com.sun.star.awt.XWindowPeer; +import com.sun.star.drawing.XControlShape; +import com.sun.star.text.XTextDocument; +import com.sun.star.uno.UnoRuntime; +import com.sun.star.uno.XInterface; +import com.sun.star.view.XControlAccess; + +import java.io.PrintWriter; + +import lib.TestCase; +import lib.TestEnvironment; +import lib.TestParameters; +import util.FormTools; +import util.SOfficeFactory; +import util.WriterTools; +import util.utils; + + +public class UnoControlFixedText extends TestCase { + private static XTextDocument xTextDoc; + + @Override + protected void initialize(TestParameters Param, PrintWriter log) throws Exception { + SOfficeFactory SOF = SOfficeFactory.getFactory( + Param.getMSF()); + + log.println("creating a textdocument"); + xTextDoc = SOF.createTextDoc(null); + } + + @Override + protected void cleanup(TestParameters tParam, PrintWriter log) { + log.println(" disposing xTextDoc "); + + util.DesktopTools.closeDoc(xTextDoc); + } + + @Override + protected TestEnvironment createTestEnvironment(TestParameters Param, + PrintWriter log) throws Exception { + XInterface oObj = null; + XWindowPeer the_win = null; + XToolkit the_kit = null; + XDevice aDevice = null; + XGraphics aGraphic = null; + XControl aControl = null; + + //Insert a ControlShape and get the ControlModel + XControlShape aShape = FormTools.createUnoControlShape(xTextDoc, 3000, + 4500, 15000, + 10000, + "FixedText", + "UnoControlFixedText"); + + WriterTools.getDrawPage(xTextDoc).add(aShape); + + XControlModel the_Model = aShape.getControl(); + + XControlShape aShape2 = FormTools.createControlShape(xTextDoc, 3000, + 4500, 5000, 10000, + "TextField"); + + WriterTools.getDrawPage(xTextDoc).add(aShape2); + + XControlModel the_Model2 = aShape2.getControl(); + + //Try to query XControlAccess + XControlAccess the_access = UnoRuntime.queryInterface( + XControlAccess.class, + xTextDoc.getCurrentController()); + + //get the FixedTextControl for the needed Object relations + oObj = the_access.getControl(the_Model); + aControl = the_access.getControl(the_Model2); + the_win = the_access.getControl(the_Model).getPeer(); + the_kit = the_win.getToolkit(); + aDevice = the_kit.createScreenCompatibleDevice(200, 200); + aGraphic = aDevice.createGraphics(); + + log.println( + "creating a new environment for UnoControlFixedText object"); + + TestEnvironment tEnv = new TestEnvironment(oObj); + + + //Adding ObjRelation for XView + tEnv.addObjRelation("GRAPHICS", aGraphic); + + + //Adding ObjRelation for XControl + tEnv.addObjRelation("CONTEXT", xTextDoc); + tEnv.addObjRelation("WINPEER", the_win); + tEnv.addObjRelation("TOOLKIT", the_kit); + tEnv.addObjRelation("MODEL", the_Model); + + XWindow forObjRel = UnoRuntime.queryInterface(XWindow.class, + aControl); + + tEnv.addObjRelation("XWindow.AnotherWindow", forObjRel); + + System.out.println("ImplementationName: " + utils.getImplName(oObj)); + + return tEnv; + } // finish method getTestEnvironment +} // finish class UnoControlFixedText diff --git a/qadevOOo/tests/java/mod/_toolkit/UnoControlFixedTextModel.java b/qadevOOo/tests/java/mod/_toolkit/UnoControlFixedTextModel.java new file mode 100644 index 000000000..9433d8c26 --- /dev/null +++ b/qadevOOo/tests/java/mod/_toolkit/UnoControlFixedTextModel.java @@ -0,0 +1,77 @@ +/* + * 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._toolkit; + +import com.sun.star.text.XTextDocument; +import com.sun.star.uno.XInterface; + +import java.io.PrintWriter; + +import lib.TestCase; +import lib.TestEnvironment; +import lib.TestParameters; + +import util.WriterTools; +import util.utils; + + +public class UnoControlFixedTextModel extends TestCase { + private static XTextDocument xTextDoc; + + /** + * Creates StarOffice Writer document. + */ + @Override + protected void initialize(TestParameters tParam, PrintWriter log) throws Exception { + log.println("creating a textdocument"); + xTextDoc = WriterTools.createTextDoc( + tParam.getMSF()); + } + + /** + * Disposes StarOffice Writer document. + */ + @Override + protected void cleanup(TestParameters tParam, PrintWriter log) { + log.println(" disposing xTextDoc "); + + util.DesktopTools.closeDoc(xTextDoc); + } + + @Override + protected TestEnvironment createTestEnvironment(TestParameters Param, + PrintWriter log) { + XInterface oObj = null; + + try { + oObj = (XInterface) Param.getMSF().createInstance( + "com.sun.star.awt.UnoControlFixedTextModel"); + } catch (Exception e) { + } + + log.println( + "creating a new environment for UnoControlFixedTextModel object"); + + TestEnvironment tEnv = new TestEnvironment(oObj); + + tEnv.addObjRelation("OBJNAME", "stardiv.vcl.controlmodel.FixedText"); + System.out.println("ImplementationName: " + utils.getImplName(oObj)); + + return tEnv; + } // finish method getTestEnvironment +} // finish class UnoControlFixedTextModel diff --git a/qadevOOo/tests/java/mod/_toolkit/UnoControlFormattedField.java b/qadevOOo/tests/java/mod/_toolkit/UnoControlFormattedField.java new file mode 100644 index 000000000..d2091caba --- /dev/null +++ b/qadevOOo/tests/java/mod/_toolkit/UnoControlFormattedField.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._toolkit; + +import com.sun.star.awt.XControl; +import com.sun.star.awt.XControlModel; +import com.sun.star.awt.XDevice; +import com.sun.star.awt.XGraphics; +import com.sun.star.awt.XTextComponent; +import com.sun.star.awt.XToolkit; +import com.sun.star.awt.XWindow; +import com.sun.star.awt.XWindowPeer; +import com.sun.star.beans.XPropertySet; +import com.sun.star.drawing.XControlShape; +import com.sun.star.text.XTextDocument; +import com.sun.star.uno.UnoRuntime; +import com.sun.star.uno.XInterface; +import com.sun.star.view.XControlAccess; + +import java.io.PrintWriter; + +import lib.TestCase; +import lib.TestEnvironment; +import lib.TestParameters; +import util.FormTools; +import util.SOfficeFactory; +import util.WriterTools; +import util.utils; + + +public class UnoControlFormattedField extends TestCase { + private static XTextDocument xTextDoc; + + @Override + protected void initialize(TestParameters Param, PrintWriter log) throws Exception { + SOfficeFactory SOF = SOfficeFactory.getFactory( + Param.getMSF()); + + log.println("creating a textdocument"); + xTextDoc = SOF.createTextDoc(null); + } + + @Override + protected void cleanup(TestParameters tParam, PrintWriter log) { + log.println(" disposing xTextDoc "); + + util.DesktopTools.closeDoc(xTextDoc); + } + + @Override + protected TestEnvironment createTestEnvironment(TestParameters Param, + PrintWriter log) throws Exception { + XInterface oObj = null; + XWindowPeer the_win = null; + XToolkit the_kit = null; + XDevice aDevice = null; + XGraphics aGraphic = null; + XControl aControl = null; + + //Insert a ControlShape and get the ControlModel + XControlShape aShape = FormTools.createUnoControlShape(xTextDoc, 3000, + 4500, 15000, + 10000, + "DatabaseFormattedField", + "UnoControlFormattedField"); + + WriterTools.getDrawPage(xTextDoc).add(aShape); + + XControlModel the_Model = aShape.getControl(); + + XControlShape aShape2 = FormTools.createControlShape(xTextDoc, 3000, + 4500, 5000, 10000, + "TextField"); + + WriterTools.getDrawPage(xTextDoc).add(aShape2); + + XControlModel the_Model2 = aShape2.getControl(); + + XPropertySet xPS = UnoRuntime.queryInterface( + XPropertySet.class, the_Model); + + //Try to query XControlAccess + XControlAccess the_access = UnoRuntime.queryInterface( + XControlAccess.class, + xTextDoc.getCurrentController()); + + //get the EditControl for the needed Object relations + oObj = the_access.getControl(the_Model); + aControl = the_access.getControl(the_Model2); + the_win = the_access.getControl(the_Model).getPeer(); + the_kit = the_win.getToolkit(); + aDevice = the_kit.createScreenCompatibleDevice(200, 200); + aGraphic = aDevice.createGraphics(); + + xPS.setPropertyValue("Spin", Boolean.TRUE); + + log.println("creating a new environment for UnoControlEdit object"); + + TestEnvironment tEnv = new TestEnvironment(oObj); + + + //Adding ObjRelation for XView + tEnv.addObjRelation("GRAPHICS", aGraphic); + + + //Adding ObjRelation for XControl + tEnv.addObjRelation("CONTEXT", xTextDoc); + tEnv.addObjRelation("WINPEER", the_win); + tEnv.addObjRelation("TOOLKIT", the_kit); + tEnv.addObjRelation("MODEL", the_Model); + + XWindow forObjRel = UnoRuntime.queryInterface(XWindow.class, + aControl); + + tEnv.addObjRelation("XWindow.AnotherWindow", forObjRel); + tEnv.addObjRelation("XWindow.ControlShape", aShape); + + // Adding relation for XTextListener + ifc.awt._XTextListener.TestTextListener listener = + new ifc.awt._XTextListener.TestTextListener(); + XTextComponent textComp = UnoRuntime.queryInterface( + XTextComponent.class, oObj); + textComp.addTextListener(listener); + tEnv.addObjRelation("TestTextListener", listener); + + log.println("ImplementationName: " + utils.getImplName(oObj)); + + return tEnv; + } // finish method getTestEnvironment +} diff --git a/qadevOOo/tests/java/mod/_toolkit/UnoControlFormattedFieldModel.java b/qadevOOo/tests/java/mod/_toolkit/UnoControlFormattedFieldModel.java new file mode 100644 index 000000000..bb5e1b355 --- /dev/null +++ b/qadevOOo/tests/java/mod/_toolkit/UnoControlFormattedFieldModel.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._toolkit; + +import com.sun.star.text.XTextDocument; +import com.sun.star.uno.XInterface; + +import java.io.PrintWriter; + +import lib.TestCase; +import lib.TestEnvironment; +import lib.TestParameters; + +import util.WriterTools; +import util.utils; + + +public class UnoControlFormattedFieldModel extends TestCase { + private static XTextDocument xTextDoc; + + /** + * Creates StarOffice Writer document. + */ + @Override + protected void initialize(TestParameters tParam, PrintWriter log) throws Exception { + log.println("creating a textdocument"); + xTextDoc = WriterTools.createTextDoc( + tParam.getMSF()); + } + + /** + * Disposes StarOffice Writer document. + */ + @Override + protected void cleanup(TestParameters tParam, PrintWriter log) { + log.println(" disposing xTextDoc "); + + util.DesktopTools.closeDoc(xTextDoc); + } + + @Override + public TestEnvironment createTestEnvironment(TestParameters Param, + PrintWriter log) { + XInterface oObj = null; + + try { + oObj = (XInterface) Param.getMSF().createInstance( + "com.sun.star.awt.UnoControlFormattedFieldModel"); + } catch (Exception e) { + } + + log.println( + "creating a new environment for UnoControlFormattedFieldModel object"); + + TestEnvironment tEnv = new TestEnvironment(oObj); + + tEnv.addObjRelation("OBJNAME", + "stardiv.vcl.controlmodel.FormattedField"); + System.out.println("ImplementationName: " + utils.getImplName(oObj)); + + return tEnv; + } // finish method getTestEnvironment +} // finish class UnoControlFormattedFieldModel diff --git a/qadevOOo/tests/java/mod/_toolkit/UnoControlGroupBox.java b/qadevOOo/tests/java/mod/_toolkit/UnoControlGroupBox.java new file mode 100644 index 000000000..714085696 --- /dev/null +++ b/qadevOOo/tests/java/mod/_toolkit/UnoControlGroupBox.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._toolkit; + +import com.sun.star.awt.XControl; +import com.sun.star.awt.XControlModel; +import com.sun.star.awt.XDevice; +import com.sun.star.awt.XGraphics; +import com.sun.star.awt.XToolkit; +import com.sun.star.awt.XWindow; +import com.sun.star.awt.XWindowPeer; +import com.sun.star.drawing.XControlShape; +import com.sun.star.text.XTextDocument; +import com.sun.star.uno.UnoRuntime; +import com.sun.star.uno.XInterface; +import com.sun.star.view.XControlAccess; + +import java.io.PrintWriter; + +import lib.TestCase; +import lib.TestEnvironment; +import lib.TestParameters; +import util.FormTools; +import util.SOfficeFactory; +import util.WriterTools; +import util.utils; + + +public class UnoControlGroupBox extends TestCase { + private static XTextDocument xTextDoc; + + @Override + protected void initialize(TestParameters Param, PrintWriter log) throws Exception { + SOfficeFactory SOF = SOfficeFactory.getFactory( + Param.getMSF()); + + log.println("creating a textdocument"); + xTextDoc = SOF.createTextDoc(null); + } + + @Override + protected void cleanup(TestParameters tParam, PrintWriter log) { + log.println(" disposing xTextDoc "); + + util.DesktopTools.closeDoc(xTextDoc); + } + + @Override + protected TestEnvironment createTestEnvironment(TestParameters Param, + PrintWriter log) throws Exception { + XInterface oObj = null; + XWindowPeer the_win = null; + XToolkit the_kit = null; + XDevice aDevice = null; + XGraphics aGraphic = null; + XControl aControl = null; + + //Insert a ControlShape and get the ControlModel + XControlShape aShape = FormTools.createUnoControlShape(xTextDoc, 3000, + 4500, 15000, + 10000, + "GroupBox", + "UnoControlGroupBox"); + + WriterTools.getDrawPage(xTextDoc).add(aShape); + + XControlModel the_Model = aShape.getControl(); + + XControlShape aShape2 = FormTools.createControlShape(xTextDoc, 3000, + 4500, 5000, 10000, + "TextField"); + + WriterTools.getDrawPage(xTextDoc).add(aShape2); + + XControlModel the_Model2 = aShape2.getControl(); + + //Try to query XControlAccess + XControlAccess the_access = UnoRuntime.queryInterface( + XControlAccess.class, + xTextDoc.getCurrentController()); + + //get the GroupBoxControl for the needed Object relations + oObj = the_access.getControl(the_Model); + aControl = the_access.getControl(the_Model2); + the_win = the_access.getControl(the_Model).getPeer(); + the_kit = the_win.getToolkit(); + aDevice = the_kit.createScreenCompatibleDevice(200, 200); + aGraphic = aDevice.createGraphics(); + + log.println("creating a new environment for UnoControlGroupBox object"); + + TestEnvironment tEnv = new TestEnvironment(oObj); + + + //Adding ObjRelation for XView + tEnv.addObjRelation("GRAPHICS", aGraphic); + + + //Adding ObjRelation for XControl + tEnv.addObjRelation("CONTEXT", xTextDoc); + tEnv.addObjRelation("WINPEER", the_win); + tEnv.addObjRelation("TOOLKIT", the_kit); + tEnv.addObjRelation("MODEL", the_Model); + + XWindow forObjRel = UnoRuntime.queryInterface(XWindow.class, + aControl); + + tEnv.addObjRelation("XWindow.AnotherWindow", forObjRel); + + System.out.println("ImplementationName: " + utils.getImplName(oObj)); + + return tEnv; + } // finish method getTestEnvironment +} // finish class UnoControlGroupBox diff --git a/qadevOOo/tests/java/mod/_toolkit/UnoControlGroupBoxModel.java b/qadevOOo/tests/java/mod/_toolkit/UnoControlGroupBoxModel.java new file mode 100644 index 000000000..1a6cae71e --- /dev/null +++ b/qadevOOo/tests/java/mod/_toolkit/UnoControlGroupBoxModel.java @@ -0,0 +1,77 @@ +/* + * 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._toolkit; + +import com.sun.star.text.XTextDocument; +import com.sun.star.uno.XInterface; + +import java.io.PrintWriter; + +import lib.TestCase; +import lib.TestEnvironment; +import lib.TestParameters; + +import util.WriterTools; +import util.utils; + + +public class UnoControlGroupBoxModel extends TestCase { + private static XTextDocument xTextDoc; + + /** + * Creates StarOffice Writer document. + */ + @Override + protected void initialize(TestParameters tParam, PrintWriter log) throws Exception { + log.println("creating a textdocument"); + xTextDoc = WriterTools.createTextDoc( + tParam.getMSF()); + } + + /** + * Disposes StarOffice Writer document. + */ + @Override + protected void cleanup(TestParameters tParam, PrintWriter log) { + log.println(" disposing xTextDoc "); + + util.DesktopTools.closeDoc(xTextDoc); + } + + @Override + protected TestEnvironment createTestEnvironment(TestParameters Param, + PrintWriter log) { + XInterface oObj = null; + + try { + oObj = (XInterface) Param.getMSF().createInstance( + "com.sun.star.awt.UnoControlGroupBoxModel"); + } catch (Exception e) { + } + + log.println( + "creating a new environment for UnoControlGroupBoxModel object"); + + TestEnvironment tEnv = new TestEnvironment(oObj); + + tEnv.addObjRelation("OBJNAME", "stardiv.vcl.controlmodel.GroupBox"); + System.out.println("ImplementationName: " + utils.getImplName(oObj)); + + return tEnv; + } // finish method getTestEnvironment +} // finish class UnoControlGroupBoxModel diff --git a/qadevOOo/tests/java/mod/_toolkit/UnoControlImageControl.java b/qadevOOo/tests/java/mod/_toolkit/UnoControlImageControl.java new file mode 100644 index 000000000..ea320d043 --- /dev/null +++ b/qadevOOo/tests/java/mod/_toolkit/UnoControlImageControl.java @@ -0,0 +1,138 @@ +/* + * 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._toolkit; + +import com.sun.star.awt.XControl; +import com.sun.star.awt.XControlModel; +import com.sun.star.awt.XDevice; +import com.sun.star.awt.XGraphics; +import com.sun.star.awt.XToolkit; +import com.sun.star.awt.XWindow; +import com.sun.star.awt.XWindowPeer; +import com.sun.star.beans.XPropertySet; +import com.sun.star.drawing.XControlShape; +import com.sun.star.text.XTextDocument; +import com.sun.star.uno.UnoRuntime; +import com.sun.star.uno.XInterface; +import com.sun.star.view.XControlAccess; + +import java.io.PrintWriter; + +import lib.TestCase; +import lib.TestEnvironment; +import lib.TestParameters; +import util.FormTools; +import util.SOfficeFactory; +import util.WriterTools; +import util.utils; + + +public class UnoControlImageControl extends TestCase { + private static XTextDocument xTextDoc; + + @Override + protected void initialize(TestParameters Param, PrintWriter log) throws Exception { + SOfficeFactory SOF = SOfficeFactory.getFactory( + Param.getMSF()); + + log.println("creating a textdocument"); + xTextDoc = SOF.createTextDoc(null); + } + + @Override + protected void cleanup(TestParameters tParam, PrintWriter log) { + log.println(" disposing xTextDoc "); + + util.DesktopTools.closeDoc(xTextDoc); + } + + @Override + protected TestEnvironment createTestEnvironment(TestParameters Param, + PrintWriter log) throws Exception { + XInterface oObj = null; + XWindowPeer the_win = null; + XToolkit the_kit = null; + XDevice aDevice = null; + XGraphics aGraphic = null; + XControl aControl = null; + + //Insert a ControlShape and get the ControlModel + XControlShape aShape = FormTools.createUnoControlShape(xTextDoc, 3000, + 4500, 15000, + 10000, + "DatabaseImageControl", + "UnoControlImageControl"); + + WriterTools.getDrawPage(xTextDoc).add(aShape); + + XControlModel the_Model = aShape.getControl(); + + XPropertySet xPS = UnoRuntime.queryInterface( + XPropertySet.class, the_Model); + + XControlShape aShape2 = FormTools.createControlShape(xTextDoc, 3000, + 4500, 5000, 10000, + "TextField"); + + WriterTools.getDrawPage(xTextDoc).add(aShape2); + + XControlModel the_Model2 = aShape2.getControl(); + + //Try to query XControlAccess + XControlAccess the_access = UnoRuntime.queryInterface( + XControlAccess.class, + xTextDoc.getCurrentController()); + + //get the ImageControlControl for the needed Object relations + oObj = the_access.getControl(the_Model); + aControl = the_access.getControl(the_Model2); + the_win = the_access.getControl(the_Model).getPeer(); + the_kit = the_win.getToolkit(); + aDevice = the_kit.createScreenCompatibleDevice(200, 200); + aGraphic = aDevice.createGraphics(); + + String imgUrl = util.utils.getFullTestURL("poliball.gif"); + + xPS.setPropertyValue("ImageURL", imgUrl); + + log.println( + "creating a new environment for UnoControlImageControl object"); + + TestEnvironment tEnv = new TestEnvironment(oObj); + + + //Adding ObjRelation for XView + tEnv.addObjRelation("GRAPHICS", aGraphic); + + + //Adding ObjRelation for XControl + tEnv.addObjRelation("CONTEXT", xTextDoc); + tEnv.addObjRelation("WINPEER", the_win); + tEnv.addObjRelation("TOOLKIT", the_kit); + tEnv.addObjRelation("MODEL", the_Model); + + XWindow forObjRel = UnoRuntime.queryInterface(XWindow.class, + aControl); + + tEnv.addObjRelation("XWindow.AnotherWindow", forObjRel); + + System.out.println("ImplementationName: " + utils.getImplName(oObj)); + + return tEnv; + } // finish method getTestEnvironment +} // finish class UnoControlImageControl diff --git a/qadevOOo/tests/java/mod/_toolkit/UnoControlImageControlModel.java b/qadevOOo/tests/java/mod/_toolkit/UnoControlImageControlModel.java new file mode 100644 index 000000000..e0f0ff0ad --- /dev/null +++ b/qadevOOo/tests/java/mod/_toolkit/UnoControlImageControlModel.java @@ -0,0 +1,53 @@ +/* + * 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._toolkit; + +import com.sun.star.uno.XInterface; + +import java.io.PrintWriter; + +import lib.TestCase; +import lib.TestEnvironment; +import lib.TestParameters; + +import util.utils; + + +public class UnoControlImageControlModel extends TestCase { + @Override + protected TestEnvironment createTestEnvironment(TestParameters Param, + PrintWriter log) { + XInterface oObj = null; + + try { + oObj = (XInterface) Param.getMSF().createInstance( + "com.sun.star.awt.UnoControlImageControlModel"); + } catch (Exception e) { + } + + log.println( + "creating a new environment for UnoControlImageControlModel object"); + + TestEnvironment tEnv = new TestEnvironment(oObj); + + tEnv.addObjRelation("OBJNAME", "stardiv.vcl.controlmodel.ImageControl"); + System.out.println("ImplementationName: " + utils.getImplName(oObj)); + + return tEnv; + } // finish method getTestEnvironment +} // finish class UnoControlImageControlModel diff --git a/qadevOOo/tests/java/mod/_toolkit/UnoControlListBox.java b/qadevOOo/tests/java/mod/_toolkit/UnoControlListBox.java new file mode 100644 index 000000000..1d733bd06 --- /dev/null +++ b/qadevOOo/tests/java/mod/_toolkit/UnoControlListBox.java @@ -0,0 +1,139 @@ +/* + * 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._toolkit; + +import com.sun.star.awt.XControl; +import com.sun.star.awt.XControlModel; +import com.sun.star.awt.XDevice; +import com.sun.star.awt.XGraphics; +import com.sun.star.awt.XListBox; +import com.sun.star.awt.XToolkit; +import com.sun.star.awt.XWindow; +import com.sun.star.awt.XWindowPeer; +import com.sun.star.drawing.XControlShape; +import com.sun.star.text.XTextDocument; +import com.sun.star.uno.UnoRuntime; +import com.sun.star.uno.XInterface; +import com.sun.star.view.XControlAccess; + +import java.io.PrintWriter; + +import lib.TestCase; +import lib.TestEnvironment; +import lib.TestParameters; +import util.FormTools; +import util.SOfficeFactory; +import util.WriterTools; +import util.utils; + + +public class UnoControlListBox extends TestCase { + private static XTextDocument xTextDoc; + + @Override + protected void initialize(TestParameters Param, PrintWriter log) throws Exception { + SOfficeFactory SOF = SOfficeFactory.getFactory( + Param.getMSF()); + + log.println("creating a textdocument"); + xTextDoc = SOF.createTextDoc(null); + } + + @Override + protected void cleanup(TestParameters tParam, PrintWriter log) { + log.println(" disposing xTextDoc "); + + util.DesktopTools.closeDoc(xTextDoc); + } + + @Override + protected TestEnvironment createTestEnvironment(TestParameters Param, + PrintWriter log) throws Exception { + XInterface oObj = null; + XWindowPeer the_win = null; + XToolkit the_kit = null; + XDevice aDevice = null; + XGraphics aGraphic = null; + XControl aControl = null; + + //Insert a ControlShape and get the ControlModel + XControlShape aShape = FormTools.createUnoControlShape(xTextDoc, 3000, + 4500, 15000, + 10000, + "ListBox", + "UnoControlListBox"); + + WriterTools.getDrawPage(xTextDoc).add(aShape); + + XControlModel the_Model = aShape.getControl(); + + XControlShape aShape2 = FormTools.createControlShape(xTextDoc, 3000, + 4500, 5000, 10000, + "TextField"); + + WriterTools.getDrawPage(xTextDoc).add(aShape2); + + XControlModel the_Model2 = aShape2.getControl(); + + //Try to query XControlAccess + XControlAccess the_access = UnoRuntime.queryInterface( + XControlAccess.class, + xTextDoc.getCurrentController()); + + //get the ListBoxControl for the needed Object relations + oObj = the_access.getControl(the_Model); + aControl = the_access.getControl(the_Model2); + the_win = the_access.getControl(the_Model).getPeer(); + the_kit = the_win.getToolkit(); + aDevice = the_kit.createScreenCompatibleDevice(200, 200); + aGraphic = aDevice.createGraphics(); + + log.println("creating a new environment for UnoControlListBox object"); + + TestEnvironment tEnv = new TestEnvironment(oObj); + + + //Adding ObjRelation for XView + tEnv.addObjRelation("GRAPHICS", aGraphic); + + + //Adding ObjRelation for XControl + tEnv.addObjRelation("CONTEXT", xTextDoc); + tEnv.addObjRelation("WINPEER", the_win); + tEnv.addObjRelation("TOOLKIT", the_kit); + tEnv.addObjRelation("MODEL", the_Model); + + // adding object relation for XItemListener + ifc.awt._XItemListener.TestItemListener listener = + new ifc.awt._XItemListener.TestItemListener(); + XListBox list = UnoRuntime.queryInterface(XListBox.class, + oObj); + list.addItemListener(listener); + tEnv.addObjRelation("TestItemListener", listener); + + XWindow forObjRel = UnoRuntime.queryInterface(XWindow.class, + aControl); + + tEnv.addObjRelation("XWindow.AnotherWindow", forObjRel); + tEnv.addObjRelation("XWindow.ControlShape", aShape); + + System.out.println("ImplementationName: " + utils.getImplName(oObj)); + + return tEnv; + } // finish method getTestEnvironment +} // finish class UnoControlListBox diff --git a/qadevOOo/tests/java/mod/_toolkit/UnoControlListBoxModel.java b/qadevOOo/tests/java/mod/_toolkit/UnoControlListBoxModel.java new file mode 100644 index 000000000..a0d26319c --- /dev/null +++ b/qadevOOo/tests/java/mod/_toolkit/UnoControlListBoxModel.java @@ -0,0 +1,77 @@ +/* + * 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._toolkit; + +import com.sun.star.text.XTextDocument; +import com.sun.star.uno.XInterface; + +import java.io.PrintWriter; + +import lib.TestCase; +import lib.TestEnvironment; +import lib.TestParameters; + +import util.WriterTools; +import util.utils; + + +public class UnoControlListBoxModel extends TestCase { + private static XTextDocument xTextDoc; + + /** + * Creates StarOffice Writer document. + */ + @Override + protected void initialize(TestParameters tParam, PrintWriter log) throws Exception { + log.println("creating a textdocument"); + xTextDoc = WriterTools.createTextDoc( + tParam.getMSF()); + } + + /** + * Disposes StarOffice Writer document. + */ + @Override + protected void cleanup(TestParameters tParam, PrintWriter log) { + log.println(" disposing xTextDoc "); + + util.DesktopTools.closeDoc(xTextDoc); + } + + @Override + protected TestEnvironment createTestEnvironment(TestParameters Param, + PrintWriter log) { + XInterface oObj = null; + + try { + oObj = (XInterface) Param.getMSF().createInstance( + "com.sun.star.awt.UnoControlListBoxModel"); + } catch (Exception e) { + } + + log.println( + "creating a new environment for UnoControlListBoxModel object"); + + TestEnvironment tEnv = new TestEnvironment(oObj); + + tEnv.addObjRelation("OBJNAME", "stardiv.vcl.controlmodel.ListBox"); + System.out.println("ImplementationName: " + utils.getImplName(oObj)); + + return tEnv; + } // finish method getTestEnvironment +} // finish class UnoControlListBoxModel diff --git a/qadevOOo/tests/java/mod/_toolkit/UnoControlNumericField.java b/qadevOOo/tests/java/mod/_toolkit/UnoControlNumericField.java new file mode 100644 index 000000000..073b63756 --- /dev/null +++ b/qadevOOo/tests/java/mod/_toolkit/UnoControlNumericField.java @@ -0,0 +1,150 @@ +/* + * 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._toolkit; + +import java.io.PrintWriter; + +import lib.TestCase; +import lib.TestEnvironment; +import lib.TestParameters; +import util.FormTools; +import util.SOfficeFactory; +import util.WriterTools; +import util.utils; + +import com.sun.star.awt.XControl; +import com.sun.star.awt.XControlModel; +import com.sun.star.awt.XDevice; +import com.sun.star.awt.XGraphics; +import com.sun.star.awt.XTextComponent; +import com.sun.star.awt.XToolkit; +import com.sun.star.awt.XWindow; +import com.sun.star.awt.XWindowPeer; +import com.sun.star.drawing.XControlShape; +import com.sun.star.text.XTextDocument; +import com.sun.star.uno.UnoRuntime; +import com.sun.star.uno.XInterface; +import com.sun.star.util.XCloseable; +import com.sun.star.view.XControlAccess; + + +public class UnoControlNumericField extends TestCase { + private static XTextDocument xTextDoc; + + @Override + protected void initialize(TestParameters Param, PrintWriter log) throws Exception { + SOfficeFactory SOF = SOfficeFactory.getFactory( Param.getMSF()); + + log.println("creating a textdocument"); + xTextDoc = SOF.createTextDoc(null); + } + + @Override + protected void cleanup(TestParameters tParam, PrintWriter log) { + log.println(" disposing xTextDoc "); + + try { + XCloseable closer = UnoRuntime.queryInterface( + XCloseable.class, xTextDoc); + closer.close(true); + } catch (com.sun.star.util.CloseVetoException e) { + log.println("couldn't close document"); + } catch (com.sun.star.lang.DisposedException e) { + log.println("couldn't close document"); + } + } + + @Override + protected TestEnvironment createTestEnvironment(TestParameters Param, + PrintWriter log) throws Exception { + XInterface oObj = null; + XWindowPeer the_win = null; + XToolkit the_kit = null; + XDevice aDevice = null; + XGraphics aGraphic = null; + XControl aControl = null; + + //Insert a ControlShape and get the ControlModel + XControlShape aShape = FormTools.createUnoControlShape(xTextDoc, 3000, + 4500, 15000, + 10000, + "NumericField", + "UnoControlNumericField"); + + WriterTools.getDrawPage(xTextDoc).add(aShape); + + XControlModel the_Model = aShape.getControl(); + + XControlShape aShape2 = FormTools.createControlShape(xTextDoc, 3000, + 4500, 5000, 10000, + "TextField"); + + WriterTools.getDrawPage(xTextDoc).add(aShape2); + + XControlModel the_Model2 = aShape2.getControl(); + + //Try to query XControlAccess + XControlAccess the_access = UnoRuntime.queryInterface( + XControlAccess.class, + xTextDoc.getCurrentController()); + + //get the NumericFieldControl for the needed Object relations + oObj = the_access.getControl(the_Model); + aControl = the_access.getControl(the_Model2); + the_win = the_access.getControl(the_Model).getPeer(); + the_kit = the_win.getToolkit(); + aDevice = the_kit.createScreenCompatibleDevice(200, 200); + aGraphic = aDevice.createGraphics(); + + log.println( + "creating a new environment for UnoControlNumericField object"); + + TestEnvironment tEnv = new TestEnvironment(oObj); + + + //Adding ObjRelation for XView + tEnv.addObjRelation("GRAPHICS", aGraphic); + + + //Adding ObjRelation for XControl + tEnv.addObjRelation("CONTEXT", xTextDoc); + tEnv.addObjRelation("WINPEER", the_win); + tEnv.addObjRelation("TOOLKIT", the_kit); + tEnv.addObjRelation("MODEL", the_Model); + + XWindow forObjRel = UnoRuntime.queryInterface(XWindow.class, + aControl); + + tEnv.addObjRelation("XWindow.AnotherWindow", forObjRel); + tEnv.addObjRelation("XWindow.ControlShape", aShape); + + // Adding relation for XTextListener + ifc.awt._XTextListener.TestTextListener listener = + new ifc.awt._XTextListener.TestTextListener(); + XTextComponent textComp = UnoRuntime.queryInterface( + XTextComponent.class, oObj); + textComp.addTextListener(listener); + tEnv.addObjRelation("TestTextListener", listener); + + tEnv.addObjRelation("XTextComponent.onlyNumbers", ""); + + log.println("ImplementationName: " + utils.getImplName(oObj)); + + return tEnv; + } // finish method getTestEnvironment +} // finish class UnoControlNumericField diff --git a/qadevOOo/tests/java/mod/_toolkit/UnoControlNumericFieldModel.java b/qadevOOo/tests/java/mod/_toolkit/UnoControlNumericFieldModel.java new file mode 100644 index 000000000..bcee5feaf --- /dev/null +++ b/qadevOOo/tests/java/mod/_toolkit/UnoControlNumericFieldModel.java @@ -0,0 +1,77 @@ +/* + * 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._toolkit; + +import com.sun.star.text.XTextDocument; +import com.sun.star.uno.XInterface; + +import java.io.PrintWriter; + +import lib.TestCase; +import lib.TestEnvironment; +import lib.TestParameters; + +import util.WriterTools; +import util.utils; + + +public class UnoControlNumericFieldModel extends TestCase { + private static XTextDocument xTextDoc; + + /** + * Creates StarOffice Writer document. + */ + @Override + protected void initialize(TestParameters tParam, PrintWriter log) throws Exception { + log.println("creating a textdocument"); + xTextDoc = WriterTools.createTextDoc( + tParam.getMSF()); + } + + /** + * Disposes StarOffice Writer document. + */ + @Override + protected void cleanup(TestParameters tParam, PrintWriter log) { + log.println(" disposing xTextDoc "); + + util.DesktopTools.closeDoc(xTextDoc); + } + + @Override + public TestEnvironment createTestEnvironment(TestParameters Param, + PrintWriter log) { + XInterface oObj = null; + + try { + oObj = (XInterface) Param.getMSF().createInstance( + "com.sun.star.awt.UnoControlNumericFieldModel"); + } catch (Exception e) { + } + + log.println( + "creating a new environment for UnoControlNumericFieldModel object"); + + TestEnvironment tEnv = new TestEnvironment(oObj); + + tEnv.addObjRelation("OBJNAME", "stardiv.vcl.controlmodel.NumericField"); + System.out.println("ImplementationName: " + utils.getImplName(oObj)); + + return tEnv; + } // finish method getTestEnvironment +} // finish class UnoControlNumericFieldModel diff --git a/qadevOOo/tests/java/mod/_toolkit/UnoControlPatternField.java b/qadevOOo/tests/java/mod/_toolkit/UnoControlPatternField.java new file mode 100644 index 000000000..72a864373 --- /dev/null +++ b/qadevOOo/tests/java/mod/_toolkit/UnoControlPatternField.java @@ -0,0 +1,140 @@ +/* + * 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._toolkit; + +import com.sun.star.awt.XControl; +import com.sun.star.awt.XControlModel; +import com.sun.star.awt.XDevice; +import com.sun.star.awt.XGraphics; +import com.sun.star.awt.XTextComponent; +import com.sun.star.awt.XToolkit; +import com.sun.star.awt.XWindow; +import com.sun.star.awt.XWindowPeer; +import com.sun.star.drawing.XControlShape; +import com.sun.star.text.XTextDocument; +import com.sun.star.uno.UnoRuntime; +import com.sun.star.uno.XInterface; +import com.sun.star.view.XControlAccess; + +import java.io.PrintWriter; + +import lib.TestCase; +import lib.TestEnvironment; +import lib.TestParameters; +import util.FormTools; +import util.SOfficeFactory; +import util.WriterTools; +import util.utils; + + +public class UnoControlPatternField extends TestCase { + private static XTextDocument xTextDoc; + + @Override + protected void initialize(TestParameters Param, PrintWriter log) throws Exception { + SOfficeFactory SOF = SOfficeFactory.getFactory( + Param.getMSF()); + + log.println("creating a textdocument"); + xTextDoc = SOF.createTextDoc(null); + } + + @Override + protected void cleanup(TestParameters tParam, PrintWriter log) { + log.println(" disposing xTextDoc "); + + util.DesktopTools.closeDoc(xTextDoc); + } + + @Override + protected TestEnvironment createTestEnvironment(TestParameters Param, + PrintWriter log) throws Exception { + XInterface oObj = null; + XWindowPeer the_win = null; + XToolkit the_kit = null; + XDevice aDevice = null; + XGraphics aGraphic = null; + XControl aControl = null; + + //Insert a ControlShape and get the ControlModel + XControlShape aShape = FormTools.createUnoControlShape(xTextDoc, 3000, + 4500, 15000, + 10000, + "PatternField", + "UnoControlPatternField"); + + WriterTools.getDrawPage(xTextDoc).add(aShape); + + XControlModel the_Model = aShape.getControl(); + + XControlShape aShape2 = FormTools.createControlShape(xTextDoc, 3000, + 4500, 5000, 10000, + "TextField"); + + WriterTools.getDrawPage(xTextDoc).add(aShape2); + + XControlModel the_Model2 = aShape2.getControl(); + + //Try to query XControlAccess + XControlAccess the_access = UnoRuntime.queryInterface( + XControlAccess.class, + xTextDoc.getCurrentController()); + + //get the PatternFieldControl for the needed Object relations + oObj = the_access.getControl(the_Model); + aControl = the_access.getControl(the_Model2); + the_win = the_access.getControl(the_Model).getPeer(); + the_kit = the_win.getToolkit(); + aDevice = the_kit.createScreenCompatibleDevice(200, 200); + aGraphic = aDevice.createGraphics(); + + log.println( + "creating a new environment for UnoControlPatternField object"); + + TestEnvironment tEnv = new TestEnvironment(oObj); + + + //Adding ObjRelation for XView + tEnv.addObjRelation("GRAPHICS", aGraphic); + + + //Adding ObjRelation for XControl + tEnv.addObjRelation("CONTEXT", xTextDoc); + tEnv.addObjRelation("WINPEER", the_win); + tEnv.addObjRelation("TOOLKIT", the_kit); + tEnv.addObjRelation("MODEL", the_Model); + + XWindow forObjRel = UnoRuntime.queryInterface(XWindow.class, + aControl); + + tEnv.addObjRelation("XWindow.AnotherWindow", forObjRel); + tEnv.addObjRelation("XWindow.ControlShape", aShape); + + // Adding relation for XTextListener + ifc.awt._XTextListener.TestTextListener listener = + new ifc.awt._XTextListener.TestTextListener(); + XTextComponent textComp = UnoRuntime.queryInterface( + XTextComponent.class, oObj); + textComp.addTextListener(listener); + tEnv.addObjRelation("TestTextListener", listener); + + log.println("ImplementationName: " + utils.getImplName(oObj)); + + return tEnv; + } // finish method getTestEnvironment +} // finish class UnoControlPatternField diff --git a/qadevOOo/tests/java/mod/_toolkit/UnoControlPatternFieldModel.java b/qadevOOo/tests/java/mod/_toolkit/UnoControlPatternFieldModel.java new file mode 100644 index 000000000..e2dcd18cf --- /dev/null +++ b/qadevOOo/tests/java/mod/_toolkit/UnoControlPatternFieldModel.java @@ -0,0 +1,53 @@ +/* + * 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._toolkit; + +import com.sun.star.uno.XInterface; + +import java.io.PrintWriter; + +import lib.TestCase; +import lib.TestEnvironment; +import lib.TestParameters; + +import util.utils; + + +public class UnoControlPatternFieldModel extends TestCase { + @Override + public TestEnvironment createTestEnvironment(TestParameters Param, + PrintWriter log) { + XInterface oObj = null; + + try { + oObj = (XInterface) Param.getMSF().createInstance( + "com.sun.star.awt.UnoControlPatternFieldModel"); + } catch (Exception e) { + } + + log.println( + "creating a new environment for UnoControlPatternFieldModel object"); + + TestEnvironment tEnv = new TestEnvironment(oObj); + + tEnv.addObjRelation("OBJNAME", "stardiv.vcl.controlmodel.PatternField"); + System.out.println("ImplementationName: " + utils.getImplName(oObj)); + + return tEnv; + } // finish method getTestEnvironment +} // finish class UnoControlPatternFieldModel diff --git a/qadevOOo/tests/java/mod/_toolkit/UnoControlProgressBarModel.java b/qadevOOo/tests/java/mod/_toolkit/UnoControlProgressBarModel.java new file mode 100644 index 000000000..f36d39d0b --- /dev/null +++ b/qadevOOo/tests/java/mod/_toolkit/UnoControlProgressBarModel.java @@ -0,0 +1,85 @@ +/* + * 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._toolkit; + +import com.sun.star.uno.XInterface; + +import java.io.PrintWriter; + +import lib.StatusException; +import lib.TestCase; +import lib.TestEnvironment; +import lib.TestParameters; + + +/** +* Test for object which is represented by service +* <code>com.sun.star.awt.UnoControlProgressBarModel</code>. <p> +* Object implements the following interfaces : +* <ul> +* <li> <code>com::sun::star::awt::UnoControlProgressBarModel</code></li> +* <li> <code>com::sun::star::io::XPersistObject</code></li> +* <li> <code>com::sun::star::lang::XComponent</code></li> +* <li> <code>com::sun::star::beans::XPropertySet</code></li> +* <li> <code>com::sun::star::beans::XMultiPropertySet</code></li> +* </ul> +* This object test <b> is NOT </b> designed to be run in several +* threads concurrently. +* @see com.sun.star.awt.UnoControlProgressBarModel +* @see com.sun.star.io.XPersistObject +* @see com.sun.star.lang.XComponent +* @see com.sun.star.beans.XPropertySet +* @see com.sun.star.beans.XMultiPropertySet +* @see ifc.awt._UnoControlProgressBarModel +* @see ifc.io._XPersistObject +* @see ifc.lang._XComponent +* @see ifc.beans._XPropertySet +* @see ifc.beans._XMultiPropertySet +*/ +public class UnoControlProgressBarModel extends TestCase { + /** + * Creating a TestEnvironment for the interfaces to be tested. + * Creates an instance of the service + * <code>com.sun.star.awt.UnoControlProgressBarModel</code>. + * Object relations created : + * <ul> + * <li> <code>'OBJNAME'</code> for + * {@link ifc.io._XPersistObject} </li> + * </ul> + */ + @Override + public TestEnvironment createTestEnvironment(TestParameters Param, + PrintWriter log) + throws StatusException { + XInterface oObj = null; + + try { + oObj = (XInterface) Param.getMSF().createInstance( + "com.sun.star.awt.UnoControlProgressBarModel"); + } catch (Exception e) { + } + + log.println("creating a new environment for object"); + + TestEnvironment tEnv = new TestEnvironment(oObj); + + tEnv.addObjRelation("OBJNAME", "stardiv.vcl.controlmodel.ProgressBar"); + + return tEnv; + } // finish method getTestEnvironment +}
\ No newline at end of file diff --git a/qadevOOo/tests/java/mod/_toolkit/UnoControlRadioButton.java b/qadevOOo/tests/java/mod/_toolkit/UnoControlRadioButton.java new file mode 100644 index 000000000..1f13ae6c0 --- /dev/null +++ b/qadevOOo/tests/java/mod/_toolkit/UnoControlRadioButton.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._toolkit; + +import com.sun.star.awt.XControl; +import com.sun.star.awt.XControlModel; +import com.sun.star.awt.XDevice; +import com.sun.star.awt.XGraphics; +import com.sun.star.awt.XToolkit; +import com.sun.star.awt.XWindow; +import com.sun.star.awt.XWindowPeer; +import com.sun.star.drawing.XControlShape; +import com.sun.star.text.XTextDocument; +import com.sun.star.uno.UnoRuntime; +import com.sun.star.uno.XInterface; +import com.sun.star.view.XControlAccess; + +import java.io.PrintWriter; + +import lib.TestCase; +import lib.TestEnvironment; +import lib.TestParameters; +import util.FormTools; +import util.SOfficeFactory; +import util.WriterTools; +import util.utils; + + +public class UnoControlRadioButton extends TestCase { + private static XTextDocument xTextDoc; + + @Override + protected void initialize(TestParameters Param, PrintWriter log) throws Exception { + SOfficeFactory SOF = SOfficeFactory.getFactory( + Param.getMSF()); + + log.println("creating a textdocument"); + xTextDoc = SOF.createTextDoc(null); + } + + @Override + protected void cleanup(TestParameters tParam, PrintWriter log) { + log.println(" disposing xTextDoc "); + + util.DesktopTools.closeDoc(xTextDoc); + } + + @Override + protected TestEnvironment createTestEnvironment(TestParameters Param, + PrintWriter log) throws Exception { + XInterface oObj = null; + XWindowPeer the_win = null; + XToolkit the_kit = null; + XDevice aDevice = null; + XGraphics aGraphic = null; + XControl aControl = null; + + //Insert a ControlShape and get the ControlModel + XControlShape aShape = FormTools.createUnoControlShape(xTextDoc, 3000, + 4500, 15000, + 10000, + "RadioButton", + "UnoControlRadioButton"); + + WriterTools.getDrawPage(xTextDoc).add(aShape); + + XControlModel the_Model = aShape.getControl(); + + XControlShape aShape2 = FormTools.createControlShape(xTextDoc, 3000, + 4500, 5000, 10000, + "TextField"); + + WriterTools.getDrawPage(xTextDoc).add(aShape2); + + XControlModel the_Model2 = aShape2.getControl(); + + //Try to query XControlAccess + XControlAccess the_access = UnoRuntime.queryInterface( + XControlAccess.class, + xTextDoc.getCurrentController()); + + //get the RadioButtonControl for the needed Object relations + oObj = the_access.getControl(the_Model); + aControl = the_access.getControl(the_Model2); + the_win = the_access.getControl(the_Model).getPeer(); + the_kit = the_win.getToolkit(); + aDevice = the_kit.createScreenCompatibleDevice(200, 200); + aGraphic = aDevice.createGraphics(); + + log.println( + "creating a new environment for UnoControlRadioButton object"); + + TestEnvironment tEnv = new TestEnvironment(oObj); + + + //Adding ObjRelation for XView + tEnv.addObjRelation("GRAPHICS", aGraphic); + + + //Adding ObjRelation for XControl + tEnv.addObjRelation("CONTEXT", xTextDoc); + tEnv.addObjRelation("WINPEER", the_win); + tEnv.addObjRelation("TOOLKIT", the_kit); + tEnv.addObjRelation("MODEL", the_Model); + + XWindow forObjRel = UnoRuntime.queryInterface(XWindow.class, + aControl); + + tEnv.addObjRelation("XWindow.AnotherWindow", forObjRel); + + System.out.println("ImplementationName: " + utils.getImplName(oObj)); + + return tEnv; + } // finish method getTestEnvironment +} // finish class UnoControlRadioButton diff --git a/qadevOOo/tests/java/mod/_toolkit/UnoControlRadioButtonModel.java b/qadevOOo/tests/java/mod/_toolkit/UnoControlRadioButtonModel.java new file mode 100644 index 000000000..859280865 --- /dev/null +++ b/qadevOOo/tests/java/mod/_toolkit/UnoControlRadioButtonModel.java @@ -0,0 +1,53 @@ +/* + * 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._toolkit; + +import com.sun.star.uno.XInterface; + +import java.io.PrintWriter; + +import lib.TestCase; +import lib.TestEnvironment; +import lib.TestParameters; + +import util.utils; + + +public class UnoControlRadioButtonModel extends TestCase { + @Override + public TestEnvironment createTestEnvironment(TestParameters Param, + PrintWriter log) { + XInterface oObj = null; + + try { + oObj = (XInterface) Param.getMSF().createInstance( + "com.sun.star.awt.UnoControlRadioButtonModel"); + } catch (Exception e) { + } + + log.println( + "creating a new environment for UnoControlRadioButtonModel object"); + + TestEnvironment tEnv = new TestEnvironment(oObj); + + tEnv.addObjRelation("OBJNAME", "stardiv.vcl.controlmodel.RadioButton"); + System.out.println("ImplementationName: " + utils.getImplName(oObj)); + + return tEnv; + } // finish method getTestEnvironment +} // finish class UnoControlRadioButtonModel diff --git a/qadevOOo/tests/java/mod/_toolkit/UnoControlScrollBarModel.java b/qadevOOo/tests/java/mod/_toolkit/UnoControlScrollBarModel.java new file mode 100644 index 000000000..1a8e21a38 --- /dev/null +++ b/qadevOOo/tests/java/mod/_toolkit/UnoControlScrollBarModel.java @@ -0,0 +1,88 @@ +/* + * 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._toolkit; + +import com.sun.star.uno.XInterface; + +import java.io.PrintWriter; + +import lib.StatusException; +import lib.TestCase; +import lib.TestEnvironment; +import lib.TestParameters; + +import util.utils; + + +/** +* Test for object which is represented by service +* <code>com.sun.star.awt.UnoControlScrollBarModel</code>. <p> +* Object implements the following interfaces : +* <ul> +* <li> <code>com::sun::star::awt::UnoControlScrollBarModel</code></li> +* <li> <code>com::sun::star::io::XPersistObject</code></li> +* <li> <code>com::sun::star::lang::XComponent</code></li> +* <li> <code>com::sun::star::beans::XPropertySet</code></li> +* <li> <code>com::sun::star::beans::XMultiPropertySet</code></li> +* </ul> +* This object test <b> is NOT </b> designed to be run in several +* threads concurrently. +* @see com.sun.star.awt.UnoControlScrollBarModel +* @see com.sun.star.io.XPersistObject +* @see com.sun.star.lang.XComponent +* @see com.sun.star.beans.XPropertySet +* @see com.sun.star.beans.XMultiPropertySet +* @see ifc.awt._UnoControlScrollBarModel +* @see ifc.io._XPersistObject +* @see ifc.lang._XComponent +* @see ifc.beans._XPropertySet +* @see ifc.beans._XMultiPropertySet +*/ +public class UnoControlScrollBarModel extends TestCase { + /** + * Creating a TestEnvironment for the interfaces to be tested. + * Creates an instance of the service + * <code>com.sun.star.awt.UnoControlScrollBarModel</code>. + * Object relations created : + * <ul> + * <li> <code>'OBJNAME'</code> for + * {@link ifc.io._XPersistObject} </li> + * </ul> + */ + @Override + public TestEnvironment createTestEnvironment(TestParameters Param, + PrintWriter log) + throws StatusException { + XInterface oObj = null; + + try { + oObj = (XInterface) Param.getMSF().createInstance( + "com.sun.star.awt.UnoControlScrollBarModel"); + } catch (Exception e) { + } + + log.println("creating a new environment for object"); + + TestEnvironment tEnv = new TestEnvironment(oObj); + + tEnv.addObjRelation("OBJNAME", "stardiv.vcl.controlmodel.ScrollBar"); + System.out.println("ImplementationName: " + utils.getImplName(oObj)); + + return tEnv; + } // finish method getTestEnvironment +}
\ No newline at end of file diff --git a/qadevOOo/tests/java/mod/_toolkit/UnoControlTimeField.java b/qadevOOo/tests/java/mod/_toolkit/UnoControlTimeField.java new file mode 100644 index 000000000..574330987 --- /dev/null +++ b/qadevOOo/tests/java/mod/_toolkit/UnoControlTimeField.java @@ -0,0 +1,140 @@ +/* + * 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._toolkit; + +import com.sun.star.awt.XControl; +import com.sun.star.awt.XControlModel; +import com.sun.star.awt.XDevice; +import com.sun.star.awt.XGraphics; +import com.sun.star.awt.XTextComponent; +import com.sun.star.awt.XToolkit; +import com.sun.star.awt.XWindow; +import com.sun.star.awt.XWindowPeer; +import com.sun.star.drawing.XControlShape; +import com.sun.star.text.XTextDocument; +import com.sun.star.uno.UnoRuntime; +import com.sun.star.uno.XInterface; +import com.sun.star.view.XControlAccess; + +import java.io.PrintWriter; + +import lib.TestCase; +import lib.TestEnvironment; +import lib.TestParameters; +import util.FormTools; +import util.SOfficeFactory; +import util.WriterTools; +import util.utils; + + +public class UnoControlTimeField extends TestCase { + private static XTextDocument xTextDoc; + + @Override + protected void initialize(TestParameters Param, PrintWriter log) throws Exception { + SOfficeFactory SOF = SOfficeFactory.getFactory( + Param.getMSF()); + + log.println("creating a textdocument"); + xTextDoc = SOF.createTextDoc(null); + } + + @Override + protected void cleanup(TestParameters tParam, PrintWriter log) { + log.println(" disposing xTextDoc "); + + util.DesktopTools.closeDoc(xTextDoc); + } + + @Override + protected TestEnvironment createTestEnvironment(TestParameters Param, + PrintWriter log) throws Exception { + XInterface oObj = null; + XWindowPeer the_win = null; + XToolkit the_kit = null; + XDevice aDevice = null; + XGraphics aGraphic = null; + XControl aControl = null; + + //Insert a ControlShape and get the ControlModel + XControlShape aShape = FormTools.createUnoControlShape(xTextDoc, 3000, + 4500, 15000, + 10000, + "TimeField", + "UnoControlTimeField"); + + WriterTools.getDrawPage(xTextDoc).add(aShape); + + XControlModel the_Model = aShape.getControl(); + + XControlShape aShape2 = FormTools.createControlShape(xTextDoc, 3000, + 4500, 5000, 10000, + "TextField"); + + WriterTools.getDrawPage(xTextDoc).add(aShape2); + + XControlModel the_Model2 = aShape2.getControl(); + + //Try to query XControlAccess + XControlAccess the_access = UnoRuntime.queryInterface( + XControlAccess.class, + xTextDoc.getCurrentController()); + + //get the TimeFieldControl for the needed Object relations + oObj = the_access.getControl(the_Model); + aControl = the_access.getControl(the_Model2); + the_win = the_access.getControl(the_Model).getPeer(); + the_kit = the_win.getToolkit(); + aDevice = the_kit.createScreenCompatibleDevice(200, 200); + aGraphic = aDevice.createGraphics(); + + log.println( + "creating a new environment for UnoControlTimeField object"); + + TestEnvironment tEnv = new TestEnvironment(oObj); + + + //Adding ObjRelation for XView + tEnv.addObjRelation("GRAPHICS", aGraphic); + + + //Adding ObjRelation for XControl + tEnv.addObjRelation("CONTEXT", xTextDoc); + tEnv.addObjRelation("WINPEER", the_win); + tEnv.addObjRelation("TOOLKIT", the_kit); + tEnv.addObjRelation("MODEL", the_Model); + + XWindow forObjRel = UnoRuntime.queryInterface(XWindow.class, + aControl); + + tEnv.addObjRelation("XWindow.AnotherWindow", forObjRel); + tEnv.addObjRelation("XWindow.ControlShape", aShape); + + // Adding relation for XTextListener + ifc.awt._XTextListener.TestTextListener listener = + new ifc.awt._XTextListener.TestTextListener(); + XTextComponent textComp = UnoRuntime.queryInterface( + XTextComponent.class, oObj); + textComp.addTextListener(listener); + tEnv.addObjRelation("TestTextListener", listener); + + log.println("ImplementationName: " + utils.getImplName(oObj)); + + return tEnv; + } // finish method getTestEnvironment +} // finish class UnoControlTimeField diff --git a/qadevOOo/tests/java/mod/_toolkit/UnoControlTimeFieldModel.java b/qadevOOo/tests/java/mod/_toolkit/UnoControlTimeFieldModel.java new file mode 100644 index 000000000..90f75d027 --- /dev/null +++ b/qadevOOo/tests/java/mod/_toolkit/UnoControlTimeFieldModel.java @@ -0,0 +1,53 @@ +/* + * 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._toolkit; + +import com.sun.star.uno.XInterface; + +import java.io.PrintWriter; + +import lib.TestCase; +import lib.TestEnvironment; +import lib.TestParameters; + +import util.utils; + + +public class UnoControlTimeFieldModel extends TestCase { + @Override + protected TestEnvironment createTestEnvironment(TestParameters Param, + PrintWriter log) { + XInterface oObj = null; + + try { + oObj = (XInterface) Param.getMSF().createInstance( + "com.sun.star.awt.UnoControlTimeFieldModel"); + } catch (Exception e) { + } + + log.println( + "creating a new environment for UnoControlTimeFieldModel object"); + + TestEnvironment tEnv = new TestEnvironment(oObj); + + tEnv.addObjRelation("OBJNAME", "stardiv.vcl.controlmodel.TimeField"); + System.out.println("ImplementationName: " + utils.getImplName(oObj)); + + return tEnv; + } // finish method getTestEnvironment +} // finish class UnoControlTimeFieldModel diff --git a/qadevOOo/tests/java/mod/_toolkit/UnoScrollBarControl.java b/qadevOOo/tests/java/mod/_toolkit/UnoScrollBarControl.java new file mode 100644 index 000000000..3a6b27474 --- /dev/null +++ b/qadevOOo/tests/java/mod/_toolkit/UnoScrollBarControl.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._toolkit; + +import com.sun.star.awt.Rectangle; +import com.sun.star.awt.XControl; +import com.sun.star.awt.XControlModel; +import com.sun.star.awt.XDevice; +import com.sun.star.awt.XGraphics; +import com.sun.star.awt.XToolkit; +import com.sun.star.awt.XWindow; +import com.sun.star.awt.XWindowPeer; +import com.sun.star.drawing.XControlShape; +import com.sun.star.frame.XFrame; +import com.sun.star.frame.XModel; +import com.sun.star.text.XTextDocument; +import com.sun.star.uno.UnoRuntime; +import com.sun.star.uno.XInterface; +import com.sun.star.view.XControlAccess; + +import java.awt.Dimension; +import java.awt.Toolkit; +import java.io.PrintWriter; + +import lib.TestCase; +import lib.TestEnvironment; +import lib.TestParameters; +import util.FormTools; +import util.SOfficeFactory; +import util.WriterTools; +import util.utils; + + +public class UnoScrollBarControl extends TestCase { + private static XTextDocument xTextDoc; + + @Override + protected void initialize(TestParameters Param, PrintWriter log) throws Exception { + SOfficeFactory SOF = SOfficeFactory.getFactory( + Param.getMSF()); + + log.println("creating a textdocument"); + xTextDoc = SOF.createTextDoc(null); + + log.println("maximize the window size"); + XModel xModel = UnoRuntime.queryInterface(XModel.class, xTextDoc); + XFrame xFrame = xModel.getCurrentController().getFrame(); + XWindow xWin = xFrame.getContainerWindow(); + + Toolkit.getDefaultToolkit(); + Dimension dim = new Dimension(800, 600); + + Rectangle newPosSize = xWin.getPosSize(); + newPosSize.Width = (int) dim.getWidth(); + newPosSize.Height = (int) dim.getHeight(); + newPosSize.X = 0; + newPosSize.Y = 0; + + xWin.setPosSize(newPosSize.X, newPosSize.Y, newPosSize.Width, + newPosSize.Height, com.sun.star.awt.PosSize.POSSIZE); + } + + @Override + protected void cleanup(TestParameters tParam, PrintWriter log) { + log.println(" disposing xTextDoc "); + + util.DesktopTools.closeDoc(xTextDoc); + } + + @Override + protected TestEnvironment createTestEnvironment(TestParameters Param, + PrintWriter log) throws Exception { + XInterface oObj = null; + XWindowPeer the_win = null; + XToolkit the_kit = null; + XDevice aDevice = null; + XGraphics aGraphic = null; + XControl aControl = null; + + //Insert a ControlShape and get the ControlModel + XControlShape aShape = FormTools.createUnoControlShape(xTextDoc, 3000, + 4500, 15000, + 10000, + "ScrollBar", + "UnoControlScrollBar"); + + WriterTools.getDrawPage(xTextDoc).add(aShape); + + XControlModel the_Model = aShape.getControl(); + + XControlShape aShape2 = FormTools.createControlShape(xTextDoc, 3000, + 4500, 5000, 10000, + "TextField"); + + WriterTools.getDrawPage(xTextDoc).add(aShape2); + + XControlModel the_Model2 = aShape2.getControl(); + + //Try to query XControlAccess + XControlAccess the_access = UnoRuntime.queryInterface( + XControlAccess.class, + xTextDoc.getCurrentController()); + + //get the ScrollBarControl for the needed Object relations + oObj = the_access.getControl(the_Model); + aControl = the_access.getControl(the_Model2); + the_win = the_access.getControl(the_Model).getPeer(); + the_kit = the_win.getToolkit(); + aDevice = the_kit.createScreenCompatibleDevice(200, 200); + aGraphic = aDevice.createGraphics(); + + log.println( + "creating a new environment for UnoControlScrollBar object"); + + TestEnvironment tEnv = new TestEnvironment(oObj); + + + //adding Object-Relation for XScrollBar + tEnv.addObjRelation("Document", xTextDoc); + + + //Adding ObjRelation for XView + tEnv.addObjRelation("GRAPHICS", aGraphic); + + + //Adding ObjRelation for XControl + tEnv.addObjRelation("CONTEXT", xTextDoc); + tEnv.addObjRelation("WINPEER", the_win); + tEnv.addObjRelation("TOOLKIT", the_kit); + tEnv.addObjRelation("MODEL", the_Model); + + XWindow forObjRel = UnoRuntime.queryInterface(XWindow.class, + aControl); + + tEnv.addObjRelation("XWindow.AnotherWindow", forObjRel); + + System.out.println("ImplementationName: " + utils.getImplName(oObj)); + + return tEnv; + } // finish method getTestEnvironment +} diff --git a/qadevOOo/tests/java/mod/_toolkit/UnoSpinButtonControl.java b/qadevOOo/tests/java/mod/_toolkit/UnoSpinButtonControl.java new file mode 100644 index 000000000..df8506f9e --- /dev/null +++ b/qadevOOo/tests/java/mod/_toolkit/UnoSpinButtonControl.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._toolkit; + +import com.sun.star.awt.XControl; +import com.sun.star.awt.XControlModel; +import com.sun.star.awt.XDevice; +import com.sun.star.awt.XGraphics; +import com.sun.star.awt.XToolkit; +import com.sun.star.awt.XWindow; +import com.sun.star.awt.XWindowPeer; +import com.sun.star.drawing.XControlShape; +import com.sun.star.text.XTextDocument; +import com.sun.star.uno.UnoRuntime; +import com.sun.star.uno.XInterface; +import com.sun.star.view.XControlAccess; + +import java.io.PrintWriter; + +import lib.TestCase; +import lib.TestEnvironment; +import lib.TestParameters; +import util.FormTools; +import util.WriterTools; +import util.utils; + + +public class UnoSpinButtonControl extends TestCase { + private static XTextDocument xTextDoc; + + @Override + protected void initialize(TestParameters Param, PrintWriter log) throws Exception { + log.println("creating a textdocument"); + xTextDoc = WriterTools.createTextDoc( + Param.getMSF()); + } + + @Override + protected void cleanup(TestParameters tParam, PrintWriter log) { + log.println(" disposing xTextDoc "); + + util.DesktopTools.closeDoc(xTextDoc); + } + + @Override + protected TestEnvironment createTestEnvironment(TestParameters Param, + PrintWriter log) throws Exception { + XInterface oObj = null; + XWindowPeer the_win = null; + XToolkit the_kit = null; + XDevice aDevice = null; + XGraphics aGraphic = null; + XControl aControl = null; + + //Insert a ControlShape and get the ControlModel + XControlShape aShape = FormTools.createUnoControlShape(xTextDoc, 3000, + 4500, 15000, + 10000, + "SpinButton", + "UnoControlSpinButton"); + + WriterTools.getDrawPage(xTextDoc).add(aShape); + + XControlModel the_Model = aShape.getControl(); + + XControlShape aShape2 = FormTools.createControlShape(xTextDoc, 3000, + 4500, 5000, 10000, + "TextField"); + + WriterTools.getDrawPage(xTextDoc).add(aShape2); + + XControlModel the_Model2 = aShape2.getControl(); + + //Try to query XControlAccess + XControlAccess the_access = UnoRuntime.queryInterface( + XControlAccess.class, + xTextDoc.getCurrentController()); + + //get the SpinButtonControl for the needed Object relations + oObj = the_access.getControl(the_Model); + aControl = the_access.getControl(the_Model2); + the_win = the_access.getControl(the_Model).getPeer(); + the_kit = the_win.getToolkit(); + aDevice = the_kit.createScreenCompatibleDevice(200, 200); + aGraphic = aDevice.createGraphics(); + + log.println( + "creating a new environment for UnoControlSpinButton object"); + + TestEnvironment tEnv = new TestEnvironment(oObj); + + + //adding Object-Relation for XScrollBar + tEnv.addObjRelation("Document", xTextDoc); + + + //Adding ObjRelation for XView + tEnv.addObjRelation("GRAPHICS", aGraphic); + + + //Adding ObjRelation for XControl + tEnv.addObjRelation("CONTEXT", xTextDoc); + tEnv.addObjRelation("WINPEER", the_win); + tEnv.addObjRelation("TOOLKIT", the_kit); + tEnv.addObjRelation("MODEL", the_Model); + + XWindow forObjRel = UnoRuntime.queryInterface(XWindow.class, + aControl); + + tEnv.addObjRelation("XWindow.AnotherWindow", forObjRel); + + tEnv.addObjRelation("Document", xTextDoc); + + System.out.println("ImplementationName: " + utils.getImplName(oObj)); + + return tEnv; + } // finish method getTestEnvironment +} diff --git a/qadevOOo/tests/java/mod/_toolkit/UnoSpinButtonControlModel.java b/qadevOOo/tests/java/mod/_toolkit/UnoSpinButtonControlModel.java new file mode 100644 index 000000000..911e81b96 --- /dev/null +++ b/qadevOOo/tests/java/mod/_toolkit/UnoSpinButtonControlModel.java @@ -0,0 +1,60 @@ +/* + * 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._toolkit; + +import com.sun.star.uno.XInterface; + +import java.io.PrintWriter; + +import lib.StatusException; +import lib.TestCase; +import lib.TestEnvironment; +import lib.TestParameters; + +import util.utils; + + +public class UnoSpinButtonControlModel extends TestCase { + /** + * Creating a TestEnvironment for the interfaces to be tested. + * Creates an instance of the service + * <code>com.sun.star.awt.UnoControlSpinButtonModel</code>. + */ + @Override + public TestEnvironment createTestEnvironment(TestParameters Param, + PrintWriter log) + throws StatusException { + XInterface oObj = null; + + try { + oObj = (XInterface) Param.getMSF().createInstance( + "com.sun.star.awt.UnoControlSpinButtonModel"); + } catch (Exception e) { + } + + log.println("creating a new environment for object"); + + TestEnvironment tEnv = new TestEnvironment(oObj); + + tEnv.addObjRelation("OBJNAME", + "com.sun.star.awt.UnoControlSpinButtonModel"); + System.out.println("ImplementationName: " + utils.getImplName(oObj)); + + return tEnv; + } // finish method getTestEnvironment +}
\ No newline at end of file diff --git a/qadevOOo/tests/java/mod/_toolkit/UnoTreeControl.java b/qadevOOo/tests/java/mod/_toolkit/UnoTreeControl.java new file mode 100644 index 000000000..95f9c56d9 --- /dev/null +++ b/qadevOOo/tests/java/mod/_toolkit/UnoTreeControl.java @@ -0,0 +1,265 @@ +/* + * 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._toolkit; + +import com.sun.star.awt.XControl; +import com.sun.star.awt.XControlContainer; +import com.sun.star.awt.XControlModel; +import com.sun.star.awt.XDialog; +import com.sun.star.awt.XToolkit; +import com.sun.star.awt.tree.XMutableTreeDataModel; +import com.sun.star.awt.tree.XMutableTreeNode; +import com.sun.star.awt.tree.XTreeControl; +import com.sun.star.awt.tree.XTreeNode; +import com.sun.star.beans.XPropertySet; +import com.sun.star.container.XNameContainer; +import com.sun.star.lang.XMultiServiceFactory; +import com.sun.star.ucb.CommandAbortedException; +import com.sun.star.ucb.XSimpleFileAccess; +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 java.util.Comparator; + +import lib.TestCase; +import lib.TestEnvironment; +import lib.TestParameters; +import util.SOfficeFactory; +import util.utils; + + +public class UnoTreeControl extends TestCase { + private static XMutableTreeDataModel mXTreeDataModel; + private static XMultiServiceFactory mxMSF; + + @Override + protected void initialize(TestParameters Param, PrintWriter log) throws Exception { + SOfficeFactory SOF = SOfficeFactory.getFactory( + Param.getMSF()); + + log.println("creating a textdocument"); + SOF.createTextDoc(null); + } + + @Override + protected void cleanup(TestParameters tParam, PrintWriter log) { + } + + @Override + protected TestEnvironment createTestEnvironment(TestParameters Param, + PrintWriter log) { + String sTreeControlName = "UnoTreeControl-Test"; + mxMSF = Param.getMSF(); + XInterface oObj = null; + XMutableTreeNode xNode = null; + + try { + + mXTreeDataModel = UnoRuntime.queryInterface(XMutableTreeDataModel.class, + mxMSF.createInstance("com.sun.star.awt.tree.MutableTreeDataModel")); + + xNode = mXTreeDataModel.createNode("UnoTreeControl", false); + + xNode.setDataValue( "UnoTreeControl"); + xNode.setExpandedGraphicURL( "private:graphicrepository/sd/res/triangle_down.png"); + xNode.setCollapsedGraphicURL( "private:graphicrepository/sd/res/triangle_right.png"); + + fillNode(xNode); + + mXTreeDataModel.setRoot(xNode); + + XControlModel xDialogModel = UnoRuntime.queryInterface(XControlModel.class, + mxMSF.createInstance("com.sun.star.awt.UnoControlDialogModel")); + + XPropertySet xDialogPropertySet = UnoRuntime.queryInterface(XPropertySet.class, xDialogModel); + xDialogPropertySet.setPropertyValue( "PositionX", Integer.valueOf(50) ); + xDialogPropertySet.setPropertyValue( "PositionY", Integer.valueOf(50) ); + xDialogPropertySet.setPropertyValue( "Width", Integer.valueOf(256) ); + xDialogPropertySet.setPropertyValue( "Height", Integer.valueOf(256) ); + xDialogPropertySet.setPropertyValue( "Title", "Tree Control Test"); + + XMultiServiceFactory xDialogMSF = UnoRuntime.queryInterface(XMultiServiceFactory.class, xDialogModel); + + XControlModel xTreeControlModel = UnoRuntime.queryInterface(XControlModel.class, + xDialogMSF.createInstance("com.sun.star.awt.tree.TreeControlModel")); + + XPropertySet XTreeControlModelSet = UnoRuntime.queryInterface(XPropertySet.class, xTreeControlModel); + + XTreeControlModelSet.setPropertyValue( "SelectionType",com.sun.star.view.SelectionType.NONE); + XTreeControlModelSet.setPropertyValue( "PositionX", Integer.valueOf(3 )); + XTreeControlModelSet.setPropertyValue( "PositionY", Integer.valueOf(3 )); + XTreeControlModelSet.setPropertyValue( "Width", Integer.valueOf(253)); + XTreeControlModelSet.setPropertyValue( "Height", Integer.valueOf(253) ); + XTreeControlModelSet.setPropertyValue( "DataModel", mXTreeDataModel ); + XTreeControlModelSet.setPropertyValue( "ShowsRootHandles", Boolean.FALSE); + XTreeControlModelSet.setPropertyValue( "ShowsHandles", Boolean.FALSE); + XTreeControlModelSet.setPropertyValue( "RootDisplayed", Boolean.TRUE); + XTreeControlModelSet.setPropertyValue( "Editable", Boolean.TRUE); + + XNameContainer xDialogModelContainer = UnoRuntime.queryInterface(XNameContainer.class, xDialogModel); + + xDialogModelContainer.insertByName( sTreeControlName, xTreeControlModel); + + XControl xDialogControl = UnoRuntime.queryInterface(XControl.class, + mxMSF.createInstance("com.sun.star.awt.UnoControlDialog")); + + xDialogControl.setModel( xDialogModel ); + + XToolkit xToolkit = UnoRuntime.queryInterface(XToolkit.class, + mxMSF.createInstance("com.sun.star.awt.Toolkit" )); + + xDialogControl.createPeer( xToolkit, null ); + + // get the peers of the sub controls from the dialog peer container + XControlContainer xDialogContainer = UnoRuntime.queryInterface(XControlContainer.class ,xDialogControl); + + XTreeControl xTreeControl = UnoRuntime.queryInterface(XTreeControl.class, xDialogContainer.getControl( sTreeControlName )); + + xTreeControl.expandNode(xNode); + oObj = xTreeControl; + + XDialog xDialog = UnoRuntime.queryInterface(XDialog.class, xDialogControl); + + execurteDialog aDialog = new execurteDialog(xDialog); + + aDialog.start(); + + } catch (com.sun.star.uno.Exception ex) { + ex.printStackTrace(); + } + TestEnvironment tEnv = new TestEnvironment(oObj); + + tEnv.addObjRelation("XTreeControl_Node", xNode); + + //com.sun.star.view.XSelectionSupplier + try { + + System.out.println("count of children: " + xNode.getChildCount()); + tEnv.addObjRelation("Selections", new Object[]{xNode.getChildAt(0), xNode}); + } catch (com.sun.star.lang.IndexOutOfBoundsException ex) { + log.println("ERROR: could not add object relation 'Selections' because 'xNode.getChildAt(1) failed: " + + ex.toString()); + } + + tEnv.addObjRelation("Comparer", + new Comparator<Object>() { + public int compare(Object o1, Object o2) { + XMutableTreeNode xNode1 = UnoRuntime.queryInterface( + XMutableTreeNode.class, o1); + XTreeNode xNode2a = null; + try { + xNode2a = (XTreeNode) AnyConverter.toObject(new Type(XTreeNode.class), o2); + } catch (com.sun.star.lang.IllegalArgumentException ex) { + ex.printStackTrace(); + } + + XMutableTreeNode xNode2 = UnoRuntime.queryInterface( + XMutableTreeNode.class, xNode2a); + + if (((String) xNode1.getDataValue()).equals(xNode2.getDataValue())) { + return 0; + } + + return -1; + } + }); + System.out.println("ImplementationName: " + utils.getImplName(oObj)); + + return tEnv; + } // finish method getTestEnvironment + + private void fillNode( XMutableTreeNode xNode ){ + + if( xNode.getChildCount() == 0 ) + { + xNode.getDataValue(); + + String officeUserPath = utils.getOfficeUserPath(mxMSF); + Object fileacc = null; + try { + fileacc = mxMSF.createInstance("com.sun.star.comp.ucb.SimpleFileAccess"); + } catch (com.sun.star.uno.Exception ex) { + ex.printStackTrace(); + } + UnoRuntime.queryInterface(XSimpleFileAccess.class,fileacc); + + + dirlist(officeUserPath, xNode); + } + } + + private void dirlist(String dir, XMutableTreeNode xNode){ + + Object fileacc = null; + try { + fileacc = mxMSF.createInstance("com.sun.star.comp.ucb.SimpleFileAccess"); + } catch (com.sun.star.uno.Exception ex) { + ex.printStackTrace(); + } + XSimpleFileAccess sfa = UnoRuntime.queryInterface(XSimpleFileAccess.class,fileacc); + XMutableTreeNode xChildNode = null; + try { + xChildNode = mXTreeDataModel.createNode(dir.substring(dir.lastIndexOf("/")+1, dir.length()), sfa.isFolder(dir)); + xChildNode.setDataValue(dir); + sfa.isFolder(dir); + if (sfa.isFolder(dir)){ + xChildNode.setExpandedGraphicURL( "private:graphicrepository/sd/res/triangle_down.png"); + xChildNode.setCollapsedGraphicURL("private:graphicrepository/sd/res/triangle_right.png"); + String[] children = sfa.getFolderContents(dir, true); + if (children != null){ + for (int i=0; i<children.length; i++) { + // Get filename of file or directory + String filename = children[i]; + dirlist( filename , xChildNode); + } + } + } + else{ + xChildNode.setNodeGraphicURL( "private:graphicrepository/sw/res/nc20010.png"); + } + } catch (CommandAbortedException ex) { + ex.printStackTrace(); + } catch (com.sun.star.uno.Exception ex) { + ex.printStackTrace(); + } + + try { + xNode.appendChild( xChildNode ); + } catch (com.sun.star.lang.IllegalArgumentException ex) { + ex.printStackTrace(); + } + } + + private static class execurteDialog extends Thread{ + private final XDialog mXDialog; + + public execurteDialog(XDialog xDialog){ + mXDialog = xDialog; + } + + @Override + public void run() { + mXDialog.endExecute(); + } + } + + +} // finish class UnoControlRadioButton diff --git a/qadevOOo/tests/java/mod/_toolkit/UnoTreeModel.java b/qadevOOo/tests/java/mod/_toolkit/UnoTreeModel.java new file mode 100644 index 000000000..bb7534ebd --- /dev/null +++ b/qadevOOo/tests/java/mod/_toolkit/UnoTreeModel.java @@ -0,0 +1,77 @@ +/* + * 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._toolkit; + +import com.sun.star.text.XTextDocument; +import com.sun.star.uno.XInterface; + +import java.io.PrintWriter; + +import lib.TestCase; +import lib.TestEnvironment; +import lib.TestParameters; + +import util.WriterTools; +import util.utils; + + +public class UnoTreeModel extends TestCase { + private static XTextDocument xTextDoc; + + /** + * Creates StarOffice Writer document. + */ + @Override + protected void initialize(TestParameters tParam, PrintWriter log) throws Exception { + log.println("creating a textdocument"); + xTextDoc = WriterTools.createTextDoc( + tParam.getMSF()); + } + + /** + * Disposes StarOffice Writer document. + */ + @Override + protected void cleanup(TestParameters tParam, PrintWriter log) { + log.println(" disposing xTextDoc "); + + util.DesktopTools.closeDoc(xTextDoc); + } + + @Override + protected TestEnvironment createTestEnvironment(TestParameters Param, + PrintWriter log) { + XInterface oObj = null; + + try { + oObj = (XInterface) Param.getMSF().createInstance( + "com.sun.star.awt.tree.TreeControlModel"); + } catch (Exception e) { + } + + log.println( + "creating a new environment for TreeControlModel object"); + + TestEnvironment tEnv = new TestEnvironment(oObj); + + tEnv.addObjRelation("OBJNAME", "com.sun.star.awt.tree.TreeControlModel"); + System.out.println("ImplementationName: " + utils.getImplName(oObj)); + + return tEnv; + } // finish method getTestEnvironment +} // finish class UnoControlListBoxModel diff --git a/qadevOOo/tests/java/mod/_toolkit/package.html b/qadevOOo/tests/java/mod/_toolkit/package.html new file mode 100644 index 000000000..1ab783205 --- /dev/null +++ b/qadevOOo/tests/java/mod/_toolkit/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 'toolkit'.</P> +</BODY> +</HTML> |