Update ooo320-m1
[ooovba.git] / qadevOOo / tests / java / ifc / sheet / _XSpreadsheetView.java
blob9354750b23aae4dfed3375ddaca8aa81ff0e2f9b
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: _XSpreadsheetView.java,v $
10 * $Revision: 1.4 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 package ifc.sheet;
33 import lib.MultiMethodTest;
34 import lib.Status;
35 import lib.StatusException;
37 import com.sun.star.sheet.XSpreadsheet;
38 import com.sun.star.sheet.XSpreadsheetView;
40 /**
41 * Testing <code>com.sun.star.sheet.XSpreadsheetView</code>
42 * interface methods :
43 * <ul>
44 * <li><code> getActiveSheet()</code></li>
45 * <li><code> setActiveSheet()</code></li>
46 * </ul> <p>
47 * This test needs the following object relations :
48 * <ul>
49 * <li> <code>'Sheet'</code> (of type <code>XSpreadsheet</code>):
50 * to set new active spreadsheet </li>
51 * <ul> <p>
52 * @see com.sun.star.sheet.XSpreadsheetView
54 public class _XSpreadsheetView extends MultiMethodTest {
56 public XSpreadsheetView oObj = null;
57 public XSpreadsheet oSheet = null;
59 /**
60 * Test calls the method, stores and checks returned value. <p>
61 * Has <b> OK </b> status if returned value isn't null. <p>
63 public void _getActiveSheet() {
64 oSheet = oObj.getActiveSheet();
65 tRes.tested("getActiveSheet()", oSheet != null);
68 /**
69 * Test sets new active sheet that was obtained by relation
70 * <code>'Sheet'</code>, gets the current active sheet and compares
71 * returned value with value that was stored by method
72 * <code>getFilterFields()</code>. <p>
73 * Has <b> OK </b> status if values aren't equal. <p>
74 * The following method tests are to be completed successfully before :
75 * <ul>
76 * <li> <code> getActiveSheet() </code> : to have the current
77 * active sheet </li>
78 * </ul>
80 public void _setActiveSheet() {
81 requiredMethod("getActiveSheet()");
83 XSpreadsheet new_Sheet = (XSpreadsheet)tEnv.getObjRelation("Sheet");
84 if (new_Sheet == null) throw new StatusException(Status.failed
85 ("Relation 'Sheet' not found"));
87 oObj.setActiveSheet(new_Sheet);
88 new_Sheet = oObj.getActiveSheet();
89 tRes.tested("setActiveSheet()", !oSheet.equals(new_Sheet));
93 } // finish class _XSpreadsheetView