1 /************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 23 24 package ifc.sheet; 25 26 import lib.MultiMethodTest; 27 import lib.Status; 28 import lib.StatusException; 29 30 import com.sun.star.sheet.XSpreadsheet; 31 import com.sun.star.sheet.XSpreadsheetView; 32 33 /** 34 * Testing <code>com.sun.star.sheet.XSpreadsheetView</code> 35 * interface methods : 36 * <ul> 37 * <li><code> getActiveSheet()</code></li> 38 * <li><code> setActiveSheet()</code></li> 39 * </ul> <p> 40 * This test needs the following object relations : 41 * <ul> 42 * <li> <code>'Sheet'</code> (of type <code>XSpreadsheet</code>): 43 * to set new active spreadsheet </li> 44 * <ul> <p> 45 * @see com.sun.star.sheet.XSpreadsheetView 46 */ 47 public class _XSpreadsheetView extends MultiMethodTest { 48 49 public XSpreadsheetView oObj = null; 50 public XSpreadsheet oSheet = null; 51 52 /** 53 * Test calls the method, stores and checks returned value. <p> 54 * Has <b> OK </b> status if returned value isn't null. <p> 55 */ _getActiveSheet()56 public void _getActiveSheet() { 57 oSheet = oObj.getActiveSheet(); 58 tRes.tested("getActiveSheet()", oSheet != null); 59 } 60 61 /** 62 * Test sets new active sheet that was obtained by relation 63 * <code>'Sheet'</code>, gets the current active sheet and compares 64 * returned value with value that was stored by method 65 * <code>getFilterFields()</code>. <p> 66 * Has <b> OK </b> status if values aren't equal. <p> 67 * The following method tests are to be completed successfully before : 68 * <ul> 69 * <li> <code> getActiveSheet() </code> : to have the current 70 * active sheet </li> 71 * </ul> 72 */ _setActiveSheet()73 public void _setActiveSheet() { 74 requiredMethod("getActiveSheet()"); 75 76 XSpreadsheet new_Sheet = (XSpreadsheet)tEnv.getObjRelation("Sheet"); 77 if (new_Sheet == null) throw new StatusException(Status.failed 78 ("Relation 'Sheet' not found")); 79 80 oObj.setActiveSheet(new_Sheet); 81 new_Sheet = oObj.getActiveSheet(); 82 tRes.tested("setActiveSheet()", !oSheet.equals(new_Sheet)); 83 } 84 85 86 } // finish class _XSpreadsheetView 87 88 89