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 lib
.MultiMethodTest
;
23 import com
.sun
.star
.accessibility
.XAccessible
;
24 import com
.sun
.star
.accessibility
.XAccessibleContext
;
25 import com
.sun
.star
.accessibility
.XAccessibleSelection
;
26 import com
.sun
.star
.accessibility
.XAccessibleTable
;
27 import com
.sun
.star
.uno
.UnoRuntime
;
30 * Testing <code>com.sun.star.accessibility.XAccessibleTable</code>
33 * <li><code>getAccessibleRowCount()</code></li>
34 * <li><code>getAccessibleColumnCount()</code></li>
35 * <li><code>getAccessibleRowDescription()</code></li>
36 * <li><code>getAccessibleColumnDescription()</code></li>
37 * <li><code>getAccessibleRowExtentAt()</code></li>
38 * <li><code>getAccessibleColumnExtentAt()</code></li>
39 * <li><code>getAccessibleRowHeaders()</code></li>
40 * <li><code>getAccessibleColumnHeaders()</code></li>
41 * <li><code>getSelectedAccessibleRows()</code></li>
42 * <li><code>getSelectedAccessibleColumns()</code></li>
43 * <li><code>isAccessibleRowSelected()</code></li>
44 * <li><code>isAccessibleColumnSelected()</code></li>
45 * <li><code>getAccessibleCellAt()</code></li>
46 * <li><code>getAccessibleCaption()</code></li>
47 * <li><code>getAccessibleSummary()</code></li>
48 * <li><code>isAccessibleSelected()</code></li>
49 * <li><code>getAccessibleIndex()</code></li>
50 * <li><code>getAccessibleRow()</code></li>
51 * <li><code>getAccessibleColumn()</code></li>
53 * @see com.sun.star.accessibility.XAccessibleTable
55 public class _XAccessibleTable
extends MultiMethodTest
{
57 public XAccessibleTable oObj
= null;
58 XAccessibleSelection xASel
= null;
59 XAccessibleContext xACont
= null;
62 protected void before() {
63 xASel
= UnoRuntime
.queryInterface(XAccessibleSelection
.class, oObj
);
65 log
.println("The component doesn't implement the interface " +
66 "XAccessibleSelection.");
67 log
.println("This interface is required for more detailed tests.");
70 xACont
= UnoRuntime
.queryInterface(XAccessibleContext
.class, oObj
);
76 * Calls the method and stores the returned value to the variable
77 * <code>rowCount</code>.
79 public void _getAccessibleRowCount() {
80 rowCount
= oObj
.getAccessibleRowCount();
81 log
.println("Accessible row count: " + rowCount
);
82 tRes
.tested("getAccessibleRowCount()", true);
88 * Calls the method and stores the returned value to the variable
89 * <code>colCount</code>.
91 public void _getAccessibleColumnCount() {
92 colCount
= oObj
.getAccessibleColumnCount();
93 log
.println("Accessible column count: " + colCount
);
94 tRes
.tested("getAccessibleColumnCount()", true);
98 * Calls the method with the wrong indexes and with the correct index,
99 * checks a returned value.
100 * Has OK status if exceptions were thrown for the wrong indexes,
101 * if exception wasn't thrown for the correct index and
102 * if returned value isn't <code>null</code>.
103 * The following method tests are to be executed before:
105 * <li> <code>getAccessibleRowCount()</code> </li>
108 public void _getAccessibleRowDescription() {
109 requiredMethod("getAccessibleRowCount()");
113 log
.print("getAccessibleRowDescription(-1): ");
114 String descr
= oObj
.getAccessibleRowDescription(-1);
115 log
.println("'" + descr
+ "'");
116 log
.println("Exception was expected");
118 } catch(com
.sun
.star
.lang
.IndexOutOfBoundsException e
) {
119 log
.println("expected exception");
124 log
.print("getAccessibleRowDescription(" + rowCount
+ "): ");
125 String descr
= oObj
.getAccessibleRowDescription(rowCount
);
126 log
.println("'" + descr
+ "'");
127 log
.println("Exception was expected");
129 } catch(com
.sun
.star
.lang
.IndexOutOfBoundsException e
) {
130 log
.println("expected exception");
135 log
.print("getAccessibleRowDescription(" + (rowCount
- 1) + "): ");
137 oObj
.getAccessibleRowDescription(rowCount
- 1);
138 res
&= descr
!= null;
139 log
.println("'" + descr
+ "'");
140 } catch(com
.sun
.star
.lang
.IndexOutOfBoundsException e
) {
141 log
.println("Unexpected exception");
142 e
.printStackTrace(log
);
146 tRes
.tested("getAccessibleRowDescription()", res
);
150 * Calls the method with the wrong indexes and with the correct index,
151 * checks a returned value.
152 * Has OK status if exceptions were thrown for the wrong indexes,
153 * if exception wasn't thrown for the correct index and
154 * if returned value isn't <code>null</code>.
155 * The following method tests are to be executed before:
157 * <li> <code>getAccessibleColumnCount()</code> </li>
160 public void _getAccessibleColumnDescription() {
161 requiredMethod("getAccessibleColumnCount()");
165 log
.print("getAccessibleColumnDescription(-1): ");
166 String descr
= oObj
.getAccessibleColumnDescription(-1);
167 log
.println("'" + descr
+ "'");
168 log
.println("Exception was expected");
170 } catch(com
.sun
.star
.lang
.IndexOutOfBoundsException e
) {
171 log
.println("expected exception");
176 log
.print("getAccessibleColumnDescription(" + colCount
+ "): ");
177 String descr
= oObj
.getAccessibleColumnDescription(colCount
);
178 log
.println("'" + descr
+ "'");
179 log
.println("Exception was expected");
181 } catch(com
.sun
.star
.lang
.IndexOutOfBoundsException e
) {
182 log
.println("expected exception");
187 log
.print("getAccessibleColumnDescription(" + (colCount
- 1) + "): ");
189 oObj
.getAccessibleColumnDescription(colCount
- 1);
190 res
&= descr
!= null;
191 log
.println("'" + descr
+ "'");
192 } catch(com
.sun
.star
.lang
.IndexOutOfBoundsException e
) {
193 log
.println("Unexpected exception");
194 e
.printStackTrace(log
);
198 tRes
.tested("getAccessibleColumnDescription()", res
);
203 * Calls the method with the wrong parameters and with the correct
204 * parameters, checks a returned value.
205 * Has OK status if exceptions were thrown for the wrong indexes,
206 * if exception wasn't thrown for the correct index and
207 * if returned value is greater than or is equal to 1.
208 * The following method tests are to be executed before:
210 * <li> <code>getAccessibleColumnCount()</code> </li>
211 * <li> <code>getAccessibleRowCount()</code> </li>
214 public void _getAccessibleRowExtentAt() {
215 requiredMethod("getAccessibleRowCount()");
216 requiredMethod("getAccessibleColumnCount()");
220 log
.print("getAccessibleRowExtentAt(-1," + (colCount
-1) + "):");
221 int ext
= oObj
.getAccessibleRowExtentAt(-1, colCount
- 1);
223 log
.println("Exception was expected");
225 } catch(com
.sun
.star
.lang
.IndexOutOfBoundsException e
) {
226 log
.println("expected exception");
231 log
.print("getAccessibleRowExtentAt(" + (rowCount
-1) + ",-1):");
232 int ext
= oObj
.getAccessibleRowExtentAt(rowCount
- 1, -1);
234 log
.println("Exception was expected");
236 } catch(com
.sun
.star
.lang
.IndexOutOfBoundsException e
) {
237 log
.println("expected exception");
242 log
.print("getAccessibleRowExtentAt(0," + colCount
+ "):");
243 int ext
= oObj
.getAccessibleRowExtentAt(0, colCount
);
245 log
.println("Exception was expected");
247 } catch(com
.sun
.star
.lang
.IndexOutOfBoundsException e
) {
248 log
.println("expected exception");
253 log
.print("getAccessibleRowExtentAt(" + rowCount
+ ",0):");
254 int ext
= oObj
.getAccessibleRowExtentAt(rowCount
, 0);
256 log
.println("Exception was expected");
258 } catch(com
.sun
.star
.lang
.IndexOutOfBoundsException e
) {
259 log
.println("expected exception");
264 log
.print("getAccessibleRowExtentAt(" +
265 (rowCount
-1) + "," + (colCount
-1) + "):");
266 int ext
= oObj
.getAccessibleRowExtentAt(rowCount
-1, colCount
- 1);
269 } catch(com
.sun
.star
.lang
.IndexOutOfBoundsException e
) {
270 log
.println("Unexpected exception");
271 e
.printStackTrace(log
);
275 tRes
.tested("getAccessibleRowExtentAt()", res
);
279 * Calls the method with the wrong parameters and with the correct
280 * parameters, checks a returned value.
281 * Has OK status if exceptions were thrown for the wrong indexes,
282 * if exception wasn't thrown for the correct index and
283 * if returned value is greater than or is equal to 1.
284 * The following method tests are to be executed before:
286 * <li> <code>getAccessibleColumnCount()</code> </li>
287 * <li> <code>getAccessibleRowCount()</code> </li>
290 public void _getAccessibleColumnExtentAt() {
291 requiredMethod("getAccessibleRowCount()");
292 requiredMethod("getAccessibleColumnCount()");
296 log
.print("getAccessibleColumnExtentAt(-1," + (colCount
-1) + "):");
297 int ext
= oObj
.getAccessibleColumnExtentAt(-1, colCount
- 1);
299 log
.println("Exception was expected");
301 } catch(com
.sun
.star
.lang
.IndexOutOfBoundsException e
) {
302 log
.println("expected exception");
307 log
.print("getAccessibleColumnExtentAt(" + (rowCount
-1) + ",-1):");
308 int ext
= oObj
.getAccessibleColumnExtentAt(rowCount
- 1, -1);
310 log
.println("Exception was expected");
312 } catch(com
.sun
.star
.lang
.IndexOutOfBoundsException e
) {
313 log
.println("expected exception");
318 log
.print("getAccessibleColumnExtentAt(0," + colCount
+ "):");
319 int ext
= oObj
.getAccessibleColumnExtentAt(0, colCount
);
321 log
.println("Exception was expected");
323 } catch(com
.sun
.star
.lang
.IndexOutOfBoundsException e
) {
324 log
.println("expected exception");
329 log
.print("getAccessibleColumnExtentAt(" + rowCount
+ ",0):");
330 int ext
= oObj
.getAccessibleColumnExtentAt(rowCount
, 0);
332 log
.println("Exception was expected");
334 } catch(com
.sun
.star
.lang
.IndexOutOfBoundsException e
) {
335 log
.println("expected exception");
340 log
.print("getAccessibleColumnExtentAt(" +
341 (rowCount
-1) + "," + (colCount
-1) + "):");
342 int ext
= oObj
.getAccessibleColumnExtentAt(rowCount
-1,colCount
- 1);
345 } catch(com
.sun
.star
.lang
.IndexOutOfBoundsException e
) {
346 log
.println("Unexpected exception");
347 e
.printStackTrace(log
);
351 tRes
.tested("getAccessibleColumnExtentAt()", res
);
355 * Calls the method and checks a returned value.
356 * Has OK status if returned value isn't <code>null</code>.
358 public void _getAccessibleRowHeaders() {
359 XAccessibleTable rowHeaders
= oObj
.getAccessibleRowHeaders();
360 log
.println("getAccessibleRowHeaders(): " + rowHeaders
);
361 tRes
.tested("getAccessibleRowHeaders()", true);
365 * Calls the method and checks a returned value.
366 * Has OK status if returned value isn't <code>null</code>.
368 public void _getAccessibleColumnHeaders() {
369 XAccessibleTable colHeaders
= oObj
.getAccessibleColumnHeaders();
370 log
.println("getAccessibleColumnHeaders(): " + colHeaders
);
371 tRes
.tested("getAccessibleColumnHeaders()", true);
375 * If the interface <code>XAccessibleSelection</code> is supported by
376 * the component than selects all accessible children.
377 * Calls the method and checks a returned sequence.
378 * Has OK status if a returned sequince is in ascending order.
379 * The following method tests are to be executed before:
381 * <li> <code>getAccessibleRowCount()</code> </li>
384 public void _getSelectedAccessibleRows() {
385 requiredMethod("getAccessibleRowCount()");
387 boolean locRes
= true;
388 int selRows
[] = null;
391 log
.println("XAccessibleSelection.selectAllAccessibleChildren()");
392 xASel
.selectAllAccessibleChildren();
395 log
.println("getSelectedAccessibleRows()");
396 selRows
= oObj
.getSelectedAccessibleRows();
397 log
.println("Length of the returned sequince: " + selRows
.length
);
399 res
&= selRows
.length
== rowCount
;
401 res
&= selRows
.length
== 0;
404 if (selRows
.length
> 0) {
405 log
.println("Checking that returned sequence is" +
406 " in ascending order");
409 for(int i
= 1; i
< selRows
.length
; i
++) {
410 locRes
&= selRows
[i
] >= selRows
[i
- 1];
413 log
.println("Element #" + i
+ ":" + selRows
[i
] +
414 " is less than element #" + (i
-1) + ": " +
420 tRes
.tested("getSelectedAccessibleRows()", res
);
424 * If the interface <code>XAccessibleSelection</code> is supported by
425 * the component than selects all accessible children.
426 * Calls the method and checks a returned sequence.
427 * Has OK status if a returned sequince is in ascending order.
428 * The following method tests are to be executed before:
430 * <li> <code>getAccessibleColumnCount()</code> </li>
433 public void _getSelectedAccessibleColumns() {
434 requiredMethod("getAccessibleColumnCount()");
436 boolean locRes
= true;
437 int selCols
[] = null;
440 log
.println("XAccessibleSelection.selectAllAccessibleChildren()");
441 xASel
.selectAllAccessibleChildren();
444 log
.println("getSelectedAccessibleColumns()");
445 selCols
= oObj
.getSelectedAccessibleColumns();
446 log
.println("Length of the returned sequince: " + selCols
.length
);
449 res
&= selCols
.length
== colCount
;
451 res
&= selCols
.length
== 0;
454 if (selCols
.length
> 0) {
455 log
.println("Checking that returned sequence is" +
456 " in ascending order");
459 for(int i
= 1; i
< selCols
.length
; i
++) {
460 locRes
&= selCols
[i
] >= selCols
[i
- 1];
463 log
.println("Element #" + i
+ ":" + selCols
[i
] +
464 " is less than element #" + (i
-1) + ": " +
470 tRes
.tested("getSelectedAccessibleColumns()", res
);
474 * Calls the method with invalid indexes.
475 * If the interface <code>XAccessibleSelection</code> is supported by
476 * the component than selects all accessible children.
477 * Calls the method for every row and checks returned values.
478 * The following method tests are to be executed before:
480 * <li> <code>getAccessibleRowCount()</code> </li>
483 public void _isAccessibleRowSelected() {
484 requiredMethod("getAccessibleRowCount()");
486 boolean locRes
= true;
489 log
.print("isAccessibleRowSelected(-1): ");
490 locRes
= oObj
.isAccessibleRowSelected(-1);
492 log
.println("Exception was expected");
494 } catch(com
.sun
.star
.lang
.IndexOutOfBoundsException e
) {
495 log
.println("expected exception");
500 log
.print("isAccessibleRowSelected(" + rowCount
+ "): ");
501 locRes
= oObj
.isAccessibleRowSelected(rowCount
);
503 log
.println("Exception was expected");
505 } catch(com
.sun
.star
.lang
.IndexOutOfBoundsException e
) {
506 log
.println("expected exception");
511 log
.println("XAccessibleSelection.selectAllAccessibleChildren()");
512 xASel
.selectAllAccessibleChildren();
516 log
.println("Checking of every row selection...");
517 for(int i
= 0; i
< rowCount
; i
++) {
518 boolean isSel
= oObj
.isAccessibleRowSelected(i
);
519 locRes
= (xASel
== null) ?
!isSel
: isSel
;
522 log
.println("isAccessibleRowSelected(" + i
+ "): " + isSel
);
526 } catch(com
.sun
.star
.lang
.IndexOutOfBoundsException e
) {
527 log
.println("Unexpected exception");
528 e
.printStackTrace(log
);
532 tRes
.tested("isAccessibleRowSelected()", res
);
536 * Calls the method with invalid indexes.
537 * If the interface <code>XAccessibleSelection</code> is supported by
538 * the component than selects all accessible children.
539 * Calls the method for every column and checks returned values.
540 * The following method tests are to be executed before:
542 * <li> <code>getAccessibleRowCount()</code> </li>
545 public void _isAccessibleColumnSelected() {
546 requiredMethod("getAccessibleColumnCount()");
548 boolean locRes
= true;
551 log
.print("isAccessibleColumnSelected(-1): ");
552 locRes
= oObj
.isAccessibleColumnSelected(-1);
554 log
.println("Exception was expected");
556 } catch(com
.sun
.star
.lang
.IndexOutOfBoundsException e
) {
557 log
.println("expected exception");
562 log
.print("isAccessibleColumnSelected(" + colCount
+ "): ");
563 locRes
= oObj
.isAccessibleColumnSelected(colCount
);
565 log
.println("Exception was expected");
567 } catch(com
.sun
.star
.lang
.IndexOutOfBoundsException e
) {
568 log
.println("expected exception");
573 log
.println("XAccessibleSelection.selectAllAccessibleChildren()");
574 xASel
.selectAllAccessibleChildren();
578 log
.println("Checking of every column selection...");
579 for(int i
= 0; i
< colCount
; i
++) {
580 boolean isSel
= oObj
.isAccessibleColumnSelected(i
);
581 locRes
= (xASel
== null) ?
!isSel
: isSel
;
584 log
.println("isAccessibleColumnSelected(" + i
+ "): " + isSel
);
588 } catch(com
.sun
.star
.lang
.IndexOutOfBoundsException e
) {
589 log
.println("Unexpected exception");
590 e
.printStackTrace(log
);
594 tRes
.tested("isAccessibleColumnSelected()", res
);
597 XAccessible xCellAc
= null;
600 * Calls the method with the wrong parameters and with the correct
601 * parameter, checks a returned value and stores it to the variable
602 * <code>xCellAc</code>.
603 * Has OK status if exceptions were thrown for the wrong indexes,
604 * if exception wasn't thrown for the correct index and
605 * if returned value isn't null.
606 * The following method tests are to be executed before:
608 * <li> <code>getAccessibleColumnCount()</code> </li>
609 * <li> <code>getAccessibleRowCount()</code> </li>
612 public void _getAccessibleCellAt() {
613 requiredMethod("getAccessibleRowCount()");
614 requiredMethod("getAccessibleColumnCount()");
618 log
.print("getAccessibleCellAt(-1," + (colCount
-1) + "):");
619 xCellAc
= oObj
.getAccessibleCellAt(-1, colCount
- 1);
620 log
.println(xCellAc
);
621 log
.println("Exception was expected");
623 } catch(com
.sun
.star
.lang
.IndexOutOfBoundsException e
) {
624 log
.println("expected exception");
629 log
.print("getAccessibleCellAt(" + (rowCount
-1) + ",-1):");
630 xCellAc
= oObj
.getAccessibleCellAt(rowCount
- 1, -1);
631 log
.println(xCellAc
);
632 log
.println("Exception was expected");
634 } catch(com
.sun
.star
.lang
.IndexOutOfBoundsException e
) {
635 log
.println("expected exception");
640 log
.print("getAccessibleCellAt(0, " + colCount
+ "):");
641 xCellAc
= oObj
.getAccessibleCellAt(0, colCount
);
642 log
.println(xCellAc
);
643 log
.println("Exception was expected");
645 } catch(com
.sun
.star
.lang
.IndexOutOfBoundsException e
) {
646 log
.println("expected exception");
651 log
.print("getAccessibleCellAt(" + rowCount
+ ",0):");
652 XAccessible xCellAc
= oObj
.getAccessibleCellAt(rowCount
, 0);
653 log
.println(xCellAc
);
654 log
.println("Exception was expected");
656 } catch(com
.sun
.star
.lang
.IndexOutOfBoundsException e
) {
657 log
.println("expected exception");
662 log
.print("getAccessibleCellAt(" + (rowCount
-1) + "," +
663 (colCount
-1) + "): ");
664 xCellAc
= oObj
.getAccessibleCellAt(
665 rowCount
- 1, colCount
- 1);
666 log
.println(xCellAc
);
667 res
&= xCellAc
!= null;
668 } catch(com
.sun
.star
.lang
.IndexOutOfBoundsException e
) {
669 log
.println("Unexpected exception");
670 e
.printStackTrace(log
);
674 tRes
.tested("getAccessibleCellAt()", res
);
678 * Just calls the method.
680 public void _getAccessibleCaption() {
681 XAccessible caption
= oObj
.getAccessibleCaption();
682 log
.println("getAccessibleCaption(): " + caption
);
683 tRes
.tested("getAccessibleCaption()", true);
687 * Just calls the method.
689 public void _getAccessibleSummary() {
690 XAccessible summary
= oObj
.getAccessibleSummary();
691 log
.println("getAccessibleSummary(): " + summary
);
692 tRes
.tested("getAccessibleSummary()", true);
696 * Calls the method with the wrong parameters and with the correct
697 * parameter, checks a returned value.
698 * Has OK status if exceptions were thrown for the wrong indexes,
699 * if exception wasn't thrown for the correct index.
700 * The following method tests are to be executed before:
702 * <li> <code>getAccessibleColumnCount()</code> </li>
703 * <li> <code>getAccessibleRowCount()</code> </li>
706 public void _isAccessibleSelected() {
707 requiredMethod("getAccessibleRowCount()");
708 requiredMethod("getAccessibleColumnCount()");
710 boolean locRes
= true;
713 log
.print("isAccessibleSelected(-1," + (colCount
-1) + "):");
714 locRes
= oObj
.isAccessibleSelected(-1, colCount
- 1);
716 log
.println("Exception was expected");
718 } catch(com
.sun
.star
.lang
.IndexOutOfBoundsException e
) {
719 log
.println("expected exception");
724 log
.print("isAccessibleSelected(" + (rowCount
-1) + ",-1):");
725 locRes
= oObj
.isAccessibleSelected(rowCount
- 1, -1);
727 log
.println("Exception was expected");
729 } catch(com
.sun
.star
.lang
.IndexOutOfBoundsException e
) {
730 log
.println("expected exception");
735 log
.print("isAccessibleSelected(0, " + colCount
+ "):");
736 locRes
= oObj
.isAccessibleSelected(0, colCount
);
738 log
.println("Exception was expected");
740 } catch(com
.sun
.star
.lang
.IndexOutOfBoundsException e
) {
741 log
.println("expected exception");
746 log
.print("isAccessibleSelected(" + rowCount
+ ",0):");
747 locRes
= oObj
.isAccessibleSelected(rowCount
, 0);
749 log
.println("Exception was expected");
751 } catch(com
.sun
.star
.lang
.IndexOutOfBoundsException e
) {
752 log
.println("expected exception");
757 log
.println("XAccessibleSelection.selectAllAccessibleChildren()");
758 xASel
.selectAllAccessibleChildren();
762 log
.print("isAccessibleSelected(" + (rowCount
-1) + "," +
763 (colCount
-1) + "): ");
764 boolean isSel
= oObj
.isAccessibleSelected(
765 rowCount
- 1, colCount
- 1);
767 locRes
= (xASel
== null) ?
!isSel
: isSel
;
769 } catch(com
.sun
.star
.lang
.IndexOutOfBoundsException e
) {
770 log
.println("Unexpected exception");
771 e
.printStackTrace(log
);
775 tRes
.tested("isAccessibleSelected()", res
);
779 * Calls the method with the wrong parameters and with the correct
780 * parameter, checks a returned value.
781 * Has OK status if exceptions were thrown for the wrong indexes,
782 * if exception wasn't thrown for the correct index and
783 * if returned value is equal to value returned by calling
784 * <code>XAccessibleContext::getAccessibleIndexInParent</code> for the cell.
785 * The following method tests are to be executed before:
787 * <li> <code>getAccessibleCellAt()</code> </li>
790 public void _getAccessibleIndex() {
791 executeMethod("getAccessibleCellAt()");
795 log
.print("getAccessibleIndex(-1," + (colCount
-1) + "):");
796 int indx
= oObj
.getAccessibleIndex(-1, colCount
- 1);
798 log
.println("Exception was expected");
800 } catch(com
.sun
.star
.lang
.IndexOutOfBoundsException e
) {
801 log
.println("expected exception");
806 log
.print("getAccessibleIndex(" + (rowCount
-1) + ",-1):");
807 int indx
= oObj
.getAccessibleIndex(rowCount
- 1, -1);
809 log
.println("Exception was expected");
811 } catch(com
.sun
.star
.lang
.IndexOutOfBoundsException e
) {
812 log
.println("expected exception");
817 log
.print("getAccessibleIndex(0," + colCount
+ "):");
818 int indx
= oObj
.getAccessibleIndex(0, colCount
);
820 log
.println("Exception was expected");
822 } catch(com
.sun
.star
.lang
.IndexOutOfBoundsException e
) {
823 log
.println("expected exception");
828 log
.print("getAccessibleIndex(" + rowCount
+ ",0):");
829 int indx
= oObj
.getAccessibleIndex(rowCount
, 0);
831 log
.println("Exception was expected");
833 } catch(com
.sun
.star
.lang
.IndexOutOfBoundsException e
) {
834 log
.println("expected exception");
839 log
.print("getAccessibleIndex(" + (rowCount
-1) + "," +
840 (colCount
-1) + "): ");
841 int indx
= oObj
.getAccessibleIndex(
842 rowCount
- 1, colCount
- 1);
844 if (xCellAc
!= null) {
845 XAccessibleContext xAC
= xCellAc
.getAccessibleContext();
846 int expIndx
= xAC
.getAccessibleIndexInParent();
847 log
.println("Expected index: " + expIndx
);
848 res
&= expIndx
== indx
;
852 } catch(com
.sun
.star
.lang
.IndexOutOfBoundsException e
) {
853 log
.println("Unexpected exception");
854 e
.printStackTrace(log
);
858 tRes
.tested("getAccessibleIndex()", res
);
862 * Receives an accessible child count using the interface
863 * <code>XAccessibleContext</code>.
864 * Calls the method with the wrong parameters and with the correct
865 * parameter, checks a returned value.
866 * Has OK status if exceptions were thrown for the wrong indexes,
867 * if exception wasn't thrown for the correct index and
868 * if returned value is greater than zero and is less than
869 * accessible row count.
870 * The following method tests are to be executed before:
872 * <li> <code>getAccessibleRowCount()</code> </li>
875 public void _getAccessibleRow() {
876 requiredMethod("getAccessibleRowCount()");
879 if (xACont
!= null) {
880 int childCount
= xACont
.getAccessibleChildCount();
881 log
.println("accessible child count: " + childCount
);
884 log
.print("getAccessibleRow(" + childCount
+ "): ");
885 int rowIndx
= oObj
.getAccessibleRow(childCount
);
886 log
.println(rowIndx
);
887 log
.println("Exception was expected");
889 } catch(com
.sun
.star
.lang
.IndexOutOfBoundsException e
) {
890 log
.println("expected exception");
895 log
.print("getAccessibleRow(" + (childCount
-1) + "): ");
896 int rowIndx
= oObj
.getAccessibleRow(childCount
- 1);
897 log
.println(rowIndx
);
898 res
&= (rowIndx
>= 0 && rowIndx
<= rowCount
);
899 } catch(com
.sun
.star
.lang
.IndexOutOfBoundsException e
) {
900 log
.println("Unexpected exception");
901 e
.printStackTrace(log
);
907 log
.print("getAccessibleRow(-1): ");
908 int rowIndx
= oObj
.getAccessibleRow(-1);
909 log
.println(rowIndx
);
910 log
.println("Exception was expected");
912 } catch(com
.sun
.star
.lang
.IndexOutOfBoundsException e
) {
913 log
.println("expected exception");
918 log
.print("getAccessibleRow(0): ");
919 int rowIndx
= oObj
.getAccessibleRow(0);
920 log
.println(rowIndx
);
921 res
&= (rowIndx
>= 0 && rowIndx
<= rowCount
);
922 } catch(com
.sun
.star
.lang
.IndexOutOfBoundsException e
) {
923 log
.println("Unexpected exception");
924 e
.printStackTrace(log
);
928 tRes
.tested("getAccessibleRow()", res
);
932 * Receives an accessible child count using the interface
933 * <code>XAccessibleContext</code>.
934 * Calls the method with the wrong parameters and with the correct
935 * parameter, checks a returned value.
936 * Has OK status if exceptions were thrown for the wrong indexes,
937 * if exception wasn't thrown for the correct index and
938 * if returned value is greater than zero and is less than
939 * accessible column count.
940 * The following method tests are to be executed before:
942 * <li> <code>getAccessibleColumnCount()</code> </li>
945 public void _getAccessibleColumn() {
946 requiredMethod("getAccessibleColumnCount()");
949 if (xACont
!= null) {
950 int childCount
= xACont
.getAccessibleChildCount();
951 log
.println("accessible child count: " + childCount
);
954 log
.print("getAccessibleColumn(" + childCount
+ "): ");
955 int colIndx
= oObj
.getAccessibleColumn(childCount
);
956 log
.println(colIndx
);
957 log
.println("Exception was expected");
959 } catch(com
.sun
.star
.lang
.IndexOutOfBoundsException e
) {
960 log
.println("expected exception");
965 log
.print("getAccessibleColumn(" + (childCount
-1) + "): ");
966 int colIndx
= oObj
.getAccessibleColumn(childCount
- 1);
967 log
.println(colIndx
);
968 res
&= (colIndx
>= 0 && colIndx
<= colCount
);
969 } catch(com
.sun
.star
.lang
.IndexOutOfBoundsException e
) {
970 log
.println("Unexpected exception");
971 e
.printStackTrace(log
);
977 log
.print("getAccessibleColumn(-1): ");
978 int colIndx
= oObj
.getAccessibleColumn(-1);
979 log
.println(colIndx
);
980 log
.println("Exception was expected");
982 } catch(com
.sun
.star
.lang
.IndexOutOfBoundsException e
) {
983 log
.println("expected exception");
988 log
.print("getAccessibleColumn(0): ");
989 int colIndx
= oObj
.getAccessibleColumn(0);
990 log
.println(colIndx
);
991 res
&= (colIndx
>= 0 && colIndx
<= rowCount
);
992 } catch(com
.sun
.star
.lang
.IndexOutOfBoundsException e
) {
993 log
.println("Unexpected exception");
994 e
.printStackTrace(log
);
998 tRes
.tested("getAccessibleColumn()", res
);