tdf#130857 qt weld: Introduce QtInstanceScrolledWindow
[LibreOffice.git] / qadevOOo / tests / java / mod / _sw / SwAccessibleTableCellView.java
blobc16f1f497eecb830c7fbe65f6e2d02f4a4572059
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 .
18 package mod._sw;
20 import java.io.PrintWriter;
22 import lib.TestCase;
23 import lib.TestEnvironment;
24 import lib.TestParameters;
25 import util.AccessibilityTools;
26 import util.SOfficeFactory;
27 import util.WriterTools;
28 import util.utils;
30 import com.sun.star.accessibility.AccessibleRole;
31 import com.sun.star.accessibility.XAccessible;
32 import com.sun.star.accessibility.XAccessibleContext;
33 import com.sun.star.accessibility.XAccessibleSelection;
34 import com.sun.star.awt.XWindow;
35 import com.sun.star.frame.XModel;
36 import com.sun.star.text.XTextDocument;
37 import com.sun.star.text.XTextTable;
38 import com.sun.star.uno.UnoRuntime;
41 /**
42 * Test of accessible object for the table cell of a text document.<p>
43 * Object implements the following interfaces :
44 * <ul>
45 * <li> <code>::com::sun::star::accessibility::XAccessible</code></li>
46 * </ul>
47 * @see com.sun.star.accessibility.XAccessible
49 public class SwAccessibleTableCellView extends TestCase {
50 XTextDocument xTextDoc = null;
52 /**
53 * Called to create an instance of <code>TestEnvironment</code>
54 * with an object to test and related objects.
55 * Creates a text table and inserts it to document. Then obtains accessible
56 * object for one of table cell.
58 * @param Param test parameters
59 * @param log writer to log information while testing
61 * @see TestEnvironment
62 * @see #getTestEnvironment
64 @Override
65 protected TestEnvironment createTestEnvironment(TestParameters Param,
66 PrintWriter log) {
67 XAccessibleContext oObj = null;
68 XTextTable oTable = null;
70 SOfficeFactory.getFactory( Param.getMSF());
72 oTable = SOfficeFactory.createTextTable(xTextDoc);
74 SOfficeFactory.insertTextContent(xTextDoc, oTable);
76 XModel aModel = UnoRuntime.queryInterface(XModel.class,
77 xTextDoc);
79 XWindow xWindow = AccessibilityTools.getCurrentWindow(aModel);
80 XAccessible xRoot = AccessibilityTools.getAccessibleObject(xWindow);
82 oObj = AccessibilityTools.getAccessibleObjectForRole(xRoot, AccessibleRole.TABLE_CELL);
84 log.println("ImplementationName " + utils.getImplName(oObj));
86 AccessibilityTools.printAccessibleTree(log, xRoot, Param.getBool(util.PropertyName.DEBUG_IS_ACTIVE));
87 TestEnvironment tEnv = new TestEnvironment(oObj);
89 final XAccessibleSelection accSel = UnoRuntime.queryInterface(
90 XAccessibleSelection.class,
91 oObj.getAccessibleParent());
93 tEnv.addObjRelation("EventProducer",
94 new ifc.accessibility._XAccessibleEventBroadcaster.EventProducer() {
95 public void fireEvent() {
96 accSel.selectAllAccessibleChildren();
98 });
100 return tEnv;
104 * Called while disposing a <code>TestEnvironment</code>.
105 * Disposes text document.
106 * @param Param test parameters
107 * @param log writer to log information while testing
109 @Override
110 protected void cleanup(TestParameters Param, PrintWriter log) {
111 log.println("dispose text document");
112 util.DesktopTools.closeDoc(xTextDoc);
116 * Called while the <code>TestCase</code> initialization.
117 * Creates a text document.
119 * @param Param test parameters
120 * @param log writer to log information while testing
122 * @see #initializeTestCase
124 @Override
125 protected void initialize(TestParameters Param, PrintWriter log) throws Exception {
126 log.println("creating a text document");
127 xTextDoc = WriterTools.createTextDoc( Param.getMSF());