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 .
19 package ifc
.accessibility
;
21 import com
.sun
.star
.accessibility
.XAccessibleAction
;
23 public class _XAccessibleAction
extends lib
.MultiMethodTest
{
25 public XAccessibleAction oObj
= null;
29 * calls the method and stores the result in the <br>
30 * variable count. Is OK if no excpetion occurs
33 public void _getAccessibleActionCount() {
34 count
= oObj
.getAccessibleActionCount();
35 tRes
.tested("getAccessibleActionCount()",count
> 0);
39 * calls the method with invalid argument and check if the <br>
40 * expected Exception is thrown.<br>
41 * Calls the method afterwards the first valid parameter.<br>
42 * This is the last method called and the environment is disposed<br>
46 public void _doAccessibleAction() {
47 requiredMethod("getAccessibleActionKeyBinding()");
50 log
.println("Calling method with wrong argument");
52 oObj
.doAccessibleAction(count
);
53 log
.println("Exception expected -- FAILED");
55 } catch (com
.sun
.star
.lang
.IndexOutOfBoundsException ioe
) {
56 log
.println("Expected exception -- OK");
62 for (int i
= 0; i
< count
; i
++) {
63 log
.println("do Action "+ oObj
.getAccessibleActionDescription(i
));
64 act
= oObj
.doAccessibleAction(i
);
65 log
.println("Worked: "+act
);
67 log
.println("Did action: "+act
);
69 } catch (com
.sun
.star
.lang
.IndexOutOfBoundsException ioe
) {
70 log
.println("Unexepected exception -- FAILED");
74 tRes
.tested("doAccessibleAction()",res
);
78 * calls the method with invalid argument and check if the <br>
79 * expected Exception is thrown.<br>
80 * Calls the method afterwards all valid parameters.<br>
81 * Is ok if the exception is thrown and the resulting value
82 * for the calls with valid parameters aren't null.
85 public void _getAccessibleActionDescription() {
86 requiredMethod("getAccessibleActionCount()");
89 log
.println("Calling method with wrong argument");
91 oObj
.getAccessibleActionDescription(count
);
92 log
.println("Exception expected -- FAILED");
94 } catch (com
.sun
.star
.lang
.IndexOutOfBoundsException ioe
) {
95 log
.println("Expected exception -- OK");
99 for (int i
=0;i
<count
;i
++) {
101 String desc
= oObj
.getAccessibleActionDescription(i
);
102 log
.println("Found action: "+desc
);
104 } catch (com
.sun
.star
.lang
.IndexOutOfBoundsException ioe
) {
105 log
.println("Unexepected exception -- FAILED");
110 tRes
.tested("getAccessibleActionDescription()",res
);
114 * calls the method with invalid argument and check if the <br>
115 * expected Exception is thrown.<br>
116 * Calls the method afterwards all valid parameters.<br>
117 * Is ok if the exception is thrown and the resulting value
118 * for the calls with valid parameters aren't null.
121 public void _getAccessibleActionKeyBinding() {
122 requiredMethod("getAccessibleActionDescription()");
125 log
.println("Calling method with wrong argument");
127 oObj
.getAccessibleActionKeyBinding(count
);
128 log
.println("Exception expected -- FAILED");
130 } catch (com
.sun
.star
.lang
.IndexOutOfBoundsException ioe
) {
131 log
.println("Expected exception -- OK");
135 for (int i
=0;i
<count
;i
++) {
137 Object key
= oObj
.getAccessibleActionKeyBinding(i
);
139 log
.println("Found key: "+key
.toString());
142 } catch (com
.sun
.star
.lang
.IndexOutOfBoundsException ioe
) {
143 log
.println("Unexepected exception -- FAILED");
148 tRes
.tested("getAccessibleActionKeyBinding()",res
);
152 * Forces environment recreation.
155 protected void after() {
156 disposeEnvironment();