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 .
21 import lib
.MultiMethodTest
;
23 import com
.sun
.star
.sheet
.XSheetCellCursor
;
24 import com
.sun
.star
.sheet
.XSheetCellRange
;
25 import com
.sun
.star
.sheet
.XSpreadsheet
;
26 import com
.sun
.star
.table
.XCellRange
;
27 import com
.sun
.star
.uno
.UnoRuntime
;
30 * Testing <code>com.sun.star.sheet.XSpreadsheet</code>
33 * <li><code> createCursor()</code></li>
34 * <li><code> createCursorByRange()</code></li>
36 * @see com.sun.star.sheet.XSpreadsheet
38 public class _XSpreadsheet
extends MultiMethodTest
{
40 // oObj filled by MultiMethodTest
41 public XSpreadsheet oObj
= null;
44 * Test calls the method and checks returned value. <p>
45 * Has <b> OK </b> status if returned value isn't null. <p>
47 public void _createCursor() {
48 log
.println("Testing createCursor");
49 XSheetCellCursor oCursor
= oObj
.createCursor() ;
50 tRes
.tested("createCursor()", oCursor
!= null);
54 * Test gets a cell range, call method using this cell range
55 * and checks returned value. <p>
56 * Has <b> OK </b> status if returned value isn't null
57 * and no exceptions were thrown. <p>
59 public void _createCursorByRange() {
60 log
.println("Testing createCursorByRange");
62 log
.println("getting cellrange");
63 XCellRange oRange
= null;
65 oRange
= oObj
.getCellRangeByPosition (1, 1, 2, 3);
66 } catch (com
.sun
.star
.lang
.IndexOutOfBoundsException e
) {
67 log
.println("Can't get cell range by address");
68 e
.printStackTrace(log
);
69 tRes
.tested("createCursorByRange()", false);
72 XSheetCellRange oSheetRange
= UnoRuntime
.queryInterface(XSheetCellRange
.class, oRange
) ;
73 log
.println("getting Cursor");
74 XSheetCellCursor oCursor
= oObj
.createCursorByRange(oSheetRange
);
75 tRes
.tested("createCursorByRange()", oCursor
!= null);
78 } // finisch class _XSpreadsheet