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.awt; 29 30 31 import lib.MultiMethodTest; 32 33 import com.sun.star.awt.TextAlign; 34 import com.sun.star.awt.XFixedText; 35 36 /** 37 * Testing <code>com.sun.star.awt.XFixedText</code> 38 * interface methods : 39 * <ul> 40 * <li><code> setText()</code></li> 41 * <li><code> getText()</code></li> 42 * <li><code> setAlignment()</code></li> 43 * <li><code> getAlignment()</code></li> 44 * </ul> <p> 45 * Test is <b> NOT </b> multithread compilant. <p> 46 * @see com.sun.star.awt.XFixedText 47 */ 48 public class _XFixedText extends MultiMethodTest { 49 50 public XFixedText oObj = null; 51 private String text = null ; 52 private int align = -1 ; 53 54 /** 55 * Sets value changed and then compares it to get value. <p> 56 * Has <b>OK</b> status if set and get values are equal. 57 * The following method tests are to be completed successfully before : 58 * <ul> 59 * <li> <code> getText </code> </li> 60 * </ul> 61 */ 62 public void _setText() { 63 requiredMethod("getText()") ; 64 65 boolean result = true ; 66 oObj.setText(text + "_") ; 67 result = (text+"_").equals(oObj.getText()) ; 68 69 tRes.tested("setText()", result) ; 70 } 71 72 /** 73 * Just calls the method and stores value returned. <p> 74 * Has <b>OK</b> status if no runtime exceptions occured. 75 */ 76 public void _getText() { 77 78 boolean result = true ; 79 text = oObj.getText() ; 80 if (util.utils.isVoid(text)) text = "XFixedText"; 81 82 tRes.tested("getText()", result) ; 83 } 84 85 /** 86 * Sets value changed and then compares it to get value. <p> 87 * Has <b>OK</b> status if set and get values are equal. 88 * The following method tests are to be completed successfully before : 89 * <ul> 90 * <li> <code> getAlignment </code> </li> 91 * </ul> 92 */ 93 public void _setAlignment() { 94 requiredMethod("getAlignment()") ; 95 96 boolean result = true ; 97 int newAlign = align == 98 TextAlign.CENTER ? TextAlign.LEFT : TextAlign.CENTER ; 99 oObj.setAlignment((short)newAlign) ; 100 short getAlign = oObj.getAlignment() ; 101 result = newAlign == getAlign ; 102 103 tRes.tested("setAlignment()", result) ; 104 } 105 106 /** 107 * Just calls the method and stores value returned. <p> 108 * Has <b>OK</b> status if no runtime exceptions occured. 109 */ 110 public void _getAlignment() { 111 112 boolean result = true ; 113 align = oObj.getAlignment() ; 114 115 tRes.tested("getAlignment()", result) ; 116 } 117 118 } 119 120 121