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
;
31 import lib
.TestEnvironment
;
32 import lib
.TestParameters
;
34 import util
.AccessibilityTools
;
35 import util
.SOfficeFactory
;
40 * Test for object which is represented by accessible component
41 * of the URL locator combo box located in the left upper corner
44 * Object implements the following interfaces :
46 * <li> <code>::com::sun::star::accessibility::XAccessibleExtendedComponent</code></li>
47 * <li> <code>::com::sun::star::accessibility::XAccessibleEventBroadcaster</code></li>
48 * <li> <code>::com::sun::star::accessibility::XAccessibleComponent</code></li>
49 * <li> <code>::com::sun::star::accessibility::XAccessibleAction</code></li>
50 * <li> <code>::com::sun::star::accessibility::XAccessibleContext</code></li>
53 * @see com.sun.star.accessibility.XAccessibleExtendedComponent
54 * @see com.sun.star.accessibility.XAccessibleEventBroadcaster
55 * @see com.sun.star.accessibility.XAccessibleComponent
56 * @see com.sun.star.accessibility.XAccessibleAction
57 * @see com.sun.star.accessibility.XAccessibleContext
58 * @see ifc.accessibility._XAccessibleExtendedComponent
59 * @see ifc.accessibility._XAccessibleEventBroadcaster
60 * @see ifc.accessibility._XAccessibleComponent
61 * @see ifc.accessibility._XAccessibleAction
62 * @see ifc.accessibility._XAccessibleContext
64 public class AccessibleDropDownComboBox
extends TestCase
{
65 private static XTextDocument xTextDoc
= null;
68 * Finds AccessibleDropDownComboBox walking through the
69 * accessible component tree of a writer document.
72 protected TestEnvironment
createTestEnvironment(TestParameters Param
,
74 XInterface oObj
= null;
76 XWindow xWindow
= AccessibilityTools
.getCurrentContainerWindow(
79 XAccessible xRoot
= AccessibilityTools
.getAccessibleObject(xWindow
);
81 oObj
= AccessibilityTools
.getAccessibleObjectForRole(xRoot
, AccessibleRole
.COMBO_BOX
,
82 "", "AccessibleDropDownComboBox");
84 log
.println("ImplementationName " + utils
.getImplName(oObj
));
86 TestEnvironment tEnv
= new TestEnvironment(oObj
);
88 final XAccessibleAction editAction
= UnoRuntime
.queryInterface(
89 XAccessibleAction
.class,
92 tEnv
.addObjRelation("EventProducer",
93 new ifc
.accessibility
._XAccessibleEventBroadcaster
.EventProducer() {
94 public void fireEvent() {
96 editAction
.doAccessibleAction(0);
97 } catch (com
.sun
.star
.lang
.IndexOutOfBoundsException e
) {
107 * Creates writer document.
110 protected void initialize(TestParameters Param
, PrintWriter log
) throws Exception
{
111 SOfficeFactory SOF
= SOfficeFactory
.getFactory(
113 xTextDoc
= SOF
.createTextDoc(null);
117 * Disposes writer document.
120 protected void cleanup(TestParameters Param
, PrintWriter log
) {
121 util
.DesktopTools
.closeDoc(xTextDoc
);