From 940b4d1848e8c70ab7642901a68594e8016caffc Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sat, 27 Apr 2024 18:51:28 +0200 Subject: Adding upstream version 1:7.0.4. Signed-off-by: Daniel Baumann --- .../java/mod/_svtools/AccessibleBrowseBox.java | 172 ++++++++++++++ .../mod/_svtools/AccessibleBrowseBoxHeaderBar.java | 222 +++++++++++++++++ .../_svtools/AccessibleBrowseBoxHeaderCell.java | 207 ++++++++++++++++ .../mod/_svtools/AccessibleBrowseBoxTable.java | 209 ++++++++++++++++ .../mod/_svtools/AccessibleBrowseBoxTableCell.java | 175 ++++++++++++++ .../mod/_svtools/AccessibleIconChoiceCtrl.java | 244 +++++++++++++++++++ .../_svtools/AccessibleIconChoiceCtrlEntry.java | 217 +++++++++++++++++ .../tests/java/mod/_svtools/AccessibleTabBar.java | 132 +++++++++++ .../java/mod/_svtools/AccessibleTabBarPage.java | 156 ++++++++++++ .../mod/_svtools/AccessibleTabBarPageList.java | 172 ++++++++++++++ .../java/mod/_svtools/AccessibleTreeListBox.java | 211 +++++++++++++++++ .../mod/_svtools/AccessibleTreeListBoxEntry.java | 262 +++++++++++++++++++++ 12 files changed, 2379 insertions(+) create mode 100644 qadevOOo/tests/java/mod/_svtools/AccessibleBrowseBox.java create mode 100644 qadevOOo/tests/java/mod/_svtools/AccessibleBrowseBoxHeaderBar.java create mode 100644 qadevOOo/tests/java/mod/_svtools/AccessibleBrowseBoxHeaderCell.java create mode 100644 qadevOOo/tests/java/mod/_svtools/AccessibleBrowseBoxTable.java create mode 100644 qadevOOo/tests/java/mod/_svtools/AccessibleBrowseBoxTableCell.java create mode 100644 qadevOOo/tests/java/mod/_svtools/AccessibleIconChoiceCtrl.java create mode 100644 qadevOOo/tests/java/mod/_svtools/AccessibleIconChoiceCtrlEntry.java create mode 100644 qadevOOo/tests/java/mod/_svtools/AccessibleTabBar.java create mode 100644 qadevOOo/tests/java/mod/_svtools/AccessibleTabBarPage.java create mode 100644 qadevOOo/tests/java/mod/_svtools/AccessibleTabBarPageList.java create mode 100644 qadevOOo/tests/java/mod/_svtools/AccessibleTreeListBox.java create mode 100644 qadevOOo/tests/java/mod/_svtools/AccessibleTreeListBoxEntry.java (limited to 'qadevOOo/tests/java/mod/_svtools') diff --git a/qadevOOo/tests/java/mod/_svtools/AccessibleBrowseBox.java b/qadevOOo/tests/java/mod/_svtools/AccessibleBrowseBox.java new file mode 100644 index 000000000..2bba0293e --- /dev/null +++ b/qadevOOo/tests/java/mod/_svtools/AccessibleBrowseBox.java @@ -0,0 +1,172 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +package mod._svtools; + +import java.io.PrintWriter; + +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.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.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 xDesktop; + static XTextDocument xTextDoc; + + /** + * Creates the Desktop service (com.sun.star.frame.Desktop). + */ + @Override + protected void initialize(TestParameters Param, PrintWriter log) throws Exception { + xDesktop = DesktopTools.createDesktop(Param.getMSF()); + } + + /** + * Disposes the document, if exists, created in + * createTestEnvironment method. + */ + @Override + protected void cleanup(TestParameters Param, PrintWriter log) { + + log.println("disposing xTextDoc"); + + if (xTextDoc != null) { + xTextDoc.dispose(); + } + } + + /** + * Called to create an instance of TestEnvironment 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 getTestEnvironment(). + * + * @param tParam test parameters + * @param log writer to log information while testing + * + * @see TestEnvironment + * @see #getTestEnvironment + */ + @Override + protected TestEnvironment createTestEnvironment(TestParameters tParam, PrintWriter log) throws Exception { + + log.println("creating a test environment"); + + if (xTextDoc != null) { + xTextDoc.dispose(); // get a soffice factory object + } + SOfficeFactory SOF = SOfficeFactory.getFactory(tParam.getMSF()); + + log.println("creating a text document"); + xTextDoc = SOF.createTextDoc(null); + + util.utils.waitForEventIdle(tParam.getMSF()); + + XModel aModel1 = UnoRuntime.queryInterface(XModel.class, xTextDoc); + + XController secondController = aModel1.getCurrentController(); + + + XDispatchProvider aProv = UnoRuntime.queryInterface(XDispatchProvider.class, + secondController); + + 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); + + util.utils.waitForEventIdle(tParam.getMSF()); + + XFrame the_frame1 = xDesktop.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 = 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 = Integer.valueOf(com.sun.star.sdb.CommandType.TABLE); + params[2].Name = "Command"; + params[2].Value = "biblio"; + + final PropertyValue[] fParams = params; + + util.utils.waitForEventIdle(tParam.getMSF()); + + XWindow xWindow = secondController.getFrame().getContainerWindow(); + + XAccessible xRoot = AccessibilityTools.getAccessibleObject(xWindow); + + AccessibilityTools.printAccessibleTree(log, xRoot, tParam.getBool(util.PropertyName.DEBUG_IS_ACTIVE)); + + oObj = AccessibilityTools.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.lang.IllegalArgumentException e) { + e.printStackTrace(); + } + } + }); + + return tEnv; + } +} diff --git a/qadevOOo/tests/java/mod/_svtools/AccessibleBrowseBoxHeaderBar.java b/qadevOOo/tests/java/mod/_svtools/AccessibleBrowseBoxHeaderBar.java new file mode 100644 index 000000000..a19e61076 --- /dev/null +++ b/qadevOOo/tests/java/mod/_svtools/AccessibleBrowseBoxHeaderBar.java @@ -0,0 +1,222 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +package mod._svtools; + +import com.sun.star.view.XSelectionSupplier; + +import java.awt.Robot; +import java.awt.event.InputEvent; +import java.io.PrintWriter; + +import lib.TestCase; +import lib.TestEnvironment; +import lib.TestParameters; +import util.AccessibilityTools; +import util.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.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.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 : + *

+ * + * @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 xDesktop; + static XTextDocument xTextDoc; + + /** + * Creates the Desktop service (com.sun.star.frame.Desktop). + */ + @Override + protected void initialize(TestParameters Param, PrintWriter log) throws Exception { + xDesktop = DesktopTools.createDesktop(Param.getMSF()); + } + + /** + * Disposes the document, if exists, created in + * createTestEnvironment method. + */ + @Override + 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 com.sun.star.awt.Toolkit + * and gets active top window. Then obtains an accessible object with + * the role AccessibleRole.TABLE. + * Object relations created : + *

+ * + * @param tParam test parameters + * @param log writer to log information while testing + * + * @see com.sun.star.awt.Toolkit + * @see com.sun.star.accessibility.AccessibleRole + * @see ifc.accessibility._XAccessibleEventBroadcaster + * @see com.sun.star.accessibility.XAccessibleEventBroadcaster + */ + @Override + protected TestEnvironment createTestEnvironment(TestParameters tParam, + PrintWriter log) throws Exception { + log.println("creating a test environment"); + + if (xTextDoc != null) { + xTextDoc.dispose(); + } + + // get a soffice factory object + SOfficeFactory SOF = SOfficeFactory.getFactory( tParam.getMSF()); + + log.println("creating a text document"); + xTextDoc = SOF.createTextDoc(null); + + util.utils.waitForEventIdle(tParam.getMSF()); + + XModel aModel1 = UnoRuntime.queryInterface(XModel.class, + xTextDoc); + + XController secondController = aModel1.getCurrentController(); + + XDispatchProvider aProv = UnoRuntime.queryInterface( + XDispatchProvider.class, + secondController); + + 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); + + // an XSelectionSupplier at the controller -> call with params + 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 = Integer.valueOf(com.sun.star.sdb.CommandType.TABLE); + params[1] = param2; + + PropertyValue param3 = new PropertyValue(); + param3.Name = "Command"; + param3.Value = "biblio"; + params[2] = param3; + + util.utils.waitForEventIdle(tParam.getMSF()); + + XFrame the_frame1 = xDesktop.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 = UnoRuntime.queryInterface( + XSelectionSupplier.class, xCont); + + xSelect.select(params); + + XInterface oObj = null; + + XWindow xWindow = secondController.getFrame().getContainerWindow(); + + XAccessible xRoot = AccessibilityTools.getAccessibleObject(xWindow); + + oObj = AccessibilityTools.getAccessibleObjectForRole(xRoot, AccessibleRole.TABLE); + + AccessibilityTools.printAccessibleTree(log, xRoot, tParam.getBool(util.PropertyName.DEBUG_IS_ACTIVE)); + log.println("ImplementationName: " + util.utils.getImplName(oObj)); + + TestEnvironment tEnv = new TestEnvironment(oObj); + + util.utils.waitForEventIdle(tParam.getMSF()); + + XAccessibleComponent accComp = UnoRuntime.queryInterface( + XAccessibleComponent.class, + oObj); + final Point point = accComp.getLocationOnScreen(); + + util.utils.waitForEventIdle(tParam.getMSF()); + + 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; + } +} diff --git a/qadevOOo/tests/java/mod/_svtools/AccessibleBrowseBoxHeaderCell.java b/qadevOOo/tests/java/mod/_svtools/AccessibleBrowseBoxHeaderCell.java new file mode 100644 index 000000000..e050458ec --- /dev/null +++ b/qadevOOo/tests/java/mod/_svtools/AccessibleBrowseBoxHeaderCell.java @@ -0,0 +1,207 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +package mod._svtools; + +import com.sun.star.view.XSelectionSupplier; + +import java.io.PrintWriter; + +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.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.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 : + *

+ * + * @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 (com.sun.star.frame.Desktop). + */ + @Override + protected void initialize(TestParameters Param, PrintWriter log) throws Exception { + the_Desk = UnoRuntime.queryInterface( + XDesktop.class, DesktopTools.createDesktop(Param.getMSF())); + } + + /** + * Disposes the document, if exists, created in + * createTestEnvironment method. + */ + @Override + 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 + * com.sun.star.awt.Toolkit and gets active top window. + * Then obtains an accessible object with the role + * AccessibleRole.UNKNOWN and with the name + * "Identifier". + * Object relations created : + *

+ * + * @param tParam test parameters + * @param log writer to log information while testing + * + * @see com.sun.star.awt.Toolkit + * @see com.sun.star.accessibility.AccessibleRole + * @see ifc.accessibility._XAccessibleEventBroadcaster + * @see com.sun.star.accessibility.XAccessibleEventBroadcaster + */ + @Override + protected TestEnvironment createTestEnvironment( + TestParameters tParam, PrintWriter log) throws Exception { + + log.println( "creating a test environment" ); + + if (xTextDoc != null) xTextDoc.dispose(); + + // get a soffice factory object + SOfficeFactory SOF = SOfficeFactory.getFactory( tParam.getMSF()); + + log.println( "creating a text document" ); + xTextDoc = SOF.createTextDoc(null); + + util.utils.waitForEventIdle(tParam.getMSF()); + + XModel aModel1 = UnoRuntime.queryInterface(XModel.class, xTextDoc); + + XController secondController = aModel1.getCurrentController(); + + XDispatchProvider aProv = UnoRuntime. + queryInterface(XDispatchProvider.class, secondController); + + 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); + + util.utils.waitForEventIdle(tParam.getMSF()); + + 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; + + 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 = Integer.valueOf(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 = UnoRuntime.queryInterface( + XSelectionSupplier.class, xCont); + + xSelect.select(params); + + XWindow xWindow = secondController.getFrame().getContainerWindow(); + + XAccessible xRoot = AccessibilityTools.getAccessibleObject(xWindow); + + AccessibilityTools.printAccessibleTree(log, xRoot, tParam.getBool(util.PropertyName.DEBUG_IS_ACTIVE)); + + oObj = AccessibilityTools.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; + } + +} diff --git a/qadevOOo/tests/java/mod/_svtools/AccessibleBrowseBoxTable.java b/qadevOOo/tests/java/mod/_svtools/AccessibleBrowseBoxTable.java new file mode 100644 index 000000000..49f42f4c6 --- /dev/null +++ b/qadevOOo/tests/java/mod/_svtools/AccessibleBrowseBoxTable.java @@ -0,0 +1,209 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +package mod._svtools; + +import com.sun.star.view.XSelectionSupplier; + +import java.io.PrintWriter; + +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.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.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 : + *

+ * + * @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 (com.sun.star.frame.Desktop). + */ + @Override + protected void initialize(TestParameters Param, PrintWriter log) throws Exception { + the_Desk = UnoRuntime.queryInterface(XDesktop.class, + DesktopTools.createDesktop( + Param.getMSF())); + } + + /** + * Disposes the document, if exists, created in + * createTestEnvironment method. + */ + @Override + 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 + * com.sun.star.awt.Toolkit and gets active top window. + * Then obtains an accessible object with the role + * AccessibleRole.TABLE and with the name + * "Table". + * Object relations created : + *

+ * + * @param tParam test parameters + * @param log writer to log information while testing + * + * @see com.sun.star.awt.Toolkit + * @see com.sun.star.accessibility.AccessibleRole + * @see ifc.accessibility._XAccessibleEventBroadcaster + * @see com.sun.star.accessibility.XAccessibleEventBroadcaster + */ + @Override + protected TestEnvironment createTestEnvironment(TestParameters tParam, + PrintWriter log) throws Exception { + log.println("creating a test environment"); + + if (xTextDoc != null) { + xTextDoc.dispose(); + } + + // get a soffice factory object + SOfficeFactory SOF = SOfficeFactory.getFactory( + tParam.getMSF()); + + log.println("creating a text document"); + xTextDoc = SOF.createTextDoc(null); + + util.utils.waitForEventIdle(tParam.getMSF()); + + XModel aModel1 = UnoRuntime.queryInterface(XModel.class, + xTextDoc); + + XController secondController = aModel1.getCurrentController(); + + XDispatchProvider aProv = UnoRuntime.queryInterface( + XDispatchProvider.class, + secondController); + + 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); + + util.utils.waitForEventIdle(tParam.getMSF()); + + 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 = Integer.valueOf(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 = UnoRuntime.queryInterface( + XSelectionSupplier.class, xCont); + + + XInterface oObj = null; + + XWindow xWindow = secondController.getFrame().getContainerWindow(); + + XAccessible xRoot = AccessibilityTools.getAccessibleObject(xWindow); + + oObj = AccessibilityTools.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; + } +} diff --git a/qadevOOo/tests/java/mod/_svtools/AccessibleBrowseBoxTableCell.java b/qadevOOo/tests/java/mod/_svtools/AccessibleBrowseBoxTableCell.java new file mode 100644 index 000000000..e80d6bc8a --- /dev/null +++ b/qadevOOo/tests/java/mod/_svtools/AccessibleBrowseBoxTableCell.java @@ -0,0 +1,175 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +package mod._svtools; + +import java.io.PrintWriter; + +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.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.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 : + *

+ * + * @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 xDesktop; + static XTextDocument xTextDoc; + + /** + * Creates the Desktop service (com.sun.star.frame.Desktop). + */ + @Override + protected void initialize(TestParameters Param, PrintWriter log) throws Exception { + xDesktop = DesktopTools.createDesktop(Param.getMSF()); + } + + /** + * Disposes the document, if exists, created in + * createTestEnvironment method. + */ + @Override + 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 + * com.sun.star.awt.Toolkit and gets active top window. + * Then obtains an accessible object with the role + * AccessibleRole.TABLE_CELL. + * Object relations created : + *

+ * + * @param tParam test parameters + * @param log writer to log information while testing + * + * @see com.sun.star.awt.Toolkit + * @see com.sun.star.accessibility.AccessibleRole + * @see ifc.accessibility._XAccessibleEventBroadcaster + * @see com.sun.star.accessibility.XAccessibleEventBroadcaster + */ + @Override + protected TestEnvironment createTestEnvironment(TestParameters tParam, PrintWriter log) throws Exception { + + log.println( "creating a test environment" ); + + if (xTextDoc != null) xTextDoc.dispose(); + + // get a soffice factory object + SOfficeFactory SOF = SOfficeFactory.getFactory( tParam.getMSF()); + + log.println( "creating a text document" ); + xTextDoc = SOF.createTextDoc(null); + + util.utils.waitForEventIdle(tParam.getMSF()); + + XModel aModel1 = UnoRuntime.queryInterface(XModel.class, xTextDoc); + + XController secondController = aModel1.getCurrentController(); + + + XDispatchProvider aProv = UnoRuntime.queryInterface(XDispatchProvider.class,secondController); + + 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); + + util.utils.waitForEventIdle(tParam.getMSF()); + + XFrame the_frame1 = xDesktop.getCurrentFrame(); + + if (the_frame1 == null) { + log.println("Current frame was not found !!!"); + } + + XFrame the_frame2 = the_frame1.findFrame("_beamer",4); + + the_frame2.setName("DatasourceBrowser"); + + util.utils.waitForEventIdle(tParam.getMSF()); + + XWindow xWindow = secondController.getFrame().getContainerWindow(); + + XAccessible xRoot = AccessibilityTools.getAccessibleObject(xWindow); + + XInterface oObj = AccessibilityTools.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; + } + +} diff --git a/qadevOOo/tests/java/mod/_svtools/AccessibleIconChoiceCtrl.java b/qadevOOo/tests/java/mod/_svtools/AccessibleIconChoiceCtrl.java new file mode 100644 index 000000000..05907d287 --- /dev/null +++ b/qadevOOo/tests/java/mod/_svtools/AccessibleIconChoiceCtrl.java @@ -0,0 +1,244 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +package mod._svtools; + +import java.io.PrintWriter; + +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.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 : + *

+ * + * @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 xDesktop; + static XTextDocument xTextDoc; + static XAccessibleAction accCloseButton = null; + + /** + * Creates the Desktop service (com.sun.star.frame.Desktop). + */ + @Override + protected void initialize(TestParameters Param, PrintWriter log) throws Exception { + xDesktop = DesktopTools.createDesktop(Param.getMSF()); + } + + /** + * Closes the Hyperlink dialog. + * Disposes the document, if exists, created in + * createTestEnvironment method. + */ + @Override + 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 + * com.sun.star.awt.Toolkit and gets active top window. + * Then obtains an accessible object with the role + * AccessibleRole.TREE. + * Object relations created : + *

+ * + * @param tParam test parameters + * @param log writer to log information while testing + * + * @see com.sun.star.awt.Toolkit + * @see com.sun.star.accessibility.AccessibleRole + * @see ifc.accessibility._XAccessibleEventBroadcaster + * @see com.sun.star.accessibility.XAccessibleEventBroadcaster + */ + @Override + protected TestEnvironment createTestEnvironment(TestParameters tParam, + PrintWriter log) throws Exception { + log.println("creating a test environment"); + + if (xTextDoc != null) { + xTextDoc.dispose(); + } + + // get a soffice factory object + SOfficeFactory SOF = SOfficeFactory.getFactory( tParam.getMSF()); + + log.println("creating a text document"); + xTextDoc = SOF.createTextDoc(null); + + util.utils.waitForEventIdle(tParam.getMSF()); + + XModel aModel1 = UnoRuntime.queryInterface(XModel.class, + xTextDoc); + + XController secondController = aModel1.getCurrentController(); + + XDispatchProvider aProv = UnoRuntime.queryInterface( + XDispatchProvider.class, + secondController); + + XURLTransformer urlTransf = null; + + XInterface transf = (XInterface) tParam.getMSF() + .createInstance("com.sun.star.util.URLTransformer"); + urlTransf = UnoRuntime.queryInterface( + XURLTransformer.class, transf); + + XDispatch getting = null; + log.println("opening HyperlinkDialog"); + + URL[] url = new URL[1]; + url[0] = new URL(); + url[0].Complete = ".uno:HyperlinkDialog"; + urlTransf.parseStrict(url); + getting = aProv.queryDispatch(url[0], "", 0); + + PropertyValue[] noArgs = new PropertyValue[0]; + getting.dispatch(url[0], noArgs); + + util.utils.waitForEventIdle(tParam.getMSF()); + + XInterface oObj = (XInterface) tParam.getMSF() + .createInstance("com.sun.star.awt.Toolkit"); + + XExtendedToolkit tk = UnoRuntime.queryInterface( + XExtendedToolkit.class, oObj); + + util.utils.waitForEventIdle(tParam.getMSF()); + + XWindow xWindow = UnoRuntime.queryInterface(XWindow.class, + tk.getActiveTopWindow()); + + XAccessible xRoot = AccessibilityTools.getAccessibleObject(xWindow); + + oObj = AccessibilityTools.getAccessibleObjectForRole(xRoot, AccessibleRole.TREE); + + XAccessibleContext closeButton = AccessibilityTools.getAccessibleObjectForRole(xRoot, + AccessibleRole.PUSH_BUTTON, + "Close"); + + accCloseButton = UnoRuntime.queryInterface( + XAccessibleAction.class, closeButton); + + log.println("ImplementationName: " + util.utils.getImplName(oObj)); + + TestEnvironment tEnv = new TestEnvironment(oObj); + tEnv.addObjRelation("XAccessibleSelection.multiSelection", + Boolean.FALSE); + tEnv.addObjRelation("XAccessibleSelection.OneAlwaysSelected", + 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 = 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; + } +} \ 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 000000000..847ae380b --- /dev/null +++ b/qadevOOo/tests/java/mod/_svtools/AccessibleIconChoiceCtrlEntry.java @@ -0,0 +1,217 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +package mod._svtools; + +import java.io.PrintWriter; + +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.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 : + *

+ * + * @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 xDesktop; + static XTextDocument xTextDoc; + static XAccessibleAction accCloseButton = null; + + /** + * Creates the Desktop service (com.sun.star.frame.Desktop). + */ + @Override + protected void initialize(TestParameters Param, PrintWriter log) throws Exception { + xDesktop = DesktopTools.createDesktop(Param.getMSF()); + } + + /** + * Closes the Hyperlink dialog. + * Disposes the document, if exists, created in + * createTestEnvironment method. + */ + @Override + 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 + * com.sun.star.awt.Toolkit and gets active top window. + * Then obtains an accessible object with the role + * AccessibleRole.LABEL and with the name + * "Internet". + * Object relations created : + *

+ * + * @param tParam test parameters + * @param log writer to log information while testing + * + * @see com.sun.star.awt.Toolkit + * @see com.sun.star.accessibility.AccessibleRole + * @see ifc.accessibility._XAccessibleEventBroadcaster + * @see com.sun.star.accessibility.XAccessibleEventBroadcaster + */ + @Override + protected TestEnvironment createTestEnvironment( + TestParameters tParam, PrintWriter log) throws Exception { + + log.println( "creating a test environment" ); + + if (xTextDoc != null) xTextDoc.dispose(); + + // get a soffice factory object + SOfficeFactory SOF = SOfficeFactory.getFactory( tParam.getMSF()); + + log.println( "creating a text document" ); + xTextDoc = SOF.createTextDoc(null); + + util.utils.waitForEventIdle(tParam.getMSF()); + + XModel aModel1 = UnoRuntime.queryInterface(XModel.class, xTextDoc); + + XController secondController = aModel1.getCurrentController(); + + XDispatchProvider aProv = UnoRuntime. + queryInterface(XDispatchProvider.class, secondController); + + XInterface transf = (XInterface)tParam.getMSF().createInstance + ("com.sun.star.util.URLTransformer"); + XURLTransformer urlTransf = UnoRuntime.queryInterface + (XURLTransformer.class, transf); + + XDispatch getting = null; + log.println( "opening HyperlinkDialog" ); + URL[] url = new URL[1]; + url[0] = new URL(); + url[0].Complete = ".uno:HyperlinkDialog"; + urlTransf.parseStrict(url); + getting = aProv.queryDispatch(url[0], "", 0); + PropertyValue[] noArgs = new PropertyValue[0]; + getting.dispatch(url[0], noArgs); + + util.utils.waitForEventIdle(tParam.getMSF()); + + XInterface oObj = (XInterface) tParam.getMSF().createInstance + ("com.sun.star.awt.Toolkit") ; + + XExtendedToolkit tk = UnoRuntime.queryInterface(XExtendedToolkit.class, oObj); + + util.utils.waitForEventIdle(tParam.getMSF()); + + XWindow xWindow = UnoRuntime.queryInterface(XWindow.class, tk.getActiveTopWindow()); + + XAccessible xRoot = AccessibilityTools.getAccessibleObject(xWindow); + + oObj = AccessibilityTools.getAccessibleObjectForRole(xRoot, + AccessibleRole.LABEL, "Internet"); + + XAccessibleContext closeButton = AccessibilityTools.getAccessibleObjectForRole(xRoot, + AccessibleRole.PUSH_BUTTON, "Close"); + + accCloseButton = UnoRuntime.queryInterface(XAccessibleAction.class, closeButton); + + log.println("ImplementationName: "+ util.utils.getImplName(oObj)); + + TestEnvironment tEnv = new TestEnvironment(oObj); + + tEnv.addObjRelation("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; + } + +} diff --git a/qadevOOo/tests/java/mod/_svtools/AccessibleTabBar.java b/qadevOOo/tests/java/mod/_svtools/AccessibleTabBar.java new file mode 100644 index 000000000..8e694058b --- /dev/null +++ b/qadevOOo/tests/java/mod/_svtools/AccessibleTabBar.java @@ -0,0 +1,132 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +package mod._svtools; + +import java.io.PrintWriter; + +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.XWindow; +import com.sun.star.frame.XModel; +import com.sun.star.lang.XComponent; +import com.sun.star.lang.XMultiServiceFactory; +import com.sun.star.uno.UnoRuntime; +import com.sun.star.uno.XInterface; +import com.sun.star.util.XCloseable; + + +public class AccessibleTabBar extends TestCase { + static XComponent xDoc; + + /** + * Disposes the document, if exists, created in + * createTestEnvironment method. + */ + @Override + 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 AccessibleRole.PAGETAB. + * Object relations created : + * + * + * @param tParam test parameters + * @param log writer to log information while testing + * + * @see com.sun.star.awt.Toolkit + * @see com.sun.star.accessibility.AccessibleRole + * @see ifc.accessibility._XAccessibleEventBroadcaster + * @see com.sun.star.accessibility.XAccessibleEventBroadcaster + */ + @Override + protected TestEnvironment createTestEnvironment(TestParameters tParam, + PrintWriter log) throws Exception { + log.println("creating a test environment"); + + if (xDoc != null) { + closeDoc(xDoc); + } + + XMultiServiceFactory msf = tParam.getMSF(); + + // get a soffice factory object + SOfficeFactory SOF = SOfficeFactory.getFactory(msf); + + log.println("creating a calc document"); + xDoc = UnoRuntime.queryInterface(XComponent.class, + SOF.createCalcDoc( + null)); + + util.utils.waitForEventIdle(tParam.getMSF()); + + XInterface oObj = null; + + XWindow xWindow = UnoRuntime.queryInterface(XModel.class, xDoc). + getCurrentController().getFrame().getContainerWindow(); + + XAccessible xRoot = AccessibilityTools.getAccessibleObject(xWindow); + AccessibilityTools.printAccessibleTree(log, xRoot, tParam.getBool(util.PropertyName.DEBUG_IS_ACTIVE)); + oObj = AccessibilityTools.getAccessibleObjectForRole(xRoot, AccessibleRole.PANEL); + + log.println("ImplementationName: " + util.utils.getImplName(oObj)); + + TestEnvironment tEnv = new TestEnvironment(oObj); + + final XWindow aWin = xWindow; + + tEnv.addObjRelation("EventProducer", + new ifc.accessibility._XAccessibleEventBroadcaster.EventProducer() { + public void fireEvent() { + aWin.setPosSize(100,100, 500, 500, PosSize.POSSIZE); + } + }); + + return tEnv; + } + + protected void closeDoc(XComponent xDoc) { + XCloseable closer = 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 (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 000000000..e8b4c56e7 --- /dev/null +++ b/qadevOOo/tests/java/mod/_svtools/AccessibleTabBarPage.java @@ -0,0 +1,156 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +package mod._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.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.uno.UnoRuntime; +import com.sun.star.uno.XInterface; + +/** + * Test for object that implements the following interfaces : + *

+ * + * @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 + * createTestEnvironment method. + */ + @Override + 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 AccessibleRole.PAGETAB. + * Object relations created : + *

+ * + * @param tParam test parameters + * @param log writer to log information while testing + * + * @see com.sun.star.awt.Toolkit + * @see com.sun.star.accessibility.AccessibleRole + * @see ifc.accessibility._XAccessibleEventBroadcaster + * @see com.sun.star.accessibility.XAccessibleEventBroadcaster + */ + @Override + protected TestEnvironment createTestEnvironment(TestParameters tParam, + PrintWriter log) throws Exception { + + log.println( "creating a test environment" ); + + if (xDoc != null) xDoc.dispose(); + + // get a soffice factory object + SOfficeFactory SOF = SOfficeFactory.getFactory( tParam.getMSF()); + + log.println( "creating a calc document" ); + xDoc = UnoRuntime.queryInterface(XComponent.class, SOF.createCalcDoc(null));// SOF.createDrawDoc(null); + + util.utils.waitForEventIdle(tParam.getMSF()); + + XInterface oObj = (XInterface) tParam.getMSF().createInstance + ("com.sun.star.awt.Toolkit") ; + + + XExtendedToolkit tk = UnoRuntime.queryInterface(XExtendedToolkit.class, oObj); + + + util.utils.waitForEventIdle(tParam.getMSF()); + + XWindow xWindow = UnoRuntime.queryInterface(XWindow.class,tk.getActiveTopWindow()); + + XAccessible xRoot = AccessibilityTools.getAccessibleObject(xWindow); + AccessibilityTools.printAccessibleTree(log, xRoot, tParam.getBool(util.PropertyName.DEBUG_IS_ACTIVE)); + oObj = AccessibilityTools.getAccessibleObjectForRole(xRoot, AccessibleRole.PAGE_TAB, "Sheet1"); + XAccessibleContext acc = AccessibilityTools.getAccessibleObjectForRole(xRoot, AccessibleRole.PAGE_TAB, "Sheet2"); + XAccessibleComponent accComp = 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; + } + +} diff --git a/qadevOOo/tests/java/mod/_svtools/AccessibleTabBarPageList.java b/qadevOOo/tests/java/mod/_svtools/AccessibleTabBarPageList.java new file mode 100644 index 000000000..64ca390ff --- /dev/null +++ b/qadevOOo/tests/java/mod/_svtools/AccessibleTabBarPageList.java @@ -0,0 +1,172 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +package mod._svtools; + +import com.sun.star.drawing.XLayerManager; +import com.sun.star.drawing.XLayerSupplier; + +import java.io.PrintWriter; + +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.uno.UnoRuntime; +import com.sun.star.uno.XInterface; +import com.sun.star.util.XCloseable; + + +/** + * Test for object that implements the following interfaces : + *

+ * + * @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 + * createTestEnvironment method. + */ + @Override + 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 AccessibleRole.PAGETABLIST. + * Object relations created : + *

+ * + * @param tParam test parameters + * @param log writer to log information while testing + * + * @see com.sun.star.awt.Toolkit + * @see com.sun.star.accessibility.AccessibleRole + * @see ifc.accessibility._XAccessibleEventBroadcaster + * @see com.sun.star.accessibility.XAccessibleEventBroadcaster + */ + @Override + protected TestEnvironment createTestEnvironment(TestParameters tParam, + PrintWriter log) throws Exception { + log.println("creating a test environment"); + + if (xDoc != null) { + closeDoc(); + } + + // get a soffice factory object + SOfficeFactory SOF = SOfficeFactory.getFactory( tParam.getMSF()); + + log.println("creating a draw document"); + xDoc = SOF.createDrawDoc(null); + + util.utils.waitForEventIdle(tParam.getMSF()); + + XInterface oObj = (XInterface) tParam.getMSF() + .createInstance("com.sun.star.awt.Toolkit"); + + XExtendedToolkit tk = UnoRuntime.queryInterface( + XExtendedToolkit.class, oObj); + + util.utils.waitForEventIdle(tParam.getMSF()); + + XWindow xWindow = UnoRuntime.queryInterface(XWindow.class, + tk.getActiveTopWindow()); + + XAccessible xRoot = AccessibilityTools.getAccessibleObject(xWindow); + + oObj = AccessibilityTools.getAccessibleObjectForRole(xRoot, + AccessibleRole.PAGE_TAB_LIST); + + log.println("ImplementationName: " + util.utils.getImplName(oObj)); + + TestEnvironment tEnv = new TestEnvironment(oObj); + + tEnv.addObjRelation("XAccessibleSelection.multiSelection", + Boolean.FALSE); + + tEnv.addObjRelation("XAccessibleSelection.OneAlwaysSelected", + Boolean.TRUE); + + XLayerSupplier oLS = UnoRuntime.queryInterface(XLayerSupplier.class, xDoc); + XInterface oLM = oLS.getLayerManager(); + final XLayerManager xLM = UnoRuntime.queryInterface(XLayerManager.class, oLM); + + + tEnv.addObjRelation("EventProducer", + new ifc.accessibility._XAccessibleEventBroadcaster.EventProducer() { + public void fireEvent() { + xLM.insertNewByIndex(0); + } + }); + + return tEnv; + } + + protected void closeDoc() { + XCloseable closer = 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 000000000..42371dd4e --- /dev/null +++ b/qadevOOo/tests/java/mod/_svtools/AccessibleTreeListBox.java @@ -0,0 +1,211 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +package mod._svtools; + +import java.io.PrintWriter; + +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.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.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 : + *

+ * + * @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 xDesktop; + static XTextDocument xTextDoc; + + /** + * Creates the Desktop service (com.sun.star.frame.Desktop). + */ + @Override + protected void initialize(TestParameters Param, PrintWriter log) throws Exception { + xDesktop = DesktopTools.createDesktop(Param.getMSF()); + } + + /** + * Disposes the document, if exists, created in + * createTestEnvironment method. + */ + @Override + 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 com.sun.star.awt.Toolkit + * and gets active top window. Then obtains an accessible object with + * the role AccessibleRole.TREE. + * Object relations created : + *

+ * + * @param tParam test parameters + * @param log writer to log information while testing + * + * @see com.sun.star.awt.Toolkit + * @see com.sun.star.accessibility.AccessibleRole + * @see ifc.accessibility._XAccessibleEventBroadcaster + * @see com.sun.star.accessibility.XAccessibleEventBroadcaster + */ + @Override + protected TestEnvironment createTestEnvironment( + TestParameters tParam, PrintWriter log) throws Exception { + + log.println( "creating a test environment" ); + + if (xTextDoc != null) xTextDoc.dispose(); + + // get a soffice factory object + SOfficeFactory SOF = SOfficeFactory.getFactory( tParam.getMSF()); + + log.println( "creating a text document" ); + xTextDoc = SOF.createTextDoc(null); + + util.utils.waitForEventIdle(tParam.getMSF()); + + XModel aModel1 = UnoRuntime.queryInterface(XModel.class, xTextDoc); + + XController secondController = aModel1.getCurrentController(); + + XDispatchProvider aProv = UnoRuntime. + queryInterface(XDispatchProvider.class, secondController); + + 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); + + util.utils.waitForEventIdle(tParam.getMSF()); + + XFrame the_frame1 = xDesktop.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; + + XWindow xWindow = secondController.getFrame().getContainerWindow(); + + XAccessible xRoot = AccessibilityTools.getAccessibleObject(xWindow); + + oObj = AccessibilityTools.getAccessibleObjectForRole(xRoot, AccessibleRole.TREE); + + log.println("ImplementationName: "+ util.utils.getImplName(oObj)); + + TestEnvironment tEnv = new TestEnvironment(oObj); + + final XInitialization xInit = 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 = Integer.valueOf(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() { + try { + xInit.initialize(fParams); + } catch(com.sun.star.uno.Exception e) { + e.printStackTrace(); + } + } + }); + + tEnv.addObjRelation("XAccessibleSelection.multiSelection", + Boolean.FALSE); + + return tEnv; + } + +} diff --git a/qadevOOo/tests/java/mod/_svtools/AccessibleTreeListBoxEntry.java b/qadevOOo/tests/java/mod/_svtools/AccessibleTreeListBoxEntry.java new file mode 100644 index 000000000..73f776448 --- /dev/null +++ b/qadevOOo/tests/java/mod/_svtools/AccessibleTreeListBoxEntry.java @@ -0,0 +1,262 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +package mod._svtools; + +import com.sun.star.view.XSelectionSupplier; + +import java.io.PrintWriter; + +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.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.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 : + *

+ * + * @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 xDesktop; + static XTextDocument xTextDoc; + + /** + * Creates the Desktop service (com.sun.star.frame.Desktop). + */ + @Override + protected void initialize(TestParameters Param, PrintWriter log) throws Exception { + xDesktop = DesktopTools.createDesktop(Param.getMSF()); + } + + /** + * Disposes the document, if exists, created in + * createTestEnvironment method. + */ + @Override + 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 com.sun.star.awt.Toolkit + * and gets active top window. Then obtains an accessible object with + * the role AccessibleRole.LABEL and with the name + * "Bibliography". + * Object relations created : + *

+ * + * @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 + */ + @Override + protected TestEnvironment createTestEnvironment(TestParameters tParam, + PrintWriter log) throws Exception { + log.println("creating a test environment"); + + if (xTextDoc != null) { + closeDoc(); + } + + // get a soffice factory object + SOfficeFactory SOF = SOfficeFactory.getFactory( tParam.getMSF()); + + log.println("creating a text document"); + xTextDoc = SOF.createTextDoc(null); + + util.utils.waitForEventIdle(tParam.getMSF()); + + XModel aModel1 = UnoRuntime.queryInterface(XModel.class, + xTextDoc); + + XController secondController = aModel1.getCurrentController(); + + XDispatchProvider aProv = 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); + + util.utils.waitForEventIdle(tParam.getMSF()); + + XFrame the_frame1 = xDesktop.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; + + 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 = Integer.valueOf(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 = UnoRuntime.queryInterface( + XSelectionSupplier.class, xCont); + + xSelect.select(params); + + util.utils.waitForEventIdle(tParam.getMSF()); + + XWindow xWindow = secondController.getFrame().getContainerWindow(); + + XAccessible xRoot = AccessibilityTools.getAccessibleObject(xWindow); + + AccessibilityTools.printAccessibleTree(log, xRoot, tParam.getBool(util.PropertyName.DEBUG_IS_ACTIVE)); + + oObj = AccessibilityTools.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", + Boolean.FALSE); + + tEnv.addObjRelation("XAccessibleText.Text", "Bibliography"); + + return tEnv; + } + + protected void closeDoc() { + XCloseable closer = 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 -- cgit v1.2.3