Branch libreoffice-5-0-4
[LibreOffice.git] / qadevOOo / tests / java / ifc / awt / _XFixedText.java
blob9ea5527c71b731451614a64dc8e76e5b83ad2871
1 /*
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 .
19 package ifc.awt;
22 import lib.MultiMethodTest;
24 import com.sun.star.awt.TextAlign;
25 import com.sun.star.awt.XFixedText;
27 /**
28 * Testing <code>com.sun.star.awt.XFixedText</code>
29 * interface methods :
30 * <ul>
31 * <li><code> setText()</code></li>
32 * <li><code> getText()</code></li>
33 * <li><code> setAlignment()</code></li>
34 * <li><code> getAlignment()</code></li>
35 * </ul> <p>
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 ;
45 /**
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 :
49 * <ul>
50 * <li> <code> getText </code> </li>
51 * </ul>
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) ;
63 /**
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) ;
76 /**
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 :
80 * <ul>
81 * <li> <code> getAlignment </code> </li>
82 * </ul>
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) ;
97 /**
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) ;