summaryrefslogtreecommitdiff
path: root/qadevOOo/tests/java/mod/_sch/AccArea.java
diff options
context:
space:
mode:
Diffstat (limited to 'qadevOOo/tests/java/mod/_sch/AccArea.java')
-rw-r--r--qadevOOo/tests/java/mod/_sch/AccArea.java119
1 files changed, 119 insertions, 0 deletions
diff --git a/qadevOOo/tests/java/mod/_sch/AccArea.java b/qadevOOo/tests/java/mod/_sch/AccArea.java
new file mode 100644
index 000000000000..dae93e6d3326
--- /dev/null
+++ b/qadevOOo/tests/java/mod/_sch/AccArea.java
@@ -0,0 +1,119 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+package mod._sch;
+
+import java.io.PrintWriter;
+
+import lib.StatusException;
+import lib.TestCase;
+import lib.TestEnvironment;
+import lib.TestParameters;
+import util.AccessibilityTools;
+import util.SOfficeFactory;
+import util.utils;
+
+import com.sun.star.accessibility.AccessibleRole;
+import com.sun.star.accessibility.XAccessible;
+import com.sun.star.accessibility.XAccessibleComponent;
+import com.sun.star.accessibility.XAccessibleContext;
+import com.sun.star.awt.XWindow;
+import com.sun.star.chart.XChartDocument;
+import com.sun.star.frame.XModel;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.uno.XInterface;
+
+public class AccArea extends TestCase {
+
+ XChartDocument xChartDoc = null;
+
+ protected TestEnvironment createTestEnvironment(
+ TestParameters Param, PrintWriter log) {
+
+ if (xChartDoc != null) cleanup(Param, log);
+ log.println( "creating a chart document" );
+ SOfficeFactory SOF = SOfficeFactory.getFactory( (XMultiServiceFactory)Param.getMSF());
+ try {
+ log.println( "creating a chartdocument" );
+ xChartDoc = SOF.createChartDoc(null);
+ } catch (com.sun.star.uno.Exception e) {
+ // Some exception occures.FAILED
+ e.printStackTrace( log );
+ throw new StatusException( "Couldn't create document", e );
+ }
+
+ XInterface oObj = null;
+
+ XModel aModel = (XModel)
+ UnoRuntime.queryInterface(XModel.class, xChartDoc);
+
+ AccessibilityTools at = new AccessibilityTools();
+
+ XWindow xWindow = at.getCurrentWindow((XMultiServiceFactory)Param.getMSF(), aModel);
+ XAccessible xRoot = at.getAccessibleObject(xWindow);
+
+ at.printAccessibleTree(log, xRoot, Param.getBool(util.PropertyName.DEBUG_IS_ACTIVE));
+
+ XAccessibleContext cont = at.getAccessibleObjectForRole(
+ xRoot, AccessibleRole.SHAPE, "", "AccArea");
+
+
+ oObj = cont;
+
+ log.println("ImplementationName " + utils.getImplName(oObj));
+ log.println("AccessibleName " + cont.getAccessibleName());
+
+ TestEnvironment tEnv = new TestEnvironment(oObj);
+
+ final XAccessibleComponent acc = (XAccessibleComponent)
+ UnoRuntime.queryInterface(
+ XAccessibleComponent.class,oObj);
+ tEnv.addObjRelation("EventProducer",
+ new ifc.accessibility._XAccessibleEventBroadcaster.EventProducer() {
+ public void fireEvent() {
+ acc.grabFocus();
+ }
+ });
+
+ return tEnv;
+
+ }
+
+ /**
+ * Called while disposing a <code>TestEnvironment</code>.
+ * Disposes text document.
+ * @param tParam test parameters
+ * @param tEnv the environment to cleanup
+ * @param log writer to log information while testing
+ */
+ protected void cleanup( TestParameters Param, PrintWriter log) {
+ log.println( " closing xChartDoc " );
+ util.DesktopTools.closeDoc(xChartDoc);
+
+ }
+
+}