merge the formfield patch from ooo-build
[ooovba.git] / qadevOOo / tests / java / ifc / awt / _XCheckBox.java
blob486cf372e768ec78c77bb766b4bbd822a5ee7e58
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: _XCheckBox.java,v $
10 * $Revision: 1.4 $
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 ************************************************************************/
31 package ifc.awt;
34 import lib.MultiMethodTest;
36 import com.sun.star.awt.XCheckBox;
38 /**
39 * Testing <code>com.sun.star.awt.XCheckBox</code>
40 * interface methods :
41 * <ul>
42 * <li><code> addItemListener()</code></li>
43 * <li><code> removeItemListener()</code></li>
44 * <li><code> getState()</code></li>
45 * <li><code> setState()</code></li>
46 * <li><code> setLabel()</code></li>
47 * <li><code> enableTriState()</code></li>
48 * </ul> <p>
50 * @see com.sun.star.awt.XCheckBox
52 public class _XCheckBox extends MultiMethodTest {
54 public XCheckBox oObj = null;
56 /**
57 * Listener implementation which sets flags on appropriate method calls
59 protected class TestItemListener implements com.sun.star.awt.XItemListener {
60 public boolean disposingCalled = false ;
61 public boolean itemStateChangedCalled = false ;
63 public void disposing(com.sun.star.lang.EventObject e) {
64 disposingCalled = true ;
67 public void itemStateChanged(com.sun.star.awt.ItemEvent e) {
68 itemStateChangedCalled = true ;
72 TestItemListener listener = new TestItemListener() ;
73 short state = -1 ;
75 /**
76 * !!! Can be checked only interactively !!!
78 public void _addItemListener() {
80 boolean result = true ;
81 oObj.addItemListener(listener) ;
82 tRes.tested("addItemListener()", result) ;
85 /**
86 * !!! Can be checked only interactively !!!
88 public void _removeItemListener() {
90 boolean result = true ;
91 oObj.removeItemListener(listener) ;
93 tRes.tested("removeItemListener()", result) ;
96 /**
97 * Just retrieves current state and stores it. <p>
98 * Has <b>OK</b> status if no runtime exceptions occurs.
100 public void _getState() {
102 boolean result = true ;
103 state = oObj.getState() ;
105 tRes.tested("getState()", result) ;
109 * Sets a new value and then checks get value. <p>
110 * Has <b>OK</b> status if set and get values are equal. <p>
111 * The following method tests are to be completed successfully before :
112 * <ul>
113 * <li> <code> getState </code> </li>
114 * </ul>
116 public void _setState() {
117 requiredMethod("getState()") ;
119 boolean result = true ;
120 short newState = state == 0 ? (short)1 : (short)0 ;
121 oObj.setState(newState) ;
122 result = newState == oObj.getState() ;
124 tRes.tested("setState()", result) ;
128 * Just sets some text for label. <p>
129 * Has <b>OK</b> status if no runtime exceptions occurs.
131 public void _setLabel() {
133 boolean result = true ;
134 oObj.setLabel("XCheckBox test") ;
136 tRes.tested("setLabel()", result) ;
140 * Just enables tristate. <p>
141 * Has <b>OK</b> status if no runtime exceptions occurs.
143 public void _enableTriState() {
145 boolean result = true ;
146 oObj.enableTriState(true) ;
148 tRes.tested("enableTriState()", result) ;