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 static class TestItemListener
implements com
.sun
.star
.awt
.XItemListener
{
49 public void disposing(com
.sun
.star
.lang
.EventObject e
) {
52 public void itemStateChanged(com
.sun
.star
.awt
.ItemEvent e
) {}
54 TestItemListener listener
= new TestItemListener() ;
58 * !!! Can be checked only interactively !!!
60 public void _addItemListener() {
62 boolean result
= true ;
63 oObj
.addItemListener(listener
) ;
64 tRes
.tested("addItemListener()", result
) ;
68 * !!! Can be checked only interactively !!!
70 public void _removeItemListener() {
72 boolean result
= true ;
73 oObj
.removeItemListener(listener
) ;
75 tRes
.tested("removeItemListener()", result
) ;
79 * Just retrieves current state and stores it. <p>
80 * Has <b>OK</b> status if no runtime exceptions occurs.
82 public void _getState() {
84 boolean result
= true ;
85 state
= oObj
.getState() ;
87 tRes
.tested("getState()", result
) ;
91 * Sets a new value and then checks get value. <p>
92 * Has <b>OK</b> status if set and get values are equal. <p>
93 * The following method tests are to be completed successfully before :
95 * <li> <code> getState </code> </li>
98 public void _setState() {
99 requiredMethod("getState()") ;
101 boolean result
= true ;
102 short newState
= state
== 0 ?
(short)1 : (short)0 ;
103 oObj
.setState(newState
) ;
104 result
= newState
== oObj
.getState() ;
106 tRes
.tested("setState()", result
) ;
110 * Just sets some text for label. <p>
111 * Has <b>OK</b> status if no runtime exceptions occurs.
113 public void _setLabel() {
115 boolean result
= true ;
116 oObj
.setLabel("XCheckBox test") ;
118 tRes
.tested("setLabel()", result
) ;
122 * Just enables tristate. <p>
123 * Has <b>OK</b> status if no runtime exceptions occurs.
125 public void _enableTriState() {
127 boolean result
= true ;
128 oObj
.enableTriState(true) ;
130 tRes
.tested("enableTriState()", result
) ;