xref: /AOO41X/main/qadevOOo/tests/java/ifc/accessibility/_XAccessibleTable.java (revision cdf0e10c4e3984b49a9502b011690b615761d4a3)
1*cdf0e10cSrcweir /*************************************************************************
2*cdf0e10cSrcweir  *
3*cdf0e10cSrcweir  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4*cdf0e10cSrcweir  *
5*cdf0e10cSrcweir  * Copyright 2000, 2010 Oracle and/or its affiliates.
6*cdf0e10cSrcweir  *
7*cdf0e10cSrcweir  * OpenOffice.org - a multi-platform office productivity suite
8*cdf0e10cSrcweir  *
9*cdf0e10cSrcweir  * This file is part of OpenOffice.org.
10*cdf0e10cSrcweir  *
11*cdf0e10cSrcweir  * OpenOffice.org is free software: you can redistribute it and/or modify
12*cdf0e10cSrcweir  * it under the terms of the GNU Lesser General Public License version 3
13*cdf0e10cSrcweir  * only, as published by the Free Software Foundation.
14*cdf0e10cSrcweir  *
15*cdf0e10cSrcweir  * OpenOffice.org is distributed in the hope that it will be useful,
16*cdf0e10cSrcweir  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17*cdf0e10cSrcweir  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18*cdf0e10cSrcweir  * GNU Lesser General Public License version 3 for more details
19*cdf0e10cSrcweir  * (a copy is included in the LICENSE file that accompanied this code).
20*cdf0e10cSrcweir  *
21*cdf0e10cSrcweir  * You should have received a copy of the GNU Lesser General Public License
22*cdf0e10cSrcweir  * version 3 along with OpenOffice.org.  If not, see
23*cdf0e10cSrcweir  * <http://www.openoffice.org/license.html>
24*cdf0e10cSrcweir  * for a copy of the LGPLv3 License.
25*cdf0e10cSrcweir  *
26*cdf0e10cSrcweir  ************************************************************************/
27*cdf0e10cSrcweir 
28*cdf0e10cSrcweir package ifc.accessibility;
29*cdf0e10cSrcweir 
30*cdf0e10cSrcweir import lib.MultiMethodTest;
31*cdf0e10cSrcweir 
32*cdf0e10cSrcweir import com.sun.star.accessibility.XAccessible;
33*cdf0e10cSrcweir import com.sun.star.accessibility.XAccessibleContext;
34*cdf0e10cSrcweir import com.sun.star.accessibility.XAccessibleSelection;
35*cdf0e10cSrcweir import com.sun.star.accessibility.XAccessibleTable;
36*cdf0e10cSrcweir import com.sun.star.uno.UnoRuntime;
37*cdf0e10cSrcweir 
38*cdf0e10cSrcweir /**
39*cdf0e10cSrcweir  * Testing <code>com.sun.star.accessibility.XAccessibleTable</code>
40*cdf0e10cSrcweir  * interface methods :
41*cdf0e10cSrcweir  * <ul>
42*cdf0e10cSrcweir  *  <li><code>getAccessibleRowCount()</code></li>
43*cdf0e10cSrcweir  *  <li><code>getAccessibleColumnCount()</code></li>
44*cdf0e10cSrcweir  *  <li><code>getAccessibleRowDescription()</code></li>
45*cdf0e10cSrcweir  *  <li><code>getAccessibleColumnDescription()</code></li>
46*cdf0e10cSrcweir  *  <li><code>getAccessibleRowExtentAt()</code></li>
47*cdf0e10cSrcweir  *  <li><code>getAccessibleColumnExtentAt()</code></li>
48*cdf0e10cSrcweir  *  <li><code>getAccessibleRowHeaders()</code></li>
49*cdf0e10cSrcweir  *  <li><code>getAccessibleColumnHeaders()</code></li>
50*cdf0e10cSrcweir  *  <li><code>getSelectedAccessibleRows()</code></li>
51*cdf0e10cSrcweir  *  <li><code>getSelectedAccessibleColumns()</code></li>
52*cdf0e10cSrcweir  *  <li><code>isAccessibleRowSelected()</code></li>
53*cdf0e10cSrcweir  *  <li><code>isAccessibleColumnSelected()</code></li>
54*cdf0e10cSrcweir  *  <li><code>getAccessibleCellAt()</code></li>
55*cdf0e10cSrcweir  *  <li><code>getAccessibleCaption()</code></li>
56*cdf0e10cSrcweir  *  <li><code>getAccessibleSummary()</code></li>
57*cdf0e10cSrcweir  *  <li><code>isAccessibleSelected()</code></li>
58*cdf0e10cSrcweir  *  <li><code>getAccessibleIndex()</code></li>
59*cdf0e10cSrcweir  *  <li><code>getAccessibleRow()</code></li>
60*cdf0e10cSrcweir  *  <li><code>getAccessibleColumn()</code></li>
61*cdf0e10cSrcweir  * </ul> <p>
62*cdf0e10cSrcweir  * @see com.sun.star.accessibility.XAccessibleTable
63*cdf0e10cSrcweir  */
64*cdf0e10cSrcweir public class _XAccessibleTable extends MultiMethodTest {
65*cdf0e10cSrcweir 
66*cdf0e10cSrcweir     public XAccessibleTable oObj = null;
67*cdf0e10cSrcweir     XAccessibleSelection xASel = null;
68*cdf0e10cSrcweir     XAccessibleContext xACont = null;
69*cdf0e10cSrcweir 
70*cdf0e10cSrcweir     protected void before() {
71*cdf0e10cSrcweir         xASel = (XAccessibleSelection)
72*cdf0e10cSrcweir             UnoRuntime.queryInterface(XAccessibleSelection.class, oObj);
73*cdf0e10cSrcweir         if (xASel == null) {
74*cdf0e10cSrcweir             log.println("The component doesn't implement the interface " +
75*cdf0e10cSrcweir                 "XAccessibleSelection.");
76*cdf0e10cSrcweir             log.println("This interface is required for more detailed tests.");
77*cdf0e10cSrcweir         }
78*cdf0e10cSrcweir 
79*cdf0e10cSrcweir         xACont = (XAccessibleContext)
80*cdf0e10cSrcweir             UnoRuntime.queryInterface(XAccessibleContext.class, oObj);
81*cdf0e10cSrcweir     }
82*cdf0e10cSrcweir 
83*cdf0e10cSrcweir     int rowCount = 0;
84*cdf0e10cSrcweir 
85*cdf0e10cSrcweir     /**
86*cdf0e10cSrcweir      * Calls the method and stores the returned value to the variable
87*cdf0e10cSrcweir      * <code>rowCount</code>.
88*cdf0e10cSrcweir      */
89*cdf0e10cSrcweir     public void _getAccessibleRowCount() {
90*cdf0e10cSrcweir         rowCount = oObj.getAccessibleRowCount();
91*cdf0e10cSrcweir         log.println("Accessible row count: " + rowCount);
92*cdf0e10cSrcweir         tRes.tested("getAccessibleRowCount()", true);
93*cdf0e10cSrcweir     }
94*cdf0e10cSrcweir 
95*cdf0e10cSrcweir     int colCount = 0;
96*cdf0e10cSrcweir 
97*cdf0e10cSrcweir     /**
98*cdf0e10cSrcweir      * Calls the method and stores the returned value to the variable
99*cdf0e10cSrcweir      * <code>colCount</code>.
100*cdf0e10cSrcweir      */
101*cdf0e10cSrcweir     public void _getAccessibleColumnCount() {
102*cdf0e10cSrcweir         colCount = oObj.getAccessibleColumnCount();
103*cdf0e10cSrcweir         log.println("Accessible column count: " + colCount);
104*cdf0e10cSrcweir         tRes.tested("getAccessibleColumnCount()", true);
105*cdf0e10cSrcweir     }
106*cdf0e10cSrcweir 
107*cdf0e10cSrcweir     /**
108*cdf0e10cSrcweir      * Calls the method with the wrong indexes and with the correct index,
109*cdf0e10cSrcweir      * checks a returned value.
110*cdf0e10cSrcweir      * Has OK status if exceptions were thrown for the wrong indexes,
111*cdf0e10cSrcweir      * if exception wasn't thrown for the correct index and
112*cdf0e10cSrcweir      * if returned value isn't <code>null</code>.
113*cdf0e10cSrcweir      * The following method tests are to be executed before:
114*cdf0e10cSrcweir      * <ul>
115*cdf0e10cSrcweir      *  <li> <code>getAccessibleRowCount()</code> </li>
116*cdf0e10cSrcweir      * </ul>
117*cdf0e10cSrcweir      */
118*cdf0e10cSrcweir     public void _getAccessibleRowDescription() {
119*cdf0e10cSrcweir         requiredMethod("getAccessibleRowCount()");
120*cdf0e10cSrcweir         boolean res = true;
121*cdf0e10cSrcweir 
122*cdf0e10cSrcweir         try {
123*cdf0e10cSrcweir             log.print("getAccessibleRowDescription(-1): ");
124*cdf0e10cSrcweir             String descr = oObj.getAccessibleRowDescription(-1);
125*cdf0e10cSrcweir             log.println("'" + descr + "'");
126*cdf0e10cSrcweir             log.println("Exception was expected");
127*cdf0e10cSrcweir             res &= false;
128*cdf0e10cSrcweir         } catch(com.sun.star.lang.IndexOutOfBoundsException e) {
129*cdf0e10cSrcweir             log.println("expected exception");
130*cdf0e10cSrcweir             res &= true;
131*cdf0e10cSrcweir         }
132*cdf0e10cSrcweir 
133*cdf0e10cSrcweir         try {
134*cdf0e10cSrcweir             log.print("getAccessibleRowDescription(" + rowCount + "): ");
135*cdf0e10cSrcweir             String descr = oObj.getAccessibleRowDescription(rowCount);
136*cdf0e10cSrcweir             log.println("'" + descr + "'");
137*cdf0e10cSrcweir             log.println("Exception was expected");
138*cdf0e10cSrcweir             res &= false;
139*cdf0e10cSrcweir         } catch(com.sun.star.lang.IndexOutOfBoundsException e) {
140*cdf0e10cSrcweir             log.println("expected exception");
141*cdf0e10cSrcweir             res &= true;
142*cdf0e10cSrcweir         }
143*cdf0e10cSrcweir 
144*cdf0e10cSrcweir         try {
145*cdf0e10cSrcweir             log.print("getAccessibleRowDescription(" + (rowCount - 1) + "): ");
146*cdf0e10cSrcweir             String descr =
147*cdf0e10cSrcweir                 oObj.getAccessibleRowDescription(rowCount - 1);
148*cdf0e10cSrcweir             res &= descr != null;
149*cdf0e10cSrcweir             log.println("'" + descr + "'");
150*cdf0e10cSrcweir         } catch(com.sun.star.lang.IndexOutOfBoundsException e) {
151*cdf0e10cSrcweir             log.println("Unexpected exception");
152*cdf0e10cSrcweir             e.printStackTrace(log);
153*cdf0e10cSrcweir             res &= false;
154*cdf0e10cSrcweir         }
155*cdf0e10cSrcweir 
156*cdf0e10cSrcweir         tRes.tested("getAccessibleRowDescription()", res);
157*cdf0e10cSrcweir     }
158*cdf0e10cSrcweir 
159*cdf0e10cSrcweir     /**
160*cdf0e10cSrcweir      * Calls the method with the wrong indexes and with the correct index,
161*cdf0e10cSrcweir      * checks a returned value.
162*cdf0e10cSrcweir      * Has OK status if exceptions were thrown for the wrong indexes,
163*cdf0e10cSrcweir      * if exception wasn't thrown for the correct index and
164*cdf0e10cSrcweir      * if returned value isn't <code>null</code>.
165*cdf0e10cSrcweir      * The following method tests are to be executed before:
166*cdf0e10cSrcweir      * <ul>
167*cdf0e10cSrcweir      *  <li> <code>getAccessibleColumnCount()</code> </li>
168*cdf0e10cSrcweir      * </ul>
169*cdf0e10cSrcweir      */
170*cdf0e10cSrcweir     public void _getAccessibleColumnDescription() {
171*cdf0e10cSrcweir         requiredMethod("getAccessibleColumnCount()");
172*cdf0e10cSrcweir         boolean res = true;
173*cdf0e10cSrcweir 
174*cdf0e10cSrcweir         try {
175*cdf0e10cSrcweir             log.print("getAccessibleColumnDescription(-1): ");
176*cdf0e10cSrcweir             String descr = oObj.getAccessibleColumnDescription(-1);
177*cdf0e10cSrcweir             log.println("'" + descr + "'");
178*cdf0e10cSrcweir             log.println("Exception was expected");
179*cdf0e10cSrcweir             res &= false;
180*cdf0e10cSrcweir         } catch(com.sun.star.lang.IndexOutOfBoundsException e) {
181*cdf0e10cSrcweir             log.println("expected exception");
182*cdf0e10cSrcweir             res &= true;
183*cdf0e10cSrcweir         }
184*cdf0e10cSrcweir 
185*cdf0e10cSrcweir         try {
186*cdf0e10cSrcweir             log.print("getAccessibleColumnDescription(" + colCount + "): ");
187*cdf0e10cSrcweir             String descr = oObj.getAccessibleColumnDescription(colCount);
188*cdf0e10cSrcweir             log.println("'" + descr + "'");
189*cdf0e10cSrcweir             log.println("Exception was expected");
190*cdf0e10cSrcweir             res &= false;
191*cdf0e10cSrcweir         } catch(com.sun.star.lang.IndexOutOfBoundsException e) {
192*cdf0e10cSrcweir             log.println("expected exception");
193*cdf0e10cSrcweir             res &= true;
194*cdf0e10cSrcweir         }
195*cdf0e10cSrcweir 
196*cdf0e10cSrcweir         try {
197*cdf0e10cSrcweir             log.print("getAccessibleColumnDescription(" + (colCount - 1) + "): ");
198*cdf0e10cSrcweir             String descr =
199*cdf0e10cSrcweir                 oObj.getAccessibleColumnDescription(colCount - 1);
200*cdf0e10cSrcweir             res &= descr != null;
201*cdf0e10cSrcweir             log.println("'" + descr + "'");
202*cdf0e10cSrcweir         } catch(com.sun.star.lang.IndexOutOfBoundsException e) {
203*cdf0e10cSrcweir             log.println("Unexpected exception");
204*cdf0e10cSrcweir             e.printStackTrace(log);
205*cdf0e10cSrcweir             res &= false;
206*cdf0e10cSrcweir         }
207*cdf0e10cSrcweir 
208*cdf0e10cSrcweir         tRes.tested("getAccessibleColumnDescription()", res);
209*cdf0e10cSrcweir     }
210*cdf0e10cSrcweir 
211*cdf0e10cSrcweir 
212*cdf0e10cSrcweir      /**
213*cdf0e10cSrcweir      * Calls the method with the wrong parameters and with the correct
214*cdf0e10cSrcweir      * parameters, checks a returned value.
215*cdf0e10cSrcweir      * Has OK status if exceptions were thrown for the wrong indexes,
216*cdf0e10cSrcweir      * if exception wasn't thrown for the correct index and
217*cdf0e10cSrcweir      * if returned value is greater than or is equal to 1.
218*cdf0e10cSrcweir      * The following method tests are to be executed before:
219*cdf0e10cSrcweir      * <ul>
220*cdf0e10cSrcweir      *  <li> <code>getAccessibleColumnCount()</code> </li>
221*cdf0e10cSrcweir      *  <li> <code>getAccessibleRowCount()</code> </li>
222*cdf0e10cSrcweir      * </ul>
223*cdf0e10cSrcweir      */
224*cdf0e10cSrcweir     public void _getAccessibleRowExtentAt() {
225*cdf0e10cSrcweir         requiredMethod("getAccessibleRowCount()");
226*cdf0e10cSrcweir         requiredMethod("getAccessibleColumnCount()");
227*cdf0e10cSrcweir         boolean res = true;
228*cdf0e10cSrcweir 
229*cdf0e10cSrcweir         try {
230*cdf0e10cSrcweir             log.print("getAccessibleRowExtentAt(-1," + (colCount-1) + "):");
231*cdf0e10cSrcweir             int ext = oObj.getAccessibleRowExtentAt(-1, colCount - 1);
232*cdf0e10cSrcweir             log.println(ext);
233*cdf0e10cSrcweir             log.println("Exception was expected");
234*cdf0e10cSrcweir             res &= false;
235*cdf0e10cSrcweir         } catch(com.sun.star.lang.IndexOutOfBoundsException e) {
236*cdf0e10cSrcweir             log.println("expected exception");
237*cdf0e10cSrcweir             res &= true;
238*cdf0e10cSrcweir         }
239*cdf0e10cSrcweir 
240*cdf0e10cSrcweir         try {
241*cdf0e10cSrcweir             log.print("getAccessibleRowExtentAt(" + (rowCount-1) + ",-1):");
242*cdf0e10cSrcweir             int ext = oObj.getAccessibleRowExtentAt(rowCount - 1, -1);
243*cdf0e10cSrcweir             log.println(ext);
244*cdf0e10cSrcweir             log.println("Exception was expected");
245*cdf0e10cSrcweir             res &= false;
246*cdf0e10cSrcweir         } catch(com.sun.star.lang.IndexOutOfBoundsException e) {
247*cdf0e10cSrcweir             log.println("expected exception");
248*cdf0e10cSrcweir             res &= true;
249*cdf0e10cSrcweir         }
250*cdf0e10cSrcweir 
251*cdf0e10cSrcweir         try {
252*cdf0e10cSrcweir             log.print("getAccessibleRowExtentAt(0," + colCount + "):");
253*cdf0e10cSrcweir             int ext = oObj.getAccessibleRowExtentAt(0, colCount);
254*cdf0e10cSrcweir             log.println(ext);
255*cdf0e10cSrcweir             log.println("Exception was expected");
256*cdf0e10cSrcweir             res &= false;
257*cdf0e10cSrcweir         } catch(com.sun.star.lang.IndexOutOfBoundsException e) {
258*cdf0e10cSrcweir             log.println("expected exception");
259*cdf0e10cSrcweir             res &= true;
260*cdf0e10cSrcweir         }
261*cdf0e10cSrcweir 
262*cdf0e10cSrcweir         try {
263*cdf0e10cSrcweir             log.print("getAccessibleRowExtentAt(" + rowCount + ",0):");
264*cdf0e10cSrcweir             int ext = oObj.getAccessibleRowExtentAt(rowCount, 0);
265*cdf0e10cSrcweir             log.println(ext);
266*cdf0e10cSrcweir             log.println("Exception was expected");
267*cdf0e10cSrcweir             res &= false;
268*cdf0e10cSrcweir         } catch(com.sun.star.lang.IndexOutOfBoundsException e) {
269*cdf0e10cSrcweir             log.println("expected exception");
270*cdf0e10cSrcweir             res &= true;
271*cdf0e10cSrcweir         }
272*cdf0e10cSrcweir 
273*cdf0e10cSrcweir         try {
274*cdf0e10cSrcweir             log.print("getAccessibleRowExtentAt(" +
275*cdf0e10cSrcweir                 (rowCount-1) + "," + (colCount-1) + "):");
276*cdf0e10cSrcweir             int ext = oObj.getAccessibleRowExtentAt(rowCount-1, colCount - 1);
277*cdf0e10cSrcweir             log.println(ext);
278*cdf0e10cSrcweir             res &= ext >= 1;
279*cdf0e10cSrcweir         } catch(com.sun.star.lang.IndexOutOfBoundsException e) {
280*cdf0e10cSrcweir             log.println("Unexpected exception");
281*cdf0e10cSrcweir             e.printStackTrace(log);
282*cdf0e10cSrcweir             res &= false;
283*cdf0e10cSrcweir         }
284*cdf0e10cSrcweir 
285*cdf0e10cSrcweir         tRes.tested("getAccessibleRowExtentAt()", res);
286*cdf0e10cSrcweir     }
287*cdf0e10cSrcweir 
288*cdf0e10cSrcweir     /**
289*cdf0e10cSrcweir      * Calls the method with the wrong parameters and with the correct
290*cdf0e10cSrcweir      * parameters, checks a returned value.
291*cdf0e10cSrcweir      * Has OK status if exceptions were thrown for the wrong indexes,
292*cdf0e10cSrcweir      * if exception wasn't thrown for the correct index and
293*cdf0e10cSrcweir      * if returned value is greater than or is equal to 1.
294*cdf0e10cSrcweir      * The following method tests are to be executed before:
295*cdf0e10cSrcweir      * <ul>
296*cdf0e10cSrcweir      *  <li> <code>getAccessibleColumnCount()</code> </li>
297*cdf0e10cSrcweir      *  <li> <code>getAccessibleRowCount()</code> </li>
298*cdf0e10cSrcweir      * </ul>
299*cdf0e10cSrcweir      */
300*cdf0e10cSrcweir     public void _getAccessibleColumnExtentAt() {
301*cdf0e10cSrcweir         requiredMethod("getAccessibleRowCount()");
302*cdf0e10cSrcweir         requiredMethod("getAccessibleColumnCount()");
303*cdf0e10cSrcweir         boolean res = true;
304*cdf0e10cSrcweir 
305*cdf0e10cSrcweir         try {
306*cdf0e10cSrcweir             log.print("getAccessibleColumnExtentAt(-1," + (colCount-1) + "):");
307*cdf0e10cSrcweir             int ext = oObj.getAccessibleColumnExtentAt(-1, colCount - 1);
308*cdf0e10cSrcweir             log.println(ext);
309*cdf0e10cSrcweir             log.println("Exception was expected");
310*cdf0e10cSrcweir             res &= false;
311*cdf0e10cSrcweir         } catch(com.sun.star.lang.IndexOutOfBoundsException e) {
312*cdf0e10cSrcweir             log.println("expected exception");
313*cdf0e10cSrcweir             res &= true;
314*cdf0e10cSrcweir         }
315*cdf0e10cSrcweir 
316*cdf0e10cSrcweir         try {
317*cdf0e10cSrcweir             log.print("getAccessibleColumnExtentAt(" + (rowCount-1) + ",-1):");
318*cdf0e10cSrcweir             int ext = oObj.getAccessibleColumnExtentAt(rowCount - 1, -1);
319*cdf0e10cSrcweir             log.println(ext);
320*cdf0e10cSrcweir             log.println("Exception was expected");
321*cdf0e10cSrcweir             res &= false;
322*cdf0e10cSrcweir         } catch(com.sun.star.lang.IndexOutOfBoundsException e) {
323*cdf0e10cSrcweir             log.println("expected exception");
324*cdf0e10cSrcweir             res &= true;
325*cdf0e10cSrcweir         }
326*cdf0e10cSrcweir 
327*cdf0e10cSrcweir         try {
328*cdf0e10cSrcweir             log.print("getAccessibleColumnExtentAt(0," + colCount + "):");
329*cdf0e10cSrcweir             int ext = oObj.getAccessibleColumnExtentAt(0, colCount);
330*cdf0e10cSrcweir             log.println(ext);
331*cdf0e10cSrcweir             log.println("Exception was expected");
332*cdf0e10cSrcweir             res &= false;
333*cdf0e10cSrcweir         } catch(com.sun.star.lang.IndexOutOfBoundsException e) {
334*cdf0e10cSrcweir             log.println("expected exception");
335*cdf0e10cSrcweir             res &= true;
336*cdf0e10cSrcweir         }
337*cdf0e10cSrcweir 
338*cdf0e10cSrcweir         try {
339*cdf0e10cSrcweir             log.print("getAccessibleColumnExtentAt(" + rowCount + ",0):");
340*cdf0e10cSrcweir             int ext = oObj.getAccessibleColumnExtentAt(rowCount, 0);
341*cdf0e10cSrcweir             log.println(ext);
342*cdf0e10cSrcweir             log.println("Exception was expected");
343*cdf0e10cSrcweir             res &= false;
344*cdf0e10cSrcweir         } catch(com.sun.star.lang.IndexOutOfBoundsException e) {
345*cdf0e10cSrcweir             log.println("expected exception");
346*cdf0e10cSrcweir             res &= true;
347*cdf0e10cSrcweir         }
348*cdf0e10cSrcweir 
349*cdf0e10cSrcweir         try {
350*cdf0e10cSrcweir             log.print("getAccessibleColumnExtentAt(" +
351*cdf0e10cSrcweir                 (rowCount-1) + "," + (colCount-1) + "):");
352*cdf0e10cSrcweir             int ext = oObj.getAccessibleColumnExtentAt(rowCount-1,colCount - 1);
353*cdf0e10cSrcweir             log.println(ext);
354*cdf0e10cSrcweir             res &= ext >= 1;
355*cdf0e10cSrcweir         } catch(com.sun.star.lang.IndexOutOfBoundsException e) {
356*cdf0e10cSrcweir             log.println("Unexpected exception");
357*cdf0e10cSrcweir             e.printStackTrace(log);
358*cdf0e10cSrcweir             res &= false;
359*cdf0e10cSrcweir         }
360*cdf0e10cSrcweir 
361*cdf0e10cSrcweir         tRes.tested("getAccessibleColumnExtentAt()", res);
362*cdf0e10cSrcweir     }
363*cdf0e10cSrcweir 
364*cdf0e10cSrcweir     /**
365*cdf0e10cSrcweir      * Calls the method and checks a returned value.
366*cdf0e10cSrcweir      * Has OK status if returned value isn't <code>null</code>.
367*cdf0e10cSrcweir      */
368*cdf0e10cSrcweir     public void _getAccessibleRowHeaders() {
369*cdf0e10cSrcweir         XAccessibleTable rowHeaders = oObj.getAccessibleRowHeaders();
370*cdf0e10cSrcweir         log.println("getAccessibleRowHeaders(): " + rowHeaders);
371*cdf0e10cSrcweir         tRes.tested("getAccessibleRowHeaders()", true);
372*cdf0e10cSrcweir     }
373*cdf0e10cSrcweir 
374*cdf0e10cSrcweir     /**
375*cdf0e10cSrcweir      * Calls the method and checks a returned value.
376*cdf0e10cSrcweir      * Has OK status if returned value isn't <code>null</code>.
377*cdf0e10cSrcweir      */
378*cdf0e10cSrcweir     public void _getAccessibleColumnHeaders() {
379*cdf0e10cSrcweir         XAccessibleTable colHeaders = oObj.getAccessibleColumnHeaders();
380*cdf0e10cSrcweir         log.println("getAccessibleColumnHeaders(): " + colHeaders);
381*cdf0e10cSrcweir         tRes.tested("getAccessibleColumnHeaders()", true);
382*cdf0e10cSrcweir     }
383*cdf0e10cSrcweir 
384*cdf0e10cSrcweir     /**
385*cdf0e10cSrcweir      * If the interface <code>XAccessibleSelection</code> is supported by
386*cdf0e10cSrcweir      * the component than selects all accessible childs.
387*cdf0e10cSrcweir      * Calls the method and checks a returned sequence.
388*cdf0e10cSrcweir      * Has OK status if a returned sequince is in ascending order.
389*cdf0e10cSrcweir      * The following method tests are to be executed before:
390*cdf0e10cSrcweir      * <ul>
391*cdf0e10cSrcweir      *  <li> <code>getAccessibleRowCount()</code> </li>
392*cdf0e10cSrcweir      * </ul>
393*cdf0e10cSrcweir      */
394*cdf0e10cSrcweir     public void _getSelectedAccessibleRows() {
395*cdf0e10cSrcweir         requiredMethod("getAccessibleRowCount()");
396*cdf0e10cSrcweir         boolean res = true;
397*cdf0e10cSrcweir         boolean locRes = true;
398*cdf0e10cSrcweir         int selRows[] = null;
399*cdf0e10cSrcweir 
400*cdf0e10cSrcweir         if (xASel != null) {
401*cdf0e10cSrcweir             log.println("XAccessibleSelection.selectAllAccessibleChildren()");
402*cdf0e10cSrcweir             xASel.selectAllAccessibleChildren();
403*cdf0e10cSrcweir         }
404*cdf0e10cSrcweir 
405*cdf0e10cSrcweir         log.println("getSelectedAccessibleRows()");
406*cdf0e10cSrcweir         selRows = oObj.getSelectedAccessibleRows();
407*cdf0e10cSrcweir         log.println("Length of the returned sequince: " + selRows.length);
408*cdf0e10cSrcweir         if (xASel != null) {
409*cdf0e10cSrcweir             res &= selRows.length == rowCount;
410*cdf0e10cSrcweir         } else {
411*cdf0e10cSrcweir             res &= selRows.length == 0;
412*cdf0e10cSrcweir         }
413*cdf0e10cSrcweir 
414*cdf0e10cSrcweir         if (selRows.length > 0) {
415*cdf0e10cSrcweir             log.println("Checking that returned sequence is" +
416*cdf0e10cSrcweir                 " in ascending order");
417*cdf0e10cSrcweir         }
418*cdf0e10cSrcweir 
419*cdf0e10cSrcweir         for(int i = 1; i < selRows.length; i++) {
420*cdf0e10cSrcweir             locRes &= selRows[i] >= selRows[i - 1];
421*cdf0e10cSrcweir             res &= locRes;
422*cdf0e10cSrcweir             if (!locRes) {
423*cdf0e10cSrcweir                 log.println("Element #" + i + ":" + selRows[i] +
424*cdf0e10cSrcweir                     " is less than element #" + (i-1) + ": " +
425*cdf0e10cSrcweir                     selRows[i-1]);
426*cdf0e10cSrcweir                 break;
427*cdf0e10cSrcweir             }
428*cdf0e10cSrcweir         }
429*cdf0e10cSrcweir 
430*cdf0e10cSrcweir         tRes.tested("getSelectedAccessibleRows()", res);
431*cdf0e10cSrcweir     }
432*cdf0e10cSrcweir 
433*cdf0e10cSrcweir     /**
434*cdf0e10cSrcweir      * If the interface <code>XAccessibleSelection</code> is supported by
435*cdf0e10cSrcweir      * the component than selects all accessible childs.
436*cdf0e10cSrcweir      * Calls the method and checks a returned sequence.
437*cdf0e10cSrcweir      * Has OK status if a returned sequince is in ascending order.
438*cdf0e10cSrcweir      * The following method tests are to be executed before:
439*cdf0e10cSrcweir      * <ul>
440*cdf0e10cSrcweir      *  <li> <code>getAccessibleColumnCount()</code> </li>
441*cdf0e10cSrcweir      * </ul>
442*cdf0e10cSrcweir      */
443*cdf0e10cSrcweir     public void _getSelectedAccessibleColumns() {
444*cdf0e10cSrcweir         requiredMethod("getAccessibleColumnCount()");
445*cdf0e10cSrcweir         boolean res = true;
446*cdf0e10cSrcweir         boolean locRes = true;
447*cdf0e10cSrcweir         int selCols[] = null;
448*cdf0e10cSrcweir 
449*cdf0e10cSrcweir         if (xASel != null) {
450*cdf0e10cSrcweir             log.println("XAccessibleSelection.selectAllAccessibleChildren()");
451*cdf0e10cSrcweir             xASel.selectAllAccessibleChildren();
452*cdf0e10cSrcweir         }
453*cdf0e10cSrcweir 
454*cdf0e10cSrcweir         log.println("getSelectedAccessibleColumns()");
455*cdf0e10cSrcweir         selCols = oObj.getSelectedAccessibleColumns();
456*cdf0e10cSrcweir         log.println("Length of the returned sequince: " + selCols.length);
457*cdf0e10cSrcweir 
458*cdf0e10cSrcweir         if (xASel != null) {
459*cdf0e10cSrcweir             res &= selCols.length == colCount;
460*cdf0e10cSrcweir         } else {
461*cdf0e10cSrcweir             res &= selCols.length == 0;
462*cdf0e10cSrcweir         }
463*cdf0e10cSrcweir 
464*cdf0e10cSrcweir         if (selCols.length > 0) {
465*cdf0e10cSrcweir             log.println("Checking that returned sequence is" +
466*cdf0e10cSrcweir                 " in ascending order");
467*cdf0e10cSrcweir         }
468*cdf0e10cSrcweir 
469*cdf0e10cSrcweir         for(int i = 1; i < selCols.length; i++) {
470*cdf0e10cSrcweir             locRes &= selCols[i] >= selCols[i - 1];
471*cdf0e10cSrcweir             res &= locRes;
472*cdf0e10cSrcweir             if (!locRes) {
473*cdf0e10cSrcweir                 log.println("Element #" + i + ":" + selCols[i] +
474*cdf0e10cSrcweir                     " is less than element #" + (i-1) + ": " +
475*cdf0e10cSrcweir                     selCols[i-1]);
476*cdf0e10cSrcweir                 break;
477*cdf0e10cSrcweir             }
478*cdf0e10cSrcweir         }
479*cdf0e10cSrcweir 
480*cdf0e10cSrcweir         tRes.tested("getSelectedAccessibleColumns()", res);
481*cdf0e10cSrcweir     }
482*cdf0e10cSrcweir 
483*cdf0e10cSrcweir     /**
484*cdf0e10cSrcweir      * Calls the method with invalid indexes.
485*cdf0e10cSrcweir      * If the interface <code>XAccessibleSelection</code> is supported by
486*cdf0e10cSrcweir      * the component than selects all accessible childs.
487*cdf0e10cSrcweir      * Calls the method for every row and checks returned values.
488*cdf0e10cSrcweir      * The following method tests are to be executed before:
489*cdf0e10cSrcweir      * <ul>
490*cdf0e10cSrcweir      *  <li> <code>getAccessibleRowCount()</code> </li>
491*cdf0e10cSrcweir      * </ul>
492*cdf0e10cSrcweir      */
493*cdf0e10cSrcweir     public void _isAccessibleRowSelected() {
494*cdf0e10cSrcweir         requiredMethod("getAccessibleRowCount()");
495*cdf0e10cSrcweir         boolean res = true;
496*cdf0e10cSrcweir         boolean locRes = true;
497*cdf0e10cSrcweir 
498*cdf0e10cSrcweir         try {
499*cdf0e10cSrcweir             log.print("isAccessibleRowSelected(-1): ");
500*cdf0e10cSrcweir             locRes = oObj.isAccessibleRowSelected(-1);
501*cdf0e10cSrcweir             log.println(locRes);
502*cdf0e10cSrcweir             log.println("Exception was expected");
503*cdf0e10cSrcweir             res &= false;
504*cdf0e10cSrcweir         } catch(com.sun.star.lang.IndexOutOfBoundsException e) {
505*cdf0e10cSrcweir             log.println("expected exception");
506*cdf0e10cSrcweir             res &= true;
507*cdf0e10cSrcweir         }
508*cdf0e10cSrcweir 
509*cdf0e10cSrcweir         try {
510*cdf0e10cSrcweir             log.print("isAccessibleRowSelected(" + rowCount + "): ");
511*cdf0e10cSrcweir             locRes = oObj.isAccessibleRowSelected(rowCount);
512*cdf0e10cSrcweir             log.println(locRes);
513*cdf0e10cSrcweir             log.println("Exception was expected");
514*cdf0e10cSrcweir             res &= false;
515*cdf0e10cSrcweir         } catch(com.sun.star.lang.IndexOutOfBoundsException e) {
516*cdf0e10cSrcweir             log.println("expected exception");
517*cdf0e10cSrcweir             res &= true;
518*cdf0e10cSrcweir         }
519*cdf0e10cSrcweir 
520*cdf0e10cSrcweir         if (xASel != null) {
521*cdf0e10cSrcweir             log.println("XAccessibleSelection.selectAllAccessibleChildren()");
522*cdf0e10cSrcweir             xASel.selectAllAccessibleChildren();
523*cdf0e10cSrcweir         }
524*cdf0e10cSrcweir 
525*cdf0e10cSrcweir         try {
526*cdf0e10cSrcweir             log.println("Checking of every row selection...");
527*cdf0e10cSrcweir             for(int i = 0; i < rowCount; i++) {
528*cdf0e10cSrcweir                 boolean isSel = oObj.isAccessibleRowSelected(i);
529*cdf0e10cSrcweir                 locRes = (xASel == null) ? !isSel : isSel;
530*cdf0e10cSrcweir                 res &= locRes;
531*cdf0e10cSrcweir                 if (!locRes) {
532*cdf0e10cSrcweir                     log.println("isAccessibleRowSelected(" + i + "): " + isSel);
533*cdf0e10cSrcweir                     break;
534*cdf0e10cSrcweir                 }
535*cdf0e10cSrcweir             }
536*cdf0e10cSrcweir         } catch(com.sun.star.lang.IndexOutOfBoundsException e) {
537*cdf0e10cSrcweir             log.println("Unexpected exception");
538*cdf0e10cSrcweir             e.printStackTrace(log);
539*cdf0e10cSrcweir             res &= false;
540*cdf0e10cSrcweir         }
541*cdf0e10cSrcweir 
542*cdf0e10cSrcweir         tRes.tested("isAccessibleRowSelected()", res);
543*cdf0e10cSrcweir     }
544*cdf0e10cSrcweir 
545*cdf0e10cSrcweir     /**
546*cdf0e10cSrcweir      * Calls the method with invalid indexes.
547*cdf0e10cSrcweir      * If the interface <code>XAccessibleSelection</code> is supported by
548*cdf0e10cSrcweir      * the component than selects all accessible childs.
549*cdf0e10cSrcweir      * Calls the method for every column and checks returned values.
550*cdf0e10cSrcweir      * The following method tests are to be executed before:
551*cdf0e10cSrcweir      * <ul>
552*cdf0e10cSrcweir      *  <li> <code>getAccessibleRowCount()</code> </li>
553*cdf0e10cSrcweir      * </ul>
554*cdf0e10cSrcweir      */
555*cdf0e10cSrcweir     public void _isAccessibleColumnSelected() {
556*cdf0e10cSrcweir         requiredMethod("getAccessibleColumnCount()");
557*cdf0e10cSrcweir         boolean res = true;
558*cdf0e10cSrcweir         boolean locRes = true;
559*cdf0e10cSrcweir 
560*cdf0e10cSrcweir         try {
561*cdf0e10cSrcweir             log.print("isAccessibleColumnSelected(-1): ");
562*cdf0e10cSrcweir             locRes = oObj.isAccessibleColumnSelected(-1);
563*cdf0e10cSrcweir             log.println(locRes);
564*cdf0e10cSrcweir             log.println("Exception was expected");
565*cdf0e10cSrcweir             res &= false;
566*cdf0e10cSrcweir         } catch(com.sun.star.lang.IndexOutOfBoundsException e) {
567*cdf0e10cSrcweir             log.println("expected exception");
568*cdf0e10cSrcweir             res &= true;
569*cdf0e10cSrcweir         }
570*cdf0e10cSrcweir 
571*cdf0e10cSrcweir         try {
572*cdf0e10cSrcweir             log.print("isAccessibleColumnSelected(" + colCount + "): ");
573*cdf0e10cSrcweir             locRes = oObj.isAccessibleColumnSelected(colCount);
574*cdf0e10cSrcweir             log.println(locRes);
575*cdf0e10cSrcweir             log.println("Exception was expected");
576*cdf0e10cSrcweir             res &= false;
577*cdf0e10cSrcweir         } catch(com.sun.star.lang.IndexOutOfBoundsException e) {
578*cdf0e10cSrcweir             log.println("expected exception");
579*cdf0e10cSrcweir             res &= true;
580*cdf0e10cSrcweir         }
581*cdf0e10cSrcweir 
582*cdf0e10cSrcweir         if (xASel != null) {
583*cdf0e10cSrcweir             log.println("XAccessibleSelection.selectAllAccessibleChildren()");
584*cdf0e10cSrcweir             xASel.selectAllAccessibleChildren();
585*cdf0e10cSrcweir         }
586*cdf0e10cSrcweir 
587*cdf0e10cSrcweir         try {
588*cdf0e10cSrcweir             log.println("Checking of every column selection...");
589*cdf0e10cSrcweir             for(int i = 0; i < colCount; i++) {
590*cdf0e10cSrcweir                 boolean isSel = oObj.isAccessibleColumnSelected(i);
591*cdf0e10cSrcweir                 locRes = (xASel == null) ? !isSel : isSel;
592*cdf0e10cSrcweir                 res &= locRes;
593*cdf0e10cSrcweir                 if (!locRes) {
594*cdf0e10cSrcweir                     log.println("isAccessibleColumnSelected(" + i + "): " + isSel);
595*cdf0e10cSrcweir                     break;
596*cdf0e10cSrcweir                 }
597*cdf0e10cSrcweir             }
598*cdf0e10cSrcweir         } catch(com.sun.star.lang.IndexOutOfBoundsException e) {
599*cdf0e10cSrcweir             log.println("Unexpected exception");
600*cdf0e10cSrcweir             e.printStackTrace(log);
601*cdf0e10cSrcweir             res &= false;
602*cdf0e10cSrcweir         }
603*cdf0e10cSrcweir 
604*cdf0e10cSrcweir         tRes.tested("isAccessibleColumnSelected()", res);
605*cdf0e10cSrcweir     }
606*cdf0e10cSrcweir 
607*cdf0e10cSrcweir     XAccessible xCellAc = null;
608*cdf0e10cSrcweir 
609*cdf0e10cSrcweir     /**
610*cdf0e10cSrcweir      * Calls the method with the wrong parameters and with the correct
611*cdf0e10cSrcweir      * parameter, checks a returned value and stores it to the variable
612*cdf0e10cSrcweir      * <code>xCellAc</code>.
613*cdf0e10cSrcweir      * Has OK status if exceptions were thrown for the wrong indexes,
614*cdf0e10cSrcweir      * if exception wasn't thrown for the correct index and
615*cdf0e10cSrcweir      * if returned value isn't null.
616*cdf0e10cSrcweir      * The following method tests are to be executed before:
617*cdf0e10cSrcweir      * <ul>
618*cdf0e10cSrcweir      *  <li> <code>getAccessibleColumnCount()</code> </li>
619*cdf0e10cSrcweir      *  <li> <code>getAccessibleRowCount()</code> </li>
620*cdf0e10cSrcweir      * </ul>
621*cdf0e10cSrcweir      */
622*cdf0e10cSrcweir     public void _getAccessibleCellAt() {
623*cdf0e10cSrcweir         requiredMethod("getAccessibleRowCount()");
624*cdf0e10cSrcweir         requiredMethod("getAccessibleColumnCount()");
625*cdf0e10cSrcweir         boolean res = true;
626*cdf0e10cSrcweir 
627*cdf0e10cSrcweir         try {
628*cdf0e10cSrcweir             log.print("getAccessibleCellAt(-1," + (colCount-1) + "):");
629*cdf0e10cSrcweir             xCellAc = oObj.getAccessibleCellAt(-1, colCount - 1);
630*cdf0e10cSrcweir             log.println(xCellAc);
631*cdf0e10cSrcweir             log.println("Exception was expected");
632*cdf0e10cSrcweir             res &= false;
633*cdf0e10cSrcweir         } catch(com.sun.star.lang.IndexOutOfBoundsException e) {
634*cdf0e10cSrcweir             log.println("expected exception");
635*cdf0e10cSrcweir             res &= true;
636*cdf0e10cSrcweir         }
637*cdf0e10cSrcweir 
638*cdf0e10cSrcweir         try {
639*cdf0e10cSrcweir             log.print("getAccessibleCellAt(" + (rowCount-1) + ",-1):");
640*cdf0e10cSrcweir             xCellAc = oObj.getAccessibleCellAt(rowCount - 1, -1);
641*cdf0e10cSrcweir             log.println(xCellAc);
642*cdf0e10cSrcweir             log.println("Exception was expected");
643*cdf0e10cSrcweir             res &= false;
644*cdf0e10cSrcweir         } catch(com.sun.star.lang.IndexOutOfBoundsException e) {
645*cdf0e10cSrcweir             log.println("expected exception");
646*cdf0e10cSrcweir             res &= true;
647*cdf0e10cSrcweir         }
648*cdf0e10cSrcweir 
649*cdf0e10cSrcweir         try {
650*cdf0e10cSrcweir             log.print("getAccessibleCellAt(0, " + colCount + "):");
651*cdf0e10cSrcweir             xCellAc = oObj.getAccessibleCellAt(0, colCount);
652*cdf0e10cSrcweir             log.println(xCellAc);
653*cdf0e10cSrcweir             log.println("Exception was expected");
654*cdf0e10cSrcweir             res &= false;
655*cdf0e10cSrcweir         } catch(com.sun.star.lang.IndexOutOfBoundsException e) {
656*cdf0e10cSrcweir             log.println("expected exception");
657*cdf0e10cSrcweir             res &= true;
658*cdf0e10cSrcweir         }
659*cdf0e10cSrcweir 
660*cdf0e10cSrcweir         try {
661*cdf0e10cSrcweir             log.print("getAccessibleCellAt(" + rowCount + ",0):");
662*cdf0e10cSrcweir             XAccessible xCellAc = oObj.getAccessibleCellAt(rowCount, 0);
663*cdf0e10cSrcweir             log.println(xCellAc);
664*cdf0e10cSrcweir             log.println("Exception was expected");
665*cdf0e10cSrcweir             res &= false;
666*cdf0e10cSrcweir         } catch(com.sun.star.lang.IndexOutOfBoundsException e) {
667*cdf0e10cSrcweir             log.println("expected exception");
668*cdf0e10cSrcweir             res &= true;
669*cdf0e10cSrcweir         }
670*cdf0e10cSrcweir 
671*cdf0e10cSrcweir         try {
672*cdf0e10cSrcweir             log.print("getAccessibleCellAt(" + (rowCount-1) + "," +
673*cdf0e10cSrcweir                 (colCount-1) + "): ");
674*cdf0e10cSrcweir             xCellAc = oObj.getAccessibleCellAt(
675*cdf0e10cSrcweir                 rowCount - 1, colCount - 1);
676*cdf0e10cSrcweir             log.println(xCellAc);
677*cdf0e10cSrcweir             res &= xCellAc != null;
678*cdf0e10cSrcweir         } catch(com.sun.star.lang.IndexOutOfBoundsException e) {
679*cdf0e10cSrcweir             log.println("Unexpected exception");
680*cdf0e10cSrcweir             e.printStackTrace(log);
681*cdf0e10cSrcweir             res &= false;
682*cdf0e10cSrcweir         }
683*cdf0e10cSrcweir 
684*cdf0e10cSrcweir         tRes.tested("getAccessibleCellAt()", res);
685*cdf0e10cSrcweir     }
686*cdf0e10cSrcweir 
687*cdf0e10cSrcweir     /**
688*cdf0e10cSrcweir      * Just calls the method.
689*cdf0e10cSrcweir      */
690*cdf0e10cSrcweir     public void _getAccessibleCaption() {
691*cdf0e10cSrcweir         XAccessible caption = oObj.getAccessibleCaption();
692*cdf0e10cSrcweir         log.println("getAccessibleCaption(): " + caption);
693*cdf0e10cSrcweir         tRes.tested("getAccessibleCaption()", true);
694*cdf0e10cSrcweir     }
695*cdf0e10cSrcweir 
696*cdf0e10cSrcweir     /**
697*cdf0e10cSrcweir      * Just calls the method.
698*cdf0e10cSrcweir      */
699*cdf0e10cSrcweir     public void _getAccessibleSummary() {
700*cdf0e10cSrcweir         XAccessible summary = oObj.getAccessibleSummary();
701*cdf0e10cSrcweir         log.println("getAccessibleSummary(): " + summary);
702*cdf0e10cSrcweir         tRes.tested("getAccessibleSummary()", true);
703*cdf0e10cSrcweir     }
704*cdf0e10cSrcweir 
705*cdf0e10cSrcweir     /**
706*cdf0e10cSrcweir      * Calls the method with the wrong parameters and with the correct
707*cdf0e10cSrcweir      * parameter, checks a returned value.
708*cdf0e10cSrcweir      * Has OK status if exceptions were thrown for the wrong indexes,
709*cdf0e10cSrcweir      * if exception wasn't thrown for the correct index.
710*cdf0e10cSrcweir      * The following method tests are to be executed before:
711*cdf0e10cSrcweir      * <ul>
712*cdf0e10cSrcweir      *  <li> <code>getAccessibleColumnCount()</code> </li>
713*cdf0e10cSrcweir      *  <li> <code>getAccessibleRowCount()</code> </li>
714*cdf0e10cSrcweir      * </ul>
715*cdf0e10cSrcweir      */
716*cdf0e10cSrcweir     public void _isAccessibleSelected() {
717*cdf0e10cSrcweir         requiredMethod("getAccessibleRowCount()");
718*cdf0e10cSrcweir         requiredMethod("getAccessibleColumnCount()");
719*cdf0e10cSrcweir         boolean res = true;
720*cdf0e10cSrcweir         boolean locRes = true;
721*cdf0e10cSrcweir 
722*cdf0e10cSrcweir         try {
723*cdf0e10cSrcweir             log.print("isAccessibleSelected(-1," + (colCount-1) + "):");
724*cdf0e10cSrcweir             locRes = oObj.isAccessibleSelected(-1, colCount - 1);
725*cdf0e10cSrcweir             log.println(locRes);
726*cdf0e10cSrcweir             log.println("Exception was expected");
727*cdf0e10cSrcweir             res &= false;
728*cdf0e10cSrcweir         } catch(com.sun.star.lang.IndexOutOfBoundsException e) {
729*cdf0e10cSrcweir             log.println("expected exception");
730*cdf0e10cSrcweir             res &= true;
731*cdf0e10cSrcweir         }
732*cdf0e10cSrcweir 
733*cdf0e10cSrcweir         try {
734*cdf0e10cSrcweir             log.print("isAccessibleSelected(" + (rowCount-1) + ",-1):");
735*cdf0e10cSrcweir             locRes = oObj.isAccessibleSelected(rowCount - 1, -1);
736*cdf0e10cSrcweir             log.println(locRes);
737*cdf0e10cSrcweir             log.println("Exception was expected");
738*cdf0e10cSrcweir             res &= false;
739*cdf0e10cSrcweir         } catch(com.sun.star.lang.IndexOutOfBoundsException e) {
740*cdf0e10cSrcweir             log.println("expected exception");
741*cdf0e10cSrcweir             res &= true;
742*cdf0e10cSrcweir         }
743*cdf0e10cSrcweir 
744*cdf0e10cSrcweir         try {
745*cdf0e10cSrcweir             log.print("isAccessibleSelected(0, " + colCount + "):");
746*cdf0e10cSrcweir             locRes = oObj.isAccessibleSelected(0, colCount);
747*cdf0e10cSrcweir             log.println(locRes);
748*cdf0e10cSrcweir             log.println("Exception was expected");
749*cdf0e10cSrcweir             res &= false;
750*cdf0e10cSrcweir         } catch(com.sun.star.lang.IndexOutOfBoundsException e) {
751*cdf0e10cSrcweir             log.println("expected exception");
752*cdf0e10cSrcweir             res &= true;
753*cdf0e10cSrcweir         }
754*cdf0e10cSrcweir 
755*cdf0e10cSrcweir         try {
756*cdf0e10cSrcweir             log.print("isAccessibleSelected(" + rowCount + ",0):");
757*cdf0e10cSrcweir             locRes = oObj.isAccessibleSelected(rowCount, 0);
758*cdf0e10cSrcweir             log.println(locRes);
759*cdf0e10cSrcweir             log.println("Exception was expected");
760*cdf0e10cSrcweir             res &= false;
761*cdf0e10cSrcweir         } catch(com.sun.star.lang.IndexOutOfBoundsException e) {
762*cdf0e10cSrcweir             log.println("expected exception");
763*cdf0e10cSrcweir             res &= true;
764*cdf0e10cSrcweir         }
765*cdf0e10cSrcweir 
766*cdf0e10cSrcweir         if (xASel != null) {
767*cdf0e10cSrcweir             log.println("XAccessibleSelection.selectAllAccessibleChildren()");
768*cdf0e10cSrcweir             xASel.selectAllAccessibleChildren();
769*cdf0e10cSrcweir         }
770*cdf0e10cSrcweir 
771*cdf0e10cSrcweir         try {
772*cdf0e10cSrcweir             log.print("isAccessibleSelected(" + (rowCount-1) + "," +
773*cdf0e10cSrcweir                 (colCount-1) + "): ");
774*cdf0e10cSrcweir             boolean isSel = oObj.isAccessibleSelected(
775*cdf0e10cSrcweir                 rowCount - 1, colCount - 1);
776*cdf0e10cSrcweir             log.println(isSel);
777*cdf0e10cSrcweir             locRes = (xASel == null) ? !isSel : isSel ;
778*cdf0e10cSrcweir             res &= locRes;
779*cdf0e10cSrcweir         } catch(com.sun.star.lang.IndexOutOfBoundsException e) {
780*cdf0e10cSrcweir             log.println("Unexpected exception");
781*cdf0e10cSrcweir             e.printStackTrace(log);
782*cdf0e10cSrcweir             res &= false;
783*cdf0e10cSrcweir         }
784*cdf0e10cSrcweir 
785*cdf0e10cSrcweir         tRes.tested("isAccessibleSelected()", res);
786*cdf0e10cSrcweir     }
787*cdf0e10cSrcweir 
788*cdf0e10cSrcweir     /**
789*cdf0e10cSrcweir      * Calls the method with the wrong parameters and with the correct
790*cdf0e10cSrcweir      * parameter, checks a returned value.
791*cdf0e10cSrcweir      * Has OK status if exceptions were thrown for the wrong indexes,
792*cdf0e10cSrcweir      * if exception wasn't thrown for the correct index and
793*cdf0e10cSrcweir      * if returned value is equal to value returned by calling
794*cdf0e10cSrcweir      * <code>XAccessibleContext::getAccessibleIndexInParent</code> for the cell.
795*cdf0e10cSrcweir      * The following method tests are to be executed before:
796*cdf0e10cSrcweir      * <ul>
797*cdf0e10cSrcweir      *  <li> <code>getAccessibleCellAt()</code> </li>
798*cdf0e10cSrcweir      * </ul>
799*cdf0e10cSrcweir      */
800*cdf0e10cSrcweir     public void _getAccessibleIndex() {
801*cdf0e10cSrcweir         executeMethod("getAccessibleCellAt()");
802*cdf0e10cSrcweir         boolean res = true;
803*cdf0e10cSrcweir 
804*cdf0e10cSrcweir         try {
805*cdf0e10cSrcweir             log.print("getAccessibleIndex(-1," + (colCount-1) + "):");
806*cdf0e10cSrcweir             int indx = oObj.getAccessibleIndex(-1, colCount - 1);
807*cdf0e10cSrcweir             log.println(indx);
808*cdf0e10cSrcweir             log.println("Exception was expected");
809*cdf0e10cSrcweir             res &= false;
810*cdf0e10cSrcweir         } catch(com.sun.star.lang.IndexOutOfBoundsException e) {
811*cdf0e10cSrcweir             log.println("expected exception");
812*cdf0e10cSrcweir             res &= true;
813*cdf0e10cSrcweir         }
814*cdf0e10cSrcweir 
815*cdf0e10cSrcweir         try {
816*cdf0e10cSrcweir             log.print("getAccessibleIndex(" + (rowCount-1) + ",-1):");
817*cdf0e10cSrcweir             int indx = oObj.getAccessibleIndex(rowCount - 1, -1);
818*cdf0e10cSrcweir             log.println(indx);
819*cdf0e10cSrcweir             log.println("Exception was expected");
820*cdf0e10cSrcweir             res &= false;
821*cdf0e10cSrcweir         } catch(com.sun.star.lang.IndexOutOfBoundsException e) {
822*cdf0e10cSrcweir             log.println("expected exception");
823*cdf0e10cSrcweir             res &= true;
824*cdf0e10cSrcweir         }
825*cdf0e10cSrcweir 
826*cdf0e10cSrcweir         try {
827*cdf0e10cSrcweir             log.print("getAccessibleIndex(0," + colCount + "):");
828*cdf0e10cSrcweir             int indx = oObj.getAccessibleIndex(0, colCount);
829*cdf0e10cSrcweir             log.println(indx);
830*cdf0e10cSrcweir             log.println("Exception was expected");
831*cdf0e10cSrcweir             res &= false;
832*cdf0e10cSrcweir         } catch(com.sun.star.lang.IndexOutOfBoundsException e) {
833*cdf0e10cSrcweir             log.println("expected exception");
834*cdf0e10cSrcweir             res &= true;
835*cdf0e10cSrcweir         }
836*cdf0e10cSrcweir 
837*cdf0e10cSrcweir         try {
838*cdf0e10cSrcweir             log.print("getAccessibleIndex(" + rowCount + ",0):");
839*cdf0e10cSrcweir             int indx = oObj.getAccessibleIndex(rowCount, 0);
840*cdf0e10cSrcweir             log.println(indx);
841*cdf0e10cSrcweir             log.println("Exception was expected");
842*cdf0e10cSrcweir             res &= false;
843*cdf0e10cSrcweir         } catch(com.sun.star.lang.IndexOutOfBoundsException e) {
844*cdf0e10cSrcweir             log.println("expected exception");
845*cdf0e10cSrcweir             res &= true;
846*cdf0e10cSrcweir         }
847*cdf0e10cSrcweir 
848*cdf0e10cSrcweir         try {
849*cdf0e10cSrcweir             log.print("getAccessibleIndex(" + (rowCount-1) + "," +
850*cdf0e10cSrcweir                 (colCount-1) + "): ");
851*cdf0e10cSrcweir             int indx = oObj.getAccessibleIndex(
852*cdf0e10cSrcweir                 rowCount - 1, colCount - 1);
853*cdf0e10cSrcweir             log.println(indx);
854*cdf0e10cSrcweir             if (xCellAc != null) {
855*cdf0e10cSrcweir                 XAccessibleContext xAC = xCellAc.getAccessibleContext();
856*cdf0e10cSrcweir                 int expIndx = xAC.getAccessibleIndexInParent();
857*cdf0e10cSrcweir                 log.println("Expected index: " + expIndx);
858*cdf0e10cSrcweir                 res &= expIndx == indx;
859*cdf0e10cSrcweir             } else {
860*cdf0e10cSrcweir                 res &= true;
861*cdf0e10cSrcweir             }
862*cdf0e10cSrcweir         } catch(com.sun.star.lang.IndexOutOfBoundsException e) {
863*cdf0e10cSrcweir             log.println("Unexpected exception");
864*cdf0e10cSrcweir             e.printStackTrace(log);
865*cdf0e10cSrcweir             res &= false;
866*cdf0e10cSrcweir         }
867*cdf0e10cSrcweir 
868*cdf0e10cSrcweir         tRes.tested("getAccessibleIndex()", res);
869*cdf0e10cSrcweir     }
870*cdf0e10cSrcweir 
871*cdf0e10cSrcweir     /**
872*cdf0e10cSrcweir      * Receives an accessible child count using the interface
873*cdf0e10cSrcweir      * <code>XAccessibleContext</code>.
874*cdf0e10cSrcweir      * Calls the method with the wrong parameters and with the correct
875*cdf0e10cSrcweir      * parameter, checks a returned value.
876*cdf0e10cSrcweir      * Has OK status if exceptions were thrown for the wrong indexes,
877*cdf0e10cSrcweir      * if exception wasn't thrown for the correct index and
878*cdf0e10cSrcweir      * if returned value is greater than zero and is less than
879*cdf0e10cSrcweir      * accessible row count.
880*cdf0e10cSrcweir      * The following method tests are to be executed before:
881*cdf0e10cSrcweir      * <ul>
882*cdf0e10cSrcweir      *  <li> <code>getAccessibleRowCount()</code> </li>
883*cdf0e10cSrcweir      * </ul>
884*cdf0e10cSrcweir      */
885*cdf0e10cSrcweir     public void _getAccessibleRow() {
886*cdf0e10cSrcweir         requiredMethod("getAccessibleRowCount()");
887*cdf0e10cSrcweir         boolean res = true;
888*cdf0e10cSrcweir 
889*cdf0e10cSrcweir         if (xACont != null) {
890*cdf0e10cSrcweir             int childCount = xACont.getAccessibleChildCount();
891*cdf0e10cSrcweir             log.println("accessible child count: " + childCount);
892*cdf0e10cSrcweir 
893*cdf0e10cSrcweir             try {
894*cdf0e10cSrcweir                 log.print("getAccessibleRow(" + childCount + "): ");
895*cdf0e10cSrcweir                 int rowIndx = oObj.getAccessibleRow(childCount);
896*cdf0e10cSrcweir                 log.println(rowIndx);
897*cdf0e10cSrcweir                 log.println("Exception was expected");
898*cdf0e10cSrcweir                 res &= false;
899*cdf0e10cSrcweir             } catch(com.sun.star.lang.IndexOutOfBoundsException e) {
900*cdf0e10cSrcweir                 log.println("expected exception");
901*cdf0e10cSrcweir                 res &= true;
902*cdf0e10cSrcweir             }
903*cdf0e10cSrcweir 
904*cdf0e10cSrcweir             try {
905*cdf0e10cSrcweir                 log.print("getAccessibleRow(" + (childCount-1) + "): ");
906*cdf0e10cSrcweir                 int rowIndx = oObj.getAccessibleRow(childCount - 1);
907*cdf0e10cSrcweir                 log.println(rowIndx);
908*cdf0e10cSrcweir                 res &= (rowIndx >= 0 && rowIndx <= rowCount);
909*cdf0e10cSrcweir             } catch(com.sun.star.lang.IndexOutOfBoundsException e) {
910*cdf0e10cSrcweir                 log.println("Unexpected exception");
911*cdf0e10cSrcweir                 e.printStackTrace(log);
912*cdf0e10cSrcweir                 res &= false;
913*cdf0e10cSrcweir             }
914*cdf0e10cSrcweir         }
915*cdf0e10cSrcweir 
916*cdf0e10cSrcweir         try {
917*cdf0e10cSrcweir             log.print("getAccessibleRow(-1): ");
918*cdf0e10cSrcweir             int rowIndx = oObj.getAccessibleRow(-1);
919*cdf0e10cSrcweir             log.println(rowIndx);
920*cdf0e10cSrcweir             log.println("Exception was expected");
921*cdf0e10cSrcweir             res &= false;
922*cdf0e10cSrcweir         } catch(com.sun.star.lang.IndexOutOfBoundsException e) {
923*cdf0e10cSrcweir             log.println("expected exception");
924*cdf0e10cSrcweir             res &= true;
925*cdf0e10cSrcweir         }
926*cdf0e10cSrcweir 
927*cdf0e10cSrcweir         try {
928*cdf0e10cSrcweir             log.print("getAccessibleRow(0): ");
929*cdf0e10cSrcweir             int rowIndx = oObj.getAccessibleRow(0);
930*cdf0e10cSrcweir             log.println(rowIndx);
931*cdf0e10cSrcweir             res &= (rowIndx >= 0 && rowIndx <= rowCount);
932*cdf0e10cSrcweir         } catch(com.sun.star.lang.IndexOutOfBoundsException e) {
933*cdf0e10cSrcweir             log.println("Unexpected exception");
934*cdf0e10cSrcweir             e.printStackTrace(log);
935*cdf0e10cSrcweir             res &= false;
936*cdf0e10cSrcweir         }
937*cdf0e10cSrcweir 
938*cdf0e10cSrcweir         tRes.tested("getAccessibleRow()", res);
939*cdf0e10cSrcweir     }
940*cdf0e10cSrcweir 
941*cdf0e10cSrcweir     /**
942*cdf0e10cSrcweir      * Receives an accessible child count using the interface
943*cdf0e10cSrcweir      * <code>XAccessibleContext</code>.
944*cdf0e10cSrcweir      * Calls the method with the wrong parameters and with the correct
945*cdf0e10cSrcweir      * parameter, checks a returned value.
946*cdf0e10cSrcweir      * Has OK status if exceptions were thrown for the wrong indexes,
947*cdf0e10cSrcweir      * if exception wasn't thrown for the correct index and
948*cdf0e10cSrcweir      * if returned value is greater than zero and is less than
949*cdf0e10cSrcweir      * accessible column count.
950*cdf0e10cSrcweir      * The following method tests are to be executed before:
951*cdf0e10cSrcweir      * <ul>
952*cdf0e10cSrcweir      *  <li> <code>getAccessibleColumnCount()</code> </li>
953*cdf0e10cSrcweir      * </ul>
954*cdf0e10cSrcweir      */
955*cdf0e10cSrcweir     public void _getAccessibleColumn() {
956*cdf0e10cSrcweir         requiredMethod("getAccessibleColumnCount()");
957*cdf0e10cSrcweir         boolean res = true;
958*cdf0e10cSrcweir 
959*cdf0e10cSrcweir         if (xACont != null) {
960*cdf0e10cSrcweir             int childCount = xACont.getAccessibleChildCount();
961*cdf0e10cSrcweir             log.println("accessible child count: " + childCount);
962*cdf0e10cSrcweir 
963*cdf0e10cSrcweir             try {
964*cdf0e10cSrcweir                 log.print("getAccessibleColumn(" + childCount + "): ");
965*cdf0e10cSrcweir                 int colIndx = oObj.getAccessibleColumn(childCount);
966*cdf0e10cSrcweir                 log.println(colIndx);
967*cdf0e10cSrcweir                 log.println("Exception was expected");
968*cdf0e10cSrcweir                 res &= false;
969*cdf0e10cSrcweir             } catch(com.sun.star.lang.IndexOutOfBoundsException e) {
970*cdf0e10cSrcweir                 log.println("expected exception");
971*cdf0e10cSrcweir                 res &= true;
972*cdf0e10cSrcweir             }
973*cdf0e10cSrcweir 
974*cdf0e10cSrcweir             try {
975*cdf0e10cSrcweir                 log.print("getAccessibleColumn(" + (childCount-1) + "): ");
976*cdf0e10cSrcweir                 int colIndx = oObj.getAccessibleColumn(childCount - 1);
977*cdf0e10cSrcweir                 log.println(colIndx);
978*cdf0e10cSrcweir                 res &= (colIndx >= 0 && colIndx <= colCount);
979*cdf0e10cSrcweir             } catch(com.sun.star.lang.IndexOutOfBoundsException e) {
980*cdf0e10cSrcweir                 log.println("Unexpected exception");
981*cdf0e10cSrcweir                 e.printStackTrace(log);
982*cdf0e10cSrcweir                 res &= false;
983*cdf0e10cSrcweir             }
984*cdf0e10cSrcweir         }
985*cdf0e10cSrcweir 
986*cdf0e10cSrcweir         try {
987*cdf0e10cSrcweir             log.print("getAccessibleColumn(-1): ");
988*cdf0e10cSrcweir             int colIndx = oObj.getAccessibleColumn(-1);
989*cdf0e10cSrcweir             log.println(colIndx);
990*cdf0e10cSrcweir             log.println("Exception was expected");
991*cdf0e10cSrcweir             res &= false;
992*cdf0e10cSrcweir         } catch(com.sun.star.lang.IndexOutOfBoundsException e) {
993*cdf0e10cSrcweir             log.println("expected exception");
994*cdf0e10cSrcweir             res &= true;
995*cdf0e10cSrcweir         }
996*cdf0e10cSrcweir 
997*cdf0e10cSrcweir         try {
998*cdf0e10cSrcweir             log.print("getAccessibleColumn(0): ");
999*cdf0e10cSrcweir             int colIndx = oObj.getAccessibleColumn(0);
1000*cdf0e10cSrcweir             log.println(colIndx);
1001*cdf0e10cSrcweir             res &= (colIndx >= 0 && colIndx <= rowCount);
1002*cdf0e10cSrcweir         } catch(com.sun.star.lang.IndexOutOfBoundsException e) {
1003*cdf0e10cSrcweir             log.println("Unexpected exception");
1004*cdf0e10cSrcweir             e.printStackTrace(log);
1005*cdf0e10cSrcweir             res &= false;
1006*cdf0e10cSrcweir         }
1007*cdf0e10cSrcweir 
1008*cdf0e10cSrcweir         tRes.tested("getAccessibleColumn()", res);
1009*cdf0e10cSrcweir     }
1010*cdf0e10cSrcweir }