Branch libreoffice-5-0-4
[LibreOffice.git] / qadevOOo / tests / java / ifc / awt / _XRadioButton.java
blobb1900464749a8bf1e2c37f8160490b56c2f06d2e
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;
23 import lib.Status;
25 import com.sun.star.awt.XRadioButton;
27 /**
28 * Testing <code>com.sun.star.awt.XRadioButton</code>
29 * interface methods :
30 * <ul>
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>
36 * </ul> <p>
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 ;
45 /**
46 * Listener implementation which sets flags on appropriate method calls
48 protected class TestItemListener implements com.sun.star.awt.XItemListener {
49 public boolean disposingCalled = false ;
50 public boolean itemStateChangedCalled = false ;
51 private final java.io.PrintWriter log;
53 public TestItemListener(java.io.PrintWriter log) {
54 this.log = log ;
57 public void disposing(com.sun.star.lang.EventObject e) {
58 disposingCalled = true ;
59 log.println(" disposing was called.") ;
62 public void itemStateChanged(com.sun.star.awt.ItemEvent e) {
63 itemStateChangedCalled = true ;
64 log.println(" itemStateChanged was called.") ;
69 TestItemListener itemListener = null ;
71 /**
72 * !!! Can be checked only interactively !!!
74 public void _addItemListener() {
76 itemListener = new TestItemListener(log) ;
78 oObj.addItemListener(itemListener) ;
80 tRes.tested("addItemListener()", Status.skipped(true)) ;
83 /**
84 * !!! Can be checked only interactively !!!
86 public void _removeItemListener() {
87 requiredMethod("addItemListener()") ;
89 oObj.removeItemListener(itemListener) ;
91 tRes.tested("removeItemListener()", Status.skipped(true)) ;
94 /**
95 * Gets state and stores it. <p>
96 * Has <b> OK </b> status if no runtime exceptions occurred
98 public void _getState() {
100 boolean result = true ;
101 state = oObj.getState() ;
103 tRes.tested("getState()", result) ;
107 * Sets a new state and the gets it for checking. <p>
108 * Has <b> OK </b> status if set and get states are equal. <p>
109 * The following method tests are to be completed successfully before :
110 * <ul>
111 * <li> <code> getState </code> </li>
112 * </ul>
114 public void _setState() {
115 requiredMethod("getState()") ;
117 boolean result = true ;
118 oObj.setState(!state) ;
120 util.utils.pause(200);
122 result = oObj.getState() == !state ;
124 tRes.tested("setState()", result) ;
128 * Just sets a new label. <p>
129 * Has <b> OK </b> status if no runtime exceptions occurred
131 public void _setLabel() {
133 boolean result = true ;
134 oObj.setLabel("XRadioButton") ;
136 tRes.tested("setLabel()", result) ;