update credits
[LibreOffice.git] / qadevOOo / tests / java / ifc / accessibility / _XAccessibleTable.java
blobf237d60cbc28bc017d88801f9450bbccc222e4f4
1 /*
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;
29 /**
30 * Testing <code>com.sun.star.accessibility.XAccessibleTable</code>
31 * interface methods :
32 * <ul>
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>
52 * </ul> <p>
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);
63 if (xASel == null) {
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);
72 int rowCount = 0;
74 /**
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);
84 int colCount = 0;
86 /**
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);
96 /**
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:
103 * <ul>
104 * <li> <code>getAccessibleRowCount()</code> </li>
105 * </ul>
107 public void _getAccessibleRowDescription() {
108 requiredMethod("getAccessibleRowCount()");
109 boolean res = true;
111 try {
112 log.print("getAccessibleRowDescription(-1): ");
113 String descr = oObj.getAccessibleRowDescription(-1);
114 log.println("'" + descr + "'");
115 log.println("Exception was expected");
116 res &= false;
117 } catch(com.sun.star.lang.IndexOutOfBoundsException e) {
118 log.println("expected exception");
119 res &= true;
122 try {
123 log.print("getAccessibleRowDescription(" + rowCount + "): ");
124 String descr = oObj.getAccessibleRowDescription(rowCount);
125 log.println("'" + descr + "'");
126 log.println("Exception was expected");
127 res &= false;
128 } catch(com.sun.star.lang.IndexOutOfBoundsException e) {
129 log.println("expected exception");
130 res &= true;
133 try {
134 log.print("getAccessibleRowDescription(" + (rowCount - 1) + "): ");
135 String descr =
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);
142 res &= false;
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:
155 * <ul>
156 * <li> <code>getAccessibleColumnCount()</code> </li>
157 * </ul>
159 public void _getAccessibleColumnDescription() {
160 requiredMethod("getAccessibleColumnCount()");
161 boolean res = true;
163 try {
164 log.print("getAccessibleColumnDescription(-1): ");
165 String descr = oObj.getAccessibleColumnDescription(-1);
166 log.println("'" + descr + "'");
167 log.println("Exception was expected");
168 res &= false;
169 } catch(com.sun.star.lang.IndexOutOfBoundsException e) {
170 log.println("expected exception");
171 res &= true;
174 try {
175 log.print("getAccessibleColumnDescription(" + colCount + "): ");
176 String descr = oObj.getAccessibleColumnDescription(colCount);
177 log.println("'" + descr + "'");
178 log.println("Exception was expected");
179 res &= false;
180 } catch(com.sun.star.lang.IndexOutOfBoundsException e) {
181 log.println("expected exception");
182 res &= true;
185 try {
186 log.print("getAccessibleColumnDescription(" + (colCount - 1) + "): ");
187 String descr =
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);
194 res &= false;
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:
208 * <ul>
209 * <li> <code>getAccessibleColumnCount()</code> </li>
210 * <li> <code>getAccessibleRowCount()</code> </li>
211 * </ul>
213 public void _getAccessibleRowExtentAt() {
214 requiredMethod("getAccessibleRowCount()");
215 requiredMethod("getAccessibleColumnCount()");
216 boolean res = true;
218 try {
219 log.print("getAccessibleRowExtentAt(-1," + (colCount-1) + "):");
220 int ext = oObj.getAccessibleRowExtentAt(-1, colCount - 1);
221 log.println(ext);
222 log.println("Exception was expected");
223 res &= false;
224 } catch(com.sun.star.lang.IndexOutOfBoundsException e) {
225 log.println("expected exception");
226 res &= true;
229 try {
230 log.print("getAccessibleRowExtentAt(" + (rowCount-1) + ",-1):");
231 int ext = oObj.getAccessibleRowExtentAt(rowCount - 1, -1);
232 log.println(ext);
233 log.println("Exception was expected");
234 res &= false;
235 } catch(com.sun.star.lang.IndexOutOfBoundsException e) {
236 log.println("expected exception");
237 res &= true;
240 try {
241 log.print("getAccessibleRowExtentAt(0," + colCount + "):");
242 int ext = oObj.getAccessibleRowExtentAt(0, colCount);
243 log.println(ext);
244 log.println("Exception was expected");
245 res &= false;
246 } catch(com.sun.star.lang.IndexOutOfBoundsException e) {
247 log.println("expected exception");
248 res &= true;
251 try {
252 log.print("getAccessibleRowExtentAt(" + rowCount + ",0):");
253 int ext = oObj.getAccessibleRowExtentAt(rowCount, 0);
254 log.println(ext);
255 log.println("Exception was expected");
256 res &= false;
257 } catch(com.sun.star.lang.IndexOutOfBoundsException e) {
258 log.println("expected exception");
259 res &= true;
262 try {
263 log.print("getAccessibleRowExtentAt(" +
264 (rowCount-1) + "," + (colCount-1) + "):");
265 int ext = oObj.getAccessibleRowExtentAt(rowCount-1, colCount - 1);
266 log.println(ext);
267 res &= ext >= 1;
268 } catch(com.sun.star.lang.IndexOutOfBoundsException e) {
269 log.println("Unexpected exception");
270 e.printStackTrace(log);
271 res &= false;
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:
284 * <ul>
285 * <li> <code>getAccessibleColumnCount()</code> </li>
286 * <li> <code>getAccessibleRowCount()</code> </li>
287 * </ul>
289 public void _getAccessibleColumnExtentAt() {
290 requiredMethod("getAccessibleRowCount()");
291 requiredMethod("getAccessibleColumnCount()");
292 boolean res = true;
294 try {
295 log.print("getAccessibleColumnExtentAt(-1," + (colCount-1) + "):");
296 int ext = oObj.getAccessibleColumnExtentAt(-1, colCount - 1);
297 log.println(ext);
298 log.println("Exception was expected");
299 res &= false;
300 } catch(com.sun.star.lang.IndexOutOfBoundsException e) {
301 log.println("expected exception");
302 res &= true;
305 try {
306 log.print("getAccessibleColumnExtentAt(" + (rowCount-1) + ",-1):");
307 int ext = oObj.getAccessibleColumnExtentAt(rowCount - 1, -1);
308 log.println(ext);
309 log.println("Exception was expected");
310 res &= false;
311 } catch(com.sun.star.lang.IndexOutOfBoundsException e) {
312 log.println("expected exception");
313 res &= true;
316 try {
317 log.print("getAccessibleColumnExtentAt(0," + colCount + "):");
318 int ext = oObj.getAccessibleColumnExtentAt(0, colCount);
319 log.println(ext);
320 log.println("Exception was expected");
321 res &= false;
322 } catch(com.sun.star.lang.IndexOutOfBoundsException e) {
323 log.println("expected exception");
324 res &= true;
327 try {
328 log.print("getAccessibleColumnExtentAt(" + rowCount + ",0):");
329 int ext = oObj.getAccessibleColumnExtentAt(rowCount, 0);
330 log.println(ext);
331 log.println("Exception was expected");
332 res &= false;
333 } catch(com.sun.star.lang.IndexOutOfBoundsException e) {
334 log.println("expected exception");
335 res &= true;
338 try {
339 log.print("getAccessibleColumnExtentAt(" +
340 (rowCount-1) + "," + (colCount-1) + "):");
341 int ext = oObj.getAccessibleColumnExtentAt(rowCount-1,colCount - 1);
342 log.println(ext);
343 res &= ext >= 1;
344 } catch(com.sun.star.lang.IndexOutOfBoundsException e) {
345 log.println("Unexpected exception");
346 e.printStackTrace(log);
347 res &= false;
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:
379 * <ul>
380 * <li> <code>getAccessibleRowCount()</code> </li>
381 * </ul>
383 public void _getSelectedAccessibleRows() {
384 requiredMethod("getAccessibleRowCount()");
385 boolean res = true;
386 boolean locRes = true;
387 int selRows[] = null;
389 if (xASel != 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);
397 if (xASel != null) {
398 res &= selRows.length == rowCount;
399 } else {
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];
410 res &= locRes;
411 if (!locRes) {
412 log.println("Element #" + i + ":" + selRows[i] +
413 " is less than element #" + (i-1) + ": " +
414 selRows[i-1]);
415 break;
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:
428 * <ul>
429 * <li> <code>getAccessibleColumnCount()</code> </li>
430 * </ul>
432 public void _getSelectedAccessibleColumns() {
433 requiredMethod("getAccessibleColumnCount()");
434 boolean res = true;
435 boolean locRes = true;
436 int selCols[] = null;
438 if (xASel != 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);
447 if (xASel != null) {
448 res &= selCols.length == colCount;
449 } else {
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];
460 res &= locRes;
461 if (!locRes) {
462 log.println("Element #" + i + ":" + selCols[i] +
463 " is less than element #" + (i-1) + ": " +
464 selCols[i-1]);
465 break;
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:
478 * <ul>
479 * <li> <code>getAccessibleRowCount()</code> </li>
480 * </ul>
482 public void _isAccessibleRowSelected() {
483 requiredMethod("getAccessibleRowCount()");
484 boolean res = true;
485 boolean locRes = true;
487 try {
488 log.print("isAccessibleRowSelected(-1): ");
489 locRes = oObj.isAccessibleRowSelected(-1);
490 log.println(locRes);
491 log.println("Exception was expected");
492 res &= false;
493 } catch(com.sun.star.lang.IndexOutOfBoundsException e) {
494 log.println("expected exception");
495 res &= true;
498 try {
499 log.print("isAccessibleRowSelected(" + rowCount + "): ");
500 locRes = oObj.isAccessibleRowSelected(rowCount);
501 log.println(locRes);
502 log.println("Exception was expected");
503 res &= false;
504 } catch(com.sun.star.lang.IndexOutOfBoundsException e) {
505 log.println("expected exception");
506 res &= true;
509 if (xASel != null) {
510 log.println("XAccessibleSelection.selectAllAccessibleChildren()");
511 xASel.selectAllAccessibleChildren();
514 try {
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;
519 res &= locRes;
520 if (!locRes) {
521 log.println("isAccessibleRowSelected(" + i + "): " + isSel);
522 break;
525 } catch(com.sun.star.lang.IndexOutOfBoundsException e) {
526 log.println("Unexpected exception");
527 e.printStackTrace(log);
528 res &= false;
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:
540 * <ul>
541 * <li> <code>getAccessibleRowCount()</code> </li>
542 * </ul>
544 public void _isAccessibleColumnSelected() {
545 requiredMethod("getAccessibleColumnCount()");
546 boolean res = true;
547 boolean locRes = true;
549 try {
550 log.print("isAccessibleColumnSelected(-1): ");
551 locRes = oObj.isAccessibleColumnSelected(-1);
552 log.println(locRes);
553 log.println("Exception was expected");
554 res &= false;
555 } catch(com.sun.star.lang.IndexOutOfBoundsException e) {
556 log.println("expected exception");
557 res &= true;
560 try {
561 log.print("isAccessibleColumnSelected(" + colCount + "): ");
562 locRes = oObj.isAccessibleColumnSelected(colCount);
563 log.println(locRes);
564 log.println("Exception was expected");
565 res &= false;
566 } catch(com.sun.star.lang.IndexOutOfBoundsException e) {
567 log.println("expected exception");
568 res &= true;
571 if (xASel != null) {
572 log.println("XAccessibleSelection.selectAllAccessibleChildren()");
573 xASel.selectAllAccessibleChildren();
576 try {
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;
581 res &= locRes;
582 if (!locRes) {
583 log.println("isAccessibleColumnSelected(" + i + "): " + isSel);
584 break;
587 } catch(com.sun.star.lang.IndexOutOfBoundsException e) {
588 log.println("Unexpected exception");
589 e.printStackTrace(log);
590 res &= false;
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:
606 * <ul>
607 * <li> <code>getAccessibleColumnCount()</code> </li>
608 * <li> <code>getAccessibleRowCount()</code> </li>
609 * </ul>
611 public void _getAccessibleCellAt() {
612 requiredMethod("getAccessibleRowCount()");
613 requiredMethod("getAccessibleColumnCount()");
614 boolean res = true;
616 try {
617 log.print("getAccessibleCellAt(-1," + (colCount-1) + "):");
618 xCellAc = oObj.getAccessibleCellAt(-1, colCount - 1);
619 log.println(xCellAc);
620 log.println("Exception was expected");
621 res &= false;
622 } catch(com.sun.star.lang.IndexOutOfBoundsException e) {
623 log.println("expected exception");
624 res &= true;
627 try {
628 log.print("getAccessibleCellAt(" + (rowCount-1) + ",-1):");
629 xCellAc = oObj.getAccessibleCellAt(rowCount - 1, -1);
630 log.println(xCellAc);
631 log.println("Exception was expected");
632 res &= false;
633 } catch(com.sun.star.lang.IndexOutOfBoundsException e) {
634 log.println("expected exception");
635 res &= true;
638 try {
639 log.print("getAccessibleCellAt(0, " + colCount + "):");
640 xCellAc = oObj.getAccessibleCellAt(0, colCount);
641 log.println(xCellAc);
642 log.println("Exception was expected");
643 res &= false;
644 } catch(com.sun.star.lang.IndexOutOfBoundsException e) {
645 log.println("expected exception");
646 res &= true;
649 try {
650 log.print("getAccessibleCellAt(" + rowCount + ",0):");
651 XAccessible xCellAc = oObj.getAccessibleCellAt(rowCount, 0);
652 log.println(xCellAc);
653 log.println("Exception was expected");
654 res &= false;
655 } catch(com.sun.star.lang.IndexOutOfBoundsException e) {
656 log.println("expected exception");
657 res &= true;
660 try {
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);
670 res &= false;
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:
700 * <ul>
701 * <li> <code>getAccessibleColumnCount()</code> </li>
702 * <li> <code>getAccessibleRowCount()</code> </li>
703 * </ul>
705 public void _isAccessibleSelected() {
706 requiredMethod("getAccessibleRowCount()");
707 requiredMethod("getAccessibleColumnCount()");
708 boolean res = true;
709 boolean locRes = true;
711 try {
712 log.print("isAccessibleSelected(-1," + (colCount-1) + "):");
713 locRes = oObj.isAccessibleSelected(-1, colCount - 1);
714 log.println(locRes);
715 log.println("Exception was expected");
716 res &= false;
717 } catch(com.sun.star.lang.IndexOutOfBoundsException e) {
718 log.println("expected exception");
719 res &= true;
722 try {
723 log.print("isAccessibleSelected(" + (rowCount-1) + ",-1):");
724 locRes = oObj.isAccessibleSelected(rowCount - 1, -1);
725 log.println(locRes);
726 log.println("Exception was expected");
727 res &= false;
728 } catch(com.sun.star.lang.IndexOutOfBoundsException e) {
729 log.println("expected exception");
730 res &= true;
733 try {
734 log.print("isAccessibleSelected(0, " + colCount + "):");
735 locRes = oObj.isAccessibleSelected(0, colCount);
736 log.println(locRes);
737 log.println("Exception was expected");
738 res &= false;
739 } catch(com.sun.star.lang.IndexOutOfBoundsException e) {
740 log.println("expected exception");
741 res &= true;
744 try {
745 log.print("isAccessibleSelected(" + rowCount + ",0):");
746 locRes = oObj.isAccessibleSelected(rowCount, 0);
747 log.println(locRes);
748 log.println("Exception was expected");
749 res &= false;
750 } catch(com.sun.star.lang.IndexOutOfBoundsException e) {
751 log.println("expected exception");
752 res &= true;
755 if (xASel != null) {
756 log.println("XAccessibleSelection.selectAllAccessibleChildren()");
757 xASel.selectAllAccessibleChildren();
760 try {
761 log.print("isAccessibleSelected(" + (rowCount-1) + "," +
762 (colCount-1) + "): ");
763 boolean isSel = oObj.isAccessibleSelected(
764 rowCount - 1, colCount - 1);
765 log.println(isSel);
766 locRes = (xASel == null) ? !isSel : isSel ;
767 res &= locRes;
768 } catch(com.sun.star.lang.IndexOutOfBoundsException e) {
769 log.println("Unexpected exception");
770 e.printStackTrace(log);
771 res &= false;
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:
785 * <ul>
786 * <li> <code>getAccessibleCellAt()</code> </li>
787 * </ul>
789 public void _getAccessibleIndex() {
790 executeMethod("getAccessibleCellAt()");
791 boolean res = true;
793 try {
794 log.print("getAccessibleIndex(-1," + (colCount-1) + "):");
795 int indx = oObj.getAccessibleIndex(-1, colCount - 1);
796 log.println(indx);
797 log.println("Exception was expected");
798 res &= false;
799 } catch(com.sun.star.lang.IndexOutOfBoundsException e) {
800 log.println("expected exception");
801 res &= true;
804 try {
805 log.print("getAccessibleIndex(" + (rowCount-1) + ",-1):");
806 int indx = oObj.getAccessibleIndex(rowCount - 1, -1);
807 log.println(indx);
808 log.println("Exception was expected");
809 res &= false;
810 } catch(com.sun.star.lang.IndexOutOfBoundsException e) {
811 log.println("expected exception");
812 res &= true;
815 try {
816 log.print("getAccessibleIndex(0," + colCount + "):");
817 int indx = oObj.getAccessibleIndex(0, colCount);
818 log.println(indx);
819 log.println("Exception was expected");
820 res &= false;
821 } catch(com.sun.star.lang.IndexOutOfBoundsException e) {
822 log.println("expected exception");
823 res &= true;
826 try {
827 log.print("getAccessibleIndex(" + rowCount + ",0):");
828 int indx = oObj.getAccessibleIndex(rowCount, 0);
829 log.println(indx);
830 log.println("Exception was expected");
831 res &= false;
832 } catch(com.sun.star.lang.IndexOutOfBoundsException e) {
833 log.println("expected exception");
834 res &= true;
837 try {
838 log.print("getAccessibleIndex(" + (rowCount-1) + "," +
839 (colCount-1) + "): ");
840 int indx = oObj.getAccessibleIndex(
841 rowCount - 1, colCount - 1);
842 log.println(indx);
843 if (xCellAc != null) {
844 XAccessibleContext xAC = xCellAc.getAccessibleContext();
845 int expIndx = xAC.getAccessibleIndexInParent();
846 log.println("Expected index: " + expIndx);
847 res &= expIndx == indx;
848 } else {
849 res &= true;
851 } catch(com.sun.star.lang.IndexOutOfBoundsException e) {
852 log.println("Unexpected exception");
853 e.printStackTrace(log);
854 res &= false;
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:
870 * <ul>
871 * <li> <code>getAccessibleRowCount()</code> </li>
872 * </ul>
874 public void _getAccessibleRow() {
875 requiredMethod("getAccessibleRowCount()");
876 boolean res = true;
878 if (xACont != null) {
879 int childCount = xACont.getAccessibleChildCount();
880 log.println("accessible child count: " + childCount);
882 try {
883 log.print("getAccessibleRow(" + childCount + "): ");
884 int rowIndx = oObj.getAccessibleRow(childCount);
885 log.println(rowIndx);
886 log.println("Exception was expected");
887 res &= false;
888 } catch(com.sun.star.lang.IndexOutOfBoundsException e) {
889 log.println("expected exception");
890 res &= true;
893 try {
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);
901 res &= false;
905 try {
906 log.print("getAccessibleRow(-1): ");
907 int rowIndx = oObj.getAccessibleRow(-1);
908 log.println(rowIndx);
909 log.println("Exception was expected");
910 res &= false;
911 } catch(com.sun.star.lang.IndexOutOfBoundsException e) {
912 log.println("expected exception");
913 res &= true;
916 try {
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);
924 res &= false;
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:
940 * <ul>
941 * <li> <code>getAccessibleColumnCount()</code> </li>
942 * </ul>
944 public void _getAccessibleColumn() {
945 requiredMethod("getAccessibleColumnCount()");
946 boolean res = true;
948 if (xACont != null) {
949 int childCount = xACont.getAccessibleChildCount();
950 log.println("accessible child count: " + childCount);
952 try {
953 log.print("getAccessibleColumn(" + childCount + "): ");
954 int colIndx = oObj.getAccessibleColumn(childCount);
955 log.println(colIndx);
956 log.println("Exception was expected");
957 res &= false;
958 } catch(com.sun.star.lang.IndexOutOfBoundsException e) {
959 log.println("expected exception");
960 res &= true;
963 try {
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);
971 res &= false;
975 try {
976 log.print("getAccessibleColumn(-1): ");
977 int colIndx = oObj.getAccessibleColumn(-1);
978 log.println(colIndx);
979 log.println("Exception was expected");
980 res &= false;
981 } catch(com.sun.star.lang.IndexOutOfBoundsException e) {
982 log.println("expected exception");
983 res &= true;
986 try {
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);
994 res &= false;
997 tRes.tested("getAccessibleColumn()", res);