svx: prefix members of SdrUnoObj
[LibreOffice.git] / qadevOOo / tests / java / mod / _sm / SmGraphicAccessible.java
blob1d02f98bc11c81043b10803aec20d691b485b8bb
1 /*
2 * This file is part of the LibreOffice project.
4 * This Source Code Form is subject to the terms of the Mozilla Public
5 * License, v. 2.0. If a copy of the MPL was not distributed with this
6 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 * This file incorporates work covered by the following license notice:
10 * Licensed to the Apache Software Foundation (ASF) under one or more
11 * contributor license agreements. See the NOTICE file distributed
12 * with this work for additional information regarding copyright
13 * ownership. The ASF licenses this file to you under the Apache
14 * License, Version 2.0 (the "License"); you may not use this file
15 * except in compliance with the License. You may obtain a copy of
16 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
19 package mod._sm;
21 import java.io.PrintWriter;
23 import lib.TestCase;
24 import lib.TestEnvironment;
25 import lib.TestParameters;
26 import util.AccessibilityTools;
27 import util.SOfficeFactory;
28 import util.utils;
30 import com.sun.star.accessibility.AccessibleRole;
31 import com.sun.star.accessibility.XAccessible;
32 import com.sun.star.accessibility.XAccessibleComponent;
33 import com.sun.star.awt.XWindow;
34 import com.sun.star.beans.XPropertySet;
35 import com.sun.star.frame.XModel;
36 import com.sun.star.lang.XComponent;
37 import com.sun.star.uno.UnoRuntime;
38 import com.sun.star.uno.XInterface;
42 /**
43 * Object implements the following interfaces :
44 * <ul>
45 * <li> <code>::com::sun::star::accessibility::XAccessible</code></li>
46 * <li> <code>::com::sun::star::accessibility::XAccessibleComponent</code></li>
47 * <li> <code>::com::sun::star::accessibility::XAccessibleContext</code></li>
48 * <li> <code>::com::sun::star::accessibility::XAccessibleEventBroadcaster</code></li>
49 * <li> <code>::com::sun::star::accessibility::XAccessibleText</code></li>
50 * </ul> <p>
52 * @see com.sun.star.accessibility.XAccessible
53 * @see com.sun.star.accessibility.XAccessibleComponent
54 * @see com.sun.star.accessibility.XAccessibleContext
55 * @see com.sun.star.accessibility.XAccessibleEventBroadcaster
56 * @see com.sun.star.accessibility.XAccessibleText
57 * @see ifc.accessibility._XAccessible
58 * @see ifc.accessibility._XAccessibleComponent
59 * @see ifc.accessibility._XAccessibleContext
60 * @see ifc.accessibility._XAccessibleEventBroadcaster
61 * @see ifc.accessibility._XAccessibleText
63 public class SmGraphicAccessible extends TestCase {
64 XComponent xMathDoc;
66 /**
67 * Creates a <code>StarMath</code> document and obtains an accessibility
68 * component with the role <code>AccessibleRole.PANEL</code>.
70 @Override
71 protected TestEnvironment createTestEnvironment(final TestParameters Param, PrintWriter log) throws Exception {
73 SOfficeFactory SOF = SOfficeFactory.getFactory( Param.getMSF() );
74 xMathDoc = SOF.openDoc("smath","_blank");
76 // setting a formula in document
77 final String expFormula = "sum a cdot b";
78 final XPropertySet xPS = UnoRuntime.queryInterface
79 (XPropertySet.class, xMathDoc);
80 xPS.setPropertyValue("Formula", expFormula);
82 XInterface oObj = null;
84 XModel aModel = UnoRuntime.queryInterface(XModel.class, xMathDoc);
87 XWindow xWindow = AccessibilityTools.getCurrentWindow(aModel);
88 XAccessible xRoot = AccessibilityTools.getAccessibleObject(xWindow);
90 oObj = AccessibilityTools.getAccessibleObjectForRole
91 (xRoot, AccessibleRole.DOCUMENT, "Formula");
93 log.println("ImplementationName " + utils.getImplName(oObj));
95 final XAccessibleComponent xAC = UnoRuntime.queryInterface(XAccessibleComponent.class, oObj);
97 TestEnvironment tEnv = new TestEnvironment(oObj);
99 tEnv.addObjRelation("EditOnly",
100 "This method isn't supported in this dialog");
103 tEnv.addObjRelation("EventProducer",
104 new ifc.accessibility._XAccessibleEventBroadcaster.EventProducer(){
105 public void fireEvent() {
106 try {
107 xAC.grabFocus();
108 xPS.setPropertyValue("Formula", "sum hat x");
109 util.utils.waitForEventIdle(Param.getMSF());
110 xPS.setPropertyValue("Formula", expFormula);
111 util.utils.waitForEventIdle(Param.getMSF());
112 } catch(com.sun.star.lang.WrappedTargetException e) {
113 } catch(com.sun.star.lang.IllegalArgumentException e) {
114 } catch(com.sun.star.beans.PropertyVetoException e) {
115 } catch(com.sun.star.beans.UnknownPropertyException e) {
117 }});
119 return tEnv;
123 * Disposes the document created in <code>createTestEnvironment</code>
124 * method.
126 @Override
127 protected void cleanup( TestParameters Param, PrintWriter log) {
129 log.println( " disposing xMathDoc " );
130 xMathDoc.dispose();
132 } // finish class SmModel