Branch libreoffice-5-0-4
[LibreOffice.git] / qadevOOo / tests / java / ifc / sheet / _XSpreadsheetView.java
blob947d55a0de639c584a570d0f0e83265633f9570b
1 /*
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 .
19 package ifc.sheet;
21 import lib.MultiMethodTest;
22 import lib.Status;
23 import lib.StatusException;
25 import com.sun.star.sheet.XSpreadsheet;
26 import com.sun.star.sheet.XSpreadsheetView;
28 /**
29 * Testing <code>com.sun.star.sheet.XSpreadsheetView</code>
30 * interface methods :
31 * <ul>
32 * <li><code> getActiveSheet()</code></li>
33 * <li><code> setActiveSheet()</code></li>
34 * </ul> <p>
35 * This test needs the following object relations :
36 * <ul>
37 * <li> <code>'Sheet'</code> (of type <code>XSpreadsheet</code>):
38 * to set new active spreadsheet </li>
39 * <ul> <p>
40 * @see com.sun.star.sheet.XSpreadsheetView
42 public class _XSpreadsheetView extends MultiMethodTest {
44 public XSpreadsheetView oObj = null;
45 public XSpreadsheet oSheet = null;
47 /**
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);
56 /**
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 :
63 * <ul>
64 * <li> <code> getActiveSheet() </code> : to have the current
65 * active sheet </li>
66 * </ul>
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