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
;
25 import com
.sun
.star
.awt
.XRadioButton
;
28 * Testing <code>com.sun.star.awt.XRadioButton</code>
31 * <li><code> addItemListener()</code></li>
32 * <li><code> removeItemListener()</code></li>
33 * <li><code> getState()</code></li>
34 * <li><code> setState()</code></li>
35 * <li><code> setLabel()</code></li>
37 * Test is <b> NOT </b> multithread compliant. <p>
38 * @see com.sun.star.awt.XRadioButton
40 public class _XRadioButton
extends MultiMethodTest
{
42 public XRadioButton oObj
= null;
43 private boolean state
= false ;
46 * Listener implementation which sets flags on appropriate method calls
48 protected static class TestItemListener
implements com
.sun
.star
.awt
.XItemListener
{
49 private final java
.io
.PrintWriter log
;
51 public TestItemListener(java
.io
.PrintWriter log
) {
55 public void disposing(com
.sun
.star
.lang
.EventObject e
) {
56 log
.println(" disposing was called.") ;
59 public void itemStateChanged(com
.sun
.star
.awt
.ItemEvent e
) {
60 log
.println(" itemStateChanged was called.") ;
65 TestItemListener itemListener
= null ;
68 * !!! Can be checked only interactively !!!
70 public void _addItemListener() {
72 itemListener
= new TestItemListener(log
) ;
74 oObj
.addItemListener(itemListener
) ;
76 tRes
.tested("addItemListener()", Status
.skipped(true)) ;
80 * !!! Can be checked only interactively !!!
82 public void _removeItemListener() {
83 requiredMethod("addItemListener()") ;
85 oObj
.removeItemListener(itemListener
) ;
87 tRes
.tested("removeItemListener()", Status
.skipped(true)) ;
91 * Gets state and stores it. <p>
92 * Has <b> OK </b> status if no runtime exceptions occurred
94 public void _getState() {
96 boolean result
= true ;
97 state
= oObj
.getState() ;
99 tRes
.tested("getState()", result
) ;
103 * Sets a new state and the gets it for checking. <p>
104 * Has <b> OK </b> status if set and get states are equal. <p>
105 * The following method tests are to be completed successfully before :
107 * <li> <code> getState </code> </li>
110 public void _setState() {
111 requiredMethod("getState()") ;
113 boolean result
= true ;
114 oObj
.setState(!state
) ;
118 result
= oObj
.getState() == !state
;
120 tRes
.tested("setState()", result
) ;
124 * Just sets a new label. <p>
125 * Has <b> OK </b> status if no runtime exceptions occurred
127 public void _setLabel() {
129 boolean result
= true ;
130 oObj
.setLabel("XRadioButton") ;
132 tRes
.tested("setLabel()", result
) ;