1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: _XAccessibleAction.java,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 package ifc
.accessibility
;
33 import com
.sun
.star
.accessibility
.XAccessibleAction
;
35 public class _XAccessibleAction
extends lib
.MultiMethodTest
{
37 public XAccessibleAction oObj
= null;
41 * calls the method and stores the result in the <br>
42 * variable count. Is OK if no excpetion occurs
45 public void _getAccessibleActionCount() {
46 count
= oObj
.getAccessibleActionCount();
47 tRes
.tested("getAccessibleActionCount()",count
> 0);
51 * calls the method with invalid argument and check if the <br>
52 * expected Exception is thrown.<br>
53 * Calls the method afterwards the first valid parameter.<br>
54 * This is the last method called and the environment is disposed<br>
58 public void _doAccessibleAction() {
59 requiredMethod("getAccessibleActionKeyBinding()");
62 log
.println("Calling method with wrong argument");
64 oObj
.doAccessibleAction(count
);
65 log
.println("Exception expected -- FAILED");
67 } catch (com
.sun
.star
.lang
.IndexOutOfBoundsException ioe
) {
68 log
.println("Expected exception -- OK");
74 for (int i
= 0; i
< count
; i
++) {
75 log
.println("do Action "+ oObj
.getAccessibleActionDescription(i
));
76 act
= oObj
.doAccessibleAction(i
);
77 log
.println("Worked: "+act
);
79 log
.println("Did action: "+act
);
81 } catch (com
.sun
.star
.lang
.IndexOutOfBoundsException ioe
) {
82 log
.println("Unexepected exception -- FAILED");
86 tRes
.tested("doAccessibleAction()",res
);
90 * calls the method with invalid argument and check if the <br>
91 * expected Exception is thrown.<br>
92 * Calls the method afterwards all valid parameters.<br>
93 * Is ok if the exception is thrown and the resulting value
94 * for the calls with valid parameters aren't null.
97 public void _getAccessibleActionDescription() {
98 requiredMethod("getAccessibleActionCount()");
101 log
.println("Calling method with wrong argument");
103 oObj
.getAccessibleActionDescription(count
);
104 log
.println("Exception expected -- FAILED");
106 } catch (com
.sun
.star
.lang
.IndexOutOfBoundsException ioe
) {
107 log
.println("Expected exception -- OK");
111 for (int i
=0;i
<count
;i
++) {
113 String desc
= oObj
.getAccessibleActionDescription(i
);
114 log
.println("Found action: "+desc
);
116 } catch (com
.sun
.star
.lang
.IndexOutOfBoundsException ioe
) {
117 log
.println("Unexepected exception -- FAILED");
122 tRes
.tested("getAccessibleActionDescription()",res
);
126 * calls the method with invalid argument and check if the <br>
127 * expected Exception is thrown.<br>
128 * Calls the method afterwards all valid parameters.<br>
129 * Is ok if the exception is thrown and the resulting value
130 * for the calls with valid parameters aren't null.
133 public void _getAccessibleActionKeyBinding() {
134 requiredMethod("getAccessibleActionDescription()");
137 log
.println("Calling method with wrong argument");
139 oObj
.getAccessibleActionKeyBinding(count
);
140 log
.println("Exception expected -- FAILED");
142 } catch (com
.sun
.star
.lang
.IndexOutOfBoundsException ioe
) {
143 log
.println("Expected exception -- OK");
147 for (int i
=0;i
<count
;i
++) {
149 Object key
= oObj
.getAccessibleActionKeyBinding(i
);
151 log
.println("Found key: "+key
.toString());
154 } catch (com
.sun
.star
.lang
.IndexOutOfBoundsException ioe
) {
155 log
.println("Unexepected exception -- FAILED");
160 tRes
.tested("getAccessibleActionKeyBinding()",res
);
164 * Forces environment recreation.
166 protected void after() {
167 disposeEnvironment();