summaryrefslogtreecommitdiff
path: root/qadevOOo/tests/java/mod/_svtools
diff options
context:
space:
mode:
Diffstat (limited to 'qadevOOo/tests/java/mod/_svtools')
-rw-r--r--qadevOOo/tests/java/mod/_svtools/AccessibleBrowseBox.java218
-rw-r--r--qadevOOo/tests/java/mod/_svtools/AccessibleBrowseBoxHeaderBar.java270
-rw-r--r--qadevOOo/tests/java/mod/_svtools/AccessibleBrowseBoxHeaderCell.java256
-rw-r--r--qadevOOo/tests/java/mod/_svtools/AccessibleBrowseBoxTable.java255
-rw-r--r--qadevOOo/tests/java/mod/_svtools/AccessibleBrowseBoxTableCell.java247
-rw-r--r--qadevOOo/tests/java/mod/_svtools/AccessibleIconChoiceCtrl.java290
-rw-r--r--qadevOOo/tests/java/mod/_svtools/AccessibleIconChoiceCtrlEntry.java267
-rw-r--r--qadevOOo/tests/java/mod/_svtools/AccessibleTabBar.java176
-rw-r--r--qadevOOo/tests/java/mod/_svtools/AccessibleTabBarPage.java197
-rw-r--r--qadevOOo/tests/java/mod/_svtools/AccessibleTabBarPageList.java212
-rw-r--r--qadevOOo/tests/java/mod/_svtools/AccessibleTreeListBox.java266
-rw-r--r--qadevOOo/tests/java/mod/_svtools/AccessibleTreeListBoxEntry.java312
12 files changed, 2966 insertions, 0 deletions
diff --git a/qadevOOo/tests/java/mod/_svtools/AccessibleBrowseBox.java b/qadevOOo/tests/java/mod/_svtools/AccessibleBrowseBox.java
new file mode 100644
index 000000000000..32717be5f6d2
--- /dev/null
+++ b/qadevOOo/tests/java/mod/_svtools/AccessibleBrowseBox.java
@@ -0,0 +1,218 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: AccessibleBrowseBox.java,v $
+ * $Revision: 1.7.8.2 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+package mod._svtools;
+
+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 com.sun.star.accessibility.AccessibleRole;
+import com.sun.star.accessibility.XAccessible;
+import com.sun.star.awt.XExtendedToolkit;
+import com.sun.star.awt.XWindow;
+import com.sun.star.beans.PropertyValue;
+import com.sun.star.frame.XController;
+import com.sun.star.frame.XDesktop;
+import com.sun.star.frame.XDispatch;
+import com.sun.star.frame.XDispatchProvider;
+import com.sun.star.frame.XFrame;
+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.view.XSelectionSupplier;
+
+public class AccessibleBrowseBox extends TestCase {
+
+ static XDesktop the_Desk;
+ static XTextDocument xTextDoc;
+
+ /**
+ * Creates the Desktop service (<code>com.sun.star.frame.Desktop</code>).
+ */
+ protected void initialize(TestParameters Param, PrintWriter log) {
+ the_Desk = (XDesktop) UnoRuntime.queryInterface(
+ XDesktop.class, DesktopTools.createDesktop((XMultiServiceFactory) Param.getMSF()));
+ }
+
+ /**
+ * Disposes the document, if exists, created in
+ * <code>createTestEnvironment</code> method.
+ */
+ protected void cleanup(TestParameters Param, PrintWriter log) {
+
+ log.println("disposing xTextDoc");
+
+ if (xTextDoc != null) {
+ xTextDoc.dispose();
+ }
+ }
+
+ /**
+ * Called to create an instance of <code>TestEnvironment</code> with an
+ * object to test and related objects. Subclasses should implement this
+ * method to provide the implementation and related objects. The method is
+ * called from <code>getTestEnvironment()</code>.
+ *
+ * @param tParam test parameters
+ * @param log writer to log information while testing
+ *
+ * @see TestEnvironment
+ * @see #getTestEnvironment()
+ */
+ protected TestEnvironment createTestEnvironment(TestParameters tParam, PrintWriter log) {
+
+ log.println("creating a test environment");
+
+ if (xTextDoc != null) {
+ xTextDoc.dispose(); // get a soffice factory object
+ }
+ SOfficeFactory SOF = SOfficeFactory.getFactory((XMultiServiceFactory) tParam.getMSF());
+
+ try {
+ log.println("creating a text document");
+ xTextDoc = SOF.createTextDoc(null);
+ } catch (com.sun.star.uno.Exception e) {
+ // Some exception occures.FAILED
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't create document", e);
+ }
+
+ shortWait();
+
+ XModel aModel1 = (XModel) UnoRuntime.queryInterface(XModel.class, xTextDoc);
+
+ XController secondController = aModel1.getCurrentController();
+
+
+ XDispatchProvider aProv = (XDispatchProvider) UnoRuntime.queryInterface(XDispatchProvider.class,
+ secondController);
+
+ XDispatch getting = null;
+
+ log.println("opening DatasourceBrowser");
+ URL the_url = new URL();
+ the_url.Complete = ".component:DB/DataSourceBrowser";
+ getting = aProv.queryDispatch(the_url, "_beamer", 12);
+ PropertyValue[] noArgs = new PropertyValue[0];
+ getting.dispatch(the_url, noArgs);
+
+ shortWait();
+
+ XFrame the_frame1 = the_Desk.getCurrentFrame();
+
+ if (the_frame1 == null) {
+ log.println("Current frame was not found !!!");
+ }
+
+ XFrame the_frame2 = the_frame1.findFrame("_beamer", 4);
+
+ the_frame2.setName("DatasourceBrowser");
+
+ XInterface oObj = null;
+
+ final XSelectionSupplier xSelect = (XSelectionSupplier) UnoRuntime.queryInterface(
+ XSelectionSupplier.class, the_frame2.getController());
+
+ PropertyValue[] params = new PropertyValue[]{new PropertyValue(), new PropertyValue(), new PropertyValue()};
+ params[0].Name = "DataSourceName";
+ params[0].Value = "Bibliography";
+ params[1].Name = "CommandType";
+ params[1].Value = new Integer(com.sun.star.sdb.CommandType.TABLE);
+ params[2].Name = "Command";
+ params[2].Value = "biblio";
+
+ final PropertyValue[] fParams = params;
+
+ shortWait();
+
+ try {
+ oObj = (XInterface) ((XMultiServiceFactory) tParam.getMSF()).createInstance("com.sun.star.awt.Toolkit");
+ } catch (com.sun.star.uno.Exception e) {
+ log.println("Couldn't get toolkit");
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't get toolkit", e);
+ }
+
+
+ XExtendedToolkit tk = (XExtendedToolkit) UnoRuntime.queryInterface(XExtendedToolkit.class, oObj);
+
+
+ AccessibilityTools at = new AccessibilityTools();
+
+ XWindow xWindow = (XWindow) UnoRuntime.queryInterface(XWindow.class, tk.getActiveTopWindow());
+
+ XAccessible xRoot = at.getAccessibleObject(xWindow);
+
+ at.printAccessibleTree(log, xRoot, tParam.getBool(util.PropertyName.DEBUG_IS_ACTIVE));
+
+ oObj = at.getAccessibleObjectForRole(xRoot, AccessibleRole.PANEL, "", "AccessibleBrowseBox");
+
+ log.println("ImplementationName: " + util.utils.getImplName(oObj));
+
+ TestEnvironment tEnv = new TestEnvironment(oObj);
+
+
+ tEnv.addObjRelation("EventProducer",
+ new ifc.accessibility._XAccessibleEventBroadcaster.EventProducer() {
+
+ public void fireEvent() {
+ try {
+ xSelect.select(fParams);
+ } catch (com.sun.star.uno.Exception e) {
+ e.printStackTrace();
+ }
+ }
+ });
+
+ return tEnv;
+ }
+
+ /**
+ * Sleeps for 0.5 sec. to allow StarOffice to react on <code>
+ * reset</code> call.
+ */
+ private void shortWait() {
+ try {
+ Thread.sleep(5000);
+ ;
+ } catch (InterruptedException e) {
+ System.out.println("While waiting :" + e);
+ }
+ }
+}
diff --git a/qadevOOo/tests/java/mod/_svtools/AccessibleBrowseBoxHeaderBar.java b/qadevOOo/tests/java/mod/_svtools/AccessibleBrowseBoxHeaderBar.java
new file mode 100644
index 000000000000..7dc133fad175
--- /dev/null
+++ b/qadevOOo/tests/java/mod/_svtools/AccessibleBrowseBoxHeaderBar.java
@@ -0,0 +1,270 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: AccessibleBrowseBoxHeaderBar.java,v $
+ * $Revision: 1.9.8.1 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+package mod._svtools;
+
+import com.sun.star.view.XSelectionSupplier;
+import java.awt.Robot;
+import java.awt.event.InputEvent;
+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 com.sun.star.accessibility.AccessibleRole;
+import com.sun.star.accessibility.XAccessible;
+import com.sun.star.accessibility.XAccessibleComponent;
+import com.sun.star.awt.Point;
+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.XDesktop;
+import com.sun.star.frame.XDispatch;
+import com.sun.star.frame.XDispatchProvider;
+import com.sun.star.frame.XFrame;
+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;
+
+
+/**
+ * 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>
+ * </ul> <p>
+ *
+ * @see com.sun.star.accessibility.XAccessibleEventBroadcaster
+ * @see com.sun.star.accessibility.XAccessibleContext
+ * @see ifc.accessibility._XAccessibleEventBroadcaster
+ * @see ifc.accessibility._XAccessibleContext
+ */
+public class AccessibleBrowseBoxHeaderBar extends TestCase {
+ static XDesktop the_Desk;
+ static XTextDocument xTextDoc;
+
+ /**
+ * Creates the Desktop service (<code>com.sun.star.frame.Desktop</code>).
+ */
+ protected void initialize(TestParameters Param, PrintWriter log) {
+ the_Desk = (XDesktop) UnoRuntime.queryInterface(XDesktop.class,
+ DesktopTools.createDesktop(
+ (XMultiServiceFactory) Param.getMSF()));
+ }
+
+ /**
+ * Disposes the document, if exists, created in
+ * <code>createTestEnvironment</code> method.
+ */
+ protected void cleanup(TestParameters Param, PrintWriter log) {
+ log.println("disposing xTextDoc");
+
+ if (xTextDoc != null) {
+ xTextDoc.dispose();
+ }
+ }
+
+ /**
+ * Creates a text document. Opens the DataSource browser.
+ * Creates an instance of the service <code>com.sun.star.awt.Toolkit</code>
+ * and gets active top window. Then obtains an accessible object with
+ * the role <code>AccessibleRole.TABLE</code>.
+ * Object relations created :
+ * <ul>
+ * <li> <code>'EventProducer'</code> for
+ * {@link ifc.accessibility._XAccessibleEventBroadcaster}:
+ * </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
+ */
+ protected TestEnvironment createTestEnvironment(TestParameters tParam,
+ PrintWriter log) {
+ log.println("creating a test environment");
+
+ if (xTextDoc != null) {
+ xTextDoc.dispose();
+ }
+
+ // get a soffice factory object
+ SOfficeFactory SOF = SOfficeFactory.getFactory( (XMultiServiceFactory) tParam.getMSF());
+
+ try {
+ log.println("creating a text document");
+ xTextDoc = SOF.createTextDoc(null);
+ } catch (com.sun.star.uno.Exception e) {
+ // Some exception occures.FAILED
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't create document", e);
+ }
+
+ shortWait();
+
+ XModel aModel1 = (XModel) UnoRuntime.queryInterface(XModel.class,
+ xTextDoc);
+
+ XController secondController = aModel1.getCurrentController();
+
+ XDispatchProvider aProv = (XDispatchProvider) UnoRuntime.queryInterface(
+ XDispatchProvider.class,
+ secondController);
+
+ XDispatch getting = null;
+
+ log.println("opening DatasourceBrowser");
+
+ URL the_url = new URL();
+ the_url.Complete = ".component:DB/DataSourceBrowser";
+ getting = aProv.queryDispatch(the_url, "_beamer", 12);
+
+ //am controller ein XSelectionSupplier->mit params rufen
+ PropertyValue[] noArgs = new PropertyValue[0];
+ getting.dispatch(the_url, noArgs);
+
+ PropertyValue[] params = new PropertyValue[3];
+ PropertyValue param1 = new PropertyValue();
+ param1.Name = "DataSourceName";
+ param1.Value = "Bibliography";
+ params[0] = param1;
+
+ PropertyValue param2 = new PropertyValue();
+ param2.Name = "CommandType";
+ param2.Value = new Integer(com.sun.star.sdb.CommandType.TABLE);
+ params[1] = param2;
+
+ PropertyValue param3 = new PropertyValue();
+ param3.Name = "Command";
+ param3.Value = "biblio";
+ params[2] = param3;
+
+ shortWait();
+
+ XFrame the_frame1 = the_Desk.getCurrentFrame();
+
+ if (the_frame1 == null) {
+ log.println("Current frame was not found !!!");
+ }
+
+ XFrame the_frame2 = the_frame1.findFrame("_beamer", 4);
+
+ the_frame2.setName("DatasourceBrowser");
+
+ XController xCont = the_frame2.getController();
+
+ XSelectionSupplier xSelect = (XSelectionSupplier) UnoRuntime.queryInterface(
+ XSelectionSupplier.class, xCont);
+
+ try {
+ xSelect.select(params);
+ } catch (com.sun.star.lang.IllegalArgumentException ex) {
+ throw new StatusException("Could not select Biblio-Database", ex);
+ }
+
+ XInterface oObj = null;
+
+ try {
+ oObj = (XInterface) ( (XMultiServiceFactory) tParam.getMSF())
+ .createInstance("com.sun.star.awt.Toolkit");
+ } catch (com.sun.star.uno.Exception e) {
+ throw new StatusException("Couldn't get toolkit", e);
+ }
+
+ XExtendedToolkit tk = (XExtendedToolkit) UnoRuntime.queryInterface(
+ XExtendedToolkit.class, oObj);
+
+ AccessibilityTools at = new AccessibilityTools();
+
+ XWindow xWindow = (XWindow) UnoRuntime.queryInterface(XWindow.class,
+ tk.getActiveTopWindow());
+
+ XAccessible xRoot = at.getAccessibleObject(xWindow);
+
+ oObj = at.getAccessibleObjectForRole(xRoot, AccessibleRole.TABLE);
+
+ at.printAccessibleTree(log, xRoot, tParam.getBool(util.PropertyName.DEBUG_IS_ACTIVE));
+ log.println("ImplementationName: " + util.utils.getImplName(oObj));
+
+ TestEnvironment tEnv = new TestEnvironment(oObj);
+
+ shortWait();
+
+ XAccessibleComponent accComp = (XAccessibleComponent) UnoRuntime.queryInterface(
+ XAccessibleComponent.class,
+ oObj);
+ final Point point = accComp.getLocationOnScreen();
+
+ shortWait();
+
+ tEnv.addObjRelation("EventProducer",
+ new ifc.accessibility._XAccessibleEventBroadcaster.EventProducer() {
+ public void fireEvent() {
+ try {
+ Robot rob = new Robot();
+ rob.mouseMove(point.X + 5, point.Y + 5);
+ rob.mousePress(InputEvent.BUTTON1_MASK);
+ } catch (java.awt.AWTException e) {
+ System.out.println("couldn't fire event");
+ }
+ }
+ });
+
+ return tEnv;
+ }
+
+ /**
+ * Sleeps for 0.5 sec. to allow StarOffice to react on <code>
+ * reset</code> call.
+ */
+ private void shortWait() {
+ try {
+ Thread.sleep(5000);;
+ } catch (InterruptedException e) {
+ System.out.println("While waiting :" + e);
+ }
+ }
+}
diff --git a/qadevOOo/tests/java/mod/_svtools/AccessibleBrowseBoxHeaderCell.java b/qadevOOo/tests/java/mod/_svtools/AccessibleBrowseBoxHeaderCell.java
new file mode 100644
index 000000000000..ca6104cd219f
--- /dev/null
+++ b/qadevOOo/tests/java/mod/_svtools/AccessibleBrowseBoxHeaderCell.java
@@ -0,0 +1,256 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: AccessibleBrowseBoxHeaderCell.java,v $
+ * $Revision: 1.10.8.1 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package mod._svtools;
+
+import com.sun.star.view.XSelectionSupplier;
+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 com.sun.star.accessibility.AccessibleRole;
+import com.sun.star.accessibility.XAccessible;
+import com.sun.star.awt.XExtendedToolkit;
+import com.sun.star.awt.XWindow;
+import com.sun.star.beans.PropertyValue;
+import com.sun.star.frame.XController;
+import com.sun.star.frame.XDesktop;
+import com.sun.star.frame.XDispatch;
+import com.sun.star.frame.XDispatchProvider;
+import com.sun.star.frame.XFrame;
+import com.sun.star.frame.XModel;
+import com.sun.star.lang.XInitialization;
+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;
+
+/**
+ * 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>
+ * </ul> <p>
+ *
+ * @see com.sun.star.accessibility.XAccessibleEventBroadcaster
+ * @see com.sun.star.accessibility.XAccessibleContext
+ * @see ifc.accessibility._XAccessibleEventBroadcaster
+ * @see ifc.accessibility._XAccessibleContext
+ */
+public class AccessibleBrowseBoxHeaderCell extends TestCase {
+
+ static XDesktop the_Desk;
+ static XTextDocument xTextDoc;
+
+ /**
+ * Creates the Desktop service (<code>com.sun.star.frame.Desktop</code>).
+ */
+ protected void initialize(TestParameters Param, PrintWriter log) {
+ the_Desk = (XDesktop) UnoRuntime.queryInterface(
+ XDesktop.class, DesktopTools.createDesktop((XMultiServiceFactory)Param.getMSF()));
+ }
+
+ /**
+ * Disposes the document, if exists, created in
+ * <code>createTestEnvironment</code> method.
+ */
+ protected void cleanup( TestParameters Param, PrintWriter log) {
+
+ log.println("disposing xTextDoc");
+
+ if (xTextDoc != null) {
+ xTextDoc.dispose();
+ }
+ }
+
+ /**
+ * Creates a text document. Opens the DataSource browser and loads
+ * the table. Creates an instance of the service
+ * <code>com.sun.star.awt.Toolkit</code> and gets active top window.
+ * Then obtains an accessible object with the role
+ * <code>AccessibleRole.UNKNOWN</code> and with the name
+ * <code>"Identifier"</code>.
+ * Object relations created :
+ * <ul>
+ * <li> <code>'EventProducer'</code> for
+ * {@link ifc.accessibility._XAccessibleEventBroadcaster}:
+ * method <code>fireEvent()</code> is empty because object is transient
+ * </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
+ */
+ protected TestEnvironment createTestEnvironment(
+ TestParameters tParam, PrintWriter log) {
+
+ log.println( "creating a test environment" );
+
+ if (xTextDoc != null) xTextDoc.dispose();
+
+ // get a soffice factory object
+ SOfficeFactory SOF = SOfficeFactory.getFactory( (XMultiServiceFactory)tParam.getMSF());
+
+ try {
+ log.println( "creating a text document" );
+ xTextDoc = SOF.createTextDoc(null);
+ } catch ( com.sun.star.uno.Exception e ) {
+ // Some exception occures.FAILED
+ e.printStackTrace( log );
+ throw new StatusException( "Couldn't create document", e );
+ }
+
+ shortWait();
+
+ XModel aModel1 = (XModel)
+ UnoRuntime.queryInterface(XModel.class, xTextDoc);
+
+ XController secondController = aModel1.getCurrentController();
+
+ XDispatchProvider aProv = (XDispatchProvider)UnoRuntime.
+ queryInterface(XDispatchProvider.class, secondController);
+
+ XDispatch getting = null;
+
+ log.println( "opening DatasourceBrowser" );
+ URL the_url = new URL();
+ the_url.Complete = ".component:DB/DataSourceBrowser";
+ getting = aProv.queryDispatch(the_url, "_beamer", 12);
+ PropertyValue[] noArgs = new PropertyValue[0];
+ getting.dispatch(the_url, noArgs);
+
+ shortWait();
+
+ XFrame the_frame1 = the_Desk.getCurrentFrame();
+
+ if (the_frame1 == null) {
+ log.println("Current frame was not found !!!");
+ }
+
+ XFrame the_frame2 = the_frame1.findFrame("_beamer", 4);
+
+ the_frame2.setName("DatasourceBrowser");
+
+ XInterface oObj = null;
+
+ final XInitialization xInit = (XInitialization)
+ UnoRuntime.queryInterface(
+ XInitialization.class, the_frame2.getController());
+
+ PropertyValue[] params = new PropertyValue[3];
+ PropertyValue param1 = new PropertyValue();
+ param1.Name = "DataSourceName";
+ param1.Value = "Bibliography";
+ params[0] = param1;
+ PropertyValue param2 = new PropertyValue();
+ param2.Name = "CommandType";
+ param2.Value = new Integer(com.sun.star.sdb.CommandType.TABLE);
+ params[1] = param2;
+ PropertyValue param3 = new PropertyValue();
+ param3.Name = "Command";
+ param3.Value = "biblio";
+ params[2] = param3;
+
+ XController xCont = the_frame2.getController();
+
+ XSelectionSupplier xSelect = (XSelectionSupplier) UnoRuntime.queryInterface(
+ XSelectionSupplier.class, xCont);
+
+ try {
+ xSelect.select(params);
+ } catch (com.sun.star.lang.IllegalArgumentException ex) {
+ throw new StatusException("Could not select Biblio-Database", ex);
+ }
+
+
+ try {
+ oObj = (XInterface) ((XMultiServiceFactory)tParam.getMSF()).createInstance
+ ("com.sun.star.awt.Toolkit");
+ } catch (com.sun.star.uno.Exception e) {
+ throw new StatusException("Couldn't get toolkit", e );
+ }
+
+ XExtendedToolkit tk = (XExtendedToolkit)
+ UnoRuntime.queryInterface(XExtendedToolkit.class, oObj);
+
+ AccessibilityTools at = new AccessibilityTools();
+
+ XWindow xWindow = (XWindow)
+ UnoRuntime.queryInterface(XWindow.class, tk.getActiveTopWindow());
+
+ XAccessible xRoot = at.getAccessibleObject(xWindow);
+
+ at.printAccessibleTree(log, xRoot, tParam.getBool(util.PropertyName.DEBUG_IS_ACTIVE));
+
+ oObj = at.getAccessibleObjectForRole(xRoot,
+ AccessibleRole.ROW_HEADER);
+
+ log.println("ImplementationName: "+ util.utils.getImplName(oObj));
+
+ TestEnvironment tEnv = new TestEnvironment(oObj);
+
+ tEnv.addObjRelation("EventProducer",
+ new ifc.accessibility._XAccessibleEventBroadcaster.EventProducer(){
+ public void fireEvent() {
+ }
+ });
+
+ return tEnv;
+ }
+
+ /**
+ * Sleeps for 0.5 sec. to allow StarOffice to react on <code>
+ * reset</code> call.
+ */
+ private void shortWait() {
+ try {
+ Thread.sleep(5000); ;
+ } catch (InterruptedException e) {
+ System.out.println("While waiting :" + e) ;
+ }
+ }
+
+}
diff --git a/qadevOOo/tests/java/mod/_svtools/AccessibleBrowseBoxTable.java b/qadevOOo/tests/java/mod/_svtools/AccessibleBrowseBoxTable.java
new file mode 100644
index 000000000000..c744a6a7f16e
--- /dev/null
+++ b/qadevOOo/tests/java/mod/_svtools/AccessibleBrowseBoxTable.java
@@ -0,0 +1,255 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: AccessibleBrowseBoxTable.java,v $
+ * $Revision: 1.8.8.1 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+package mod._svtools;
+
+import com.sun.star.view.XSelectionSupplier;
+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 com.sun.star.accessibility.AccessibleRole;
+import com.sun.star.accessibility.XAccessible;
+import com.sun.star.awt.XExtendedToolkit;
+import com.sun.star.awt.XWindow;
+import com.sun.star.beans.PropertyValue;
+import com.sun.star.frame.XController;
+import com.sun.star.frame.XDesktop;
+import com.sun.star.frame.XDispatch;
+import com.sun.star.frame.XDispatchProvider;
+import com.sun.star.frame.XFrame;
+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;
+
+
+/**
+ * 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>
+ * </ul> <p>
+ *
+ * @see com.sun.star.accessibility.XAccessibleEventBroadcaster
+ * @see com.sun.star.accessibility.XAccessibleContext
+ * @see ifc.accessibility._XAccessibleEventBroadcaster
+ * @see ifc.accessibility._XAccessibleContext
+ */
+public class AccessibleBrowseBoxTable extends TestCase {
+ static XDesktop the_Desk;
+ static XTextDocument xTextDoc;
+
+ /**
+ * Creates the Desktop service (<code>com.sun.star.frame.Desktop</code>).
+ */
+ protected void initialize(TestParameters Param, PrintWriter log) {
+ the_Desk = (XDesktop) UnoRuntime.queryInterface(XDesktop.class,
+ DesktopTools.createDesktop(
+ (XMultiServiceFactory)Param.getMSF()));
+ }
+
+ /**
+ * Disposes the document, if exists, created in
+ * <code>createTestEnvironment</code> method.
+ */
+ protected void cleanup(TestParameters Param, PrintWriter log) {
+ log.println("disposing xTextDoc");
+
+ if (xTextDoc != null) {
+ xTextDoc.dispose();
+ }
+ }
+
+ /**
+ * Creates a text document. Opens the DataSource browser.
+ * Creates an instance of the service
+ * <code>com.sun.star.awt.Toolkit</code> and gets active top window.
+ * Then obtains an accessible object with the role
+ * <code>AccessibleRole.TABLE</code> and with the name
+ * <code>"Table"</code>.
+ * Object relations created :
+ * <ul>
+ * <li> <code>'EventProducer'</code> for
+ * {@link ifc.accessibility._XAccessibleEventBroadcaster}:
+ * method <code>fireEvent()</code> is empty because object is transient
+ * </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
+ */
+ protected TestEnvironment createTestEnvironment(TestParameters tParam,
+ PrintWriter log) {
+ log.println("creating a test environment");
+
+ if (xTextDoc != null) {
+ xTextDoc.dispose();
+ }
+
+ // get a soffice factory object
+ SOfficeFactory SOF = SOfficeFactory.getFactory(
+ (XMultiServiceFactory)tParam.getMSF());
+
+ try {
+ log.println("creating a text document");
+ xTextDoc = SOF.createTextDoc(null);
+ } catch (com.sun.star.uno.Exception e) {
+ // Some exception occures.FAILED
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't create document", e);
+ }
+
+ shortWait();
+
+ XModel aModel1 = (XModel) UnoRuntime.queryInterface(XModel.class,
+ xTextDoc);
+
+ XController secondController = aModel1.getCurrentController();
+
+ XDispatchProvider aProv = (XDispatchProvider)UnoRuntime.queryInterface(
+ XDispatchProvider.class,
+ secondController);
+
+ XDispatch getting = null;
+
+ log.println("opening DatasourceBrowser");
+
+ URL the_url = new URL();
+ the_url.Complete = ".component:DB/DataSourceBrowser";
+ getting = aProv.queryDispatch(the_url, "_beamer", 12);
+
+ PropertyValue[] noArgs = new PropertyValue[0];
+ getting.dispatch(the_url, noArgs);
+
+ shortWait();
+
+ XFrame the_frame1 = the_Desk.getCurrentFrame();
+
+ if (the_frame1 == null) {
+ log.println("Current frame was not found !!!");
+ }
+
+ XFrame the_frame2 = the_frame1.findFrame("_beamer", 4);
+ XController xCont = the_frame2.getController();
+
+ the_frame2.setName("DatasourceBrowser");
+
+ final PropertyValue[] params = new PropertyValue[3];
+ PropertyValue param1 = new PropertyValue();
+ param1.Name = "DataSourceName";
+ param1.Value = "Bibliography";
+ params[0] = param1;
+
+ PropertyValue param2 = new PropertyValue();
+ param2.Name = "CommandType";
+ param2.Value = new Integer(com.sun.star.sdb.CommandType.TABLE);
+ params[1] = param2;
+
+ PropertyValue param3 = new PropertyValue();
+ param3.Name = "Command";
+ param3.Value = "biblio";
+ params[2] = param3;
+
+ final XSelectionSupplier xSelect = (XSelectionSupplier) UnoRuntime.queryInterface(
+ XSelectionSupplier.class, xCont);
+
+
+ final Object[] initArgs = params;
+
+ XInterface oObj = null;
+
+ try {
+ oObj = (XInterface)((XMultiServiceFactory)tParam.getMSF())
+ .createInstance("com.sun.star.awt.Toolkit");
+ } catch (com.sun.star.uno.Exception e) {
+ log.println("Couldn't get toolkit");
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't get toolkit", e);
+ }
+
+ XExtendedToolkit tk = (XExtendedToolkit) UnoRuntime.queryInterface(
+ XExtendedToolkit.class, oObj);
+
+ AccessibilityTools at = new AccessibilityTools();
+
+ XWindow xWindow = (XWindow) UnoRuntime.queryInterface(XWindow.class,
+ tk.getActiveTopWindow());
+
+ XAccessible xRoot = at.getAccessibleObject(xWindow);
+
+ oObj = at.getAccessibleObjectForRole(xRoot, AccessibleRole.TABLE,
+ "Table");
+
+ log.println("ImplementationName: " + util.utils.getImplName(oObj));
+
+ TestEnvironment tEnv = new TestEnvironment(oObj);
+
+ tEnv.addObjRelation("EventProducer",
+ new ifc.accessibility._XAccessibleEventBroadcaster.EventProducer() {
+ public void fireEvent() {
+ try {
+ xSelect.select(params);
+ } catch (com.sun.star.lang.IllegalArgumentException ex) {
+ }
+ }
+ });
+
+ return tEnv;
+ }
+
+ /**
+ * Sleeps for 0.5 sec. to allow StarOffice to react on <code>
+ * reset</code> call.
+ */
+ private void shortWait() {
+ try {
+ Thread.sleep(5000);
+ } catch (InterruptedException e) {
+ System.out.println("While waiting :" + e);
+ }
+ }
+}
diff --git a/qadevOOo/tests/java/mod/_svtools/AccessibleBrowseBoxTableCell.java b/qadevOOo/tests/java/mod/_svtools/AccessibleBrowseBoxTableCell.java
new file mode 100644
index 000000000000..c0a50d4f01db
--- /dev/null
+++ b/qadevOOo/tests/java/mod/_svtools/AccessibleBrowseBoxTableCell.java
@@ -0,0 +1,247 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: AccessibleBrowseBoxTableCell.java,v $
+ * $Revision: 1.7.8.1 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package mod._svtools;
+
+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 com.sun.star.accessibility.AccessibleRole;
+import com.sun.star.accessibility.XAccessible;
+import com.sun.star.awt.XExtendedToolkit;
+import com.sun.star.awt.XWindow;
+import com.sun.star.beans.PropertyValue;
+import com.sun.star.frame.XController;
+import com.sun.star.frame.XDesktop;
+import com.sun.star.frame.XDispatch;
+import com.sun.star.frame.XDispatchProvider;
+import com.sun.star.frame.XFrame;
+import com.sun.star.frame.XModel;
+import com.sun.star.lang.XInitialization;
+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;
+
+/**
+ * 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>
+ * </ul> <p>
+ *
+ * @see com.sun.star.accessibility.XAccessibleEventBroadcaster
+ * @see com.sun.star.accessibility.XAccessibleContext
+ * @see ifc.accessibility._XAccessibleEventBroadcaster
+ * @see ifc.accessibility._XAccessibleContext
+ */
+public class AccessibleBrowseBoxTableCell extends TestCase {
+
+ static XDesktop the_Desk;
+ static XTextDocument xTextDoc;
+
+ /**
+ * Creates the Desktop service (<code>com.sun.star.frame.Desktop</code>).
+ */
+ protected void initialize(TestParameters Param, PrintWriter log) {
+ the_Desk = (XDesktop) UnoRuntime.queryInterface(
+ XDesktop.class, DesktopTools.createDesktop((XMultiServiceFactory)Param.getMSF()) );
+ }
+
+ /**
+ * Disposes the document, if exists, created in
+ * <code>createTestEnvironment</code> method.
+ */
+ protected void cleanup( TestParameters Param, PrintWriter log) {
+
+ log.println("disposing xTextDoc");
+
+ if (xTextDoc != null) {
+ xTextDoc.dispose();
+ }
+ }
+
+ /**
+ * Creates a text document. Opens the DataSource browser and loads
+ * the table. Creates an instance of the service
+ * <code>com.sun.star.awt.Toolkit</code> and gets active top window.
+ * Then obtains an accessible object with the role
+ * <code>AccessibleRole.TABLE_CELL</code>.
+ * Object relations created :
+ * <ul>
+ * <li> <code>'EventProducer'</code> for
+ * {@link ifc.accessibility._XAccessibleEventBroadcaster}:
+ * method <code>fireEvent()</code> is empty because object is transient
+ * </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
+ */
+ protected TestEnvironment createTestEnvironment(TestParameters tParam, PrintWriter log) {
+
+ log.println( "creating a test environment" );
+
+ if (xTextDoc != null) xTextDoc.dispose();
+
+ // get a soffice factory object
+ SOfficeFactory SOF = SOfficeFactory.getFactory( (XMultiServiceFactory)tParam.getMSF());
+
+ try {
+ log.println( "creating a text document" );
+ xTextDoc = SOF.createTextDoc(null);
+ } catch ( com.sun.star.uno.Exception e ) {
+ // Some exception occures.FAILED
+ e.printStackTrace( log );
+ throw new StatusException( "Couldn't create document", e );
+ }
+
+ shortWait();
+
+ XModel aModel1 = (XModel)
+ UnoRuntime.queryInterface(XModel.class, xTextDoc);
+
+ XController secondController = aModel1.getCurrentController();
+
+
+ XDispatchProvider aProv = (XDispatchProvider)
+ UnoRuntime.queryInterface(XDispatchProvider.class,secondController);
+
+ XDispatch getting = null;
+
+ log.println( "opening DatasourceBrowser" );
+ URL the_url = new URL();
+ the_url.Complete = ".component:DB/DataSourceBrowser";
+ getting = aProv.queryDispatch(the_url,"_beamer",12);
+ PropertyValue[] noArgs = new PropertyValue[0];
+ getting.dispatch(the_url,noArgs);
+
+ shortWait();
+
+ XFrame the_frame1 = the_Desk.getCurrentFrame();
+
+ if (the_frame1 == null) {
+ log.println("Current frame was not found !!!");
+ }
+
+ XFrame the_frame2 = the_frame1.findFrame("_beamer",4);
+
+ the_frame2.setName("DatasourceBrowser");
+
+ XInterface oObj = null;
+
+ final XInitialization xInit = (XInitialization)
+ UnoRuntime.queryInterface(
+ XInitialization.class, the_frame2.getController());
+
+ Object[] params = new Object[3];
+ PropertyValue param1 = new PropertyValue();
+ param1.Name = "DataSourceName";
+ param1.Value = "Bibliography";
+ params[0] = param1;
+ PropertyValue param2 = new PropertyValue();
+ param2.Name = "CommandType";
+ param2.Value = new Integer(com.sun.star.sdb.CommandType.TABLE);
+ params[1] = param2;
+ PropertyValue param3 = new PropertyValue();
+ param3.Name = "Command";
+ param3.Value = "biblio";
+ params[2] = param3;
+
+ shortWait();
+
+ try {
+ oObj = (XInterface) ((XMultiServiceFactory)tParam.getMSF()).createInstance
+ ("com.sun.star.awt.Toolkit") ;
+ xInit.initialize(params);
+ } catch (com.sun.star.uno.Exception e) {
+ log.println("Couldn't get toolkit");
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't get toolkit", e );
+ }
+
+ shortWait();
+
+ XExtendedToolkit tk = (XExtendedToolkit)
+ UnoRuntime.queryInterface(XExtendedToolkit.class,oObj);
+
+
+ AccessibilityTools at = new AccessibilityTools();
+
+ XWindow xWindow = (XWindow)
+ UnoRuntime.queryInterface(XWindow.class,tk.getActiveTopWindow());
+
+ XAccessible xRoot = at.getAccessibleObject(xWindow);
+
+ oObj = at.getAccessibleObjectForRole(xRoot, AccessibleRole.TABLE_CELL);
+
+ log.println("ImplementationName: "+util.utils.getImplName(oObj));
+
+ TestEnvironment tEnv = new TestEnvironment( oObj );
+
+ tEnv.addObjRelation("EventProducer",
+ new ifc.accessibility._XAccessibleEventBroadcaster.EventProducer(){
+ public void fireEvent() {
+ }
+ });
+
+ return tEnv;
+ }
+
+ /**
+ * Sleeps for 0.5 sec. to allow StarOffice to react on <code>
+ * reset</code> call.
+ */
+ private void shortWait() {
+ try {
+ Thread.sleep(5000); ;
+ } catch (InterruptedException e) {
+ System.out.println("While waiting :" + e) ;
+ }
+ }
+
+}
diff --git a/qadevOOo/tests/java/mod/_svtools/AccessibleIconChoiceCtrl.java b/qadevOOo/tests/java/mod/_svtools/AccessibleIconChoiceCtrl.java
new file mode 100644
index 000000000000..d73f197f18d4
--- /dev/null
+++ b/qadevOOo/tests/java/mod/_svtools/AccessibleIconChoiceCtrl.java
@@ -0,0 +1,290 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: AccessibleIconChoiceCtrl.java,v $
+ * $Revision: 1.7.8.1 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+package mod._svtools;
+
+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 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.XDesktop;
+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;
+
+
+/**
+ * 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::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.XAccessibleSelection
+ * @see ifc.accessibility._XAccessibleEventBroadcaster
+ * @see ifc.accessibility._XAccessibleContext
+ * @see ifc.accessibility._XAccessibleComponent
+ * @see ifc.accessibility._XAccessibleSelection
+ */
+public class AccessibleIconChoiceCtrl extends TestCase {
+ static XDesktop the_Desk;
+ static XTextDocument xTextDoc;
+ static XAccessibleAction accCloseButton = null;
+
+ /**
+ * Creates the Desktop service (<code>com.sun.star.frame.Desktop</code>).
+ */
+ protected void initialize(TestParameters Param, PrintWriter log) {
+ the_Desk = (XDesktop) UnoRuntime.queryInterface(XDesktop.class,
+ DesktopTools.createDesktop(
+ (XMultiServiceFactory) Param.getMSF()));
+ }
+
+ /**
+ * Closes the Hyperlink dialog.
+ * Disposes the document, if exists, created in
+ * <code>createTestEnvironment</code> method.
+ */
+ protected void cleanup(TestParameters Param, PrintWriter log) {
+ log.println("closing HyperlinkDialog");
+
+ try {
+ if (accCloseButton != null) {
+ accCloseButton.doAccessibleAction(0);
+ }
+ } catch (com.sun.star.lang.IndexOutOfBoundsException e) {
+ e.printStackTrace(log);
+ }
+
+ log.println("disposing xTextDoc");
+
+ if (xTextDoc != null) {
+ xTextDoc.dispose();
+ }
+ }
+
+ /**
+ * Creates a text document. Opens the Hyperlink dialog.
+ * Creates an instance of the service
+ * <code>com.sun.star.awt.Toolkit</code> and gets active top window.
+ * Then obtains an accessible object with the role
+ * <code>AccessibleRole.TREE</code>.
+ * Object relations created :
+ * <ul>
+ * <li> <code>'EventProducer'</code> for
+ * {@link ifc.accessibility._XAccessibleEventBroadcaster}:
+ * method <code>fireEvent()</code> selects accessible childs
+ * </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
+ */
+ protected TestEnvironment createTestEnvironment(TestParameters tParam,
+ PrintWriter log) {
+ log.println("creating a test environment");
+
+ if (xTextDoc != null) {
+ xTextDoc.dispose();
+ }
+
+ // get a soffice factory object
+ SOfficeFactory SOF = SOfficeFactory.getFactory( (XMultiServiceFactory) tParam.getMSF());
+
+ try {
+ log.println("creating a text document");
+ xTextDoc = SOF.createTextDoc(null);
+ } catch (com.sun.star.uno.Exception e) {
+ // Some exception occures.FAILED
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't create document", e);
+ }
+
+ shortWait();
+
+ XModel aModel1 = (XModel) UnoRuntime.queryInterface(XModel.class,
+ xTextDoc);
+
+ XController secondController = aModel1.getCurrentController();
+
+ XDispatchProvider aProv = (XDispatchProvider) UnoRuntime.queryInterface(
+ XDispatchProvider.class,
+ secondController);
+
+ XURLTransformer urlTransf = null;
+
+ try {
+ XInterface transf = (XInterface) ( (XMultiServiceFactory) tParam.getMSF())
+ .createInstance("com.sun.star.util.URLTransformer");
+ urlTransf = (XURLTransformer) UnoRuntime.queryInterface(
+ XURLTransformer.class, transf);
+ } catch (com.sun.star.uno.Exception e) {
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't create URLTransformer", e);
+ }
+
+ 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);
+
+ shortWait();
+
+ XInterface oObj = null;
+
+ try {
+ oObj = (XInterface) ( (XMultiServiceFactory) tParam.getMSF())
+ .createInstance("com.sun.star.awt.Toolkit");
+ } catch (com.sun.star.uno.Exception e) {
+ log.println("Couldn't get toolkit");
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't get toolkit", e);
+ }
+
+ XExtendedToolkit tk = (XExtendedToolkit) UnoRuntime.queryInterface(
+ XExtendedToolkit.class, oObj);
+
+ AccessibilityTools at = new AccessibilityTools();
+
+ shortWait();
+
+ XWindow xWindow = (XWindow) UnoRuntime.queryInterface(XWindow.class,
+ tk.getActiveTopWindow());
+
+ XAccessible xRoot = at.getAccessibleObject(xWindow);
+
+ oObj = at.getAccessibleObjectForRole(xRoot, AccessibleRole.TREE);
+
+ XAccessibleContext closeButton = at.getAccessibleObjectForRole(xRoot,
+ AccessibleRole.PUSH_BUTTON,
+ "Close");
+
+ accCloseButton = (XAccessibleAction) UnoRuntime.queryInterface(
+ XAccessibleAction.class, closeButton);
+
+ log.println("ImplementationName: " + util.utils.getImplName(oObj));
+
+ TestEnvironment tEnv = new TestEnvironment(oObj);
+ tEnv.addObjRelation("XAccessibleSelection.multiSelection",
+ new Boolean(false));
+ tEnv.addObjRelation("XAccessibleSelection.OneAlwaysSelected",
+ new Boolean(true));
+
+ String[] expectedStateNames = new String[] {
+ "com.sun.star.accessibility.AccessibleStateType.ENABLED",
+ "com.sun.star.accessibility.AccessibleStateType.FOCUSABLE",
+ "com.sun.star.accessibility.AccessibleStateType.SHOWING",
+ "com.sun.star.accessibility.AccessibleStateType.VISIBLE",
+ "com.sun.star.accessibility.AccessibleStateType.MANAGES_DESCENDANTS",
+ };
+
+ short[] expectedStates = new short[] {
+ com.sun.star.accessibility.AccessibleStateType.ENABLED,
+ com.sun.star.accessibility.AccessibleStateType.FOCUSABLE,
+ com.sun.star.accessibility.AccessibleStateType.SHOWING,
+ com.sun.star.accessibility.AccessibleStateType.VISIBLE,
+ com.sun.star.accessibility.AccessibleStateType.MANAGES_DESCENDANTS,
+ };
+
+ tEnv.addObjRelation("expectedStateNames", expectedStateNames);
+ tEnv.addObjRelation("expectedStates", expectedStates);
+
+ final XAccessibleSelection selection = (XAccessibleSelection) (XAccessibleSelection) 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) {
+ }
+ }
+ });
+
+ return tEnv;
+ }
+
+ /**
+ * Sleeps for 0.5 sec. to allow StarOffice to react on <code>
+ * reset</code> call.
+ */
+ private void shortWait() {
+ try {
+ Thread.sleep(5000);
+ } catch (InterruptedException e) {
+ System.out.println("While waiting :" + e);
+ }
+ }
+} \ No newline at end of file
diff --git a/qadevOOo/tests/java/mod/_svtools/AccessibleIconChoiceCtrlEntry.java b/qadevOOo/tests/java/mod/_svtools/AccessibleIconChoiceCtrlEntry.java
new file mode 100644
index 000000000000..aff986416948
--- /dev/null
+++ b/qadevOOo/tests/java/mod/_svtools/AccessibleIconChoiceCtrlEntry.java
@@ -0,0 +1,267 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: AccessibleIconChoiceCtrlEntry.java,v $
+ * $Revision: 1.7.8.1 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package mod._svtools;
+
+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 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.XExtendedToolkit;
+import com.sun.star.awt.XWindow;
+import com.sun.star.beans.PropertyValue;
+import com.sun.star.frame.XController;
+import com.sun.star.frame.XDesktop;
+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;
+
+/**
+ * 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::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.XAccessibleText
+ * @see ifc.accessibility._XAccessibleEventBroadcaster
+ * @see ifc.accessibility._XAccessibleContext
+ * @see ifc.accessibility._XAccessibleComponent
+ * @see ifc.accessibility.XAccessibleText
+ */
+public class AccessibleIconChoiceCtrlEntry extends TestCase {
+
+ static XDesktop the_Desk;
+ static XTextDocument xTextDoc;
+ static XAccessibleAction accCloseButton = null;
+
+ /**
+ * Creates the Desktop service (<code>com.sun.star.frame.Desktop</code>).
+ */
+ protected void initialize(TestParameters Param, PrintWriter log) {
+ the_Desk = (XDesktop) UnoRuntime.queryInterface(
+ XDesktop.class, DesktopTools.createDesktop((XMultiServiceFactory)Param.getMSF()));
+ }
+
+ /**
+ * Closes the Hyperlink dialog.
+ * Disposes the document, if exists, created in
+ * <code>createTestEnvironment</code> method.
+ */
+ protected void cleanup( TestParameters Param, PrintWriter log) {
+
+ log.println("closing HyperlinkDialog");
+
+ try {
+ if (accCloseButton != null) {
+ accCloseButton.doAccessibleAction(0);
+ }
+ } catch(com.sun.star.lang.IndexOutOfBoundsException e) {
+ e.printStackTrace(log);
+ }
+
+ log.println("disposing xTextDoc");
+
+ if (xTextDoc != null) {
+ xTextDoc.dispose();
+ }
+ }
+
+ /**
+ * Creates a text document. Opens the Hyperlink dialog.
+ * Creates an instance of the service
+ * <code>com.sun.star.awt.Toolkit</code> and gets active top window.
+ * Then obtains an accessible object with the role
+ * <code>AccessibleRole.LABEL</code> and with the name
+ * <code>"Internet"</code>.
+ * Object relations created :
+ * <ul>
+ * <li> <code>'EventProducer'</code> for
+ * {@link ifc.accessibility._XAccessibleEventBroadcaster}:
+ * method <code>fireEvent()</code> is empty because object is transient
+ * </li>
+ * <li> <code>'XAccessibleText.Text'</code> for
+ * {@link ifc.accessibility._XAccessibleText}:
+ * the string representation of the item text
+ * </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
+ */
+ protected TestEnvironment createTestEnvironment(
+ TestParameters tParam, PrintWriter log) {
+
+ log.println( "creating a test environment" );
+
+ if (xTextDoc != null) xTextDoc.dispose();
+
+ // get a soffice factory object
+ SOfficeFactory SOF = SOfficeFactory.getFactory( (XMultiServiceFactory)tParam.getMSF());
+
+ try {
+ log.println( "creating a text document" );
+ xTextDoc = SOF.createTextDoc(null);
+ } catch ( com.sun.star.uno.Exception e ) {
+ // Some exception occures.FAILED
+ e.printStackTrace( log );
+ throw new StatusException( "Couldn't create document", e );
+ }
+
+ shortWait();
+
+ XModel aModel1 = (XModel)
+ UnoRuntime.queryInterface(XModel.class, xTextDoc);
+
+ XController secondController = aModel1.getCurrentController();
+
+ XDispatchProvider aProv = (XDispatchProvider)UnoRuntime.
+ queryInterface(XDispatchProvider.class, secondController);
+
+ XURLTransformer urlTransf = null;
+
+ try {
+ XInterface transf = (XInterface)((XMultiServiceFactory)tParam.getMSF()).createInstance
+ ("com.sun.star.util.URLTransformer");
+ urlTransf = (XURLTransformer)UnoRuntime.queryInterface
+ (XURLTransformer.class, transf);
+ } catch (com.sun.star.uno.Exception e) {
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't create URLTransformer", e );
+ }
+
+ 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);
+
+ shortWait();
+
+ XInterface oObj = null;
+ try {
+ oObj = (XInterface) ((XMultiServiceFactory)tParam.getMSF()).createInstance
+ ("com.sun.star.awt.Toolkit") ;
+ } catch (com.sun.star.uno.Exception e) {
+ log.println("Couldn't get toolkit");
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't get toolkit", e );
+ }
+
+ XExtendedToolkit tk = (XExtendedToolkit)
+ UnoRuntime.queryInterface(XExtendedToolkit.class, oObj);
+
+ AccessibilityTools at = new AccessibilityTools();
+
+ shortWait();
+
+ XWindow xWindow = (XWindow)
+ UnoRuntime.queryInterface(XWindow.class, tk.getActiveTopWindow());
+
+ XAccessible xRoot = at.getAccessibleObject(xWindow);
+
+ oObj = at.getAccessibleObjectForRole(xRoot,
+ AccessibleRole.LABEL, "Internet");
+
+ XAccessibleContext closeButton = at.getAccessibleObjectForRole(xRoot,
+ AccessibleRole.PUSH_BUTTON, "Close");
+
+ accCloseButton = (XAccessibleAction)
+ UnoRuntime.queryInterface(XAccessibleAction.class, closeButton);
+
+ log.println("ImplementationName: "+ util.utils.getImplName(oObj));
+
+ TestEnvironment tEnv = new TestEnvironment(oObj);
+
+ tEnv.addObjRelation("EventProducer",
+ new ifc.accessibility._XAccessibleEventBroadcaster.EventProducer(){
+ public void fireEvent() {
+ }
+ });
+
+ tEnv.addObjRelation("XAccessibleText.Text", "Internet");
+
+ tEnv.addObjRelation("EditOnly",
+ "This method isn't supported in this dialog");
+
+ tEnv.addObjRelation("LimitedBounds",
+ "only delivers senseful values for getCharacterBounds(0,length-1)");
+
+ return tEnv;
+ }
+
+ /**
+ * Sleeps for 0.5 sec. to allow StarOffice to react on <code>
+ * reset</code> call.
+ */
+ private void shortWait() {
+ try {
+ Thread.sleep(5000); ;
+ } catch (InterruptedException e) {
+ System.out.println("While waiting :" + e) ;
+ }
+ }
+
+}
diff --git a/qadevOOo/tests/java/mod/_svtools/AccessibleTabBar.java b/qadevOOo/tests/java/mod/_svtools/AccessibleTabBar.java
new file mode 100644
index 000000000000..8927bc015e60
--- /dev/null
+++ b/qadevOOo/tests/java/mod/_svtools/AccessibleTabBar.java
@@ -0,0 +1,176 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: AccessibleTabBar.java,v $
+ * $Revision: 1.8.8.1 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+package mod._svtools;
+
+import java.io.PrintWriter;
+
+import lib.StatusException;
+import lib.TestCase;
+import lib.TestEnvironment;
+import lib.TestParameters;
+import util.AccessibilityTools;
+import util.SOfficeFactory;
+
+import com.sun.star.accessibility.AccessibleRole;
+import com.sun.star.accessibility.XAccessible;
+import com.sun.star.awt.PosSize;
+import com.sun.star.awt.XExtendedToolkit;
+import com.sun.star.awt.XWindow;
+import com.sun.star.lang.XComponent;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.uno.XInterface;
+import com.sun.star.util.XCloseable;
+
+
+public class AccessibleTabBar extends TestCase {
+ static XComponent xDoc;
+
+ /**
+ * Disposes the document, if exists, created in
+ * <code>createTestEnvironment</code> method.
+ */
+ protected void cleanup(TestParameters Param, PrintWriter log) {
+ log.println("disposing xCalcDoc");
+
+ if (xDoc != null) {
+ closeDoc(xDoc);
+ }
+ }
+
+ /**
+ * Creates a spreadsheet document. 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}:
+ * </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
+ */
+ protected TestEnvironment createTestEnvironment(TestParameters tParam,
+ PrintWriter log) {
+ log.println("creating a test environment");
+
+ if (xDoc != null) {
+ closeDoc(xDoc);
+ }
+
+ XMultiServiceFactory msf = (XMultiServiceFactory) tParam.getMSF();
+
+ // get a soffice factory object
+ SOfficeFactory SOF = SOfficeFactory.getFactory(msf);
+
+ try {
+ log.println("creating a calc document");
+ xDoc = (XComponent) UnoRuntime.queryInterface(XComponent.class,
+ SOF.createCalcDoc(
+ null));
+ } catch (com.sun.star.uno.Exception e) {
+ // Some exception occures.FAILED
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't create document", e);
+ }
+
+ shortWait();
+
+ XInterface oObj = null;
+
+ try {
+ oObj = (XInterface) msf.createInstance("com.sun.star.awt.Toolkit");
+ } catch (com.sun.star.uno.Exception e) {
+ log.println("Couldn't get toolkit");
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't get toolkit", e);
+ }
+
+ XExtendedToolkit tk = (XExtendedToolkit) UnoRuntime.queryInterface(
+ XExtendedToolkit.class, oObj);
+
+ AccessibilityTools at = new AccessibilityTools();
+
+ shortWait();
+
+ XWindow xWindow = (XWindow) UnoRuntime.queryInterface(XWindow.class,
+ tk.getActiveTopWindow());
+
+ XAccessible xRoot = at.getAccessibleObject(xWindow);
+ at.printAccessibleTree(log, xRoot, tParam.getBool(util.PropertyName.DEBUG_IS_ACTIVE));
+ oObj = at.getAccessibleObjectForRole(xRoot, AccessibleRole.PANEL);
+
+ log.println("ImplementationName: " + util.utils.getImplName(oObj));
+
+ TestEnvironment tEnv = new TestEnvironment(oObj);
+
+ final XWindow aWin = xWindow;
+
+ tEnv.addObjRelation("EventProducer",
+ new ifc.accessibility._XAccessibleEventBroadcaster.EventProducer() {
+ public void fireEvent() {
+ aWin.setPosSize(100,100, 500, 500, PosSize.POSSIZE);
+ }
+ });
+
+ return tEnv;
+ }
+
+ /**
+ * Sleeps for 3 sec. to allow StarOffice to react on <code>
+ * reset</code> call.
+ */
+ private void shortWait() {
+ try {
+ Thread.sleep(5000);
+ } catch (InterruptedException e) {
+ System.out.println("While waiting :" + e);
+ }
+ }
+
+ protected void closeDoc(XComponent xDoc) {
+ XCloseable closer = (XCloseable) UnoRuntime.queryInterface(
+ XCloseable.class, xDoc);
+
+ try {
+ closer.close(true);
+ } catch (com.sun.star.util.CloseVetoException e) {
+ log.println("Couldn't close document " + e.getMessage());
+ } catch (java.lang.NullPointerException e) {
+ log.println("Couldn't close document " + e.getMessage());
+ }
+ }
+} \ No newline at end of file
diff --git a/qadevOOo/tests/java/mod/_svtools/AccessibleTabBarPage.java b/qadevOOo/tests/java/mod/_svtools/AccessibleTabBarPage.java
new file mode 100644
index 000000000000..d625df3fc078
--- /dev/null
+++ b/qadevOOo/tests/java/mod/_svtools/AccessibleTabBarPage.java
@@ -0,0 +1,197 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: AccessibleTabBarPage.java,v $
+ * $Revision: 1.11.8.1 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package mod._svtools;
+
+import com.sun.star.accessibility.AccessibleRole;
+import com.sun.star.accessibility.XAccessibleComponent;
+import com.sun.star.accessibility.XAccessibleContext;
+import com.sun.star.awt.Point;
+import java.awt.Robot;
+import java.awt.event.InputEvent;
+import java.io.PrintWriter;
+
+import lib.StatusException;
+import lib.TestCase;
+import lib.TestEnvironment;
+import lib.TestParameters;
+import util.AccessibilityTools;
+import util.SOfficeFactory;
+
+import com.sun.star.accessibility.XAccessible;
+import com.sun.star.awt.XExtendedToolkit;
+import com.sun.star.awt.XWindow;
+import com.sun.star.lang.XComponent;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.uno.XInterface;
+
+/**
+ * Test for object that implements the following interfaces :
+ * <ul>
+ * <li><code>::com::sun::star::accessibility::XAccessibleComponent
+ * </code></li>
+ * <li><code>::com::sun::star::accessibility::XAccessibleContext
+ * </code></li>
+ * <li><code>::com::sun::star::accessibility::XAccessibleEventBroadcaster
+ * </code></li>
+ * <li>
+ * <code>::com::sun::star::accessibility::XAccessibleExtendedComponent
+ * </code></li>
+ * </ul> <p>
+ *
+ * @see com.sun.star.accessibility.XAccessibleExtendedComponent
+ * @see com.sun.star.accessibility.XAccessibleEventBroadcaster
+ * @see com.sun.star.accessibility.XAccessibleContext
+ * @see com.sun.star.accessibility.XAccessibleComponent
+ * @see ifc.accessibility._XAccessibleComponent
+ * @see ifc.accessibility._XAccessibleExtendedComponent
+ * @see ifc.accessibility._XAccessibleEventBroadcaster
+ * @see ifc.accessibility._XAccessibleContext
+ */
+public class AccessibleTabBarPage extends TestCase {
+
+ static XComponent xDoc;
+
+ /**
+ * Disposes the document, if exists, created in
+ * <code>createTestEnvironment</code> method.
+ */
+ protected void cleanup( TestParameters Param, PrintWriter log) {
+
+ log.println("disposing xCalcDoc");
+ if (xDoc != null) {
+ util.DesktopTools.closeDoc(xDoc);
+ }
+ }
+
+ /**
+ * Creates a spreadsheet document. 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}:
+ * </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
+ */
+ protected TestEnvironment createTestEnvironment(TestParameters tParam,
+ PrintWriter log) {
+
+ log.println( "creating a test environment" );
+
+ if (xDoc != null) xDoc.dispose();
+
+ // get a soffice factory object
+ SOfficeFactory SOF = SOfficeFactory.getFactory( (XMultiServiceFactory)tParam.getMSF());
+
+ try {
+ log.println( "creating a calc document" );
+ xDoc = (XComponent) UnoRuntime.queryInterface(XComponent.class, SOF.createCalcDoc(null));// SOF.createDrawDoc(null);
+ } catch ( com.sun.star.uno.Exception e ) {
+ // Some exception occures.FAILED
+ e.printStackTrace( log );
+ throw new StatusException( "Couldn't create document", e );
+ }
+
+ shortWait();
+
+ XInterface oObj = null;
+
+ try {
+ oObj = (XInterface) ((XMultiServiceFactory)tParam.getMSF()).createInstance
+ ("com.sun.star.awt.Toolkit") ;
+ } catch (com.sun.star.uno.Exception e) {
+ log.println("Couldn't get toolkit");
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't get toolkit", e );
+ }
+
+
+ XExtendedToolkit tk = (XExtendedToolkit)
+ UnoRuntime.queryInterface(XExtendedToolkit.class, oObj);
+
+
+ AccessibilityTools at = new AccessibilityTools();
+
+ shortWait();
+
+ XWindow xWindow = (XWindow)
+ UnoRuntime.queryInterface(XWindow.class,tk.getActiveTopWindow());
+
+ XAccessible xRoot = at.getAccessibleObject(xWindow);
+ at.printAccessibleTree(log, xRoot, tParam.getBool(util.PropertyName.DEBUG_IS_ACTIVE));
+ oObj = at.getAccessibleObjectForRole(xRoot, AccessibleRole.PAGE_TAB, "Sheet1");
+ XAccessibleContext acc = at.getAccessibleObjectForRole(xRoot, AccessibleRole.PAGE_TAB, "Sheet2");
+ XAccessibleComponent accComp = (XAccessibleComponent) UnoRuntime.queryInterface(
+ XAccessibleComponent.class,
+ acc);
+ final Point point = accComp.getLocationOnScreen();
+ log.println("ImplementationName: " + util.utils.getImplName(oObj));
+
+ TestEnvironment tEnv = new TestEnvironment( oObj );
+ tEnv.addObjRelation("Destroy","yes");
+ tEnv.addObjRelation("EventProducer",
+ new ifc.accessibility._XAccessibleEventBroadcaster.EventProducer(){
+ public void fireEvent() {
+ try {
+ Robot rob = new Robot();
+ rob.mouseMove(point.X + 25, point.Y + 5);
+ rob.mousePress(InputEvent.BUTTON1_MASK);
+ } catch (java.awt.AWTException e) {
+ System.out.println("couldn't fire event");
+ }
+ }
+ });
+
+ return tEnv;
+ }
+
+ /**
+ * Sleeps for 0.5 sec. to allow StarOffice to react on <code>
+ * reset</code> call.
+ */
+ private void shortWait() {
+ try {
+ Thread.sleep(5000);
+ } catch (InterruptedException e) {
+ System.out.println("While waiting :" + e) ;
+ }
+ }
+
+}
diff --git a/qadevOOo/tests/java/mod/_svtools/AccessibleTabBarPageList.java b/qadevOOo/tests/java/mod/_svtools/AccessibleTabBarPageList.java
new file mode 100644
index 000000000000..7b376ac029bf
--- /dev/null
+++ b/qadevOOo/tests/java/mod/_svtools/AccessibleTabBarPageList.java
@@ -0,0 +1,212 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: AccessibleTabBarPageList.java,v $
+ * $Revision: 1.9.8.1 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+package mod._svtools;
+
+import com.sun.star.drawing.XLayerManager;
+import com.sun.star.drawing.XLayerSupplier;
+import java.io.PrintWriter;
+
+import lib.StatusException;
+import lib.TestCase;
+import lib.TestEnvironment;
+import lib.TestParameters;
+import util.AccessibilityTools;
+import util.SOfficeFactory;
+
+import com.sun.star.accessibility.AccessibleRole;
+import com.sun.star.accessibility.XAccessible;
+import com.sun.star.awt.XExtendedToolkit;
+import com.sun.star.awt.XWindow;
+import com.sun.star.lang.XComponent;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.uno.XInterface;
+import com.sun.star.util.XCloseable;
+
+
+/**
+ * Test for object that implements the following interfaces :
+ * <ul>
+ * <li><code>::com::sun::star::accessibility::XAccessibleComponent
+ * </code></li>
+ * <li><code>::com::sun::star::accessibility::XAccessibleContext
+ * </code></li>
+ * <li><code>::com::sun::star::accessibility::XAccessibleEventBroadcaster
+ * </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.XAccessibleSelection
+ * @see com.sun.star.accessibility.XAccessibleExtendedComponent
+ * @see com.sun.star.accessibility.XAccessibleEventBroadcaster
+ * @see com.sun.star.accessibility.XAccessibleContext
+ * @see com.sun.star.accessibility.XAccessibleComponent
+ * @see ifc.accessibility._XAccessibleSelection
+ * @see ifc.accessibility._XAccessibleComponent
+ * @see ifc.accessibility._XAccessibleExtendedComponent
+ * @see ifc.accessibility._XAccessibleEventBroadcaster
+ * @see ifc.accessibility._XAccessibleContext
+ */
+public class AccessibleTabBarPageList extends TestCase {
+ static XComponent xDoc;
+
+ /**
+ * Disposes the document, if exists, created in
+ * <code>createTestEnvironment</code> method.
+ */
+ protected void cleanup(TestParameters Param, PrintWriter log) {
+ log.println("disposing xDoc");
+
+ if (xDoc != null) {
+ closeDoc();
+ }
+ }
+
+ /**
+ * Creates a spreadsheet document. 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}:
+ * </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
+ */
+ protected TestEnvironment createTestEnvironment(TestParameters tParam,
+ PrintWriter log) {
+ log.println("creating a test environment");
+
+ if (xDoc != null) {
+ closeDoc();
+ }
+
+ // get a soffice factory object
+ SOfficeFactory SOF = SOfficeFactory.getFactory( (XMultiServiceFactory) tParam.getMSF());
+
+ try {
+ log.println("creating a draw document");
+ xDoc = SOF.createDrawDoc(null);
+ } catch (com.sun.star.uno.Exception e) {
+ // Some exception occures.FAILED
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't create document", e);
+ }
+
+ shortWait();
+
+ XInterface oObj = null;
+
+ try {
+ oObj = (XInterface) ( (XMultiServiceFactory) tParam.getMSF())
+ .createInstance("com.sun.star.awt.Toolkit");
+ } catch (com.sun.star.uno.Exception e) {
+ log.println("Couldn't get toolkit");
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't get toolkit", e);
+ }
+
+ XExtendedToolkit tk = (XExtendedToolkit) UnoRuntime.queryInterface(
+ XExtendedToolkit.class, oObj);
+
+ AccessibilityTools at = new AccessibilityTools();
+
+ shortWait();
+
+ XWindow xWindow = (XWindow) UnoRuntime.queryInterface(XWindow.class,
+ tk.getActiveTopWindow());
+
+ XAccessible xRoot = at.getAccessibleObject(xWindow);
+
+ oObj = at.getAccessibleObjectForRole(xRoot,
+ AccessibleRole.PAGE_TAB_LIST);
+
+ log.println("ImplementationName: " + util.utils.getImplName(oObj));
+
+ TestEnvironment tEnv = new TestEnvironment(oObj);
+
+ tEnv.addObjRelation("XAccessibleSelection.multiSelection",
+ new Boolean(false));
+
+ tEnv.addObjRelation("XAccessibleSelection.OneAlwaysSelected",
+ new Boolean(true));
+
+ XLayerSupplier oLS = (XLayerSupplier)
+ UnoRuntime.queryInterface(XLayerSupplier.class, xDoc);
+ XInterface oLM = oLS.getLayerManager();
+ final XLayerManager xLM = (XLayerManager) UnoRuntime.queryInterface(XLayerManager.class, oLM);
+
+
+ tEnv.addObjRelation("EventProducer",
+ new ifc.accessibility._XAccessibleEventBroadcaster.EventProducer() {
+ public void fireEvent() {
+ xLM.insertNewByIndex(0);
+ }
+ });
+
+ return tEnv;
+ }
+
+ /**
+ * Sleeps for 0.5 sec. to allow StarOffice to react on <code>
+ * reset</code> call.
+ */
+ private void shortWait() {
+ try {
+ Thread.sleep(5000);
+ } catch (InterruptedException e) {
+ System.out.println("While waiting :" + e);
+ }
+ }
+
+ protected void closeDoc() {
+ XCloseable closer = (XCloseable) UnoRuntime.queryInterface(
+ XCloseable.class, xDoc);
+
+ try {
+ closer.close(true);
+ } catch (com.sun.star.util.CloseVetoException e) {
+ log.println("Couldn't close document " + e.getMessage());
+ } catch (com.sun.star.lang.DisposedException e) {
+ log.println("Couldn't close document " + e.getMessage());
+ }
+ }
+} \ No newline at end of file
diff --git a/qadevOOo/tests/java/mod/_svtools/AccessibleTreeListBox.java b/qadevOOo/tests/java/mod/_svtools/AccessibleTreeListBox.java
new file mode 100644
index 000000000000..73453427ce4d
--- /dev/null
+++ b/qadevOOo/tests/java/mod/_svtools/AccessibleTreeListBox.java
@@ -0,0 +1,266 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: AccessibleTreeListBox.java,v $
+ * $Revision: 1.7.8.1 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package mod._svtools;
+
+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 com.sun.star.accessibility.AccessibleRole;
+import com.sun.star.accessibility.XAccessible;
+import com.sun.star.awt.XExtendedToolkit;
+import com.sun.star.awt.XWindow;
+import com.sun.star.beans.PropertyValue;
+import com.sun.star.frame.XController;
+import com.sun.star.frame.XDesktop;
+import com.sun.star.frame.XDispatch;
+import com.sun.star.frame.XDispatchProvider;
+import com.sun.star.frame.XFrame;
+import com.sun.star.frame.XModel;
+import com.sun.star.lang.XInitialization;
+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;
+
+/**
+ * Test for object that implements the following interfaces :
+ * <ul>
+ * <li><code>::com::sun::star::accessibility::XAccessibleComponent
+ * </code></li>
+ * <li><code>::com::sun::star::accessibility::XAccessibleEventBroadcaster
+ * </code></li>
+ * <li><code>::com::sun::star::accessibility::XAccessibleContext
+ * </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.XAccessibleSelection
+ * @see ifc.accessibility._XAccessibleEventBroadcaster
+ * @see ifc.accessibility._XAccessibleContext
+ * @see ifc.accessibility._XAccessibleComponent
+ * @see ifc.accessibility._XAccessibleSelection
+ */
+public class AccessibleTreeListBox extends TestCase {
+
+ static XDesktop the_Desk;
+ static XTextDocument xTextDoc;
+
+ /**
+ * Creates the Desktop service (<code>com.sun.star.frame.Desktop</code>).
+ */
+ protected void initialize(TestParameters Param, PrintWriter log) {
+ the_Desk = (XDesktop) UnoRuntime.queryInterface(
+ XDesktop.class, DesktopTools.createDesktop((XMultiServiceFactory)Param.getMSF()));
+ }
+
+ /**
+ * Disposes the document, if exists, created in
+ * <code>createTestEnvironment</code> method.
+ */
+ protected void cleanup( TestParameters Param, PrintWriter log) {
+
+ log.println("disposing xTextDoc");
+
+ if (xTextDoc != null) {
+ xTextDoc.dispose();
+ }
+ }
+
+ /**
+ * Creates a text document. Opens the DataSource browser.
+ * Creates an instance of the service <code>com.sun.star.awt.Toolkit</code>
+ * and gets active top window. Then obtains an accessible object with
+ * the role <code>AccessibleRole.TREE</code>.
+ * Object relations created :
+ * <ul>
+ * <li> <code>'EventProducer'</code> for
+ * {@link ifc.accessibility._XAccessibleEventBroadcaster}:
+ * </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 com.sun.star.accessibility.XAccessibleEventBroadcaster
+ */
+ protected TestEnvironment createTestEnvironment(
+ TestParameters tParam, PrintWriter log) {
+
+ log.println( "creating a test environment" );
+
+ if (xTextDoc != null) xTextDoc.dispose();
+
+ // get a soffice factory object
+ SOfficeFactory SOF = SOfficeFactory.getFactory( (XMultiServiceFactory)tParam.getMSF());
+
+ try {
+ log.println( "creating a text document" );
+ xTextDoc = SOF.createTextDoc(null);
+ } catch ( com.sun.star.uno.Exception e ) {
+ // Some exception occures.FAILED
+ e.printStackTrace( log );
+ throw new StatusException( "Couldn't create document", e );
+ }
+
+ shortWait();
+
+ XModel aModel1 = (XModel)
+ UnoRuntime.queryInterface(XModel.class, xTextDoc);
+
+ XController secondController = aModel1.getCurrentController();
+
+ XDispatchProvider aProv = (XDispatchProvider)UnoRuntime.
+ queryInterface(XDispatchProvider.class, secondController);
+
+ XDispatch getting = null;
+
+ log.println( "opening DatasourceBrowser" );
+ URL the_url = new URL();
+ the_url.Complete = ".component:DB/DataSourceBrowser";
+ getting = aProv.queryDispatch(the_url, "_beamer", 12);
+ PropertyValue[] noArgs = new PropertyValue[0];
+ getting.dispatch(the_url, noArgs);
+
+ shortWait();
+
+ XFrame the_frame1 = the_Desk.getCurrentFrame();
+
+ if (the_frame1 == null) {
+ log.println("Current frame was not found !!!");
+ }
+
+ XFrame the_frame2 = the_frame1.findFrame("_beamer", 4);
+
+ the_frame2.setName("DatasourceBrowser");
+
+ XInterface oObj = null;
+
+ try {
+ oObj = (XInterface) ((XMultiServiceFactory)tParam.getMSF()).createInstance
+ ("com.sun.star.awt.Toolkit") ;
+ } catch (com.sun.star.uno.Exception e) {
+ log.println("Couldn't get toolkit");
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't get toolkit", e );
+ }
+
+ XExtendedToolkit tk = (XExtendedToolkit)
+ UnoRuntime.queryInterface(XExtendedToolkit.class, oObj);
+
+ AccessibilityTools at = new AccessibilityTools();
+
+ XWindow xWindow = (XWindow)
+ UnoRuntime.queryInterface(XWindow.class, tk.getActiveTopWindow());
+
+ XAccessible xRoot = at.getAccessibleObject(xWindow);
+
+ oObj = at.getAccessibleObjectForRole(xRoot, AccessibleRole.TREE);
+
+ log.println("ImplementationName: "+ util.utils.getImplName(oObj));
+
+ TestEnvironment tEnv = new TestEnvironment(oObj);
+
+ final XInitialization xInit = (XInitialization)
+ UnoRuntime.queryInterface(
+ XInitialization.class, the_frame2.getController());
+
+ Object[] params = new Object[3];
+ PropertyValue param1 = new PropertyValue();
+ param1.Name = "DataSourceName";
+ param1.Value = "Bibliography";
+ params[0] = param1;
+ PropertyValue param2 = new PropertyValue();
+ param2.Name = "CommandType";
+ param2.Value = new Integer(com.sun.star.sdb.CommandType.TABLE);
+ params[1] = param2;
+ PropertyValue param3 = new PropertyValue();
+ param3.Name = "Command";
+ param3.Value = "biblio";
+ params[2] = param3;
+
+ final Object[] fParams = params;
+
+// tEnv.addObjRelation("EventProducer",
+// new ifc.accessibility._XAccessibleEventBroadcaster.EventProducer(){
+// public void fireEvent() {
+// fXComp.grabFocus();
+// }
+// });
+
+ tEnv.addObjRelation("EventProducer",
+ new ifc.accessibility._XAccessibleEventBroadcaster.EventProducer(){
+ public void fireEvent() {
+ try {
+ xInit.initialize(fParams);
+ } catch(com.sun.star.uno.Exception e) {
+ e.printStackTrace();
+ }
+ }
+ });
+
+ tEnv.addObjRelation("XAccessibleSelection.multiSelection",
+ new Boolean(false));
+
+ return tEnv;
+ }
+
+ /**
+ * Sleeps for 0.5 sec. to allow StarOffice to react on <code>
+ * reset</code> call.
+ */
+ private void shortWait() {
+ try {
+ Thread.sleep(5000);
+ } catch (InterruptedException e) {
+ System.out.println("While waiting :" + e) ;
+ }
+ }
+
+}
diff --git a/qadevOOo/tests/java/mod/_svtools/AccessibleTreeListBoxEntry.java b/qadevOOo/tests/java/mod/_svtools/AccessibleTreeListBoxEntry.java
new file mode 100644
index 000000000000..8746ed4328ed
--- /dev/null
+++ b/qadevOOo/tests/java/mod/_svtools/AccessibleTreeListBoxEntry.java
@@ -0,0 +1,312 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: AccessibleTreeListBoxEntry.java,v $
+ * $Revision: 1.11.8.1 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+package mod._svtools;
+
+import com.sun.star.view.XSelectionSupplier;
+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 com.sun.star.accessibility.AccessibleRole;
+import com.sun.star.accessibility.XAccessible;
+import com.sun.star.awt.XExtendedToolkit;
+import com.sun.star.awt.XWindow;
+import com.sun.star.beans.PropertyValue;
+import com.sun.star.frame.XController;
+import com.sun.star.frame.XDesktop;
+import com.sun.star.frame.XDispatch;
+import com.sun.star.frame.XDispatchProvider;
+import com.sun.star.frame.XFrame;
+import com.sun.star.frame.XModel;
+import com.sun.star.lang.XInitialization;
+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.XCloseable;
+
+
+/**
+ * Test for object that implements the following interfaces :
+ * <ul>
+ * <li><code>::com::sun::star::accessibility::XAccessibleComponent
+ * </code></li>
+ * <li><code>::com::sun::star::accessibility::XAccessibleEventBroadcaster
+ * </code></li>
+ * <li><code>::com::sun::star::accessibility::XAccessibleContext
+ * </code></li>
+ * <li><code>::com::sun::star::accessibility::XAccessibleSelection
+ * </code></li>
+ * <li><code>::com::sun::star::accessibility::XAccessibleAction
+ * </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.XAccessibleSelection
+ * @see com.sun.star.accessibility.XAccessibleAction
+ * @see com.sun.star.accessibility.XAccessibleText
+ * @see ifc.accessibility._XAccessibleEventBroadcaster
+ * @see ifc.accessibility._XAccessibleContext
+ * @see ifc.accessibility._XAccessibleComponent
+ * @see ifc.accessibility._XAccessibleSelection
+ * @see ifc.accessibility._XAccessibleAction
+ * @see ifc.accessibility._XAccessibleText
+ */
+public class AccessibleTreeListBoxEntry extends TestCase {
+ static XDesktop the_Desk;
+ static XTextDocument xTextDoc;
+
+ /**
+ * Creates the Desktop service (<code>com.sun.star.frame.Desktop</code>).
+ */
+ protected void initialize(TestParameters Param, PrintWriter log) {
+ the_Desk = (XDesktop) UnoRuntime.queryInterface(XDesktop.class,
+ DesktopTools.createDesktop(
+ (XMultiServiceFactory) Param.getMSF()));
+ }
+
+ /**
+ * Disposes the document, if exists, created in
+ * <code>createTestEnvironment</code> method.
+ */
+ protected void cleanup(TestParameters Param, PrintWriter log) {
+ log.println("disposing xTextDoc");
+
+ if (xTextDoc != null) {
+ closeDoc();
+ }
+ }
+
+ /**
+ * Creates a text document. Opens the DataSource browser.
+ * Creates an instance of the service <code>com.sun.star.awt.Toolkit</code>
+ * and gets active top window. Then obtains an accessible object with
+ * the role <code>AccessibleRole.LABEL</code> and with the name
+ * <code>"Bibliography"</code>.
+ * Object relations created :
+ * <ul>
+ * <li> <code>'EventProducer'</code> for
+ * {@link ifc.accessibility._XAccessibleEventBroadcaster}:
+ * </li>
+ * <li> <code>'XAccessibleSelection.multiSelection'</code>
+ * of type <code>Boolean</code> for
+ * {@link ifc.accessibility._XAccessibleSelection}:
+ * indicates that component supports single selection mode.</li>
+ * <li> <code>'XAccessibleText.Text'</code> for
+ * {@link ifc.accessibility._XAccessibleText}:
+ * the text of the component</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 ifc.accessibility._XAccessibleText
+ * @see com.sun.star.accessibility.XAccessibleEventBroadcaster
+ * @see com.sun.star.accessibility.XAccessibleSelection
+ * @see com.sun.star.accessibility.XAccessibleText
+ */
+ protected TestEnvironment createTestEnvironment(TestParameters tParam,
+ PrintWriter log) {
+ log.println("creating a test environment");
+
+ if (xTextDoc != null) {
+ closeDoc();
+ }
+
+ // get a soffice factory object
+ SOfficeFactory SOF = SOfficeFactory.getFactory( (XMultiServiceFactory) tParam.getMSF());
+
+ try {
+ log.println("creating a text document");
+ xTextDoc = SOF.createTextDoc(null);
+ } catch (com.sun.star.uno.Exception e) {
+ // Some exception occures.FAILED
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't create document", e);
+ }
+
+ shortWait();
+
+ XModel aModel1 = (XModel) UnoRuntime.queryInterface(XModel.class,
+ xTextDoc);
+
+ XController secondController = aModel1.getCurrentController();
+
+ XDispatchProvider aProv = (XDispatchProvider) UnoRuntime.queryInterface(
+ XDispatchProvider.class,
+ secondController);
+
+ XDispatch getting = null;
+
+ log.println("opening DatasourceBrowser");
+
+ URL the_url = new URL();
+ the_url.Complete = ".component:DB/DataSourceBrowser";
+ getting = aProv.queryDispatch(the_url, "_beamer", 12);
+
+ PropertyValue[] noArgs = new PropertyValue[0];
+ getting.dispatch(the_url, noArgs);
+
+ shortWait();
+
+ XFrame the_frame1 = the_Desk.getCurrentFrame();
+
+ if (the_frame1 == null) {
+ log.println("Current frame was not found !!!");
+ }
+
+ XFrame the_frame2 = the_frame1.findFrame("_beamer", 4);
+
+ the_frame2.setName("DatasourceBrowser");
+
+ XInterface oObj = null;
+
+ XInitialization xInit = (XInitialization) UnoRuntime.queryInterface(
+ XInitialization.class,
+ the_frame2.getController());
+
+ PropertyValue[] params = new PropertyValue[3];
+ PropertyValue param1 = new PropertyValue();
+ param1.Name = "DataSourceName";
+ param1.Value = "Bibliography";
+ params[0] = param1;
+
+ PropertyValue param2 = new PropertyValue();
+ param2.Name = "CommandType";
+ param2.Value = new Integer(com.sun.star.sdb.CommandType.QUERY);
+ params[1] = param2;
+
+ PropertyValue param3 = new PropertyValue();
+ param3.Name = "Command";
+ param3.Value = "select * from biblio";
+ params[2] = param3;
+
+ XController xCont = the_frame2.getController();
+
+ XSelectionSupplier xSelect = (XSelectionSupplier) UnoRuntime.queryInterface(
+ XSelectionSupplier.class, xCont);
+
+ try {
+ xSelect.select(params);
+ } catch (com.sun.star.lang.IllegalArgumentException ex) {
+ throw new StatusException("Could not select Biblio-Database", ex);
+ }
+
+
+ try {
+ shortWait();
+ oObj = (XInterface) ( (XMultiServiceFactory) tParam.getMSF())
+ .createInstance("com.sun.star.awt.Toolkit");
+ } catch (com.sun.star.uno.Exception e) {
+ throw new StatusException("Couldn't get toolkit", e);
+ }
+
+ shortWait();
+
+ XExtendedToolkit tk = (XExtendedToolkit) UnoRuntime.queryInterface(
+ XExtendedToolkit.class, oObj);
+
+ AccessibilityTools at = new AccessibilityTools();
+
+ XWindow xWindow = (XWindow) UnoRuntime.queryInterface(XWindow.class,
+ tk.getActiveTopWindow());
+
+ XAccessible xRoot = at.getAccessibleObject(xWindow);
+
+ at.printAccessibleTree(log, xRoot, tParam.getBool(util.PropertyName.DEBUG_IS_ACTIVE));
+
+ oObj = at.getAccessibleObjectForRole(xRoot, AccessibleRole.LABEL,
+ "Bibliography");
+
+ log.println("ImplementationName: " + util.utils.getImplName(oObj));
+
+ TestEnvironment tEnv = new TestEnvironment(oObj);
+
+ tEnv.addObjRelation("EditOnly",
+ "This method isn't supported in this component");
+
+ //adding ObjectRelation for XAccessibleText
+ tEnv.addObjRelation("LimitedBounds", "true");
+
+
+ tEnv.addObjRelation("EventProducer",
+ new ifc.accessibility._XAccessibleEventBroadcaster.EventProducer() {
+ public void fireEvent() {
+ }
+ });
+
+ tEnv.addObjRelation("XAccessibleSelection.multiSelection",
+ new Boolean(false));
+
+ tEnv.addObjRelation("XAccessibleText.Text", "Bibliography");
+
+ return tEnv;
+ }
+
+ /**
+ * Sleeps for 0.5 sec. to allow StarOffice to react on <code>
+ * reset</code> call.
+ */
+ private void shortWait() {
+ try {
+ Thread.sleep(5000);
+ } catch (InterruptedException e) {
+ System.out.println("While waiting :" + e);
+ }
+ }
+
+ protected void closeDoc() {
+ XCloseable closer = (XCloseable) UnoRuntime.queryInterface(
+ XCloseable.class, xTextDoc);
+
+ try {
+ closer.close(true);
+ } catch (com.sun.star.util.CloseVetoException e) {
+ log.println("Couldn't close document " + e.getMessage());
+ } catch (com.sun.star.lang.DisposedException e) {
+ log.println("Couldn't close document " + e.getMessage());
+ }
+ }
+} \ No newline at end of file