1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: _XFixedText.java,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
34 import lib
.MultiMethodTest
;
36 import com
.sun
.star
.awt
.TextAlign
;
37 import com
.sun
.star
.awt
.XFixedText
;
40 * Testing <code>com.sun.star.awt.XFixedText</code>
43 * <li><code> setText()</code></li>
44 * <li><code> getText()</code></li>
45 * <li><code> setAlignment()</code></li>
46 * <li><code> getAlignment()</code></li>
48 * Test is <b> NOT </b> multithread compilant. <p>
49 * @see com.sun.star.awt.XFixedText
51 public class _XFixedText
extends MultiMethodTest
{
53 public XFixedText oObj
= null;
54 private String text
= null ;
55 private int align
= -1 ;
58 * Sets value changed and then compares it to get value. <p>
59 * Has <b>OK</b> status if set and get values are equal.
60 * The following method tests are to be completed successfully before :
62 * <li> <code> getText </code> </li>
65 public void _setText() {
66 requiredMethod("getText()") ;
68 boolean result
= true ;
69 oObj
.setText(text
+ "_") ;
70 result
= (text
+"_").equals(oObj
.getText()) ;
72 tRes
.tested("setText()", result
) ;
76 * Just calls the method and stores value returned. <p>
77 * Has <b>OK</b> status if no runtime exceptions occured.
79 public void _getText() {
81 boolean result
= true ;
82 text
= oObj
.getText() ;
83 if (util
.utils
.isVoid(text
)) text
= "XFixedText";
85 tRes
.tested("getText()", result
) ;
89 * Sets value changed and then compares it to get value. <p>
90 * Has <b>OK</b> status if set and get values are equal.
91 * The following method tests are to be completed successfully before :
93 * <li> <code> getAlignment </code> </li>
96 public void _setAlignment() {
97 requiredMethod("getAlignment()") ;
99 boolean result
= true ;
100 int newAlign
= align
==
101 TextAlign
.CENTER ? TextAlign
.LEFT
: TextAlign
.CENTER
;
102 oObj
.setAlignment((short)newAlign
) ;
103 short getAlign
= oObj
.getAlignment() ;
104 result
= newAlign
== getAlign
;
106 tRes
.tested("setAlignment()", result
) ;
110 * Just calls the method and stores value returned. <p>
111 * Has <b>OK</b> status if no runtime exceptions occured.
113 public void _getAlignment() {
115 boolean result
= true ;
116 align
= oObj
.getAlignment() ;
118 tRes
.tested("getAlignment()", result
) ;