1 /************************************************************************* 2 * 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * Copyright 2000, 2010 Oracle and/or its affiliates. 6 * 7 * OpenOffice.org - a multi-platform office productivity suite 8 * 9 * This file is part of OpenOffice.org. 10 * 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. 14 * 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). 20 * 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. 25 * 26 ************************************************************************/ 27 28 package ifc.sheet; 29 30 import lib.MultiMethodTest; 31 import util.ValueComparer; 32 33 import com.sun.star.sheet.XLabelRange; 34 import com.sun.star.table.CellRangeAddress; 35 36 /** 37 * Testing <code>com.sun.star.sheet.XLabelRange</code> 38 * interface methods : 39 * <ul> 40 * <li><code> getLabelArea()</code></li> 41 * <li><code> setLabelArea()</code></li> 42 * <li><code> getDataArea()</code></li> 43 * <li><code> setDataArea()</code></li> 44 * </ul> <p> 45 * @see com.sun.star.sheet.XLabelRange 46 */ 47 public class _XLabelRange extends MultiMethodTest { 48 49 public XLabelRange oObj = null; 50 public CellRangeAddress setDAddress = null; 51 public CellRangeAddress setLAddress = null; 52 53 /** 54 * Test creates and stores <code>CellRangeAddress</code>, calls the method. 55 * <p>Has <b> OK </b> status if the method successfully returns. <p> 56 * @see com.sun.star.table.CellRangeAddress 57 */ 58 public void _setDataArea() { 59 int nr = Thread.activeCount(); 60 setDAddress = new CellRangeAddress((short)1, nr, 1, nr, 8); 61 oObj.setDataArea(setDAddress); 62 tRes.tested("setDataArea()", true); 63 } 64 65 /** 66 * Test creates and stores <code>CellRangeAddress</code>, calls the method. 67 * <p>Has <b> OK </b> status if the method successfully returns. <p> 68 * @see com.sun.star.table.CellRangeAddress 69 */ 70 public void _setLabelArea() { 71 int nr = Thread.activeCount(); 72 setLAddress = new CellRangeAddress((short)1, nr, 0, nr, 0); 73 oObj.setLabelArea(setLAddress); 74 tRes.tested("setLabelArea()", true); 75 } 76 77 /** 78 * Test calls the method and compares returned value with value that was set. 79 * <p>Has <b> OK </b> status if values are equal. <p> 80 * The following method tests are to be completed successfully before : 81 * <ul> 82 * <li> <code> setDataArea() </code> : to have address of the cell range for 83 * which the labels are valid</li> 84 * </ul> 85 */ 86 public void _getDataArea() { 87 requiredMethod("setDataArea()"); 88 CellRangeAddress gA = oObj.getDataArea(); 89 tRes.tested("getDataArea()", ValueComparer.equalValue(gA, setDAddress)); 90 } 91 92 /** 93 * Test calls the method and compares returned value with value set before. 94 * <p>Has <b> OK </b> status if if values are equal. <p> 95 * The following method tests are to be completed successfully before : 96 * <ul> 97 * <li> <code> setLabelArea() </code>: to have the cell range that contains 98 * the labels</li> 99 * </ul> 100 */ 101 public void _getLabelArea() { 102 requiredMethod("setLabelArea()"); 103 CellRangeAddress gA1 = oObj.getLabelArea(); 104 tRes.tested("getLabelArea()", 105 ValueComparer.equalValue(gA1, setLAddress)); 106 } 107 } // finish class _XLabelRange 108 109 110