1*ef39d40dSAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3*ef39d40dSAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*ef39d40dSAndrew Rist * or more contributor license agreements. See the NOTICE file 5*ef39d40dSAndrew Rist * distributed with this work for additional information 6*ef39d40dSAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*ef39d40dSAndrew Rist * to you under the Apache License, Version 2.0 (the 8*ef39d40dSAndrew Rist * "License"); you may not use this file except in compliance 9*ef39d40dSAndrew Rist * with the License. You may obtain a copy of the License at 10*ef39d40dSAndrew Rist * 11*ef39d40dSAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12*ef39d40dSAndrew Rist * 13*ef39d40dSAndrew Rist * Unless required by applicable law or agreed to in writing, 14*ef39d40dSAndrew Rist * software distributed under the License is distributed on an 15*ef39d40dSAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*ef39d40dSAndrew Rist * KIND, either express or implied. See the License for the 17*ef39d40dSAndrew Rist * specific language governing permissions and limitations 18*ef39d40dSAndrew Rist * under the License. 19*ef39d40dSAndrew Rist * 20*ef39d40dSAndrew Rist *************************************************************/ 21*ef39d40dSAndrew Rist 22*ef39d40dSAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir package ifc.accessibility; 25cdf0e10cSrcweir 26cdf0e10cSrcweir import lib.MultiMethodTest; 27cdf0e10cSrcweir 28cdf0e10cSrcweir import com.sun.star.accessibility.XAccessible; 29cdf0e10cSrcweir import com.sun.star.accessibility.XAccessibleContext; 30cdf0e10cSrcweir import com.sun.star.accessibility.XAccessibleSelection; 31cdf0e10cSrcweir import com.sun.star.accessibility.XAccessibleTable; 32cdf0e10cSrcweir import com.sun.star.uno.UnoRuntime; 33cdf0e10cSrcweir 34cdf0e10cSrcweir /** 35cdf0e10cSrcweir * Testing <code>com.sun.star.accessibility.XAccessibleTable</code> 36cdf0e10cSrcweir * interface methods : 37cdf0e10cSrcweir * <ul> 38cdf0e10cSrcweir * <li><code>getAccessibleRowCount()</code></li> 39cdf0e10cSrcweir * <li><code>getAccessibleColumnCount()</code></li> 40cdf0e10cSrcweir * <li><code>getAccessibleRowDescription()</code></li> 41cdf0e10cSrcweir * <li><code>getAccessibleColumnDescription()</code></li> 42cdf0e10cSrcweir * <li><code>getAccessibleRowExtentAt()</code></li> 43cdf0e10cSrcweir * <li><code>getAccessibleColumnExtentAt()</code></li> 44cdf0e10cSrcweir * <li><code>getAccessibleRowHeaders()</code></li> 45cdf0e10cSrcweir * <li><code>getAccessibleColumnHeaders()</code></li> 46cdf0e10cSrcweir * <li><code>getSelectedAccessibleRows()</code></li> 47cdf0e10cSrcweir * <li><code>getSelectedAccessibleColumns()</code></li> 48cdf0e10cSrcweir * <li><code>isAccessibleRowSelected()</code></li> 49cdf0e10cSrcweir * <li><code>isAccessibleColumnSelected()</code></li> 50cdf0e10cSrcweir * <li><code>getAccessibleCellAt()</code></li> 51cdf0e10cSrcweir * <li><code>getAccessibleCaption()</code></li> 52cdf0e10cSrcweir * <li><code>getAccessibleSummary()</code></li> 53cdf0e10cSrcweir * <li><code>isAccessibleSelected()</code></li> 54cdf0e10cSrcweir * <li><code>getAccessibleIndex()</code></li> 55cdf0e10cSrcweir * <li><code>getAccessibleRow()</code></li> 56cdf0e10cSrcweir * <li><code>getAccessibleColumn()</code></li> 57cdf0e10cSrcweir * </ul> <p> 58cdf0e10cSrcweir * @see com.sun.star.accessibility.XAccessibleTable 59cdf0e10cSrcweir */ 60cdf0e10cSrcweir public class _XAccessibleTable extends MultiMethodTest { 61cdf0e10cSrcweir 62cdf0e10cSrcweir public XAccessibleTable oObj = null; 63cdf0e10cSrcweir XAccessibleSelection xASel = null; 64cdf0e10cSrcweir XAccessibleContext xACont = null; 65cdf0e10cSrcweir before()66cdf0e10cSrcweir protected void before() { 67cdf0e10cSrcweir xASel = (XAccessibleSelection) 68cdf0e10cSrcweir UnoRuntime.queryInterface(XAccessibleSelection.class, oObj); 69cdf0e10cSrcweir if (xASel == null) { 70cdf0e10cSrcweir log.println("The component doesn't implement the interface " + 71cdf0e10cSrcweir "XAccessibleSelection."); 72cdf0e10cSrcweir log.println("This interface is required for more detailed tests."); 73cdf0e10cSrcweir } 74cdf0e10cSrcweir 75cdf0e10cSrcweir xACont = (XAccessibleContext) 76cdf0e10cSrcweir UnoRuntime.queryInterface(XAccessibleContext.class, oObj); 77cdf0e10cSrcweir } 78cdf0e10cSrcweir 79cdf0e10cSrcweir int rowCount = 0; 80cdf0e10cSrcweir 81cdf0e10cSrcweir /** 82cdf0e10cSrcweir * Calls the method and stores the returned value to the variable 83cdf0e10cSrcweir * <code>rowCount</code>. 84cdf0e10cSrcweir */ _getAccessibleRowCount()85cdf0e10cSrcweir public void _getAccessibleRowCount() { 86cdf0e10cSrcweir rowCount = oObj.getAccessibleRowCount(); 87cdf0e10cSrcweir log.println("Accessible row count: " + rowCount); 88cdf0e10cSrcweir tRes.tested("getAccessibleRowCount()", true); 89cdf0e10cSrcweir } 90cdf0e10cSrcweir 91cdf0e10cSrcweir int colCount = 0; 92cdf0e10cSrcweir 93cdf0e10cSrcweir /** 94cdf0e10cSrcweir * Calls the method and stores the returned value to the variable 95cdf0e10cSrcweir * <code>colCount</code>. 96cdf0e10cSrcweir */ _getAccessibleColumnCount()97cdf0e10cSrcweir public void _getAccessibleColumnCount() { 98cdf0e10cSrcweir colCount = oObj.getAccessibleColumnCount(); 99cdf0e10cSrcweir log.println("Accessible column count: " + colCount); 100cdf0e10cSrcweir tRes.tested("getAccessibleColumnCount()", true); 101cdf0e10cSrcweir } 102cdf0e10cSrcweir 103cdf0e10cSrcweir /** 104cdf0e10cSrcweir * Calls the method with the wrong indexes and with the correct index, 105cdf0e10cSrcweir * checks a returned value. 106cdf0e10cSrcweir * Has OK status if exceptions were thrown for the wrong indexes, 107cdf0e10cSrcweir * if exception wasn't thrown for the correct index and 108cdf0e10cSrcweir * if returned value isn't <code>null</code>. 109cdf0e10cSrcweir * The following method tests are to be executed before: 110cdf0e10cSrcweir * <ul> 111cdf0e10cSrcweir * <li> <code>getAccessibleRowCount()</code> </li> 112cdf0e10cSrcweir * </ul> 113cdf0e10cSrcweir */ _getAccessibleRowDescription()114cdf0e10cSrcweir public void _getAccessibleRowDescription() { 115cdf0e10cSrcweir requiredMethod("getAccessibleRowCount()"); 116cdf0e10cSrcweir boolean res = true; 117cdf0e10cSrcweir 118cdf0e10cSrcweir try { 119cdf0e10cSrcweir log.print("getAccessibleRowDescription(-1): "); 120cdf0e10cSrcweir String descr = oObj.getAccessibleRowDescription(-1); 121cdf0e10cSrcweir log.println("'" + descr + "'"); 122cdf0e10cSrcweir log.println("Exception was expected"); 123cdf0e10cSrcweir res &= false; 124cdf0e10cSrcweir } catch(com.sun.star.lang.IndexOutOfBoundsException e) { 125cdf0e10cSrcweir log.println("expected exception"); 126cdf0e10cSrcweir res &= true; 127cdf0e10cSrcweir } 128cdf0e10cSrcweir 129cdf0e10cSrcweir try { 130cdf0e10cSrcweir log.print("getAccessibleRowDescription(" + rowCount + "): "); 131cdf0e10cSrcweir String descr = oObj.getAccessibleRowDescription(rowCount); 132cdf0e10cSrcweir log.println("'" + descr + "'"); 133cdf0e10cSrcweir log.println("Exception was expected"); 134cdf0e10cSrcweir res &= false; 135cdf0e10cSrcweir } catch(com.sun.star.lang.IndexOutOfBoundsException e) { 136cdf0e10cSrcweir log.println("expected exception"); 137cdf0e10cSrcweir res &= true; 138cdf0e10cSrcweir } 139cdf0e10cSrcweir 140cdf0e10cSrcweir try { 141cdf0e10cSrcweir log.print("getAccessibleRowDescription(" + (rowCount - 1) + "): "); 142cdf0e10cSrcweir String descr = 143cdf0e10cSrcweir oObj.getAccessibleRowDescription(rowCount - 1); 144cdf0e10cSrcweir res &= descr != null; 145cdf0e10cSrcweir log.println("'" + descr + "'"); 146cdf0e10cSrcweir } catch(com.sun.star.lang.IndexOutOfBoundsException e) { 147cdf0e10cSrcweir log.println("Unexpected exception"); 148cdf0e10cSrcweir e.printStackTrace(log); 149cdf0e10cSrcweir res &= false; 150cdf0e10cSrcweir } 151cdf0e10cSrcweir 152cdf0e10cSrcweir tRes.tested("getAccessibleRowDescription()", res); 153cdf0e10cSrcweir } 154cdf0e10cSrcweir 155cdf0e10cSrcweir /** 156cdf0e10cSrcweir * Calls the method with the wrong indexes and with the correct index, 157cdf0e10cSrcweir * checks a returned value. 158cdf0e10cSrcweir * Has OK status if exceptions were thrown for the wrong indexes, 159cdf0e10cSrcweir * if exception wasn't thrown for the correct index and 160cdf0e10cSrcweir * if returned value isn't <code>null</code>. 161cdf0e10cSrcweir * The following method tests are to be executed before: 162cdf0e10cSrcweir * <ul> 163cdf0e10cSrcweir * <li> <code>getAccessibleColumnCount()</code> </li> 164cdf0e10cSrcweir * </ul> 165cdf0e10cSrcweir */ _getAccessibleColumnDescription()166cdf0e10cSrcweir public void _getAccessibleColumnDescription() { 167cdf0e10cSrcweir requiredMethod("getAccessibleColumnCount()"); 168cdf0e10cSrcweir boolean res = true; 169cdf0e10cSrcweir 170cdf0e10cSrcweir try { 171cdf0e10cSrcweir log.print("getAccessibleColumnDescription(-1): "); 172cdf0e10cSrcweir String descr = oObj.getAccessibleColumnDescription(-1); 173cdf0e10cSrcweir log.println("'" + descr + "'"); 174cdf0e10cSrcweir log.println("Exception was expected"); 175cdf0e10cSrcweir res &= false; 176cdf0e10cSrcweir } catch(com.sun.star.lang.IndexOutOfBoundsException e) { 177cdf0e10cSrcweir log.println("expected exception"); 178cdf0e10cSrcweir res &= true; 179cdf0e10cSrcweir } 180cdf0e10cSrcweir 181cdf0e10cSrcweir try { 182cdf0e10cSrcweir log.print("getAccessibleColumnDescription(" + colCount + "): "); 183cdf0e10cSrcweir String descr = oObj.getAccessibleColumnDescription(colCount); 184cdf0e10cSrcweir log.println("'" + descr + "'"); 185cdf0e10cSrcweir log.println("Exception was expected"); 186cdf0e10cSrcweir res &= false; 187cdf0e10cSrcweir } catch(com.sun.star.lang.IndexOutOfBoundsException e) { 188cdf0e10cSrcweir log.println("expected exception"); 189cdf0e10cSrcweir res &= true; 190cdf0e10cSrcweir } 191cdf0e10cSrcweir 192cdf0e10cSrcweir try { 193cdf0e10cSrcweir log.print("getAccessibleColumnDescription(" + (colCount - 1) + "): "); 194cdf0e10cSrcweir String descr = 195cdf0e10cSrcweir oObj.getAccessibleColumnDescription(colCount - 1); 196cdf0e10cSrcweir res &= descr != null; 197cdf0e10cSrcweir log.println("'" + descr + "'"); 198cdf0e10cSrcweir } catch(com.sun.star.lang.IndexOutOfBoundsException e) { 199cdf0e10cSrcweir log.println("Unexpected exception"); 200cdf0e10cSrcweir e.printStackTrace(log); 201cdf0e10cSrcweir res &= false; 202cdf0e10cSrcweir } 203cdf0e10cSrcweir 204cdf0e10cSrcweir tRes.tested("getAccessibleColumnDescription()", res); 205cdf0e10cSrcweir } 206cdf0e10cSrcweir 207cdf0e10cSrcweir 208cdf0e10cSrcweir /** 209cdf0e10cSrcweir * Calls the method with the wrong parameters and with the correct 210cdf0e10cSrcweir * parameters, checks a returned value. 211cdf0e10cSrcweir * Has OK status if exceptions were thrown for the wrong indexes, 212cdf0e10cSrcweir * if exception wasn't thrown for the correct index and 213cdf0e10cSrcweir * if returned value is greater than or is equal to 1. 214cdf0e10cSrcweir * The following method tests are to be executed before: 215cdf0e10cSrcweir * <ul> 216cdf0e10cSrcweir * <li> <code>getAccessibleColumnCount()</code> </li> 217cdf0e10cSrcweir * <li> <code>getAccessibleRowCount()</code> </li> 218cdf0e10cSrcweir * </ul> 219cdf0e10cSrcweir */ _getAccessibleRowExtentAt()220cdf0e10cSrcweir public void _getAccessibleRowExtentAt() { 221cdf0e10cSrcweir requiredMethod("getAccessibleRowCount()"); 222cdf0e10cSrcweir requiredMethod("getAccessibleColumnCount()"); 223cdf0e10cSrcweir boolean res = true; 224cdf0e10cSrcweir 225cdf0e10cSrcweir try { 226cdf0e10cSrcweir log.print("getAccessibleRowExtentAt(-1," + (colCount-1) + "):"); 227cdf0e10cSrcweir int ext = oObj.getAccessibleRowExtentAt(-1, colCount - 1); 228cdf0e10cSrcweir log.println(ext); 229cdf0e10cSrcweir log.println("Exception was expected"); 230cdf0e10cSrcweir res &= false; 231cdf0e10cSrcweir } catch(com.sun.star.lang.IndexOutOfBoundsException e) { 232cdf0e10cSrcweir log.println("expected exception"); 233cdf0e10cSrcweir res &= true; 234cdf0e10cSrcweir } 235cdf0e10cSrcweir 236cdf0e10cSrcweir try { 237cdf0e10cSrcweir log.print("getAccessibleRowExtentAt(" + (rowCount-1) + ",-1):"); 238cdf0e10cSrcweir int ext = oObj.getAccessibleRowExtentAt(rowCount - 1, -1); 239cdf0e10cSrcweir log.println(ext); 240cdf0e10cSrcweir log.println("Exception was expected"); 241cdf0e10cSrcweir res &= false; 242cdf0e10cSrcweir } catch(com.sun.star.lang.IndexOutOfBoundsException e) { 243cdf0e10cSrcweir log.println("expected exception"); 244cdf0e10cSrcweir res &= true; 245cdf0e10cSrcweir } 246cdf0e10cSrcweir 247cdf0e10cSrcweir try { 248cdf0e10cSrcweir log.print("getAccessibleRowExtentAt(0," + colCount + "):"); 249cdf0e10cSrcweir int ext = oObj.getAccessibleRowExtentAt(0, colCount); 250cdf0e10cSrcweir log.println(ext); 251cdf0e10cSrcweir log.println("Exception was expected"); 252cdf0e10cSrcweir res &= false; 253cdf0e10cSrcweir } catch(com.sun.star.lang.IndexOutOfBoundsException e) { 254cdf0e10cSrcweir log.println("expected exception"); 255cdf0e10cSrcweir res &= true; 256cdf0e10cSrcweir } 257cdf0e10cSrcweir 258cdf0e10cSrcweir try { 259cdf0e10cSrcweir log.print("getAccessibleRowExtentAt(" + rowCount + ",0):"); 260cdf0e10cSrcweir int ext = oObj.getAccessibleRowExtentAt(rowCount, 0); 261cdf0e10cSrcweir log.println(ext); 262cdf0e10cSrcweir log.println("Exception was expected"); 263cdf0e10cSrcweir res &= false; 264cdf0e10cSrcweir } catch(com.sun.star.lang.IndexOutOfBoundsException e) { 265cdf0e10cSrcweir log.println("expected exception"); 266cdf0e10cSrcweir res &= true; 267cdf0e10cSrcweir } 268cdf0e10cSrcweir 269cdf0e10cSrcweir try { 270cdf0e10cSrcweir log.print("getAccessibleRowExtentAt(" + 271cdf0e10cSrcweir (rowCount-1) + "," + (colCount-1) + "):"); 272cdf0e10cSrcweir int ext = oObj.getAccessibleRowExtentAt(rowCount-1, colCount - 1); 273cdf0e10cSrcweir log.println(ext); 274cdf0e10cSrcweir res &= ext >= 1; 275cdf0e10cSrcweir } catch(com.sun.star.lang.IndexOutOfBoundsException e) { 276cdf0e10cSrcweir log.println("Unexpected exception"); 277cdf0e10cSrcweir e.printStackTrace(log); 278cdf0e10cSrcweir res &= false; 279cdf0e10cSrcweir } 280cdf0e10cSrcweir 281cdf0e10cSrcweir tRes.tested("getAccessibleRowExtentAt()", res); 282cdf0e10cSrcweir } 283cdf0e10cSrcweir 284cdf0e10cSrcweir /** 285cdf0e10cSrcweir * Calls the method with the wrong parameters and with the correct 286cdf0e10cSrcweir * parameters, checks a returned value. 287cdf0e10cSrcweir * Has OK status if exceptions were thrown for the wrong indexes, 288cdf0e10cSrcweir * if exception wasn't thrown for the correct index and 289cdf0e10cSrcweir * if returned value is greater than or is equal to 1. 290cdf0e10cSrcweir * The following method tests are to be executed before: 291cdf0e10cSrcweir * <ul> 292cdf0e10cSrcweir * <li> <code>getAccessibleColumnCount()</code> </li> 293cdf0e10cSrcweir * <li> <code>getAccessibleRowCount()</code> </li> 294cdf0e10cSrcweir * </ul> 295cdf0e10cSrcweir */ _getAccessibleColumnExtentAt()296cdf0e10cSrcweir public void _getAccessibleColumnExtentAt() { 297cdf0e10cSrcweir requiredMethod("getAccessibleRowCount()"); 298cdf0e10cSrcweir requiredMethod("getAccessibleColumnCount()"); 299cdf0e10cSrcweir boolean res = true; 300cdf0e10cSrcweir 301cdf0e10cSrcweir try { 302cdf0e10cSrcweir log.print("getAccessibleColumnExtentAt(-1," + (colCount-1) + "):"); 303cdf0e10cSrcweir int ext = oObj.getAccessibleColumnExtentAt(-1, colCount - 1); 304cdf0e10cSrcweir log.println(ext); 305cdf0e10cSrcweir log.println("Exception was expected"); 306cdf0e10cSrcweir res &= false; 307cdf0e10cSrcweir } catch(com.sun.star.lang.IndexOutOfBoundsException e) { 308cdf0e10cSrcweir log.println("expected exception"); 309cdf0e10cSrcweir res &= true; 310cdf0e10cSrcweir } 311cdf0e10cSrcweir 312cdf0e10cSrcweir try { 313cdf0e10cSrcweir log.print("getAccessibleColumnExtentAt(" + (rowCount-1) + ",-1):"); 314cdf0e10cSrcweir int ext = oObj.getAccessibleColumnExtentAt(rowCount - 1, -1); 315cdf0e10cSrcweir log.println(ext); 316cdf0e10cSrcweir log.println("Exception was expected"); 317cdf0e10cSrcweir res &= false; 318cdf0e10cSrcweir } catch(com.sun.star.lang.IndexOutOfBoundsException e) { 319cdf0e10cSrcweir log.println("expected exception"); 320cdf0e10cSrcweir res &= true; 321cdf0e10cSrcweir } 322cdf0e10cSrcweir 323cdf0e10cSrcweir try { 324cdf0e10cSrcweir log.print("getAccessibleColumnExtentAt(0," + colCount + "):"); 325cdf0e10cSrcweir int ext = oObj.getAccessibleColumnExtentAt(0, colCount); 326cdf0e10cSrcweir log.println(ext); 327cdf0e10cSrcweir log.println("Exception was expected"); 328cdf0e10cSrcweir res &= false; 329cdf0e10cSrcweir } catch(com.sun.star.lang.IndexOutOfBoundsException e) { 330cdf0e10cSrcweir log.println("expected exception"); 331cdf0e10cSrcweir res &= true; 332cdf0e10cSrcweir } 333cdf0e10cSrcweir 334cdf0e10cSrcweir try { 335cdf0e10cSrcweir log.print("getAccessibleColumnExtentAt(" + rowCount + ",0):"); 336cdf0e10cSrcweir int ext = oObj.getAccessibleColumnExtentAt(rowCount, 0); 337cdf0e10cSrcweir log.println(ext); 338cdf0e10cSrcweir log.println("Exception was expected"); 339cdf0e10cSrcweir res &= false; 340cdf0e10cSrcweir } catch(com.sun.star.lang.IndexOutOfBoundsException e) { 341cdf0e10cSrcweir log.println("expected exception"); 342cdf0e10cSrcweir res &= true; 343cdf0e10cSrcweir } 344cdf0e10cSrcweir 345cdf0e10cSrcweir try { 346cdf0e10cSrcweir log.print("getAccessibleColumnExtentAt(" + 347cdf0e10cSrcweir (rowCount-1) + "," + (colCount-1) + "):"); 348cdf0e10cSrcweir int ext = oObj.getAccessibleColumnExtentAt(rowCount-1,colCount - 1); 349cdf0e10cSrcweir log.println(ext); 350cdf0e10cSrcweir res &= ext >= 1; 351cdf0e10cSrcweir } catch(com.sun.star.lang.IndexOutOfBoundsException e) { 352cdf0e10cSrcweir log.println("Unexpected exception"); 353cdf0e10cSrcweir e.printStackTrace(log); 354cdf0e10cSrcweir res &= false; 355cdf0e10cSrcweir } 356cdf0e10cSrcweir 357cdf0e10cSrcweir tRes.tested("getAccessibleColumnExtentAt()", res); 358cdf0e10cSrcweir } 359cdf0e10cSrcweir 360cdf0e10cSrcweir /** 361cdf0e10cSrcweir * Calls the method and checks a returned value. 362cdf0e10cSrcweir * Has OK status if returned value isn't <code>null</code>. 363cdf0e10cSrcweir */ _getAccessibleRowHeaders()364cdf0e10cSrcweir public void _getAccessibleRowHeaders() { 365cdf0e10cSrcweir XAccessibleTable rowHeaders = oObj.getAccessibleRowHeaders(); 366cdf0e10cSrcweir log.println("getAccessibleRowHeaders(): " + rowHeaders); 367cdf0e10cSrcweir tRes.tested("getAccessibleRowHeaders()", true); 368cdf0e10cSrcweir } 369cdf0e10cSrcweir 370cdf0e10cSrcweir /** 371cdf0e10cSrcweir * Calls the method and checks a returned value. 372cdf0e10cSrcweir * Has OK status if returned value isn't <code>null</code>. 373cdf0e10cSrcweir */ _getAccessibleColumnHeaders()374cdf0e10cSrcweir public void _getAccessibleColumnHeaders() { 375cdf0e10cSrcweir XAccessibleTable colHeaders = oObj.getAccessibleColumnHeaders(); 376cdf0e10cSrcweir log.println("getAccessibleColumnHeaders(): " + colHeaders); 377cdf0e10cSrcweir tRes.tested("getAccessibleColumnHeaders()", true); 378cdf0e10cSrcweir } 379cdf0e10cSrcweir 380cdf0e10cSrcweir /** 381cdf0e10cSrcweir * If the interface <code>XAccessibleSelection</code> is supported by 382cdf0e10cSrcweir * the component than selects all accessible childs. 383cdf0e10cSrcweir * Calls the method and checks a returned sequence. 384cdf0e10cSrcweir * Has OK status if a returned sequince is in ascending order. 385cdf0e10cSrcweir * The following method tests are to be executed before: 386cdf0e10cSrcweir * <ul> 387cdf0e10cSrcweir * <li> <code>getAccessibleRowCount()</code> </li> 388cdf0e10cSrcweir * </ul> 389cdf0e10cSrcweir */ _getSelectedAccessibleRows()390cdf0e10cSrcweir public void _getSelectedAccessibleRows() { 391cdf0e10cSrcweir requiredMethod("getAccessibleRowCount()"); 392cdf0e10cSrcweir boolean res = true; 393cdf0e10cSrcweir boolean locRes = true; 394cdf0e10cSrcweir int selRows[] = null; 395cdf0e10cSrcweir 396cdf0e10cSrcweir if (xASel != null) { 397cdf0e10cSrcweir log.println("XAccessibleSelection.selectAllAccessibleChildren()"); 398cdf0e10cSrcweir xASel.selectAllAccessibleChildren(); 399cdf0e10cSrcweir } 400cdf0e10cSrcweir 401cdf0e10cSrcweir log.println("getSelectedAccessibleRows()"); 402cdf0e10cSrcweir selRows = oObj.getSelectedAccessibleRows(); 403cdf0e10cSrcweir log.println("Length of the returned sequince: " + selRows.length); 404cdf0e10cSrcweir if (xASel != null) { 405cdf0e10cSrcweir res &= selRows.length == rowCount; 406cdf0e10cSrcweir } else { 407cdf0e10cSrcweir res &= selRows.length == 0; 408cdf0e10cSrcweir } 409cdf0e10cSrcweir 410cdf0e10cSrcweir if (selRows.length > 0) { 411cdf0e10cSrcweir log.println("Checking that returned sequence is" + 412cdf0e10cSrcweir " in ascending order"); 413cdf0e10cSrcweir } 414cdf0e10cSrcweir 415cdf0e10cSrcweir for(int i = 1; i < selRows.length; i++) { 416cdf0e10cSrcweir locRes &= selRows[i] >= selRows[i - 1]; 417cdf0e10cSrcweir res &= locRes; 418cdf0e10cSrcweir if (!locRes) { 419cdf0e10cSrcweir log.println("Element #" + i + ":" + selRows[i] + 420cdf0e10cSrcweir " is less than element #" + (i-1) + ": " + 421cdf0e10cSrcweir selRows[i-1]); 422cdf0e10cSrcweir break; 423cdf0e10cSrcweir } 424cdf0e10cSrcweir } 425cdf0e10cSrcweir 426cdf0e10cSrcweir tRes.tested("getSelectedAccessibleRows()", res); 427cdf0e10cSrcweir } 428cdf0e10cSrcweir 429cdf0e10cSrcweir /** 430cdf0e10cSrcweir * If the interface <code>XAccessibleSelection</code> is supported by 431cdf0e10cSrcweir * the component than selects all accessible childs. 432cdf0e10cSrcweir * Calls the method and checks a returned sequence. 433cdf0e10cSrcweir * Has OK status if a returned sequince is in ascending order. 434cdf0e10cSrcweir * The following method tests are to be executed before: 435cdf0e10cSrcweir * <ul> 436cdf0e10cSrcweir * <li> <code>getAccessibleColumnCount()</code> </li> 437cdf0e10cSrcweir * </ul> 438cdf0e10cSrcweir */ _getSelectedAccessibleColumns()439cdf0e10cSrcweir public void _getSelectedAccessibleColumns() { 440cdf0e10cSrcweir requiredMethod("getAccessibleColumnCount()"); 441cdf0e10cSrcweir boolean res = true; 442cdf0e10cSrcweir boolean locRes = true; 443cdf0e10cSrcweir int selCols[] = null; 444cdf0e10cSrcweir 445cdf0e10cSrcweir if (xASel != null) { 446cdf0e10cSrcweir log.println("XAccessibleSelection.selectAllAccessibleChildren()"); 447cdf0e10cSrcweir xASel.selectAllAccessibleChildren(); 448cdf0e10cSrcweir } 449cdf0e10cSrcweir 450cdf0e10cSrcweir log.println("getSelectedAccessibleColumns()"); 451cdf0e10cSrcweir selCols = oObj.getSelectedAccessibleColumns(); 452cdf0e10cSrcweir log.println("Length of the returned sequince: " + selCols.length); 453cdf0e10cSrcweir 454cdf0e10cSrcweir if (xASel != null) { 455cdf0e10cSrcweir res &= selCols.length == colCount; 456cdf0e10cSrcweir } else { 457cdf0e10cSrcweir res &= selCols.length == 0; 458cdf0e10cSrcweir } 459cdf0e10cSrcweir 460cdf0e10cSrcweir if (selCols.length > 0) { 461cdf0e10cSrcweir log.println("Checking that returned sequence is" + 462cdf0e10cSrcweir " in ascending order"); 463cdf0e10cSrcweir } 464cdf0e10cSrcweir 465cdf0e10cSrcweir for(int i = 1; i < selCols.length; i++) { 466cdf0e10cSrcweir locRes &= selCols[i] >= selCols[i - 1]; 467cdf0e10cSrcweir res &= locRes; 468cdf0e10cSrcweir if (!locRes) { 469cdf0e10cSrcweir log.println("Element #" + i + ":" + selCols[i] + 470cdf0e10cSrcweir " is less than element #" + (i-1) + ": " + 471cdf0e10cSrcweir selCols[i-1]); 472cdf0e10cSrcweir break; 473cdf0e10cSrcweir } 474cdf0e10cSrcweir } 475cdf0e10cSrcweir 476cdf0e10cSrcweir tRes.tested("getSelectedAccessibleColumns()", res); 477cdf0e10cSrcweir } 478cdf0e10cSrcweir 479cdf0e10cSrcweir /** 480cdf0e10cSrcweir * Calls the method with invalid indexes. 481cdf0e10cSrcweir * If the interface <code>XAccessibleSelection</code> is supported by 482cdf0e10cSrcweir * the component than selects all accessible childs. 483cdf0e10cSrcweir * Calls the method for every row and checks returned values. 484cdf0e10cSrcweir * The following method tests are to be executed before: 485cdf0e10cSrcweir * <ul> 486cdf0e10cSrcweir * <li> <code>getAccessibleRowCount()</code> </li> 487cdf0e10cSrcweir * </ul> 488cdf0e10cSrcweir */ _isAccessibleRowSelected()489cdf0e10cSrcweir public void _isAccessibleRowSelected() { 490cdf0e10cSrcweir requiredMethod("getAccessibleRowCount()"); 491cdf0e10cSrcweir boolean res = true; 492cdf0e10cSrcweir boolean locRes = true; 493cdf0e10cSrcweir 494cdf0e10cSrcweir try { 495cdf0e10cSrcweir log.print("isAccessibleRowSelected(-1): "); 496cdf0e10cSrcweir locRes = oObj.isAccessibleRowSelected(-1); 497cdf0e10cSrcweir log.println(locRes); 498cdf0e10cSrcweir log.println("Exception was expected"); 499cdf0e10cSrcweir res &= false; 500cdf0e10cSrcweir } catch(com.sun.star.lang.IndexOutOfBoundsException e) { 501cdf0e10cSrcweir log.println("expected exception"); 502cdf0e10cSrcweir res &= true; 503cdf0e10cSrcweir } 504cdf0e10cSrcweir 505cdf0e10cSrcweir try { 506cdf0e10cSrcweir log.print("isAccessibleRowSelected(" + rowCount + "): "); 507cdf0e10cSrcweir locRes = oObj.isAccessibleRowSelected(rowCount); 508cdf0e10cSrcweir log.println(locRes); 509cdf0e10cSrcweir log.println("Exception was expected"); 510cdf0e10cSrcweir res &= false; 511cdf0e10cSrcweir } catch(com.sun.star.lang.IndexOutOfBoundsException e) { 512cdf0e10cSrcweir log.println("expected exception"); 513cdf0e10cSrcweir res &= true; 514cdf0e10cSrcweir } 515cdf0e10cSrcweir 516cdf0e10cSrcweir if (xASel != null) { 517cdf0e10cSrcweir log.println("XAccessibleSelection.selectAllAccessibleChildren()"); 518cdf0e10cSrcweir xASel.selectAllAccessibleChildren(); 519cdf0e10cSrcweir } 520cdf0e10cSrcweir 521cdf0e10cSrcweir try { 522cdf0e10cSrcweir log.println("Checking of every row selection..."); 523cdf0e10cSrcweir for(int i = 0; i < rowCount; i++) { 524cdf0e10cSrcweir boolean isSel = oObj.isAccessibleRowSelected(i); 525cdf0e10cSrcweir locRes = (xASel == null) ? !isSel : isSel; 526cdf0e10cSrcweir res &= locRes; 527cdf0e10cSrcweir if (!locRes) { 528cdf0e10cSrcweir log.println("isAccessibleRowSelected(" + i + "): " + isSel); 529cdf0e10cSrcweir break; 530cdf0e10cSrcweir } 531cdf0e10cSrcweir } 532cdf0e10cSrcweir } catch(com.sun.star.lang.IndexOutOfBoundsException e) { 533cdf0e10cSrcweir log.println("Unexpected exception"); 534cdf0e10cSrcweir e.printStackTrace(log); 535cdf0e10cSrcweir res &= false; 536cdf0e10cSrcweir } 537cdf0e10cSrcweir 538cdf0e10cSrcweir tRes.tested("isAccessibleRowSelected()", res); 539cdf0e10cSrcweir } 540cdf0e10cSrcweir 541cdf0e10cSrcweir /** 542cdf0e10cSrcweir * Calls the method with invalid indexes. 543cdf0e10cSrcweir * If the interface <code>XAccessibleSelection</code> is supported by 544cdf0e10cSrcweir * the component than selects all accessible childs. 545cdf0e10cSrcweir * Calls the method for every column and checks returned values. 546cdf0e10cSrcweir * The following method tests are to be executed before: 547cdf0e10cSrcweir * <ul> 548cdf0e10cSrcweir * <li> <code>getAccessibleRowCount()</code> </li> 549cdf0e10cSrcweir * </ul> 550cdf0e10cSrcweir */ _isAccessibleColumnSelected()551cdf0e10cSrcweir public void _isAccessibleColumnSelected() { 552cdf0e10cSrcweir requiredMethod("getAccessibleColumnCount()"); 553cdf0e10cSrcweir boolean res = true; 554cdf0e10cSrcweir boolean locRes = true; 555cdf0e10cSrcweir 556cdf0e10cSrcweir try { 557cdf0e10cSrcweir log.print("isAccessibleColumnSelected(-1): "); 558cdf0e10cSrcweir locRes = oObj.isAccessibleColumnSelected(-1); 559cdf0e10cSrcweir log.println(locRes); 560cdf0e10cSrcweir log.println("Exception was expected"); 561cdf0e10cSrcweir res &= false; 562cdf0e10cSrcweir } catch(com.sun.star.lang.IndexOutOfBoundsException e) { 563cdf0e10cSrcweir log.println("expected exception"); 564cdf0e10cSrcweir res &= true; 565cdf0e10cSrcweir } 566cdf0e10cSrcweir 567cdf0e10cSrcweir try { 568cdf0e10cSrcweir log.print("isAccessibleColumnSelected(" + colCount + "): "); 569cdf0e10cSrcweir locRes = oObj.isAccessibleColumnSelected(colCount); 570cdf0e10cSrcweir log.println(locRes); 571cdf0e10cSrcweir log.println("Exception was expected"); 572cdf0e10cSrcweir res &= false; 573cdf0e10cSrcweir } catch(com.sun.star.lang.IndexOutOfBoundsException e) { 574cdf0e10cSrcweir log.println("expected exception"); 575cdf0e10cSrcweir res &= true; 576cdf0e10cSrcweir } 577cdf0e10cSrcweir 578cdf0e10cSrcweir if (xASel != null) { 579cdf0e10cSrcweir log.println("XAccessibleSelection.selectAllAccessibleChildren()"); 580cdf0e10cSrcweir xASel.selectAllAccessibleChildren(); 581cdf0e10cSrcweir } 582cdf0e10cSrcweir 583cdf0e10cSrcweir try { 584cdf0e10cSrcweir log.println("Checking of every column selection..."); 585cdf0e10cSrcweir for(int i = 0; i < colCount; i++) { 586cdf0e10cSrcweir boolean isSel = oObj.isAccessibleColumnSelected(i); 587cdf0e10cSrcweir locRes = (xASel == null) ? !isSel : isSel; 588cdf0e10cSrcweir res &= locRes; 589cdf0e10cSrcweir if (!locRes) { 590cdf0e10cSrcweir log.println("isAccessibleColumnSelected(" + i + "): " + isSel); 591cdf0e10cSrcweir break; 592cdf0e10cSrcweir } 593cdf0e10cSrcweir } 594cdf0e10cSrcweir } catch(com.sun.star.lang.IndexOutOfBoundsException e) { 595cdf0e10cSrcweir log.println("Unexpected exception"); 596cdf0e10cSrcweir e.printStackTrace(log); 597cdf0e10cSrcweir res &= false; 598cdf0e10cSrcweir } 599cdf0e10cSrcweir 600cdf0e10cSrcweir tRes.tested("isAccessibleColumnSelected()", res); 601cdf0e10cSrcweir } 602cdf0e10cSrcweir 603cdf0e10cSrcweir XAccessible xCellAc = null; 604cdf0e10cSrcweir 605cdf0e10cSrcweir /** 606cdf0e10cSrcweir * Calls the method with the wrong parameters and with the correct 607cdf0e10cSrcweir * parameter, checks a returned value and stores it to the variable 608cdf0e10cSrcweir * <code>xCellAc</code>. 609cdf0e10cSrcweir * Has OK status if exceptions were thrown for the wrong indexes, 610cdf0e10cSrcweir * if exception wasn't thrown for the correct index and 611cdf0e10cSrcweir * if returned value isn't null. 612cdf0e10cSrcweir * The following method tests are to be executed before: 613cdf0e10cSrcweir * <ul> 614cdf0e10cSrcweir * <li> <code>getAccessibleColumnCount()</code> </li> 615cdf0e10cSrcweir * <li> <code>getAccessibleRowCount()</code> </li> 616cdf0e10cSrcweir * </ul> 617cdf0e10cSrcweir */ _getAccessibleCellAt()618cdf0e10cSrcweir public void _getAccessibleCellAt() { 619cdf0e10cSrcweir requiredMethod("getAccessibleRowCount()"); 620cdf0e10cSrcweir requiredMethod("getAccessibleColumnCount()"); 621cdf0e10cSrcweir boolean res = true; 622cdf0e10cSrcweir 623cdf0e10cSrcweir try { 624cdf0e10cSrcweir log.print("getAccessibleCellAt(-1," + (colCount-1) + "):"); 625cdf0e10cSrcweir xCellAc = oObj.getAccessibleCellAt(-1, colCount - 1); 626cdf0e10cSrcweir log.println(xCellAc); 627cdf0e10cSrcweir log.println("Exception was expected"); 628cdf0e10cSrcweir res &= false; 629cdf0e10cSrcweir } catch(com.sun.star.lang.IndexOutOfBoundsException e) { 630cdf0e10cSrcweir log.println("expected exception"); 631cdf0e10cSrcweir res &= true; 632cdf0e10cSrcweir } 633cdf0e10cSrcweir 634cdf0e10cSrcweir try { 635cdf0e10cSrcweir log.print("getAccessibleCellAt(" + (rowCount-1) + ",-1):"); 636cdf0e10cSrcweir xCellAc = oObj.getAccessibleCellAt(rowCount - 1, -1); 637cdf0e10cSrcweir log.println(xCellAc); 638cdf0e10cSrcweir log.println("Exception was expected"); 639cdf0e10cSrcweir res &= false; 640cdf0e10cSrcweir } catch(com.sun.star.lang.IndexOutOfBoundsException e) { 641cdf0e10cSrcweir log.println("expected exception"); 642cdf0e10cSrcweir res &= true; 643cdf0e10cSrcweir } 644cdf0e10cSrcweir 645cdf0e10cSrcweir try { 646cdf0e10cSrcweir log.print("getAccessibleCellAt(0, " + colCount + "):"); 647cdf0e10cSrcweir xCellAc = oObj.getAccessibleCellAt(0, colCount); 648cdf0e10cSrcweir log.println(xCellAc); 649cdf0e10cSrcweir log.println("Exception was expected"); 650cdf0e10cSrcweir res &= false; 651cdf0e10cSrcweir } catch(com.sun.star.lang.IndexOutOfBoundsException e) { 652cdf0e10cSrcweir log.println("expected exception"); 653cdf0e10cSrcweir res &= true; 654cdf0e10cSrcweir } 655cdf0e10cSrcweir 656cdf0e10cSrcweir try { 657cdf0e10cSrcweir log.print("getAccessibleCellAt(" + rowCount + ",0):"); 658cdf0e10cSrcweir XAccessible xCellAc = oObj.getAccessibleCellAt(rowCount, 0); 659cdf0e10cSrcweir log.println(xCellAc); 660cdf0e10cSrcweir log.println("Exception was expected"); 661cdf0e10cSrcweir res &= false; 662cdf0e10cSrcweir } catch(com.sun.star.lang.IndexOutOfBoundsException e) { 663cdf0e10cSrcweir log.println("expected exception"); 664cdf0e10cSrcweir res &= true; 665cdf0e10cSrcweir } 666cdf0e10cSrcweir 667cdf0e10cSrcweir try { 668cdf0e10cSrcweir log.print("getAccessibleCellAt(" + (rowCount-1) + "," + 669cdf0e10cSrcweir (colCount-1) + "): "); 670cdf0e10cSrcweir xCellAc = oObj.getAccessibleCellAt( 671cdf0e10cSrcweir rowCount - 1, colCount - 1); 672cdf0e10cSrcweir log.println(xCellAc); 673cdf0e10cSrcweir res &= xCellAc != null; 674cdf0e10cSrcweir } catch(com.sun.star.lang.IndexOutOfBoundsException e) { 675cdf0e10cSrcweir log.println("Unexpected exception"); 676cdf0e10cSrcweir e.printStackTrace(log); 677cdf0e10cSrcweir res &= false; 678cdf0e10cSrcweir } 679cdf0e10cSrcweir 680cdf0e10cSrcweir tRes.tested("getAccessibleCellAt()", res); 681cdf0e10cSrcweir } 682cdf0e10cSrcweir 683cdf0e10cSrcweir /** 684cdf0e10cSrcweir * Just calls the method. 685cdf0e10cSrcweir */ _getAccessibleCaption()686cdf0e10cSrcweir public void _getAccessibleCaption() { 687cdf0e10cSrcweir XAccessible caption = oObj.getAccessibleCaption(); 688cdf0e10cSrcweir log.println("getAccessibleCaption(): " + caption); 689cdf0e10cSrcweir tRes.tested("getAccessibleCaption()", true); 690cdf0e10cSrcweir } 691cdf0e10cSrcweir 692cdf0e10cSrcweir /** 693cdf0e10cSrcweir * Just calls the method. 694cdf0e10cSrcweir */ _getAccessibleSummary()695cdf0e10cSrcweir public void _getAccessibleSummary() { 696cdf0e10cSrcweir XAccessible summary = oObj.getAccessibleSummary(); 697cdf0e10cSrcweir log.println("getAccessibleSummary(): " + summary); 698cdf0e10cSrcweir tRes.tested("getAccessibleSummary()", true); 699cdf0e10cSrcweir } 700cdf0e10cSrcweir 701cdf0e10cSrcweir /** 702cdf0e10cSrcweir * Calls the method with the wrong parameters and with the correct 703cdf0e10cSrcweir * parameter, checks a returned value. 704cdf0e10cSrcweir * Has OK status if exceptions were thrown for the wrong indexes, 705cdf0e10cSrcweir * if exception wasn't thrown for the correct index. 706cdf0e10cSrcweir * The following method tests are to be executed before: 707cdf0e10cSrcweir * <ul> 708cdf0e10cSrcweir * <li> <code>getAccessibleColumnCount()</code> </li> 709cdf0e10cSrcweir * <li> <code>getAccessibleRowCount()</code> </li> 710cdf0e10cSrcweir * </ul> 711cdf0e10cSrcweir */ _isAccessibleSelected()712cdf0e10cSrcweir public void _isAccessibleSelected() { 713cdf0e10cSrcweir requiredMethod("getAccessibleRowCount()"); 714cdf0e10cSrcweir requiredMethod("getAccessibleColumnCount()"); 715cdf0e10cSrcweir boolean res = true; 716cdf0e10cSrcweir boolean locRes = true; 717cdf0e10cSrcweir 718cdf0e10cSrcweir try { 719cdf0e10cSrcweir log.print("isAccessibleSelected(-1," + (colCount-1) + "):"); 720cdf0e10cSrcweir locRes = oObj.isAccessibleSelected(-1, colCount - 1); 721cdf0e10cSrcweir log.println(locRes); 722cdf0e10cSrcweir log.println("Exception was expected"); 723cdf0e10cSrcweir res &= false; 724cdf0e10cSrcweir } catch(com.sun.star.lang.IndexOutOfBoundsException e) { 725cdf0e10cSrcweir log.println("expected exception"); 726cdf0e10cSrcweir res &= true; 727cdf0e10cSrcweir } 728cdf0e10cSrcweir 729cdf0e10cSrcweir try { 730cdf0e10cSrcweir log.print("isAccessibleSelected(" + (rowCount-1) + ",-1):"); 731cdf0e10cSrcweir locRes = oObj.isAccessibleSelected(rowCount - 1, -1); 732cdf0e10cSrcweir log.println(locRes); 733cdf0e10cSrcweir log.println("Exception was expected"); 734cdf0e10cSrcweir res &= false; 735cdf0e10cSrcweir } catch(com.sun.star.lang.IndexOutOfBoundsException e) { 736cdf0e10cSrcweir log.println("expected exception"); 737cdf0e10cSrcweir res &= true; 738cdf0e10cSrcweir } 739cdf0e10cSrcweir 740cdf0e10cSrcweir try { 741cdf0e10cSrcweir log.print("isAccessibleSelected(0, " + colCount + "):"); 742cdf0e10cSrcweir locRes = oObj.isAccessibleSelected(0, colCount); 743cdf0e10cSrcweir log.println(locRes); 744cdf0e10cSrcweir log.println("Exception was expected"); 745cdf0e10cSrcweir res &= false; 746cdf0e10cSrcweir } catch(com.sun.star.lang.IndexOutOfBoundsException e) { 747cdf0e10cSrcweir log.println("expected exception"); 748cdf0e10cSrcweir res &= true; 749cdf0e10cSrcweir } 750cdf0e10cSrcweir 751cdf0e10cSrcweir try { 752cdf0e10cSrcweir log.print("isAccessibleSelected(" + rowCount + ",0):"); 753cdf0e10cSrcweir locRes = oObj.isAccessibleSelected(rowCount, 0); 754cdf0e10cSrcweir log.println(locRes); 755cdf0e10cSrcweir log.println("Exception was expected"); 756cdf0e10cSrcweir res &= false; 757cdf0e10cSrcweir } catch(com.sun.star.lang.IndexOutOfBoundsException e) { 758cdf0e10cSrcweir log.println("expected exception"); 759cdf0e10cSrcweir res &= true; 760cdf0e10cSrcweir } 761cdf0e10cSrcweir 762cdf0e10cSrcweir if (xASel != null) { 763cdf0e10cSrcweir log.println("XAccessibleSelection.selectAllAccessibleChildren()"); 764cdf0e10cSrcweir xASel.selectAllAccessibleChildren(); 765cdf0e10cSrcweir } 766cdf0e10cSrcweir 767cdf0e10cSrcweir try { 768cdf0e10cSrcweir log.print("isAccessibleSelected(" + (rowCount-1) + "," + 769cdf0e10cSrcweir (colCount-1) + "): "); 770cdf0e10cSrcweir boolean isSel = oObj.isAccessibleSelected( 771cdf0e10cSrcweir rowCount - 1, colCount - 1); 772cdf0e10cSrcweir log.println(isSel); 773cdf0e10cSrcweir locRes = (xASel == null) ? !isSel : isSel ; 774cdf0e10cSrcweir res &= locRes; 775cdf0e10cSrcweir } catch(com.sun.star.lang.IndexOutOfBoundsException e) { 776cdf0e10cSrcweir log.println("Unexpected exception"); 777cdf0e10cSrcweir e.printStackTrace(log); 778cdf0e10cSrcweir res &= false; 779cdf0e10cSrcweir } 780cdf0e10cSrcweir 781cdf0e10cSrcweir tRes.tested("isAccessibleSelected()", res); 782cdf0e10cSrcweir } 783cdf0e10cSrcweir 784cdf0e10cSrcweir /** 785cdf0e10cSrcweir * Calls the method with the wrong parameters and with the correct 786cdf0e10cSrcweir * parameter, checks a returned value. 787cdf0e10cSrcweir * Has OK status if exceptions were thrown for the wrong indexes, 788cdf0e10cSrcweir * if exception wasn't thrown for the correct index and 789cdf0e10cSrcweir * if returned value is equal to value returned by calling 790cdf0e10cSrcweir * <code>XAccessibleContext::getAccessibleIndexInParent</code> for the cell. 791cdf0e10cSrcweir * The following method tests are to be executed before: 792cdf0e10cSrcweir * <ul> 793cdf0e10cSrcweir * <li> <code>getAccessibleCellAt()</code> </li> 794cdf0e10cSrcweir * </ul> 795cdf0e10cSrcweir */ _getAccessibleIndex()796cdf0e10cSrcweir public void _getAccessibleIndex() { 797cdf0e10cSrcweir executeMethod("getAccessibleCellAt()"); 798cdf0e10cSrcweir boolean res = true; 799cdf0e10cSrcweir 800cdf0e10cSrcweir try { 801cdf0e10cSrcweir log.print("getAccessibleIndex(-1," + (colCount-1) + "):"); 802cdf0e10cSrcweir int indx = oObj.getAccessibleIndex(-1, colCount - 1); 803cdf0e10cSrcweir log.println(indx); 804cdf0e10cSrcweir log.println("Exception was expected"); 805cdf0e10cSrcweir res &= false; 806cdf0e10cSrcweir } catch(com.sun.star.lang.IndexOutOfBoundsException e) { 807cdf0e10cSrcweir log.println("expected exception"); 808cdf0e10cSrcweir res &= true; 809cdf0e10cSrcweir } 810cdf0e10cSrcweir 811cdf0e10cSrcweir try { 812cdf0e10cSrcweir log.print("getAccessibleIndex(" + (rowCount-1) + ",-1):"); 813cdf0e10cSrcweir int indx = oObj.getAccessibleIndex(rowCount - 1, -1); 814cdf0e10cSrcweir log.println(indx); 815cdf0e10cSrcweir log.println("Exception was expected"); 816cdf0e10cSrcweir res &= false; 817cdf0e10cSrcweir } catch(com.sun.star.lang.IndexOutOfBoundsException e) { 818cdf0e10cSrcweir log.println("expected exception"); 819cdf0e10cSrcweir res &= true; 820cdf0e10cSrcweir } 821cdf0e10cSrcweir 822cdf0e10cSrcweir try { 823cdf0e10cSrcweir log.print("getAccessibleIndex(0," + colCount + "):"); 824cdf0e10cSrcweir int indx = oObj.getAccessibleIndex(0, colCount); 825cdf0e10cSrcweir log.println(indx); 826cdf0e10cSrcweir log.println("Exception was expected"); 827cdf0e10cSrcweir res &= false; 828cdf0e10cSrcweir } catch(com.sun.star.lang.IndexOutOfBoundsException e) { 829cdf0e10cSrcweir log.println("expected exception"); 830cdf0e10cSrcweir res &= true; 831cdf0e10cSrcweir } 832cdf0e10cSrcweir 833cdf0e10cSrcweir try { 834cdf0e10cSrcweir log.print("getAccessibleIndex(" + rowCount + ",0):"); 835cdf0e10cSrcweir int indx = oObj.getAccessibleIndex(rowCount, 0); 836cdf0e10cSrcweir log.println(indx); 837cdf0e10cSrcweir log.println("Exception was expected"); 838cdf0e10cSrcweir res &= false; 839cdf0e10cSrcweir } catch(com.sun.star.lang.IndexOutOfBoundsException e) { 840cdf0e10cSrcweir log.println("expected exception"); 841cdf0e10cSrcweir res &= true; 842cdf0e10cSrcweir } 843cdf0e10cSrcweir 844cdf0e10cSrcweir try { 845cdf0e10cSrcweir log.print("getAccessibleIndex(" + (rowCount-1) + "," + 846cdf0e10cSrcweir (colCount-1) + "): "); 847cdf0e10cSrcweir int indx = oObj.getAccessibleIndex( 848cdf0e10cSrcweir rowCount - 1, colCount - 1); 849cdf0e10cSrcweir log.println(indx); 850cdf0e10cSrcweir if (xCellAc != null) { 851cdf0e10cSrcweir XAccessibleContext xAC = xCellAc.getAccessibleContext(); 852cdf0e10cSrcweir int expIndx = xAC.getAccessibleIndexInParent(); 853cdf0e10cSrcweir log.println("Expected index: " + expIndx); 854cdf0e10cSrcweir res &= expIndx == indx; 855cdf0e10cSrcweir } else { 856cdf0e10cSrcweir res &= true; 857cdf0e10cSrcweir } 858cdf0e10cSrcweir } catch(com.sun.star.lang.IndexOutOfBoundsException e) { 859cdf0e10cSrcweir log.println("Unexpected exception"); 860cdf0e10cSrcweir e.printStackTrace(log); 861cdf0e10cSrcweir res &= false; 862cdf0e10cSrcweir } 863cdf0e10cSrcweir 864cdf0e10cSrcweir tRes.tested("getAccessibleIndex()", res); 865cdf0e10cSrcweir } 866cdf0e10cSrcweir 867cdf0e10cSrcweir /** 868cdf0e10cSrcweir * Receives an accessible child count using the interface 869cdf0e10cSrcweir * <code>XAccessibleContext</code>. 870cdf0e10cSrcweir * Calls the method with the wrong parameters and with the correct 871cdf0e10cSrcweir * parameter, checks a returned value. 872cdf0e10cSrcweir * Has OK status if exceptions were thrown for the wrong indexes, 873cdf0e10cSrcweir * if exception wasn't thrown for the correct index and 874cdf0e10cSrcweir * if returned value is greater than zero and is less than 875cdf0e10cSrcweir * accessible row count. 876cdf0e10cSrcweir * The following method tests are to be executed before: 877cdf0e10cSrcweir * <ul> 878cdf0e10cSrcweir * <li> <code>getAccessibleRowCount()</code> </li> 879cdf0e10cSrcweir * </ul> 880cdf0e10cSrcweir */ _getAccessibleRow()881cdf0e10cSrcweir public void _getAccessibleRow() { 882cdf0e10cSrcweir requiredMethod("getAccessibleRowCount()"); 883cdf0e10cSrcweir boolean res = true; 884cdf0e10cSrcweir 885cdf0e10cSrcweir if (xACont != null) { 886cdf0e10cSrcweir int childCount = xACont.getAccessibleChildCount(); 887cdf0e10cSrcweir log.println("accessible child count: " + childCount); 888cdf0e10cSrcweir 889cdf0e10cSrcweir try { 890cdf0e10cSrcweir log.print("getAccessibleRow(" + childCount + "): "); 891cdf0e10cSrcweir int rowIndx = oObj.getAccessibleRow(childCount); 892cdf0e10cSrcweir log.println(rowIndx); 893cdf0e10cSrcweir log.println("Exception was expected"); 894cdf0e10cSrcweir res &= false; 895cdf0e10cSrcweir } catch(com.sun.star.lang.IndexOutOfBoundsException e) { 896cdf0e10cSrcweir log.println("expected exception"); 897cdf0e10cSrcweir res &= true; 898cdf0e10cSrcweir } 899cdf0e10cSrcweir 900cdf0e10cSrcweir try { 901cdf0e10cSrcweir log.print("getAccessibleRow(" + (childCount-1) + "): "); 902cdf0e10cSrcweir int rowIndx = oObj.getAccessibleRow(childCount - 1); 903cdf0e10cSrcweir log.println(rowIndx); 904cdf0e10cSrcweir res &= (rowIndx >= 0 && rowIndx <= rowCount); 905cdf0e10cSrcweir } catch(com.sun.star.lang.IndexOutOfBoundsException e) { 906cdf0e10cSrcweir log.println("Unexpected exception"); 907cdf0e10cSrcweir e.printStackTrace(log); 908cdf0e10cSrcweir res &= false; 909cdf0e10cSrcweir } 910cdf0e10cSrcweir } 911cdf0e10cSrcweir 912cdf0e10cSrcweir try { 913cdf0e10cSrcweir log.print("getAccessibleRow(-1): "); 914cdf0e10cSrcweir int rowIndx = oObj.getAccessibleRow(-1); 915cdf0e10cSrcweir log.println(rowIndx); 916cdf0e10cSrcweir log.println("Exception was expected"); 917cdf0e10cSrcweir res &= false; 918cdf0e10cSrcweir } catch(com.sun.star.lang.IndexOutOfBoundsException e) { 919cdf0e10cSrcweir log.println("expected exception"); 920cdf0e10cSrcweir res &= true; 921cdf0e10cSrcweir } 922cdf0e10cSrcweir 923cdf0e10cSrcweir try { 924cdf0e10cSrcweir log.print("getAccessibleRow(0): "); 925cdf0e10cSrcweir int rowIndx = oObj.getAccessibleRow(0); 926cdf0e10cSrcweir log.println(rowIndx); 927cdf0e10cSrcweir res &= (rowIndx >= 0 && rowIndx <= rowCount); 928cdf0e10cSrcweir } catch(com.sun.star.lang.IndexOutOfBoundsException e) { 929cdf0e10cSrcweir log.println("Unexpected exception"); 930cdf0e10cSrcweir e.printStackTrace(log); 931cdf0e10cSrcweir res &= false; 932cdf0e10cSrcweir } 933cdf0e10cSrcweir 934cdf0e10cSrcweir tRes.tested("getAccessibleRow()", res); 935cdf0e10cSrcweir } 936cdf0e10cSrcweir 937cdf0e10cSrcweir /** 938cdf0e10cSrcweir * Receives an accessible child count using the interface 939cdf0e10cSrcweir * <code>XAccessibleContext</code>. 940cdf0e10cSrcweir * Calls the method with the wrong parameters and with the correct 941cdf0e10cSrcweir * parameter, checks a returned value. 942cdf0e10cSrcweir * Has OK status if exceptions were thrown for the wrong indexes, 943cdf0e10cSrcweir * if exception wasn't thrown for the correct index and 944cdf0e10cSrcweir * if returned value is greater than zero and is less than 945cdf0e10cSrcweir * accessible column count. 946cdf0e10cSrcweir * The following method tests are to be executed before: 947cdf0e10cSrcweir * <ul> 948cdf0e10cSrcweir * <li> <code>getAccessibleColumnCount()</code> </li> 949cdf0e10cSrcweir * </ul> 950cdf0e10cSrcweir */ _getAccessibleColumn()951cdf0e10cSrcweir public void _getAccessibleColumn() { 952cdf0e10cSrcweir requiredMethod("getAccessibleColumnCount()"); 953cdf0e10cSrcweir boolean res = true; 954cdf0e10cSrcweir 955cdf0e10cSrcweir if (xACont != null) { 956cdf0e10cSrcweir int childCount = xACont.getAccessibleChildCount(); 957cdf0e10cSrcweir log.println("accessible child count: " + childCount); 958cdf0e10cSrcweir 959cdf0e10cSrcweir try { 960cdf0e10cSrcweir log.print("getAccessibleColumn(" + childCount + "): "); 961cdf0e10cSrcweir int colIndx = oObj.getAccessibleColumn(childCount); 962cdf0e10cSrcweir log.println(colIndx); 963cdf0e10cSrcweir log.println("Exception was expected"); 964cdf0e10cSrcweir res &= false; 965cdf0e10cSrcweir } catch(com.sun.star.lang.IndexOutOfBoundsException e) { 966cdf0e10cSrcweir log.println("expected exception"); 967cdf0e10cSrcweir res &= true; 968cdf0e10cSrcweir } 969cdf0e10cSrcweir 970cdf0e10cSrcweir try { 971cdf0e10cSrcweir log.print("getAccessibleColumn(" + (childCount-1) + "): "); 972cdf0e10cSrcweir int colIndx = oObj.getAccessibleColumn(childCount - 1); 973cdf0e10cSrcweir log.println(colIndx); 974cdf0e10cSrcweir res &= (colIndx >= 0 && colIndx <= colCount); 975cdf0e10cSrcweir } catch(com.sun.star.lang.IndexOutOfBoundsException e) { 976cdf0e10cSrcweir log.println("Unexpected exception"); 977cdf0e10cSrcweir e.printStackTrace(log); 978cdf0e10cSrcweir res &= false; 979cdf0e10cSrcweir } 980cdf0e10cSrcweir } 981cdf0e10cSrcweir 982cdf0e10cSrcweir try { 983cdf0e10cSrcweir log.print("getAccessibleColumn(-1): "); 984cdf0e10cSrcweir int colIndx = oObj.getAccessibleColumn(-1); 985cdf0e10cSrcweir log.println(colIndx); 986cdf0e10cSrcweir log.println("Exception was expected"); 987cdf0e10cSrcweir res &= false; 988cdf0e10cSrcweir } catch(com.sun.star.lang.IndexOutOfBoundsException e) { 989cdf0e10cSrcweir log.println("expected exception"); 990cdf0e10cSrcweir res &= true; 991cdf0e10cSrcweir } 992cdf0e10cSrcweir 993cdf0e10cSrcweir try { 994cdf0e10cSrcweir log.print("getAccessibleColumn(0): "); 995cdf0e10cSrcweir int colIndx = oObj.getAccessibleColumn(0); 996cdf0e10cSrcweir log.println(colIndx); 997cdf0e10cSrcweir res &= (colIndx >= 0 && colIndx <= rowCount); 998cdf0e10cSrcweir } catch(com.sun.star.lang.IndexOutOfBoundsException e) { 999cdf0e10cSrcweir log.println("Unexpected exception"); 1000cdf0e10cSrcweir e.printStackTrace(log); 1001cdf0e10cSrcweir res &= false; 1002cdf0e10cSrcweir } 1003cdf0e10cSrcweir 1004cdf0e10cSrcweir tRes.tested("getAccessibleColumn()", res); 1005cdf0e10cSrcweir } 1006cdf0e10cSrcweir }