1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2000, 2010 Oracle and/or its affiliates.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * This file is part of OpenOffice.org.
11 * OpenOffice.org is free software: you can redistribute it and/or modify
12 * it under the terms of the GNU Lesser General Public License version 3
13 * only, as published by the Free Software Foundation.
15 * OpenOffice.org is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU Lesser General Public License version 3 for more details
19 * (a copy is included in the LICENSE file that accompanied this code).
21 * You should have received a copy of the GNU Lesser General Public License
22 * version 3 along with OpenOffice.org. If not, see
23 * <http://www.openoffice.org/license.html>
24 * for a copy of the LGPLv3 License.
26 ************************************************************************/
30 import lib
.MultiMethodTest
;
32 import lib
.StatusException
;
34 import com
.sun
.star
.sheet
.XSpreadsheet
;
35 import com
.sun
.star
.sheet
.XSpreadsheetView
;
38 * Testing <code>com.sun.star.sheet.XSpreadsheetView</code>
41 * <li><code> getActiveSheet()</code></li>
42 * <li><code> setActiveSheet()</code></li>
44 * This test needs the following object relations :
46 * <li> <code>'Sheet'</code> (of type <code>XSpreadsheet</code>):
47 * to set new active spreadsheet </li>
49 * @see com.sun.star.sheet.XSpreadsheetView
51 public class _XSpreadsheetView
extends MultiMethodTest
{
53 public XSpreadsheetView oObj
= null;
54 public XSpreadsheet oSheet
= null;
57 * Test calls the method, stores and checks returned value. <p>
58 * Has <b> OK </b> status if returned value isn't null. <p>
60 public void _getActiveSheet() {
61 oSheet
= oObj
.getActiveSheet();
62 tRes
.tested("getActiveSheet()", oSheet
!= null);
66 * Test sets new active sheet that was obtained by relation
67 * <code>'Sheet'</code>, gets the current active sheet and compares
68 * returned value with value that was stored by method
69 * <code>getFilterFields()</code>. <p>
70 * Has <b> OK </b> status if values aren't equal. <p>
71 * The following method tests are to be completed successfully before :
73 * <li> <code> getActiveSheet() </code> : to have the current
77 public void _setActiveSheet() {
78 requiredMethod("getActiveSheet()");
80 XSpreadsheet new_Sheet
= (XSpreadsheet
)tEnv
.getObjRelation("Sheet");
81 if (new_Sheet
== null) throw new StatusException(Status
.failed
82 ("Relation 'Sheet' not found"));
84 oObj
.setActiveSheet(new_Sheet
);
85 new_Sheet
= oObj
.getActiveSheet();
86 tRes
.tested("setActiveSheet()", !oSheet
.equals(new_Sheet
));
90 } // finish class _XSpreadsheetView