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
.text
.XTextDocument
;
25 import com
.sun
.star
.uno
.UnoRuntime
;
26 import com
.sun
.star
.uno
.XInterface
;
28 import java
.io
.PrintWriter
;
30 import lib
.StatusException
;
32 import lib
.TestEnvironment
;
33 import lib
.TestParameters
;
35 import util
.AccessibilityTools
;
36 import util
.DesktopTools
;
37 import util
.SOfficeFactory
;
42 * Test for object which is represented by style list box
43 * on toolbar of a document. <p>
45 * Object implements the following interfaces :
47 * <li> <code>::com::sun::star::accessibility::XAccessibleExtendedComponent</code></li>
48 * <li> <code>::com::sun::star::accessibility::XAccessibleEventBroadcaster</code></li>
49 * <li> <code>::com::sun::star::accessibility::XAccessibleComponent</code></li>
50 * <li> <code>::com::sun::star::accessibility::XAccessibleAction</code></li>
51 * <li> <code>::com::sun::star::accessibility::XAccessibleContext</code></li>
54 * @see com.sun.star.accessibility.XAccessibleExtendedComponent
55 * @see com.sun.star.accessibility.XAccessibleEventBroadcaster
56 * @see com.sun.star.accessibility.XAccessibleComponent
57 * @see com.sun.star.accessibility.XAccessibleAction
58 * @see com.sun.star.accessibility.XAccessibleContext
59 * @see ifc.accessibility._XAccessibleExtendedComponent
60 * @see ifc.accessibility._XAccessibleEventBroadcaster
61 * @see ifc.accessibility._XAccessibleComponent
62 * @see ifc.accessibility._XAccessibleAction
63 * @see ifc.accessibility._XAccessibleContext
65 public class AccessibleDropDownListBox
extends TestCase
{
66 private static XTextDocument xTextDoc
= null;
68 * Finds AccessibleDropDownListBox walking through the
69 * accessible component tree of a writer document.
72 protected TestEnvironment
createTestEnvironment(TestParameters Param
,
74 XInterface oObj
= null;
76 util
.utils
.pause(500);
78 XWindow xWindow
= AccessibilityTools
.getCurrentWindow(
81 XAccessible xRoot
= AccessibilityTools
.getAccessibleObject(xWindow
);
83 AccessibilityTools
.printAccessibleTree(log
, xRoot
, Param
.getBool(util
.PropertyName
.DEBUG_IS_ACTIVE
));
85 oObj
= AccessibilityTools
.getAccessibleObjectForRole(xRoot
, AccessibleRole
.COMBO_BOX
,
86 "", "AccessibleDropDownListBox");
88 log
.println("ImplementationName " + utils
.getImplName(oObj
));
90 TestEnvironment tEnv
= new TestEnvironment(oObj
);
92 final XAccessibleAction acomp
= UnoRuntime
.queryInterface(
93 XAccessibleAction
.class, oObj
);
94 tEnv
.addObjRelation("EventProducer",
95 new ifc
.accessibility
._XAccessibleEventBroadcaster
.EventProducer() {
96 public void fireEvent() {
98 acomp
.doAccessibleAction(0);
99 } catch (com
.sun
.star
.lang
.IndexOutOfBoundsException e
) {
100 throw new StatusException("Can't perform action 0", e
);
109 * Creates writer document.
112 protected void initialize(TestParameters Param
, PrintWriter log
) {
114 SOfficeFactory SOF
= SOfficeFactory
.getFactory(
116 // Dock the Navigator to supply an AccessibleDropDownListBox
117 DesktopTools
.dockNavigator(Param
.getMSF());
118 xTextDoc
= SOF
.createTextDoc(null);
119 } catch (com
.sun
.star
.uno
.Exception e
) {
120 throw new StatusException("Can't create document", e
);
125 * Disposes writer document.
128 protected void cleanup(TestParameters Param
, PrintWriter log
) {
129 util
.DesktopTools
.closeDoc(xTextDoc
);