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