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
.SOfficeFactory
;
41 * Test for object which is represented by accessible component
42 * of the URL locator combo box located in the left upper corner
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 AccessibleDropDownComboBox
extends TestCase
{
66 private static XTextDocument xTextDoc
= null;
69 * Finds AccessibleDropDownComboBox walking through the
70 * accessible component tree of a writer document.
73 protected TestEnvironment
createTestEnvironment(TestParameters Param
,
75 XInterface oObj
= null;
77 XWindow xWindow
= AccessibilityTools
.getCurrentContainerWindow(
80 XAccessible xRoot
= AccessibilityTools
.getAccessibleObject(xWindow
);
82 oObj
= AccessibilityTools
.getAccessibleObjectForRole(xRoot
, AccessibleRole
.COMBO_BOX
,
83 "", "AccessibleDropDownComboBox");
85 log
.println("ImplementationName " + utils
.getImplName(oObj
));
87 TestEnvironment tEnv
= new TestEnvironment(oObj
);
89 final XAccessibleAction editAction
= UnoRuntime
.queryInterface(
90 XAccessibleAction
.class,
93 tEnv
.addObjRelation("EventProducer",
94 new ifc
.accessibility
._XAccessibleEventBroadcaster
.EventProducer() {
95 public void fireEvent() {
97 editAction
.doAccessibleAction(0);
98 } catch (com
.sun
.star
.lang
.IndexOutOfBoundsException e
) {
108 * Creates writer document.
111 protected void initialize(TestParameters Param
, PrintWriter log
) {
113 SOfficeFactory SOF
= SOfficeFactory
.getFactory(
115 xTextDoc
= SOF
.createTextDoc(null);
116 } catch (com
.sun
.star
.uno
.Exception e
) {
117 throw new StatusException("Can't create document", e
);
122 * Disposes writer document.
125 protected void cleanup(TestParameters Param
, PrintWriter log
) {
126 util
.DesktopTools
.closeDoc(xTextDoc
);