2 * This file is part of the LibreOffice project.
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/.
8 * This file incorporates work covered by the following license notice:
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 .
22 import lib
.MultiMethodTest
;
24 import com
.sun
.star
.awt
.TextAlign
;
25 import com
.sun
.star
.awt
.XFixedText
;
28 * Testing <code>com.sun.star.awt.XFixedText</code>
31 * <li><code> setText()</code></li>
32 * <li><code> getText()</code></li>
33 * <li><code> setAlignment()</code></li>
34 * <li><code> getAlignment()</code></li>
36 * Test is <b> NOT </b> multithread compliant. <p>
37 * @see com.sun.star.awt.XFixedText
39 public class _XFixedText
extends MultiMethodTest
{
41 public XFixedText oObj
= null;
42 private String text
= null ;
43 private int align
= -1 ;
46 * Sets value changed and then compares it to get value. <p>
47 * Has <b>OK</b> status if set and get values are equal.
48 * The following method tests are to be completed successfully before :
50 * <li> <code> getText </code> </li>
53 public void _setText() {
54 requiredMethod("getText()") ;
56 boolean result
= true ;
57 oObj
.setText(text
+ "_") ;
58 result
= (text
+"_").equals(oObj
.getText()) ;
60 tRes
.tested("setText()", result
) ;
64 * Just calls the method and stores value returned. <p>
65 * Has <b>OK</b> status if no runtime exceptions occurred.
67 public void _getText() {
69 boolean result
= true ;
70 text
= oObj
.getText() ;
71 if (util
.utils
.isVoid(text
)) text
= "XFixedText";
73 tRes
.tested("getText()", result
) ;
77 * Sets value changed and then compares it to get value. <p>
78 * Has <b>OK</b> status if set and get values are equal.
79 * The following method tests are to be completed successfully before :
81 * <li> <code> getAlignment </code> </li>
84 public void _setAlignment() {
85 requiredMethod("getAlignment()") ;
87 boolean result
= true ;
88 int newAlign
= align
==
89 TextAlign
.CENTER ? TextAlign
.LEFT
: TextAlign
.CENTER
;
90 oObj
.setAlignment((short)newAlign
) ;
91 short getAlign
= oObj
.getAlignment() ;
92 result
= newAlign
== getAlign
;
94 tRes
.tested("setAlignment()", result
) ;
98 * Just calls the method and stores value returned. <p>
99 * Has <b>OK</b> status if no runtime exceptions occurred.
101 public void _getAlignment() {
103 boolean result
= true ;
104 align
= oObj
.getAlignment() ;
106 tRes
.tested("getAlignment()", result
) ;