1ef39d40dSAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3ef39d40dSAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4ef39d40dSAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5ef39d40dSAndrew Rist  * distributed with this work for additional information
6ef39d40dSAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7ef39d40dSAndrew Rist  * to you under the Apache License, Version 2.0 (the
8ef39d40dSAndrew Rist  * "License"); you may not use this file except in compliance
9ef39d40dSAndrew Rist  * with the License.  You may obtain a copy of the License at
10ef39d40dSAndrew Rist  *
11ef39d40dSAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12ef39d40dSAndrew Rist  *
13ef39d40dSAndrew Rist  * Unless required by applicable law or agreed to in writing,
14ef39d40dSAndrew Rist  * software distributed under the License is distributed on an
15ef39d40dSAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16ef39d40dSAndrew Rist  * KIND, either express or implied.  See the License for the
17ef39d40dSAndrew Rist  * specific language governing permissions and limitations
18ef39d40dSAndrew Rist  * under the License.
19ef39d40dSAndrew Rist  *
20ef39d40dSAndrew Rist  *************************************************************/
21ef39d40dSAndrew Rist 
22ef39d40dSAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir package ifc.awt;
25cdf0e10cSrcweir 
26cdf0e10cSrcweir 
27cdf0e10cSrcweir import lib.MultiMethodTest;
28cdf0e10cSrcweir 
29cdf0e10cSrcweir import com.sun.star.awt.TextAlign;
30cdf0e10cSrcweir import com.sun.star.awt.XFixedText;
31cdf0e10cSrcweir 
32cdf0e10cSrcweir /**
33cdf0e10cSrcweir * Testing <code>com.sun.star.awt.XFixedText</code>
34cdf0e10cSrcweir * interface methods :
35cdf0e10cSrcweir * <ul>
36cdf0e10cSrcweir *  <li><code> setText()</code></li>
37cdf0e10cSrcweir *  <li><code> getText()</code></li>
38cdf0e10cSrcweir *  <li><code> setAlignment()</code></li>
39cdf0e10cSrcweir *  <li><code> getAlignment()</code></li>
40cdf0e10cSrcweir * </ul> <p>
41cdf0e10cSrcweir * Test is <b> NOT </b> multithread compilant. <p>
42cdf0e10cSrcweir * @see com.sun.star.awt.XFixedText
43cdf0e10cSrcweir */
44cdf0e10cSrcweir public class _XFixedText extends MultiMethodTest {
45cdf0e10cSrcweir 
46cdf0e10cSrcweir     public XFixedText oObj = null;
47cdf0e10cSrcweir     private String text = null ;
48cdf0e10cSrcweir     private int align = -1 ;
49cdf0e10cSrcweir 
50cdf0e10cSrcweir     /**
51cdf0e10cSrcweir     * Sets value changed and then compares it to get value. <p>
52cdf0e10cSrcweir     * Has <b>OK</b> status if set and get values are equal.
53cdf0e10cSrcweir     * The following method tests are to be completed successfully before :
54cdf0e10cSrcweir     * <ul>
55cdf0e10cSrcweir     *  <li> <code> getText </code>  </li>
56cdf0e10cSrcweir     * </ul>
57cdf0e10cSrcweir     */
_setText()58cdf0e10cSrcweir     public void _setText() {
59cdf0e10cSrcweir         requiredMethod("getText()") ;
60cdf0e10cSrcweir 
61cdf0e10cSrcweir         boolean result = true ;
62cdf0e10cSrcweir         oObj.setText(text + "_") ;
63cdf0e10cSrcweir         result = (text+"_").equals(oObj.getText()) ;
64cdf0e10cSrcweir 
65cdf0e10cSrcweir         tRes.tested("setText()", result) ;
66cdf0e10cSrcweir     }
67cdf0e10cSrcweir 
68cdf0e10cSrcweir     /**
69cdf0e10cSrcweir     * Just calls the method and stores value returned. <p>
70*bb6af6bcSPedro Giffuni     * Has <b>OK</b> status if no runtime exceptions occurred.
71cdf0e10cSrcweir     */
_getText()72cdf0e10cSrcweir     public void _getText() {
73cdf0e10cSrcweir 
74cdf0e10cSrcweir         boolean result = true ;
75cdf0e10cSrcweir         text = oObj.getText() ;
76cdf0e10cSrcweir         if (util.utils.isVoid(text)) text = "XFixedText";
77cdf0e10cSrcweir 
78cdf0e10cSrcweir         tRes.tested("getText()", result) ;
79cdf0e10cSrcweir     }
80cdf0e10cSrcweir 
81cdf0e10cSrcweir     /**
82cdf0e10cSrcweir     * Sets value changed and then compares it to get value. <p>
83cdf0e10cSrcweir     * Has <b>OK</b> status if set and get values are equal.
84cdf0e10cSrcweir     * The following method tests are to be completed successfully before :
85cdf0e10cSrcweir     * <ul>
86cdf0e10cSrcweir     *  <li> <code> getAlignment </code>  </li>
87cdf0e10cSrcweir     * </ul>
88cdf0e10cSrcweir     */
_setAlignment()89cdf0e10cSrcweir     public void _setAlignment() {
90cdf0e10cSrcweir         requiredMethod("getAlignment()") ;
91cdf0e10cSrcweir 
92cdf0e10cSrcweir         boolean result = true ;
93cdf0e10cSrcweir         int newAlign = align ==
94cdf0e10cSrcweir             TextAlign.CENTER ? TextAlign.LEFT : TextAlign.CENTER ;
95cdf0e10cSrcweir         oObj.setAlignment((short)newAlign) ;
96cdf0e10cSrcweir         short getAlign = oObj.getAlignment() ;
97cdf0e10cSrcweir         result = newAlign == getAlign ;
98cdf0e10cSrcweir 
99cdf0e10cSrcweir         tRes.tested("setAlignment()", result) ;
100cdf0e10cSrcweir     }
101cdf0e10cSrcweir 
102cdf0e10cSrcweir     /**
103cdf0e10cSrcweir     * Just calls the method and stores value returned. <p>
104*bb6af6bcSPedro Giffuni     * Has <b>OK</b> status if no runtime exceptions occurred.
105cdf0e10cSrcweir     */
_getAlignment()106cdf0e10cSrcweir     public void _getAlignment() {
107cdf0e10cSrcweir 
108cdf0e10cSrcweir         boolean result = true ;
109cdf0e10cSrcweir         align = oObj.getAlignment() ;
110cdf0e10cSrcweir 
111cdf0e10cSrcweir         tRes.tested("getAlignment()", result) ;
112cdf0e10cSrcweir     }
113cdf0e10cSrcweir 
114cdf0e10cSrcweir }
115cdf0e10cSrcweir 
116cdf0e10cSrcweir 
117