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 .
20 import java
.io
.PrintWriter
;
22 import lib
.StatusException
;
24 import lib
.TestEnvironment
;
25 import lib
.TestParameters
;
26 import util
.AccessibilityTools
;
27 import util
.SOfficeFactory
;
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
.accessibility
.XAccessibleContext
;
34 import com
.sun
.star
.awt
.XWindow
;
35 import com
.sun
.star
.beans
.XPropertySet
;
36 import com
.sun
.star
.chart
.XChartDocument
;
37 import com
.sun
.star
.frame
.XModel
;
38 import com
.sun
.star
.uno
.UnoRuntime
;
39 import com
.sun
.star
.uno
.XInterface
;
41 public class AccWall
extends TestCase
{
43 XChartDocument xChartDoc
= null;
46 protected TestEnvironment
createTestEnvironment(
47 TestParameters Param
, PrintWriter log
) {
49 if (xChartDoc
!= null) cleanup(Param
, log
);
50 log
.println( "creating a chart document" );
51 SOfficeFactory SOF
= SOfficeFactory
.getFactory( Param
.getMSF());
53 log
.println( "creating a chartdocument" );
54 xChartDoc
= SOF
.createChartDoc();
55 } catch (com
.sun
.star
.uno
.Exception e
) {
56 // Some exception occurs.FAILED
57 e
.printStackTrace( log
);
58 throw new StatusException( "Couldn't create document", e
);
61 log
.println("Change Diagram to 3D");
62 XPropertySet ChartProps
= UnoRuntime
.queryInterface( XPropertySet
.class, xChartDoc
.getDiagram() );
64 ChartProps
.setPropertyValue("Dim3D", Boolean
.TRUE
);
65 } catch(com
.sun
.star
.lang
.WrappedTargetException e
) {
66 log
.println("Couldn't change Diagram to 3D");
67 e
.printStackTrace(log
);
68 throw new StatusException("Couldn't change Diagram to 3D", e
);
69 } catch(com
.sun
.star
.lang
.IllegalArgumentException e
) {
70 log
.println("Couldn't change Diagram to 3D");
71 e
.printStackTrace(log
);
72 throw new StatusException("Couldn't change Diagram to 3D", e
);
73 } catch(com
.sun
.star
.beans
.PropertyVetoException e
) {
74 log
.println("Couldn't change Diagram to 3D");
75 e
.printStackTrace(log
);
76 throw new StatusException("Couldn't change Diagram to 3D", e
);
77 } catch(com
.sun
.star
.beans
.UnknownPropertyException e
) {
78 log
.println("Couldn't change Diagram to 3D");
79 e
.printStackTrace(log
);
80 throw new StatusException("Couldn't change Diagram to 3D", e
);
83 XInterface oObj
= null;
85 XModel aModel
= UnoRuntime
.queryInterface(XModel
.class, xChartDoc
);
87 XWindow xWindow
= AccessibilityTools
.getCurrentWindow(aModel
);
88 XAccessible xRoot
= AccessibilityTools
.getAccessibleObject(xWindow
);
90 AccessibilityTools
.printAccessibleTree(log
, xRoot
, Param
.getBool(util
.PropertyName
.DEBUG_IS_ACTIVE
));
92 XAccessibleContext cont
= AccessibilityTools
.getAccessibleObjectForRole(
93 xRoot
, AccessibleRole
.SHAPE
, "", "AccWall");
97 log
.println("ImplementationName " + utils
.getImplName(oObj
));
98 log
.println("AccessibleName " + cont
.getAccessibleName());
100 TestEnvironment tEnv
= new TestEnvironment(oObj
);
102 final XAccessibleComponent acc
= UnoRuntime
.queryInterface(
103 XAccessibleComponent
.class,oObj
);
104 tEnv
.addObjRelation("EventProducer",
105 new ifc
.accessibility
._XAccessibleEventBroadcaster
.EventProducer() {
106 public void fireEvent() {
116 * Called while disposing a <code>TestEnvironment</code>.
117 * Disposes text document.
118 * @param Param test parameters
119 * @param log writer to log information while testing
122 protected void cleanup( TestParameters Param
, PrintWriter log
) {
123 if( xChartDoc
!=null ) {
124 log
.println( " closing xChartDoc" );
125 util
.DesktopTools
.closeDoc(xChartDoc
);