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;
61 protected void before() {
62 xASel
= UnoRuntime
.queryInterface(XAccessibleSelection
.class, oObj
);
64 log
.println("The component doesn't implement the interface " +
65 "XAccessibleSelection.");
66 log
.println("This interface is required for more detailed tests.");
69 xACont
= UnoRuntime
.queryInterface(XAccessibleContext
.class, oObj
);
75 * Calls the method and stores the returned value to the variable
76 * <code>rowCount</code>.
78 public void _getAccessibleRowCount() {
79 rowCount
= oObj
.getAccessibleRowCount();
80 log
.println("Accessible row count: " + rowCount
);
81 tRes
.tested("getAccessibleRowCount()", true);
87 * Calls the method and stores the returned value to the variable
88 * <code>colCount</code>.
90 public void _getAccessibleColumnCount() {
91 colCount
= oObj
.getAccessibleColumnCount();
92 log
.println("Accessible column count: " + colCount
);
93 tRes
.tested("getAccessibleColumnCount()", true);
97 * Calls the method with the wrong indexes and with the correct index,
98 * checks a returned value.
99 * Has OK status if exceptions were thrown for the wrong indexes,
100 * if exception wasn't thrown for the correct index and
101 * if returned value isn't <code>null</code>.
102 * The following method tests are to be executed before:
104 * <li> <code>getAccessibleRowCount()</code> </li>
107 public void _getAccessibleRowDescription() {
108 requiredMethod("getAccessibleRowCount()");
112 log
.print("getAccessibleRowDescription(-1): ");
113 String descr
= oObj
.getAccessibleRowDescription(-1);
114 log
.println("'" + descr
+ "'");
115 log
.println("Exception was expected");
117 } catch(com
.sun
.star
.lang
.IndexOutOfBoundsException e
) {
118 log
.println("expected exception");
123 log
.print("getAccessibleRowDescription(" + rowCount
+ "): ");
124 String descr
= oObj
.getAccessibleRowDescription(rowCount
);
125 log
.println("'" + descr
+ "'");
126 log
.println("Exception was expected");
128 } catch(com
.sun
.star
.lang
.IndexOutOfBoundsException e
) {
129 log
.println("expected exception");
134 log
.print("getAccessibleRowDescription(" + (rowCount
- 1) + "): ");
136 oObj
.getAccessibleRowDescription(rowCount
- 1);
137 res
&= descr
!= null;
138 log
.println("'" + descr
+ "'");
139 } catch(com
.sun
.star
.lang
.IndexOutOfBoundsException e
) {
140 log
.println("Unexpected exception");
141 e
.printStackTrace(log
);
145 tRes
.tested("getAccessibleRowDescription()", res
);
149 * Calls the method with the wrong indexes and with the correct index,
150 * checks a returned value.
151 * Has OK status if exceptions were thrown for the wrong indexes,
152 * if exception wasn't thrown for the correct index and
153 * if returned value isn't <code>null</code>.
154 * The following method tests are to be executed before:
156 * <li> <code>getAccessibleColumnCount()</code> </li>
159 public void _getAccessibleColumnDescription() {
160 requiredMethod("getAccessibleColumnCount()");
164 log
.print("getAccessibleColumnDescription(-1): ");
165 String descr
= oObj
.getAccessibleColumnDescription(-1);
166 log
.println("'" + descr
+ "'");
167 log
.println("Exception was expected");
169 } catch(com
.sun
.star
.lang
.IndexOutOfBoundsException e
) {
170 log
.println("expected exception");
175 log
.print("getAccessibleColumnDescription(" + colCount
+ "): ");
176 String descr
= oObj
.getAccessibleColumnDescription(colCount
);
177 log
.println("'" + descr
+ "'");
178 log
.println("Exception was expected");
180 } catch(com
.sun
.star
.lang
.IndexOutOfBoundsException e
) {
181 log
.println("expected exception");
186 log
.print("getAccessibleColumnDescription(" + (colCount
- 1) + "): ");
188 oObj
.getAccessibleColumnDescription(colCount
- 1);
189 res
&= descr
!= null;
190 log
.println("'" + descr
+ "'");
191 } catch(com
.sun
.star
.lang
.IndexOutOfBoundsException e
) {
192 log
.println("Unexpected exception");
193 e
.printStackTrace(log
);
197 tRes
.tested("getAccessibleColumnDescription()", res
);
202 * Calls the method with the wrong parameters and with the correct
203 * parameters, checks a returned value.
204 * Has OK status if exceptions were thrown for the wrong indexes,
205 * if exception wasn't thrown for the correct index and
206 * if returned value is greater than or is equal to 1.
207 * The following method tests are to be executed before:
209 * <li> <code>getAccessibleColumnCount()</code> </li>
210 * <li> <code>getAccessibleRowCount()</code> </li>
213 public void _getAccessibleRowExtentAt() {
214 requiredMethod("getAccessibleRowCount()");
215 requiredMethod("getAccessibleColumnCount()");
219 log
.print("getAccessibleRowExtentAt(-1," + (colCount
-1) + "):");
220 int ext
= oObj
.getAccessibleRowExtentAt(-1, colCount
- 1);
222 log
.println("Exception was expected");
224 } catch(com
.sun
.star
.lang
.IndexOutOfBoundsException e
) {
225 log
.println("expected exception");
230 log
.print("getAccessibleRowExtentAt(" + (rowCount
-1) + ",-1):");
231 int ext
= oObj
.getAccessibleRowExtentAt(rowCount
- 1, -1);
233 log
.println("Exception was expected");
235 } catch(com
.sun
.star
.lang
.IndexOutOfBoundsException e
) {
236 log
.println("expected exception");
241 log
.print("getAccessibleRowExtentAt(0," + colCount
+ "):");
242 int ext
= oObj
.getAccessibleRowExtentAt(0, colCount
);
244 log
.println("Exception was expected");
246 } catch(com
.sun
.star
.lang
.IndexOutOfBoundsException e
) {
247 log
.println("expected exception");
252 log
.print("getAccessibleRowExtentAt(" + rowCount
+ ",0):");
253 int ext
= oObj
.getAccessibleRowExtentAt(rowCount
, 0);
255 log
.println("Exception was expected");
257 } catch(com
.sun
.star
.lang
.IndexOutOfBoundsException e
) {
258 log
.println("expected exception");
263 log
.print("getAccessibleRowExtentAt(" +
264 (rowCount
-1) + "," + (colCount
-1) + "):");
265 int ext
= oObj
.getAccessibleRowExtentAt(rowCount
-1, colCount
- 1);
268 } catch(com
.sun
.star
.lang
.IndexOutOfBoundsException e
) {
269 log
.println("Unexpected exception");
270 e
.printStackTrace(log
);
274 tRes
.tested("getAccessibleRowExtentAt()", res
);
278 * Calls the method with the wrong parameters and with the correct
279 * parameters, checks a returned value.
280 * Has OK status if exceptions were thrown for the wrong indexes,
281 * if exception wasn't thrown for the correct index and
282 * if returned value is greater than or is equal to 1.
283 * The following method tests are to be executed before:
285 * <li> <code>getAccessibleColumnCount()</code> </li>
286 * <li> <code>getAccessibleRowCount()</code> </li>
289 public void _getAccessibleColumnExtentAt() {
290 requiredMethod("getAccessibleRowCount()");
291 requiredMethod("getAccessibleColumnCount()");
295 log
.print("getAccessibleColumnExtentAt(-1," + (colCount
-1) + "):");
296 int ext
= oObj
.getAccessibleColumnExtentAt(-1, colCount
- 1);
298 log
.println("Exception was expected");
300 } catch(com
.sun
.star
.lang
.IndexOutOfBoundsException e
) {
301 log
.println("expected exception");
306 log
.print("getAccessibleColumnExtentAt(" + (rowCount
-1) + ",-1):");
307 int ext
= oObj
.getAccessibleColumnExtentAt(rowCount
- 1, -1);
309 log
.println("Exception was expected");
311 } catch(com
.sun
.star
.lang
.IndexOutOfBoundsException e
) {
312 log
.println("expected exception");
317 log
.print("getAccessibleColumnExtentAt(0," + colCount
+ "):");
318 int ext
= oObj
.getAccessibleColumnExtentAt(0, colCount
);
320 log
.println("Exception was expected");
322 } catch(com
.sun
.star
.lang
.IndexOutOfBoundsException e
) {
323 log
.println("expected exception");
328 log
.print("getAccessibleColumnExtentAt(" + rowCount
+ ",0):");
329 int ext
= oObj
.getAccessibleColumnExtentAt(rowCount
, 0);
331 log
.println("Exception was expected");
333 } catch(com
.sun
.star
.lang
.IndexOutOfBoundsException e
) {
334 log
.println("expected exception");
339 log
.print("getAccessibleColumnExtentAt(" +
340 (rowCount
-1) + "," + (colCount
-1) + "):");
341 int ext
= oObj
.getAccessibleColumnExtentAt(rowCount
-1,colCount
- 1);
344 } catch(com
.sun
.star
.lang
.IndexOutOfBoundsException e
) {
345 log
.println("Unexpected exception");
346 e
.printStackTrace(log
);
350 tRes
.tested("getAccessibleColumnExtentAt()", res
);
354 * Calls the method and checks a returned value.
355 * Has OK status if returned value isn't <code>null</code>.
357 public void _getAccessibleRowHeaders() {
358 XAccessibleTable rowHeaders
= oObj
.getAccessibleRowHeaders();
359 log
.println("getAccessibleRowHeaders(): " + rowHeaders
);
360 tRes
.tested("getAccessibleRowHeaders()", true);
364 * Calls the method and checks a returned value.
365 * Has OK status if returned value isn't <code>null</code>.
367 public void _getAccessibleColumnHeaders() {
368 XAccessibleTable colHeaders
= oObj
.getAccessibleColumnHeaders();
369 log
.println("getAccessibleColumnHeaders(): " + colHeaders
);
370 tRes
.tested("getAccessibleColumnHeaders()", true);
374 * If the interface <code>XAccessibleSelection</code> is supported by
375 * the component than selects all accessible children.
376 * Calls the method and checks a returned sequence.
377 * Has OK status if a returned sequince is in ascending order.
378 * The following method tests are to be executed before:
380 * <li> <code>getAccessibleRowCount()</code> </li>
383 public void _getSelectedAccessibleRows() {
384 requiredMethod("getAccessibleRowCount()");
386 boolean locRes
= true;
387 int selRows
[] = null;
390 log
.println("XAccessibleSelection.selectAllAccessibleChildren()");
391 xASel
.selectAllAccessibleChildren();
394 log
.println("getSelectedAccessibleRows()");
395 selRows
= oObj
.getSelectedAccessibleRows();
396 log
.println("Length of the returned sequince: " + selRows
.length
);
398 res
&= selRows
.length
== rowCount
;
400 res
&= selRows
.length
== 0;
403 if (selRows
.length
> 0) {
404 log
.println("Checking that returned sequence is" +
405 " in ascending order");
408 for(int i
= 1; i
< selRows
.length
; i
++) {
409 locRes
&= selRows
[i
] >= selRows
[i
- 1];
412 log
.println("Element #" + i
+ ":" + selRows
[i
] +
413 " is less than element #" + (i
-1) + ": " +
419 tRes
.tested("getSelectedAccessibleRows()", res
);
423 * If the interface <code>XAccessibleSelection</code> is supported by
424 * the component than selects all accessible children.
425 * Calls the method and checks a returned sequence.
426 * Has OK status if a returned sequince is in ascending order.
427 * The following method tests are to be executed before:
429 * <li> <code>getAccessibleColumnCount()</code> </li>
432 public void _getSelectedAccessibleColumns() {
433 requiredMethod("getAccessibleColumnCount()");
435 boolean locRes
= true;
436 int selCols
[] = null;
439 log
.println("XAccessibleSelection.selectAllAccessibleChildren()");
440 xASel
.selectAllAccessibleChildren();
443 log
.println("getSelectedAccessibleColumns()");
444 selCols
= oObj
.getSelectedAccessibleColumns();
445 log
.println("Length of the returned sequince: " + selCols
.length
);
448 res
&= selCols
.length
== colCount
;
450 res
&= selCols
.length
== 0;
453 if (selCols
.length
> 0) {
454 log
.println("Checking that returned sequence is" +
455 " in ascending order");
458 for(int i
= 1; i
< selCols
.length
; i
++) {
459 locRes
&= selCols
[i
] >= selCols
[i
- 1];
462 log
.println("Element #" + i
+ ":" + selCols
[i
] +
463 " is less than element #" + (i
-1) + ": " +
469 tRes
.tested("getSelectedAccessibleColumns()", res
);
473 * Calls the method with invalid indexes.
474 * If the interface <code>XAccessibleSelection</code> is supported by
475 * the component than selects all accessible children.
476 * Calls the method for every row and checks returned values.
477 * The following method tests are to be executed before:
479 * <li> <code>getAccessibleRowCount()</code> </li>
482 public void _isAccessibleRowSelected() {
483 requiredMethod("getAccessibleRowCount()");
485 boolean locRes
= true;
488 log
.print("isAccessibleRowSelected(-1): ");
489 locRes
= oObj
.isAccessibleRowSelected(-1);
491 log
.println("Exception was expected");
493 } catch(com
.sun
.star
.lang
.IndexOutOfBoundsException e
) {
494 log
.println("expected exception");
499 log
.print("isAccessibleRowSelected(" + rowCount
+ "): ");
500 locRes
= oObj
.isAccessibleRowSelected(rowCount
);
502 log
.println("Exception was expected");
504 } catch(com
.sun
.star
.lang
.IndexOutOfBoundsException e
) {
505 log
.println("expected exception");
510 log
.println("XAccessibleSelection.selectAllAccessibleChildren()");
511 xASel
.selectAllAccessibleChildren();
515 log
.println("Checking of every row selection...");
516 for(int i
= 0; i
< rowCount
; i
++) {
517 boolean isSel
= oObj
.isAccessibleRowSelected(i
);
518 locRes
= (xASel
== null) ?
!isSel
: isSel
;
521 log
.println("isAccessibleRowSelected(" + i
+ "): " + isSel
);
525 } catch(com
.sun
.star
.lang
.IndexOutOfBoundsException e
) {
526 log
.println("Unexpected exception");
527 e
.printStackTrace(log
);
531 tRes
.tested("isAccessibleRowSelected()", res
);
535 * Calls the method with invalid indexes.
536 * If the interface <code>XAccessibleSelection</code> is supported by
537 * the component than selects all accessible children.
538 * Calls the method for every column and checks returned values.
539 * The following method tests are to be executed before:
541 * <li> <code>getAccessibleRowCount()</code> </li>
544 public void _isAccessibleColumnSelected() {
545 requiredMethod("getAccessibleColumnCount()");
547 boolean locRes
= true;
550 log
.print("isAccessibleColumnSelected(-1): ");
551 locRes
= oObj
.isAccessibleColumnSelected(-1);
553 log
.println("Exception was expected");
555 } catch(com
.sun
.star
.lang
.IndexOutOfBoundsException e
) {
556 log
.println("expected exception");
561 log
.print("isAccessibleColumnSelected(" + colCount
+ "): ");
562 locRes
= oObj
.isAccessibleColumnSelected(colCount
);
564 log
.println("Exception was expected");
566 } catch(com
.sun
.star
.lang
.IndexOutOfBoundsException e
) {
567 log
.println("expected exception");
572 log
.println("XAccessibleSelection.selectAllAccessibleChildren()");
573 xASel
.selectAllAccessibleChildren();
577 log
.println("Checking of every column selection...");
578 for(int i
= 0; i
< colCount
; i
++) {
579 boolean isSel
= oObj
.isAccessibleColumnSelected(i
);
580 locRes
= (xASel
== null) ?
!isSel
: isSel
;
583 log
.println("isAccessibleColumnSelected(" + i
+ "): " + isSel
);
587 } catch(com
.sun
.star
.lang
.IndexOutOfBoundsException e
) {
588 log
.println("Unexpected exception");
589 e
.printStackTrace(log
);
593 tRes
.tested("isAccessibleColumnSelected()", res
);
596 XAccessible xCellAc
= null;
599 * Calls the method with the wrong parameters and with the correct
600 * parameter, checks a returned value and stores it to the variable
601 * <code>xCellAc</code>.
602 * Has OK status if exceptions were thrown for the wrong indexes,
603 * if exception wasn't thrown for the correct index and
604 * if returned value isn't null.
605 * The following method tests are to be executed before:
607 * <li> <code>getAccessibleColumnCount()</code> </li>
608 * <li> <code>getAccessibleRowCount()</code> </li>
611 public void _getAccessibleCellAt() {
612 requiredMethod("getAccessibleRowCount()");
613 requiredMethod("getAccessibleColumnCount()");
617 log
.print("getAccessibleCellAt(-1," + (colCount
-1) + "):");
618 xCellAc
= oObj
.getAccessibleCellAt(-1, colCount
- 1);
619 log
.println(xCellAc
);
620 log
.println("Exception was expected");
622 } catch(com
.sun
.star
.lang
.IndexOutOfBoundsException e
) {
623 log
.println("expected exception");
628 log
.print("getAccessibleCellAt(" + (rowCount
-1) + ",-1):");
629 xCellAc
= oObj
.getAccessibleCellAt(rowCount
- 1, -1);
630 log
.println(xCellAc
);
631 log
.println("Exception was expected");
633 } catch(com
.sun
.star
.lang
.IndexOutOfBoundsException e
) {
634 log
.println("expected exception");
639 log
.print("getAccessibleCellAt(0, " + colCount
+ "):");
640 xCellAc
= oObj
.getAccessibleCellAt(0, colCount
);
641 log
.println(xCellAc
);
642 log
.println("Exception was expected");
644 } catch(com
.sun
.star
.lang
.IndexOutOfBoundsException e
) {
645 log
.println("expected exception");
650 log
.print("getAccessibleCellAt(" + rowCount
+ ",0):");
651 XAccessible xCellAc
= oObj
.getAccessibleCellAt(rowCount
, 0);
652 log
.println(xCellAc
);
653 log
.println("Exception was expected");
655 } catch(com
.sun
.star
.lang
.IndexOutOfBoundsException e
) {
656 log
.println("expected exception");
661 log
.print("getAccessibleCellAt(" + (rowCount
-1) + "," +
662 (colCount
-1) + "): ");
663 xCellAc
= oObj
.getAccessibleCellAt(
664 rowCount
- 1, colCount
- 1);
665 log
.println(xCellAc
);
666 res
&= xCellAc
!= null;
667 } catch(com
.sun
.star
.lang
.IndexOutOfBoundsException e
) {
668 log
.println("Unexpected exception");
669 e
.printStackTrace(log
);
673 tRes
.tested("getAccessibleCellAt()", res
);
677 * Just calls the method.
679 public void _getAccessibleCaption() {
680 XAccessible caption
= oObj
.getAccessibleCaption();
681 log
.println("getAccessibleCaption(): " + caption
);
682 tRes
.tested("getAccessibleCaption()", true);
686 * Just calls the method.
688 public void _getAccessibleSummary() {
689 XAccessible summary
= oObj
.getAccessibleSummary();
690 log
.println("getAccessibleSummary(): " + summary
);
691 tRes
.tested("getAccessibleSummary()", true);
695 * Calls the method with the wrong parameters and with the correct
696 * parameter, checks a returned value.
697 * Has OK status if exceptions were thrown for the wrong indexes,
698 * if exception wasn't thrown for the correct index.
699 * The following method tests are to be executed before:
701 * <li> <code>getAccessibleColumnCount()</code> </li>
702 * <li> <code>getAccessibleRowCount()</code> </li>
705 public void _isAccessibleSelected() {
706 requiredMethod("getAccessibleRowCount()");
707 requiredMethod("getAccessibleColumnCount()");
709 boolean locRes
= true;
712 log
.print("isAccessibleSelected(-1," + (colCount
-1) + "):");
713 locRes
= oObj
.isAccessibleSelected(-1, colCount
- 1);
715 log
.println("Exception was expected");
717 } catch(com
.sun
.star
.lang
.IndexOutOfBoundsException e
) {
718 log
.println("expected exception");
723 log
.print("isAccessibleSelected(" + (rowCount
-1) + ",-1):");
724 locRes
= oObj
.isAccessibleSelected(rowCount
- 1, -1);
726 log
.println("Exception was expected");
728 } catch(com
.sun
.star
.lang
.IndexOutOfBoundsException e
) {
729 log
.println("expected exception");
734 log
.print("isAccessibleSelected(0, " + colCount
+ "):");
735 locRes
= oObj
.isAccessibleSelected(0, colCount
);
737 log
.println("Exception was expected");
739 } catch(com
.sun
.star
.lang
.IndexOutOfBoundsException e
) {
740 log
.println("expected exception");
745 log
.print("isAccessibleSelected(" + rowCount
+ ",0):");
746 locRes
= oObj
.isAccessibleSelected(rowCount
, 0);
748 log
.println("Exception was expected");
750 } catch(com
.sun
.star
.lang
.IndexOutOfBoundsException e
) {
751 log
.println("expected exception");
756 log
.println("XAccessibleSelection.selectAllAccessibleChildren()");
757 xASel
.selectAllAccessibleChildren();
761 log
.print("isAccessibleSelected(" + (rowCount
-1) + "," +
762 (colCount
-1) + "): ");
763 boolean isSel
= oObj
.isAccessibleSelected(
764 rowCount
- 1, colCount
- 1);
766 locRes
= (xASel
== null) ?
!isSel
: isSel
;
768 } catch(com
.sun
.star
.lang
.IndexOutOfBoundsException e
) {
769 log
.println("Unexpected exception");
770 e
.printStackTrace(log
);
774 tRes
.tested("isAccessibleSelected()", res
);
778 * Calls the method with the wrong parameters and with the correct
779 * parameter, checks a returned value.
780 * Has OK status if exceptions were thrown for the wrong indexes,
781 * if exception wasn't thrown for the correct index and
782 * if returned value is equal to value returned by calling
783 * <code>XAccessibleContext::getAccessibleIndexInParent</code> for the cell.
784 * The following method tests are to be executed before:
786 * <li> <code>getAccessibleCellAt()</code> </li>
789 public void _getAccessibleIndex() {
790 executeMethod("getAccessibleCellAt()");
794 log
.print("getAccessibleIndex(-1," + (colCount
-1) + "):");
795 int indx
= oObj
.getAccessibleIndex(-1, colCount
- 1);
797 log
.println("Exception was expected");
799 } catch(com
.sun
.star
.lang
.IndexOutOfBoundsException e
) {
800 log
.println("expected exception");
805 log
.print("getAccessibleIndex(" + (rowCount
-1) + ",-1):");
806 int indx
= oObj
.getAccessibleIndex(rowCount
- 1, -1);
808 log
.println("Exception was expected");
810 } catch(com
.sun
.star
.lang
.IndexOutOfBoundsException e
) {
811 log
.println("expected exception");
816 log
.print("getAccessibleIndex(0," + colCount
+ "):");
817 int indx
= oObj
.getAccessibleIndex(0, colCount
);
819 log
.println("Exception was expected");
821 } catch(com
.sun
.star
.lang
.IndexOutOfBoundsException e
) {
822 log
.println("expected exception");
827 log
.print("getAccessibleIndex(" + rowCount
+ ",0):");
828 int indx
= oObj
.getAccessibleIndex(rowCount
, 0);
830 log
.println("Exception was expected");
832 } catch(com
.sun
.star
.lang
.IndexOutOfBoundsException e
) {
833 log
.println("expected exception");
838 log
.print("getAccessibleIndex(" + (rowCount
-1) + "," +
839 (colCount
-1) + "): ");
840 int indx
= oObj
.getAccessibleIndex(
841 rowCount
- 1, colCount
- 1);
843 if (xCellAc
!= null) {
844 XAccessibleContext xAC
= xCellAc
.getAccessibleContext();
845 int expIndx
= xAC
.getAccessibleIndexInParent();
846 log
.println("Expected index: " + expIndx
);
847 res
&= expIndx
== indx
;
851 } catch(com
.sun
.star
.lang
.IndexOutOfBoundsException e
) {
852 log
.println("Unexpected exception");
853 e
.printStackTrace(log
);
857 tRes
.tested("getAccessibleIndex()", res
);
861 * Receives an accessible child count using the interface
862 * <code>XAccessibleContext</code>.
863 * Calls the method with the wrong parameters and with the correct
864 * parameter, checks a returned value.
865 * Has OK status if exceptions were thrown for the wrong indexes,
866 * if exception wasn't thrown for the correct index and
867 * if returned value is greater than zero and is less than
868 * accessible row count.
869 * The following method tests are to be executed before:
871 * <li> <code>getAccessibleRowCount()</code> </li>
874 public void _getAccessibleRow() {
875 requiredMethod("getAccessibleRowCount()");
878 if (xACont
!= null) {
879 int childCount
= xACont
.getAccessibleChildCount();
880 log
.println("accessible child count: " + childCount
);
883 log
.print("getAccessibleRow(" + childCount
+ "): ");
884 int rowIndx
= oObj
.getAccessibleRow(childCount
);
885 log
.println(rowIndx
);
886 log
.println("Exception was expected");
888 } catch(com
.sun
.star
.lang
.IndexOutOfBoundsException e
) {
889 log
.println("expected exception");
894 log
.print("getAccessibleRow(" + (childCount
-1) + "): ");
895 int rowIndx
= oObj
.getAccessibleRow(childCount
- 1);
896 log
.println(rowIndx
);
897 res
&= (rowIndx
>= 0 && rowIndx
<= rowCount
);
898 } catch(com
.sun
.star
.lang
.IndexOutOfBoundsException e
) {
899 log
.println("Unexpected exception");
900 e
.printStackTrace(log
);
906 log
.print("getAccessibleRow(-1): ");
907 int rowIndx
= oObj
.getAccessibleRow(-1);
908 log
.println(rowIndx
);
909 log
.println("Exception was expected");
911 } catch(com
.sun
.star
.lang
.IndexOutOfBoundsException e
) {
912 log
.println("expected exception");
917 log
.print("getAccessibleRow(0): ");
918 int rowIndx
= oObj
.getAccessibleRow(0);
919 log
.println(rowIndx
);
920 res
&= (rowIndx
>= 0 && rowIndx
<= rowCount
);
921 } catch(com
.sun
.star
.lang
.IndexOutOfBoundsException e
) {
922 log
.println("Unexpected exception");
923 e
.printStackTrace(log
);
927 tRes
.tested("getAccessibleRow()", res
);
931 * Receives an accessible child count using the interface
932 * <code>XAccessibleContext</code>.
933 * Calls the method with the wrong parameters and with the correct
934 * parameter, checks a returned value.
935 * Has OK status if exceptions were thrown for the wrong indexes,
936 * if exception wasn't thrown for the correct index and
937 * if returned value is greater than zero and is less than
938 * accessible column count.
939 * The following method tests are to be executed before:
941 * <li> <code>getAccessibleColumnCount()</code> </li>
944 public void _getAccessibleColumn() {
945 requiredMethod("getAccessibleColumnCount()");
948 if (xACont
!= null) {
949 int childCount
= xACont
.getAccessibleChildCount();
950 log
.println("accessible child count: " + childCount
);
953 log
.print("getAccessibleColumn(" + childCount
+ "): ");
954 int colIndx
= oObj
.getAccessibleColumn(childCount
);
955 log
.println(colIndx
);
956 log
.println("Exception was expected");
958 } catch(com
.sun
.star
.lang
.IndexOutOfBoundsException e
) {
959 log
.println("expected exception");
964 log
.print("getAccessibleColumn(" + (childCount
-1) + "): ");
965 int colIndx
= oObj
.getAccessibleColumn(childCount
- 1);
966 log
.println(colIndx
);
967 res
&= (colIndx
>= 0 && colIndx
<= colCount
);
968 } catch(com
.sun
.star
.lang
.IndexOutOfBoundsException e
) {
969 log
.println("Unexpected exception");
970 e
.printStackTrace(log
);
976 log
.print("getAccessibleColumn(-1): ");
977 int colIndx
= oObj
.getAccessibleColumn(-1);
978 log
.println(colIndx
);
979 log
.println("Exception was expected");
981 } catch(com
.sun
.star
.lang
.IndexOutOfBoundsException e
) {
982 log
.println("expected exception");
987 log
.print("getAccessibleColumn(0): ");
988 int colIndx
= oObj
.getAccessibleColumn(0);
989 log
.println(colIndx
);
990 res
&= (colIndx
>= 0 && colIndx
<= rowCount
);
991 } catch(com
.sun
.star
.lang
.IndexOutOfBoundsException e
) {
992 log
.println("Unexpected exception");
993 e
.printStackTrace(log
);
997 tRes
.tested("getAccessibleColumn()", res
);