tdf#130857 qt weld: Implement QtInstanceWidget::strip_mnemonic
[LibreOffice.git] / qadevOOo / tests / java / ifc / accessibility / _XAccessibleTable.java
blob2e66b430685015000d4ce37e910cfa5f0a7b24f4
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 long 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 long 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 long 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 long 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 long indx = oObj.getAccessibleIndex(rowCount - 1, colCount - 1);
842 log.println(indx);
843 if (xCellAc != null) {
844 XAccessibleContext xAC = xCellAc.getAccessibleContext();
845 long 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 long 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 long 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);