tdf#130857 qt weld: Introduce QtInstanceScrolledWindow
[LibreOffice.git] / qadevOOo / tests / java / mod / _sch / AccFloor.java
blob3d5426faba2170badfcb78b9cfa2c080bce7b72a
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._sch;
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.utils;
29 import com.sun.star.accessibility.AccessibleRole;
30 import com.sun.star.accessibility.XAccessible;
31 import com.sun.star.accessibility.XAccessibleComponent;
32 import com.sun.star.accessibility.XAccessibleContext;
33 import com.sun.star.awt.XWindow;
34 import com.sun.star.beans.XPropertySet;
35 import com.sun.star.chart.XChartDocument;
36 import com.sun.star.frame.XModel;
37 import com.sun.star.uno.UnoRuntime;
38 import com.sun.star.uno.XInterface;
40 public class AccFloor extends TestCase {
42 XChartDocument xChartDoc = null;
44 @Override
45 protected TestEnvironment createTestEnvironment(
46 TestParameters Param, PrintWriter log) throws Exception {
48 if (xChartDoc != null) cleanup(Param, log);
49 log.println( "creating a chart document" );
50 SOfficeFactory SOF = SOfficeFactory.getFactory( Param.getMSF());
51 log.println( "creating a chartdocument" );
52 xChartDoc = SOF.createChartDoc();
54 log.println("Change Diagram to 3D");
55 XPropertySet ChartProps = UnoRuntime.queryInterface( XPropertySet.class, xChartDoc.getDiagram() );
56 ChartProps.setPropertyValue("Dim3D", Boolean.TRUE);
58 XInterface oObj = null;
60 XModel aModel = UnoRuntime.queryInterface(XModel.class, xChartDoc);
62 XWindow xWindow = AccessibilityTools.getCurrentWindow(aModel);
63 XAccessible xRoot = AccessibilityTools.getAccessibleObject(xWindow);
65 AccessibilityTools.printAccessibleTree(log, xRoot, Param.getBool(util.PropertyName.DEBUG_IS_ACTIVE));
67 XAccessibleContext cont = AccessibilityTools.getAccessibleObjectForRole(
68 xRoot, AccessibleRole.SHAPE, "", "AccFloor");
71 oObj = cont;
73 log.println("ImplementationName " + utils.getImplName(oObj));
74 log.println("AccessibleName " + cont.getAccessibleName());
76 TestEnvironment tEnv = new TestEnvironment(oObj);
78 final XAccessibleComponent acc = UnoRuntime.queryInterface(
79 XAccessibleComponent.class,oObj);
80 tEnv.addObjRelation("EventProducer",
81 new ifc.accessibility._XAccessibleEventBroadcaster.EventProducer() {
82 public void fireEvent() {
83 acc.grabFocus();
85 });
87 return tEnv;
91 /**
92 * Called while disposing a <code>TestEnvironment</code>.
93 * Disposes text document.
94 * @param Param test parameters
95 * @param log writer to log information while testing
97 @Override
98 protected void cleanup( TestParameters Param, PrintWriter log) {
99 if( xChartDoc!=null ) {
100 log.println( " closing xChartDoc" );
101 util.DesktopTools.closeDoc(xChartDoc);
102 xChartDoc = null;