1 /* 2 * This file is part of the LibreOffice project. 3 * 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/. 7 * 8 * This file incorporates work covered by the following license notice: 9 * 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 . 17 */ 18 19 package ifc.text; 20 21 import lib.MultiMethodTest; 22 23 import com.sun.star.text.TextColumn; 24 import com.sun.star.text.XTextColumns; 25 26 /** 27 * Testing <code>com.sun.star.text.XTextColumns</code> 28 * interface methods : 29 * <ul> 30 * <li><code> getReferenceValue()</code></li> 31 * <li><code> getColumnCount()</code></li> 32 * <li><code> setColumnCount()</code></li> 33 * <li><code> getColumns()</code></li> 34 * <li><code> setColumns()</code></li> 35 * </ul> <p> 36 * Test is <b> NOT </b> multithread compliant. <p> 37 * @see com.sun.star.text.XTextColumns 38 */ 39 public class _XTextColumns extends MultiMethodTest { 40 41 public XTextColumns oObj = null; 42 43 /** 44 * Test calls the method. <p> 45 * Has <b> OK </b> status if the method returns 46 * positive value. 47 */ _getColumnCount()48 public void _getColumnCount(){ 49 50 short howmuch = oObj.getColumnCount(); 51 tRes.tested("getColumnCount()",howmuch >=0); 52 } 53 54 /** 55 * Test calls the method. <p> 56 * Has <b> OK </b> status if the method returns not 57 * <code>null</code> value. 58 */ _getColumns()59 public void _getColumns(){ 60 TextColumn[] cols = oObj.getColumns(); 61 tRes.tested("getColumns()",cols != null); 62 } 63 64 /** 65 * Test calls the method. <p> 66 * Has <b> OK </b> status if the method returns 67 * positive value. 68 */ _getReferenceValue()69 public void _getReferenceValue(){ 70 71 int ref = oObj.getReferenceValue(); 72 tRes.tested("getReferenceValue()",ref >0); 73 } 74 75 /** 76 * Sets the column count property to some value 77 * then checks it by <code>getColumnCount</code> method. <p> 78 * 79 * Has <b>OK</b> status if set and get values are equal. 80 */ _setColumnCount()81 public void _setColumnCount(){ 82 83 oObj.setColumnCount((short) 3); 84 short howmuch = oObj.getColumnCount(); 85 tRes.tested("setColumnCount()",howmuch == 3); 86 } 87 88 /** 89 * Sets columns to some array 90 * then checks it by <code>getColumns</code> method. <p> 91 * 92 * Has <b>OK</b> status if set and get arrays are equal. 93 */ _setColumns()94 public void _setColumns(){ 95 96 TextColumn newCol = new TextColumn(5,1,1); 97 TextColumn[] cols = {newCol}; 98 oObj.setColumns(cols); 99 TextColumn[] gCols = oObj.getColumns(); 100 tRes.tested("setColumns()",util.ValueComparer.equalValue(cols, gCols)); 101 } 102 103 } // finish class _XTextColumns 104 105 106