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
;
23 import lib
.TestEnvironment
;
24 import lib
.TestParameters
;
25 import util
.AccessibilityTools
;
26 import util
.SOfficeFactory
;
29 import com
.sun
.star
.accessibility
.AccessibleRole
;
30 import com
.sun
.star
.accessibility
.XAccessible
;
31 import com
.sun
.star
.awt
.PosSize
;
32 import com
.sun
.star
.awt
.Rectangle
;
33 import com
.sun
.star
.awt
.XWindow
;
34 import com
.sun
.star
.chart
.XChartDocument
;
35 import com
.sun
.star
.frame
.XModel
;
36 import com
.sun
.star
.uno
.UnoRuntime
;
37 import com
.sun
.star
.uno
.XInterface
;
39 public class AccessibleDocumentView
extends TestCase
{
41 XChartDocument xChartDoc
= null;
44 protected TestEnvironment
createTestEnvironment(
45 TestParameters Param
, PrintWriter log
) {
47 XInterface oObj
= null;
49 XModel aModel
= UnoRuntime
.queryInterface(XModel
.class, xChartDoc
);
51 XWindow xWindow
= AccessibilityTools
.getCurrentWindow(aModel
);
52 XAccessible xRoot
= AccessibilityTools
.getAccessibleObject(xWindow
);
54 oObj
= AccessibilityTools
.getAccessibleObjectForRole(xRoot
, AccessibleRole
.DOCUMENT
);
57 log
.println("DocumentView hasn't the role 'Document'");
58 log
.println("trying the role 'Shape'");
59 oObj
= AccessibilityTools
.getAccessibleObjectForRole(xRoot
, AccessibleRole
.SHAPE
);
62 log
.println("ImplementationName " + utils
.getImplName(oObj
));
64 TestEnvironment tEnv
= new TestEnvironment(oObj
);
66 final XWindow xDocWin
= xWindow
;
67 tEnv
.addObjRelation("EventProducer",
68 new ifc
.accessibility
._XAccessibleEventBroadcaster
.EventProducer() {
69 public void fireEvent() {
70 Rectangle rect
= xDocWin
.getPosSize();
71 xDocWin
.setPosSize(100,100,100,100,PosSize
.POSSIZE
);
72 xDocWin
.setPosSize(rect
.X
,rect
.Y
,rect
.Width
,rect
.Height
,
82 * Called while disposing a <code>TestEnvironment</code>.
83 * Disposes text document.
84 * @param Param test parameters
85 * @param log writer to log information while testing
88 protected void cleanup( TestParameters Param
, PrintWriter log
) {
89 if( xChartDoc
!=null ) {
90 log
.println( " closing xChartDoc" );
91 util
.DesktopTools
.closeDoc(xChartDoc
);
97 * Called while the <code>TestCase</code> initialization.
98 * Creates a chart document.
100 * @param Param test parameters
101 * @param log writer to log information while testing
103 * @see #initializeTestCase
106 protected void initialize(TestParameters Param
, PrintWriter log
) throws Exception
{
107 log
.println( "creating a text document" );
108 SOfficeFactory SOF
= SOfficeFactory
.getFactory( Param
.getMSF());
109 log
.println( "creating a chartdocument" );
110 xChartDoc
= SOF
.createChartDoc();