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
.XCheckBox
;
27 * Testing <code>com.sun.star.awt.XCheckBox</code>
30 * <li><code> addItemListener()</code></li>
31 * <li><code> removeItemListener()</code></li>
32 * <li><code> getState()</code></li>
33 * <li><code> setState()</code></li>
34 * <li><code> setLabel()</code></li>
35 * <li><code> enableTriState()</code></li>
38 * @see com.sun.star.awt.XCheckBox
40 public class _XCheckBox
extends MultiMethodTest
{
42 public XCheckBox oObj
= null;
45 * Listener implementation which sets flags on appropriate method calls
47 protected class TestItemListener
implements com
.sun
.star
.awt
.XItemListener
{
48 public boolean disposingCalled
= false ;
49 public boolean itemStateChangedCalled
= false ;
51 public void disposing(com
.sun
.star
.lang
.EventObject e
) {
52 disposingCalled
= true ;
55 public void itemStateChanged(com
.sun
.star
.awt
.ItemEvent e
) {
56 itemStateChangedCalled
= true ;
60 TestItemListener listener
= new TestItemListener() ;
64 * !!! Can be checked only interactively !!!
66 public void _addItemListener() {
68 boolean result
= true ;
69 oObj
.addItemListener(listener
) ;
70 tRes
.tested("addItemListener()", result
) ;
74 * !!! Can be checked only interactively !!!
76 public void _removeItemListener() {
78 boolean result
= true ;
79 oObj
.removeItemListener(listener
) ;
81 tRes
.tested("removeItemListener()", result
) ;
85 * Just retrieves current state and stores it. <p>
86 * Has <b>OK</b> status if no runtime exceptions occurs.
88 public void _getState() {
90 boolean result
= true ;
91 state
= oObj
.getState() ;
93 tRes
.tested("getState()", result
) ;
97 * Sets a new value and then checks get value. <p>
98 * Has <b>OK</b> status if set and get values are equal. <p>
99 * The following method tests are to be completed successfully before :
101 * <li> <code> getState </code> </li>
104 public void _setState() {
105 requiredMethod("getState()") ;
107 boolean result
= true ;
108 short newState
= state
== 0 ?
(short)1 : (short)0 ;
109 oObj
.setState(newState
) ;
110 result
= newState
== oObj
.getState() ;
112 tRes
.tested("setState()", result
) ;
116 * Just sets some text for label. <p>
117 * Has <b>OK</b> status if no runtime exceptions occurs.
119 public void _setLabel() {
121 boolean result
= true ;
122 oObj
.setLabel("XCheckBox test") ;
124 tRes
.tested("setLabel()", result
) ;
128 * Just enables tristate. <p>
129 * Has <b>OK</b> status if no runtime exceptions occurs.
131 public void _enableTriState() {
133 boolean result
= true ;
134 oObj
.enableTriState(true) ;
136 tRes
.tested("enableTriState()", result
) ;