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 com
.sun
.star
.accessibility
.AccessibleRole
;
21 import com
.sun
.star
.accessibility
.XAccessible
;
22 import com
.sun
.star
.accessibility
.XAccessibleAction
;
23 import com
.sun
.star
.awt
.XWindow
;
24 import com
.sun
.star
.frame
.XModel
;
25 import com
.sun
.star
.lang
.XComponent
;
26 import com
.sun
.star
.uno
.UnoRuntime
;
27 import com
.sun
.star
.uno
.XInterface
;
29 import java
.io
.PrintWriter
;
32 import lib
.TestEnvironment
;
33 import lib
.TestParameters
;
34 import util
.AccessibilityTools
;
35 import util
.SOfficeFactory
;
39 * Test for object that implements the following interfaces :
42 * ::com::sun::star::accessibility::XAccessibleContext</code></li>
44 * ::com::sun::star::accessibility::XAccessibleEventBroadcaster
47 * ::com::sun::star::accessibility::XAccessibleComponent</code></li>
49 * ::com::sun::star::accessibility::XAccessibleExtendedComponent
52 * ::com::sun::star::accessibility::XAccessibleValue</code></li>
54 * ::com::sun::star::accessibility::XAccessibleAction</code></li>
57 * @see com.sun.star.accessibility.XAccessibleEventBroadcaster
58 * @see com.sun.star.accessibility.XAccessibleContext
59 * @see com.sun.star.accessibility.XAccessibleComponent
60 * @see com.sun.star.accessibility.XAccessibleExtendedComponent
61 * @see com.sun.star.accessibility.XAccessibleValue
62 * @see com.sun.star.accessibility.XAccessibleAction
63 * @see ifc.accessibility._XAccessibleEventBroadcaster
64 * @see ifc.accessibility._XAccessibleContext
65 * @see ifc.accessibility._XAccessibleComponent
66 * @see ifc.accessibility._XAccessibleExtendedComponent
67 * @see ifc.accessibility._XAccessibleValue
68 * @see ifc.accessibility._XAccessibleAction
70 public class AccessibleScrollBar
extends TestCase
{
71 private static XComponent xDoc
;
74 * Disposes the document, if exists, created in
75 * <code>createTestEnvironment</code> method.
78 protected void cleanup(TestParameters Param
, PrintWriter log
) {
79 log
.println("disposing xTextDoc");
87 * Creates a text document.
88 * Then obtains an accessible object with
89 * the role <code>AccessibleRole.SCROLLBAR</code>.
90 * Object relations created :
92 * <li> <code>'EventProducer'</code> for
93 * {@link ifc.accessibility._XAccessibleEventBroadcaster}:
97 * @param tParam test parameters
98 * @param log writer to log information while testing
100 * @see com.sun.star.awt.Toolkit
101 * @see com.sun.star.accessibility.AccessibleRole
102 * @see ifc.accessibility._XAccessibleEventBroadcaster
103 * @see com.sun.star.accessibility.XAccessibleEventBroadcaster
106 protected TestEnvironment
createTestEnvironment(TestParameters tParam
,
107 PrintWriter log
) throws Exception
{
108 log
.println("creating a test environment");
114 // get a soffice factory object
115 SOfficeFactory SOF
= SOfficeFactory
.getFactory(
118 log
.println("creating a text document");
119 xDoc
= SOF
.createDrawDoc(null);
121 XModel aModel
= UnoRuntime
.queryInterface(XModel
.class, xDoc
);
123 XInterface oObj
= null;
125 XWindow xWindow
= AccessibilityTools
.getCurrentWindow(
128 XAccessible xRoot
= AccessibilityTools
.getAccessibleObject(xWindow
);
130 oObj
= AccessibilityTools
.getAccessibleObjectForRole(xRoot
, AccessibleRole
.SCROLL_BAR
);
132 final XAccessibleAction act
= UnoRuntime
.queryInterface(
133 XAccessibleAction
.class, oObj
);
135 log
.println("ImplementationName: " + util
.utils
.getImplName(oObj
));
137 TestEnvironment tEnv
= new TestEnvironment(oObj
);
139 tEnv
.addObjRelation("EventProducer",
140 new ifc
.accessibility
._XAccessibleEventBroadcaster
.EventProducer() {
141 public void fireEvent() {
143 act
.doAccessibleAction(1);
144 } catch (Exception e
) {
152 protected void closeDoc() {
153 util
.DesktopTools
.closeDoc(xDoc
);