tdf#130857 qt weld: Implement QtInstanceWidget::strip_mnemonic
[LibreOffice.git] / qadevOOo / tests / java / ifc / awt / _XComboBox.java
blob37bf4e32423381d545dc96761775992a44eb781c
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;
21 import lib.MultiMethodTest;
22 import lib.Status;
24 import com.sun.star.awt.XComboBox;
26 /**
27 * Testing <code>com.sun.star.awt.XComboBox</code>
28 * interface methods :
29 * <ul>
30 * <li><code> addItemListener()</code></li>
31 * <li><code> removeItemListener()</code></li>
32 * <li><code> addActionListener()</code></li>
33 * <li><code> removeActionListener()</code></li>
34 * <li><code> addItem()</code></li>
35 * <li><code> addItems()</code></li>
36 * <li><code> removeItems()</code></li>
37 * <li><code> getItemCount()</code></li>
38 * <li><code> getItem()</code></li>
39 * <li><code> getItems()</code></li>
40 * <li><code> getDropDownLineCount()</code></li>
41 * <li><code> setDropDownLineCount()</code></li>
42 * </ul> <p>
43 * Test is <b> NOT </b> multithread compliant. <p>
44 * @see com.sun.star.awt.XComboBox
46 public class _XComboBox extends MultiMethodTest {
48 public XComboBox oObj = null;
50 /**
51 * Listener implementation which sets flags on appropriate method calls
53 protected static class TestActionListener
54 implements com.sun.star.awt.XActionListener {
56 public void disposing(com.sun.star.lang.EventObject e) {}
58 public void actionPerformed(com.sun.star.awt.ActionEvent e) {}
61 /**
62 * Listener implementation which sets flags on appropriate method calls
64 protected static class TestItemListener
65 implements com.sun.star.awt.XItemListener {
67 public void disposing(com.sun.star.lang.EventObject e) {}
69 public void itemStateChanged(com.sun.star.awt.ItemEvent e) {}
71 private final TestActionListener actionListener = new TestActionListener();
72 private final TestItemListener itemListener = new TestItemListener();
73 short lineCount = 0;
74 short itemCount = 0;
76 /**
77 * !!! Can be checked only interactively !!!
79 public void _addItemListener() {
81 oObj.addItemListener(itemListener);
83 tRes.tested("addItemListener()", Status.skipped(true));
86 /**
87 * !!! Can be checked only interactively !!!
89 public void _removeItemListener() {
90 requiredMethod("addItemListener()");
92 oObj.removeItemListener(itemListener);
94 tRes.tested("removeItemListener()", Status.skipped(true));
97 /**
98 * !!! Can be checked only interactively !!!
100 public void _addActionListener() {
102 oObj.addActionListener(actionListener);
104 tRes.tested("addActionListener()", Status.skipped(true));
108 * !!! Can be checked only interactively !!!
110 public void _removeActionListener() {
111 requiredMethod("addActionListener()");
113 oObj.removeActionListener(actionListener);
115 tRes.tested("removeActionListener()", Status.skipped(true));
119 * Adds one item to the last position and check the number of
120 * items after addition. <p>
121 * Has <b>OK</b> status if the number of items increased by 1.<p>
122 * The following method tests are to be completed successfully before :
123 * <ul>
124 * <li> <code> getItemCount </code> </li>
125 * </ul>
127 public void _addItem() {
128 requiredMethod("getItemCount()");
130 boolean result = true;
131 oObj.addItem("Item1", itemCount);
132 result = oObj.getItemCount() == itemCount + 1;
134 tRes.tested("addItem()", result);
138 * Adds one two items to the last position and check the number of
139 * items after addition. <p>
140 * Has <b>OK</b> status if the number of items increased by 2.<p>
141 * The following method tests are to be executed before :
142 * <ul>
143 * <li> <code> addItem </code> </li>
144 * </ul>
146 public void _addItems() {
147 executeMethod("addItem()");
149 boolean result = true;
150 short oldCnt = oObj.getItemCount();
151 oObj.addItems(new String[] { "Item2", "Item3" }, oldCnt);
152 result = oObj.getItemCount() == oldCnt + 2;
154 tRes.tested("addItems()", result);
158 * Gets the current number of items and tries to remove them all
159 * then checks number of items. <p>
160 * Has <b>OK</b> status if no items remains. <p>
161 * The following method tests are to be executed before :
162 * <ul>
163 * <li> <code> getItems </code> </li>
164 * <li> <code> getItem </code> </li>
165 * </ul>
167 public void _removeItems() {
168 executeMethod("getItems()");
169 executeMethod("getItem()");
171 boolean result = true;
172 short oldCnt = oObj.getItemCount();
173 oObj.removeItems((short) 0, oldCnt);
174 result = oObj.getItemCount() == 0;
176 tRes.tested("removeItems()", result);
180 * Just retrieves current number of items and stores it. <p>
181 * Has <b>OK</b> status if the count is not less than 0.
183 public void _getItemCount() {
185 itemCount = oObj.getItemCount();
187 tRes.tested("getItemCount()", itemCount >= 0);
191 * After <code>addItem</code> and <code>addItems</code> methods
192 * test the following items must exist {..., "Item1", "Item2", "Item3"}
193 * Retrieves the item from the position which was ititially the last.<p>
194 * Has <b>OK</b> status if the "Item1" was retrieved. <p>
195 * The following method tests are to be executed before :
196 * <ul>
197 * <li> <code> addItems </code> </li>
198 * </ul>
200 public void _getItem() {
201 requiredMethod("addItems()");
203 boolean result = true;
204 String item = oObj.getItem(itemCount);
205 result = "Item1".equals(item);
207 tRes.tested("getItem()", result);
211 * After <code>addItem</code> and <code>addItems</code> methods
212 * test the following items must exist {..., "Item1", "Item2", "Item3"}
213 * Retrieves all items. <p>
214 * Has <b>OK</b> status if the last three items retrieved are
215 * "Item1", "Item2" and "Item3". <p>
216 * The following method tests are to be executed before :
217 * <ul>
218 * <li> <code> addItems </code> </li>
219 * </ul>
221 public void _getItems() {
222 requiredMethod("addItems()");
224 boolean result = true;
225 String[] items = oObj.getItems();
226 for (int i = itemCount; i < (itemCount + 3); i++) {
227 result &= ("Item" + (i + 1)).equals(items[i]);
230 tRes.tested("getItems()", result);
234 * Gets line count and stores it. <p>
235 * Has <b>OK</b> status if no runtime exceptions occurred.
237 public void _getDropDownLineCount() {
239 boolean result = true;
240 lineCount = oObj.getDropDownLineCount();
242 tRes.tested("getDropDownLineCount()", result);
246 * Sets a new value and then checks get value. <p>
247 * Has <b>OK</b> status if set and get values are equal. <p>
248 * The following method tests are to be completed successfully before :
249 * <ul>
250 * <li> <code> getDropDownLineCount </code> </li>
251 * </ul>
253 public void _setDropDownLineCount() {
254 requiredMethod("getDropDownLineCount()");
256 boolean result = true;
257 oObj.setDropDownLineCount((short) (lineCount + 1));
258 result = oObj.getDropDownLineCount() == lineCount + 1;
260 tRes.tested("setDropDownLineCount()", result);