bump product version to 5.0.4.1
[LibreOffice.git] / qadevOOo / tests / java / ifc / accessibility / _XAccessibleTable.java
blobee2400f44813c8abc18be970f678ab6556850819
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 @Override
62 protected void before() {
63 xASel = UnoRuntime.queryInterface(XAccessibleSelection.class, oObj);
64 if (xASel == null) {
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);
73 int rowCount = 0;
75 /**
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);
85 int colCount = 0;
87 /**
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);
97 /**
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:
104 * <ul>
105 * <li> <code>getAccessibleRowCount()</code> </li>
106 * </ul>
108 public void _getAccessibleRowDescription() {
109 requiredMethod("getAccessibleRowCount()");
110 boolean res = true;
112 try {
113 log.print("getAccessibleRowDescription(-1): ");
114 String descr = oObj.getAccessibleRowDescription(-1);
115 log.println("'" + descr + "'");
116 log.println("Exception was expected");
117 res &= false;
118 } catch(com.sun.star.lang.IndexOutOfBoundsException e) {
119 log.println("expected exception");
120 res &= true;
123 try {
124 log.print("getAccessibleRowDescription(" + rowCount + "): ");
125 String descr = oObj.getAccessibleRowDescription(rowCount);
126 log.println("'" + descr + "'");
127 log.println("Exception was expected");
128 res &= false;
129 } catch(com.sun.star.lang.IndexOutOfBoundsException e) {
130 log.println("expected exception");
131 res &= true;
134 try {
135 log.print("getAccessibleRowDescription(" + (rowCount - 1) + "): ");
136 String descr =
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);
143 res &= false;
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:
156 * <ul>
157 * <li> <code>getAccessibleColumnCount()</code> </li>
158 * </ul>
160 public void _getAccessibleColumnDescription() {
161 requiredMethod("getAccessibleColumnCount()");
162 boolean res = true;
164 try {
165 log.print("getAccessibleColumnDescription(-1): ");
166 String descr = oObj.getAccessibleColumnDescription(-1);
167 log.println("'" + descr + "'");
168 log.println("Exception was expected");
169 res &= false;
170 } catch(com.sun.star.lang.IndexOutOfBoundsException e) {
171 log.println("expected exception");
172 res &= true;
175 try {
176 log.print("getAccessibleColumnDescription(" + colCount + "): ");
177 String descr = oObj.getAccessibleColumnDescription(colCount);
178 log.println("'" + descr + "'");
179 log.println("Exception was expected");
180 res &= false;
181 } catch(com.sun.star.lang.IndexOutOfBoundsException e) {
182 log.println("expected exception");
183 res &= true;
186 try {
187 log.print("getAccessibleColumnDescription(" + (colCount - 1) + "): ");
188 String descr =
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);
195 res &= false;
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:
209 * <ul>
210 * <li> <code>getAccessibleColumnCount()</code> </li>
211 * <li> <code>getAccessibleRowCount()</code> </li>
212 * </ul>
214 public void _getAccessibleRowExtentAt() {
215 requiredMethod("getAccessibleRowCount()");
216 requiredMethod("getAccessibleColumnCount()");
217 boolean res = true;
219 try {
220 log.print("getAccessibleRowExtentAt(-1," + (colCount-1) + "):");
221 int ext = oObj.getAccessibleRowExtentAt(-1, colCount - 1);
222 log.println(ext);
223 log.println("Exception was expected");
224 res &= false;
225 } catch(com.sun.star.lang.IndexOutOfBoundsException e) {
226 log.println("expected exception");
227 res &= true;
230 try {
231 log.print("getAccessibleRowExtentAt(" + (rowCount-1) + ",-1):");
232 int ext = oObj.getAccessibleRowExtentAt(rowCount - 1, -1);
233 log.println(ext);
234 log.println("Exception was expected");
235 res &= false;
236 } catch(com.sun.star.lang.IndexOutOfBoundsException e) {
237 log.println("expected exception");
238 res &= true;
241 try {
242 log.print("getAccessibleRowExtentAt(0," + colCount + "):");
243 int ext = oObj.getAccessibleRowExtentAt(0, colCount);
244 log.println(ext);
245 log.println("Exception was expected");
246 res &= false;
247 } catch(com.sun.star.lang.IndexOutOfBoundsException e) {
248 log.println("expected exception");
249 res &= true;
252 try {
253 log.print("getAccessibleRowExtentAt(" + rowCount + ",0):");
254 int ext = oObj.getAccessibleRowExtentAt(rowCount, 0);
255 log.println(ext);
256 log.println("Exception was expected");
257 res &= false;
258 } catch(com.sun.star.lang.IndexOutOfBoundsException e) {
259 log.println("expected exception");
260 res &= true;
263 try {
264 log.print("getAccessibleRowExtentAt(" +
265 (rowCount-1) + "," + (colCount-1) + "):");
266 int ext = oObj.getAccessibleRowExtentAt(rowCount-1, colCount - 1);
267 log.println(ext);
268 res &= ext >= 1;
269 } catch(com.sun.star.lang.IndexOutOfBoundsException e) {
270 log.println("Unexpected exception");
271 e.printStackTrace(log);
272 res &= false;
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:
285 * <ul>
286 * <li> <code>getAccessibleColumnCount()</code> </li>
287 * <li> <code>getAccessibleRowCount()</code> </li>
288 * </ul>
290 public void _getAccessibleColumnExtentAt() {
291 requiredMethod("getAccessibleRowCount()");
292 requiredMethod("getAccessibleColumnCount()");
293 boolean res = true;
295 try {
296 log.print("getAccessibleColumnExtentAt(-1," + (colCount-1) + "):");
297 int ext = oObj.getAccessibleColumnExtentAt(-1, colCount - 1);
298 log.println(ext);
299 log.println("Exception was expected");
300 res &= false;
301 } catch(com.sun.star.lang.IndexOutOfBoundsException e) {
302 log.println("expected exception");
303 res &= true;
306 try {
307 log.print("getAccessibleColumnExtentAt(" + (rowCount-1) + ",-1):");
308 int ext = oObj.getAccessibleColumnExtentAt(rowCount - 1, -1);
309 log.println(ext);
310 log.println("Exception was expected");
311 res &= false;
312 } catch(com.sun.star.lang.IndexOutOfBoundsException e) {
313 log.println("expected exception");
314 res &= true;
317 try {
318 log.print("getAccessibleColumnExtentAt(0," + colCount + "):");
319 int ext = oObj.getAccessibleColumnExtentAt(0, colCount);
320 log.println(ext);
321 log.println("Exception was expected");
322 res &= false;
323 } catch(com.sun.star.lang.IndexOutOfBoundsException e) {
324 log.println("expected exception");
325 res &= true;
328 try {
329 log.print("getAccessibleColumnExtentAt(" + rowCount + ",0):");
330 int ext = oObj.getAccessibleColumnExtentAt(rowCount, 0);
331 log.println(ext);
332 log.println("Exception was expected");
333 res &= false;
334 } catch(com.sun.star.lang.IndexOutOfBoundsException e) {
335 log.println("expected exception");
336 res &= true;
339 try {
340 log.print("getAccessibleColumnExtentAt(" +
341 (rowCount-1) + "," + (colCount-1) + "):");
342 int ext = oObj.getAccessibleColumnExtentAt(rowCount-1,colCount - 1);
343 log.println(ext);
344 res &= ext >= 1;
345 } catch(com.sun.star.lang.IndexOutOfBoundsException e) {
346 log.println("Unexpected exception");
347 e.printStackTrace(log);
348 res &= false;
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:
380 * <ul>
381 * <li> <code>getAccessibleRowCount()</code> </li>
382 * </ul>
384 public void _getSelectedAccessibleRows() {
385 requiredMethod("getAccessibleRowCount()");
386 boolean res = true;
387 boolean locRes = true;
388 int selRows[] = null;
390 if (xASel != 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);
398 if (xASel != null) {
399 res &= selRows.length == rowCount;
400 } else {
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];
411 res &= locRes;
412 if (!locRes) {
413 log.println("Element #" + i + ":" + selRows[i] +
414 " is less than element #" + (i-1) + ": " +
415 selRows[i-1]);
416 break;
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:
429 * <ul>
430 * <li> <code>getAccessibleColumnCount()</code> </li>
431 * </ul>
433 public void _getSelectedAccessibleColumns() {
434 requiredMethod("getAccessibleColumnCount()");
435 boolean res = true;
436 boolean locRes = true;
437 int selCols[] = null;
439 if (xASel != 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);
448 if (xASel != null) {
449 res &= selCols.length == colCount;
450 } else {
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];
461 res &= locRes;
462 if (!locRes) {
463 log.println("Element #" + i + ":" + selCols[i] +
464 " is less than element #" + (i-1) + ": " +
465 selCols[i-1]);
466 break;
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:
479 * <ul>
480 * <li> <code>getAccessibleRowCount()</code> </li>
481 * </ul>
483 public void _isAccessibleRowSelected() {
484 requiredMethod("getAccessibleRowCount()");
485 boolean res = true;
486 boolean locRes = true;
488 try {
489 log.print("isAccessibleRowSelected(-1): ");
490 locRes = oObj.isAccessibleRowSelected(-1);
491 log.println(locRes);
492 log.println("Exception was expected");
493 res &= false;
494 } catch(com.sun.star.lang.IndexOutOfBoundsException e) {
495 log.println("expected exception");
496 res &= true;
499 try {
500 log.print("isAccessibleRowSelected(" + rowCount + "): ");
501 locRes = oObj.isAccessibleRowSelected(rowCount);
502 log.println(locRes);
503 log.println("Exception was expected");
504 res &= false;
505 } catch(com.sun.star.lang.IndexOutOfBoundsException e) {
506 log.println("expected exception");
507 res &= true;
510 if (xASel != null) {
511 log.println("XAccessibleSelection.selectAllAccessibleChildren()");
512 xASel.selectAllAccessibleChildren();
515 try {
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;
520 res &= locRes;
521 if (!locRes) {
522 log.println("isAccessibleRowSelected(" + i + "): " + isSel);
523 break;
526 } catch(com.sun.star.lang.IndexOutOfBoundsException e) {
527 log.println("Unexpected exception");
528 e.printStackTrace(log);
529 res &= false;
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:
541 * <ul>
542 * <li> <code>getAccessibleRowCount()</code> </li>
543 * </ul>
545 public void _isAccessibleColumnSelected() {
546 requiredMethod("getAccessibleColumnCount()");
547 boolean res = true;
548 boolean locRes = true;
550 try {
551 log.print("isAccessibleColumnSelected(-1): ");
552 locRes = oObj.isAccessibleColumnSelected(-1);
553 log.println(locRes);
554 log.println("Exception was expected");
555 res &= false;
556 } catch(com.sun.star.lang.IndexOutOfBoundsException e) {
557 log.println("expected exception");
558 res &= true;
561 try {
562 log.print("isAccessibleColumnSelected(" + colCount + "): ");
563 locRes = oObj.isAccessibleColumnSelected(colCount);
564 log.println(locRes);
565 log.println("Exception was expected");
566 res &= false;
567 } catch(com.sun.star.lang.IndexOutOfBoundsException e) {
568 log.println("expected exception");
569 res &= true;
572 if (xASel != null) {
573 log.println("XAccessibleSelection.selectAllAccessibleChildren()");
574 xASel.selectAllAccessibleChildren();
577 try {
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;
582 res &= locRes;
583 if (!locRes) {
584 log.println("isAccessibleColumnSelected(" + i + "): " + isSel);
585 break;
588 } catch(com.sun.star.lang.IndexOutOfBoundsException e) {
589 log.println("Unexpected exception");
590 e.printStackTrace(log);
591 res &= false;
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:
607 * <ul>
608 * <li> <code>getAccessibleColumnCount()</code> </li>
609 * <li> <code>getAccessibleRowCount()</code> </li>
610 * </ul>
612 public void _getAccessibleCellAt() {
613 requiredMethod("getAccessibleRowCount()");
614 requiredMethod("getAccessibleColumnCount()");
615 boolean res = true;
617 try {
618 log.print("getAccessibleCellAt(-1," + (colCount-1) + "):");
619 xCellAc = oObj.getAccessibleCellAt(-1, colCount - 1);
620 log.println(xCellAc);
621 log.println("Exception was expected");
622 res &= false;
623 } catch(com.sun.star.lang.IndexOutOfBoundsException e) {
624 log.println("expected exception");
625 res &= true;
628 try {
629 log.print("getAccessibleCellAt(" + (rowCount-1) + ",-1):");
630 xCellAc = oObj.getAccessibleCellAt(rowCount - 1, -1);
631 log.println(xCellAc);
632 log.println("Exception was expected");
633 res &= false;
634 } catch(com.sun.star.lang.IndexOutOfBoundsException e) {
635 log.println("expected exception");
636 res &= true;
639 try {
640 log.print("getAccessibleCellAt(0, " + colCount + "):");
641 xCellAc = oObj.getAccessibleCellAt(0, colCount);
642 log.println(xCellAc);
643 log.println("Exception was expected");
644 res &= false;
645 } catch(com.sun.star.lang.IndexOutOfBoundsException e) {
646 log.println("expected exception");
647 res &= true;
650 try {
651 log.print("getAccessibleCellAt(" + rowCount + ",0):");
652 XAccessible xCellAc = oObj.getAccessibleCellAt(rowCount, 0);
653 log.println(xCellAc);
654 log.println("Exception was expected");
655 res &= false;
656 } catch(com.sun.star.lang.IndexOutOfBoundsException e) {
657 log.println("expected exception");
658 res &= true;
661 try {
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);
671 res &= false;
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:
701 * <ul>
702 * <li> <code>getAccessibleColumnCount()</code> </li>
703 * <li> <code>getAccessibleRowCount()</code> </li>
704 * </ul>
706 public void _isAccessibleSelected() {
707 requiredMethod("getAccessibleRowCount()");
708 requiredMethod("getAccessibleColumnCount()");
709 boolean res = true;
710 boolean locRes = true;
712 try {
713 log.print("isAccessibleSelected(-1," + (colCount-1) + "):");
714 locRes = oObj.isAccessibleSelected(-1, colCount - 1);
715 log.println(locRes);
716 log.println("Exception was expected");
717 res &= false;
718 } catch(com.sun.star.lang.IndexOutOfBoundsException e) {
719 log.println("expected exception");
720 res &= true;
723 try {
724 log.print("isAccessibleSelected(" + (rowCount-1) + ",-1):");
725 locRes = oObj.isAccessibleSelected(rowCount - 1, -1);
726 log.println(locRes);
727 log.println("Exception was expected");
728 res &= false;
729 } catch(com.sun.star.lang.IndexOutOfBoundsException e) {
730 log.println("expected exception");
731 res &= true;
734 try {
735 log.print("isAccessibleSelected(0, " + colCount + "):");
736 locRes = oObj.isAccessibleSelected(0, colCount);
737 log.println(locRes);
738 log.println("Exception was expected");
739 res &= false;
740 } catch(com.sun.star.lang.IndexOutOfBoundsException e) {
741 log.println("expected exception");
742 res &= true;
745 try {
746 log.print("isAccessibleSelected(" + rowCount + ",0):");
747 locRes = oObj.isAccessibleSelected(rowCount, 0);
748 log.println(locRes);
749 log.println("Exception was expected");
750 res &= false;
751 } catch(com.sun.star.lang.IndexOutOfBoundsException e) {
752 log.println("expected exception");
753 res &= true;
756 if (xASel != null) {
757 log.println("XAccessibleSelection.selectAllAccessibleChildren()");
758 xASel.selectAllAccessibleChildren();
761 try {
762 log.print("isAccessibleSelected(" + (rowCount-1) + "," +
763 (colCount-1) + "): ");
764 boolean isSel = oObj.isAccessibleSelected(
765 rowCount - 1, colCount - 1);
766 log.println(isSel);
767 locRes = (xASel == null) ? !isSel : isSel ;
768 res &= locRes;
769 } catch(com.sun.star.lang.IndexOutOfBoundsException e) {
770 log.println("Unexpected exception");
771 e.printStackTrace(log);
772 res &= false;
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:
786 * <ul>
787 * <li> <code>getAccessibleCellAt()</code> </li>
788 * </ul>
790 public void _getAccessibleIndex() {
791 executeMethod("getAccessibleCellAt()");
792 boolean res = true;
794 try {
795 log.print("getAccessibleIndex(-1," + (colCount-1) + "):");
796 int indx = oObj.getAccessibleIndex(-1, colCount - 1);
797 log.println(indx);
798 log.println("Exception was expected");
799 res &= false;
800 } catch(com.sun.star.lang.IndexOutOfBoundsException e) {
801 log.println("expected exception");
802 res &= true;
805 try {
806 log.print("getAccessibleIndex(" + (rowCount-1) + ",-1):");
807 int indx = oObj.getAccessibleIndex(rowCount - 1, -1);
808 log.println(indx);
809 log.println("Exception was expected");
810 res &= false;
811 } catch(com.sun.star.lang.IndexOutOfBoundsException e) {
812 log.println("expected exception");
813 res &= true;
816 try {
817 log.print("getAccessibleIndex(0," + colCount + "):");
818 int indx = oObj.getAccessibleIndex(0, colCount);
819 log.println(indx);
820 log.println("Exception was expected");
821 res &= false;
822 } catch(com.sun.star.lang.IndexOutOfBoundsException e) {
823 log.println("expected exception");
824 res &= true;
827 try {
828 log.print("getAccessibleIndex(" + rowCount + ",0):");
829 int indx = oObj.getAccessibleIndex(rowCount, 0);
830 log.println(indx);
831 log.println("Exception was expected");
832 res &= false;
833 } catch(com.sun.star.lang.IndexOutOfBoundsException e) {
834 log.println("expected exception");
835 res &= true;
838 try {
839 log.print("getAccessibleIndex(" + (rowCount-1) + "," +
840 (colCount-1) + "): ");
841 int indx = oObj.getAccessibleIndex(
842 rowCount - 1, colCount - 1);
843 log.println(indx);
844 if (xCellAc != null) {
845 XAccessibleContext xAC = xCellAc.getAccessibleContext();
846 int expIndx = xAC.getAccessibleIndexInParent();
847 log.println("Expected index: " + expIndx);
848 res &= expIndx == indx;
849 } else {
850 res &= true;
852 } catch(com.sun.star.lang.IndexOutOfBoundsException e) {
853 log.println("Unexpected exception");
854 e.printStackTrace(log);
855 res &= false;
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:
871 * <ul>
872 * <li> <code>getAccessibleRowCount()</code> </li>
873 * </ul>
875 public void _getAccessibleRow() {
876 requiredMethod("getAccessibleRowCount()");
877 boolean res = true;
879 if (xACont != null) {
880 int childCount = xACont.getAccessibleChildCount();
881 log.println("accessible child count: " + childCount);
883 try {
884 log.print("getAccessibleRow(" + childCount + "): ");
885 int rowIndx = oObj.getAccessibleRow(childCount);
886 log.println(rowIndx);
887 log.println("Exception was expected");
888 res &= false;
889 } catch(com.sun.star.lang.IndexOutOfBoundsException e) {
890 log.println("expected exception");
891 res &= true;
894 try {
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);
902 res &= false;
906 try {
907 log.print("getAccessibleRow(-1): ");
908 int rowIndx = oObj.getAccessibleRow(-1);
909 log.println(rowIndx);
910 log.println("Exception was expected");
911 res &= false;
912 } catch(com.sun.star.lang.IndexOutOfBoundsException e) {
913 log.println("expected exception");
914 res &= true;
917 try {
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);
925 res &= false;
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:
941 * <ul>
942 * <li> <code>getAccessibleColumnCount()</code> </li>
943 * </ul>
945 public void _getAccessibleColumn() {
946 requiredMethod("getAccessibleColumnCount()");
947 boolean res = true;
949 if (xACont != null) {
950 int childCount = xACont.getAccessibleChildCount();
951 log.println("accessible child count: " + childCount);
953 try {
954 log.print("getAccessibleColumn(" + childCount + "): ");
955 int colIndx = oObj.getAccessibleColumn(childCount);
956 log.println(colIndx);
957 log.println("Exception was expected");
958 res &= false;
959 } catch(com.sun.star.lang.IndexOutOfBoundsException e) {
960 log.println("expected exception");
961 res &= true;
964 try {
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);
972 res &= false;
976 try {
977 log.print("getAccessibleColumn(-1): ");
978 int colIndx = oObj.getAccessibleColumn(-1);
979 log.println(colIndx);
980 log.println("Exception was expected");
981 res &= false;
982 } catch(com.sun.star.lang.IndexOutOfBoundsException e) {
983 log.println("expected exception");
984 res &= true;
987 try {
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);
995 res &= false;
998 tRes.tested("getAccessibleColumn()", res);