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 lib
.StatusException
;
25 import com
.sun
.star
.sheet
.XSpreadsheet
;
26 import com
.sun
.star
.sheet
.XSpreadsheetView
;
29 * Testing <code>com.sun.star.sheet.XSpreadsheetView</code>
32 * <li><code> getActiveSheet()</code></li>
33 * <li><code> setActiveSheet()</code></li>
35 * This test needs the following object relations :
37 * <li> <code>'Sheet'</code> (of type <code>XSpreadsheet</code>):
38 * to set new active spreadsheet </li>
40 * @see com.sun.star.sheet.XSpreadsheetView
42 public class _XSpreadsheetView
extends MultiMethodTest
{
44 public XSpreadsheetView oObj
= null;
45 public XSpreadsheet oSheet
= null;
48 * Test calls the method, stores and checks returned value. <p>
49 * Has <b> OK </b> status if returned value isn't null. <p>
51 public void _getActiveSheet() {
52 oSheet
= oObj
.getActiveSheet();
53 tRes
.tested("getActiveSheet()", oSheet
!= null);
57 * Test sets new active sheet that was obtained by relation
58 * <code>'Sheet'</code>, gets the current active sheet and compares
59 * returned value with value that was stored by method
60 * <code>getFilterFields()</code>. <p>
61 * Has <b> OK </b> status if values aren't equal. <p>
62 * The following method tests are to be completed successfully before :
64 * <li> <code> getActiveSheet() </code> : to have the current
68 public void _setActiveSheet() {
69 requiredMethod("getActiveSheet()");
71 XSpreadsheet new_Sheet
= (XSpreadsheet
)tEnv
.getObjRelation("Sheet");
72 if (new_Sheet
== null) throw new StatusException(Status
.failed
73 ("Relation 'Sheet' not found"));
75 oObj
.setActiveSheet(new_Sheet
);
76 new_Sheet
= oObj
.getActiveSheet();
77 tRes
.tested("setActiveSheet()", !oSheet
.equals(new_Sheet
));
81 } // finish class _XSpreadsheetView