xref: /AOO41X/main/qadevOOo/tests/java/ifc/awt/_XListBox.java (revision ef39d40d3f5e66cf3f035b3e93783012b340500d)
1*ef39d40dSAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*ef39d40dSAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*ef39d40dSAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*ef39d40dSAndrew Rist  * distributed with this work for additional information
6*ef39d40dSAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*ef39d40dSAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*ef39d40dSAndrew Rist  * "License"); you may not use this file except in compliance
9*ef39d40dSAndrew Rist  * with the License.  You may obtain a copy of the License at
10cdf0e10cSrcweir  *
11*ef39d40dSAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12cdf0e10cSrcweir  *
13*ef39d40dSAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*ef39d40dSAndrew Rist  * software distributed under the License is distributed on an
15*ef39d40dSAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*ef39d40dSAndrew Rist  * KIND, either express or implied.  See the License for the
17*ef39d40dSAndrew Rist  * specific language governing permissions and limitations
18*ef39d40dSAndrew Rist  * under the License.
19cdf0e10cSrcweir  *
20*ef39d40dSAndrew Rist  *************************************************************/
21*ef39d40dSAndrew Rist 
22*ef39d40dSAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir package ifc.awt;
25cdf0e10cSrcweir 
26cdf0e10cSrcweir 
27cdf0e10cSrcweir import lib.MultiMethodTest;
28cdf0e10cSrcweir import lib.Status;
29cdf0e10cSrcweir 
30cdf0e10cSrcweir import com.sun.star.awt.XListBox;
31cdf0e10cSrcweir 
32cdf0e10cSrcweir /**
33cdf0e10cSrcweir * Testing <code>com.sun.star.awt.XListBox</code>
34cdf0e10cSrcweir * interface methods :
35cdf0e10cSrcweir * <ul>
36cdf0e10cSrcweir *  <li><code> addItemListener()</code></li>
37cdf0e10cSrcweir *  <li><code> removeItemListener()</code></li>
38cdf0e10cSrcweir *  <li><code> addActionListener()</code></li>
39cdf0e10cSrcweir *  <li><code> removeActionListener()</code></li>
40cdf0e10cSrcweir *  <li><code> addItem()</code></li>
41cdf0e10cSrcweir *  <li><code> addItems()</code></li>
42cdf0e10cSrcweir *  <li><code> removeItems()</code></li>
43cdf0e10cSrcweir *  <li><code> getItemCount()</code></li>
44cdf0e10cSrcweir *  <li><code> getItem()</code></li>
45cdf0e10cSrcweir *  <li><code> getItems()</code></li>
46cdf0e10cSrcweir *  <li><code> getSelectedItemPos()</code></li>
47cdf0e10cSrcweir *  <li><code> getSelectedItemsPos()</code></li>
48cdf0e10cSrcweir *  <li><code> getSelectedItem()</code></li>
49cdf0e10cSrcweir *  <li><code> getSelectedItems()</code></li>
50cdf0e10cSrcweir *  <li><code> selectItemPos()</code></li>
51cdf0e10cSrcweir *  <li><code> selectItemsPos()</code></li>
52cdf0e10cSrcweir *  <li><code> selectItem()</code></li>
53cdf0e10cSrcweir *  <li><code> isMutipleMode()</code></li>
54cdf0e10cSrcweir *  <li><code> setMultipleMode()</code></li>
55cdf0e10cSrcweir *  <li><code> getDropDownLineCount()</code></li>
56cdf0e10cSrcweir *  <li><code> setDropDownLineCount()</code></li>
57cdf0e10cSrcweir *  <li><code> makeVisible()</code></li>
58cdf0e10cSrcweir * </ul> <p>
59cdf0e10cSrcweir * Test is <b> NOT </b> multithread compilant. <p>
60cdf0e10cSrcweir * @see com.sun.star.awt.XListBox
61cdf0e10cSrcweir */
62cdf0e10cSrcweir public class _XListBox extends MultiMethodTest {
63cdf0e10cSrcweir 
64cdf0e10cSrcweir     public XListBox oObj = null;
65cdf0e10cSrcweir 
66cdf0e10cSrcweir     /**
67cdf0e10cSrcweir     * Listener implementation which sets flags on appropriate method calls
68cdf0e10cSrcweir     */
69cdf0e10cSrcweir     protected class TestActionListener implements com.sun.star.awt.XActionListener {
70cdf0e10cSrcweir         public boolean disposingCalled = false ;
71cdf0e10cSrcweir         public boolean actionPerformedCalled = false ;
72cdf0e10cSrcweir 
disposing(com.sun.star.lang.EventObject e)73cdf0e10cSrcweir         public void disposing(com.sun.star.lang.EventObject e) {
74cdf0e10cSrcweir             disposingCalled = true ;
75cdf0e10cSrcweir         }
76cdf0e10cSrcweir 
actionPerformed(com.sun.star.awt.ActionEvent e)77cdf0e10cSrcweir         public void actionPerformed(com.sun.star.awt.ActionEvent e) {
78cdf0e10cSrcweir             actionPerformedCalled = true ;
79cdf0e10cSrcweir         }
80cdf0e10cSrcweir 
81cdf0e10cSrcweir     }
82cdf0e10cSrcweir 
83cdf0e10cSrcweir     TestActionListener actionListener = new TestActionListener() ;
84cdf0e10cSrcweir 
85cdf0e10cSrcweir     /**
86cdf0e10cSrcweir     * Listener implementation which sets flags on appropriate method calls
87cdf0e10cSrcweir     */
88cdf0e10cSrcweir     protected class TestItemListener implements com.sun.star.awt.XItemListener {
89cdf0e10cSrcweir         public boolean disposingCalled = false ;
90cdf0e10cSrcweir         public boolean itemStateChangedCalled = false ;
91cdf0e10cSrcweir 
disposing(com.sun.star.lang.EventObject e)92cdf0e10cSrcweir         public void disposing(com.sun.star.lang.EventObject e) {
93cdf0e10cSrcweir             disposingCalled = true ;
94cdf0e10cSrcweir         }
95cdf0e10cSrcweir 
itemStateChanged(com.sun.star.awt.ItemEvent e)96cdf0e10cSrcweir         public void itemStateChanged(com.sun.star.awt.ItemEvent e) {
97cdf0e10cSrcweir             itemStateChangedCalled = true ;
98cdf0e10cSrcweir         }
99cdf0e10cSrcweir 
100cdf0e10cSrcweir     }
101cdf0e10cSrcweir 
102cdf0e10cSrcweir     TestItemListener itemListener = new TestItemListener() ;
103cdf0e10cSrcweir 
104cdf0e10cSrcweir     short lineCount = 0 ;
105cdf0e10cSrcweir     short itemCount = 0 ;
106cdf0e10cSrcweir 
107cdf0e10cSrcweir     /**
108cdf0e10cSrcweir     * Retrieves object relations.
109cdf0e10cSrcweir     * @throws StatusException If one of relations not found.
110cdf0e10cSrcweir     */
before()111cdf0e10cSrcweir     public void before() {
112cdf0e10cSrcweir         itemCount = oObj.getItemCount();
113cdf0e10cSrcweir     }
114cdf0e10cSrcweir 
115cdf0e10cSrcweir     /**
116cdf0e10cSrcweir     * !!! Can be checked only interactively !!!
117cdf0e10cSrcweir     */
_addItemListener()118cdf0e10cSrcweir     public void _addItemListener() {
119cdf0e10cSrcweir 
120cdf0e10cSrcweir         oObj.addItemListener(itemListener) ;
121cdf0e10cSrcweir 
122cdf0e10cSrcweir         tRes.tested("addItemListener()", Status.skipped(true)) ;
123cdf0e10cSrcweir     }
124cdf0e10cSrcweir 
125cdf0e10cSrcweir     /**
126cdf0e10cSrcweir     * !!! Can be checked only interactively !!!
127cdf0e10cSrcweir     */
_removeItemListener()128cdf0e10cSrcweir     public void _removeItemListener() {
129cdf0e10cSrcweir         requiredMethod("addItemListener()") ;
130cdf0e10cSrcweir 
131cdf0e10cSrcweir         oObj.removeItemListener(itemListener) ;
132cdf0e10cSrcweir 
133cdf0e10cSrcweir         tRes.tested("removeItemListener()", Status.skipped(true)) ;
134cdf0e10cSrcweir     }
135cdf0e10cSrcweir 
136cdf0e10cSrcweir     /**
137cdf0e10cSrcweir     * !!! Can be checked only interactively !!!
138cdf0e10cSrcweir     */
_addActionListener()139cdf0e10cSrcweir     public void _addActionListener() {
140cdf0e10cSrcweir 
141cdf0e10cSrcweir         oObj.addActionListener(actionListener) ;
142cdf0e10cSrcweir 
143cdf0e10cSrcweir         tRes.tested("addActionListener()", Status.skipped(true)) ;
144cdf0e10cSrcweir     }
145cdf0e10cSrcweir 
146cdf0e10cSrcweir     /**
147cdf0e10cSrcweir     * !!! Can be checked only interactively !!!
148cdf0e10cSrcweir     */
_removeActionListener()149cdf0e10cSrcweir     public void _removeActionListener() {
150cdf0e10cSrcweir         requiredMethod("addActionListener()") ;
151cdf0e10cSrcweir 
152cdf0e10cSrcweir         oObj.removeActionListener(actionListener) ;
153cdf0e10cSrcweir 
154cdf0e10cSrcweir         tRes.tested("removeActionListener()", Status.skipped(true)) ;
155cdf0e10cSrcweir     }
156cdf0e10cSrcweir 
157cdf0e10cSrcweir     /**
158cdf0e10cSrcweir     * Adds one item to the last position and check the number of
159cdf0e10cSrcweir     * items after addition. <p>
160cdf0e10cSrcweir     * Has <b>OK</b> status if the number of items increased by 1.<p>
161cdf0e10cSrcweir     * The following method tests are to be completed successfully before :
162cdf0e10cSrcweir     * <ul>
163cdf0e10cSrcweir     *  <li> <code> getItemCount </code> </li>
164cdf0e10cSrcweir     * </ul>
165cdf0e10cSrcweir     */
_addItem()166cdf0e10cSrcweir     public void _addItem() {
167cdf0e10cSrcweir         requiredMethod("getItemCount()") ;
168cdf0e10cSrcweir 
169cdf0e10cSrcweir         boolean result = true ;
170cdf0e10cSrcweir         oObj.addItem("Item1", itemCount) ;
171cdf0e10cSrcweir         result = oObj.getItemCount() == itemCount + 1 ;
172cdf0e10cSrcweir 
173cdf0e10cSrcweir         tRes.tested("addItem()", result) ;
174cdf0e10cSrcweir     }
175cdf0e10cSrcweir 
176cdf0e10cSrcweir     /**
177cdf0e10cSrcweir     * Adds one two items to the last position and check the number of
178cdf0e10cSrcweir     * items after addition. <p>
179cdf0e10cSrcweir     * Has <b>OK</b> status if the number of items increased by 2.<p>
180cdf0e10cSrcweir     * The following method tests are to be executed before :
181cdf0e10cSrcweir     * <ul>
182cdf0e10cSrcweir     *  <li> <code> addItem </code> </li>
183cdf0e10cSrcweir     * </ul>
184cdf0e10cSrcweir     */
_addItems()185cdf0e10cSrcweir     public void _addItems() {
186cdf0e10cSrcweir         executeMethod("addItem()") ;
187cdf0e10cSrcweir 
188cdf0e10cSrcweir         boolean result = true ;
189cdf0e10cSrcweir         short oldCnt = oObj.getItemCount() ;
190cdf0e10cSrcweir         oObj.addItems(new String[] {"Item2", "Item3"}, oldCnt) ;
191cdf0e10cSrcweir         result = oObj.getItemCount() == oldCnt + 2 ;
192cdf0e10cSrcweir 
193cdf0e10cSrcweir         tRes.tested("addItems()", result) ;
194cdf0e10cSrcweir     }
195cdf0e10cSrcweir 
196cdf0e10cSrcweir     /**
197cdf0e10cSrcweir     * Gets the current number of items and tries to remove them all
198cdf0e10cSrcweir     * then checks number of items. <p>
199cdf0e10cSrcweir     * Has <b>OK</b> status if no items remains. <p>
200cdf0e10cSrcweir     * The following method tests are to be executed before :
201cdf0e10cSrcweir     * <ul>
202cdf0e10cSrcweir     *  <li> <code> getItems </code> </li>
203cdf0e10cSrcweir     *  <li> <code> getItem </code> </li>
204cdf0e10cSrcweir     * </ul>
205cdf0e10cSrcweir     */
_removeItems()206cdf0e10cSrcweir     public void _removeItems() {
207cdf0e10cSrcweir         executeMethod("getItems()") ;
208cdf0e10cSrcweir         executeMethod("getItem()") ;
209cdf0e10cSrcweir         executeMethod("getSelectedItemPos()") ;
210cdf0e10cSrcweir         executeMethod("getSelectedItemsPos()") ;
211cdf0e10cSrcweir         executeMethod("getSelectedItem()") ;
212cdf0e10cSrcweir         executeMethod("getSelectedItems()") ;
213cdf0e10cSrcweir 
214cdf0e10cSrcweir         boolean result = true ;
215cdf0e10cSrcweir         short oldCnt = oObj.getItemCount() ;
216cdf0e10cSrcweir         oObj.removeItems((short)0, oldCnt) ;
217cdf0e10cSrcweir         result = oObj.getItemCount() == 0 ;
218cdf0e10cSrcweir 
219cdf0e10cSrcweir         tRes.tested("removeItems()", result) ;
220cdf0e10cSrcweir     }
221cdf0e10cSrcweir 
222cdf0e10cSrcweir     /**
223cdf0e10cSrcweir     * Just retrieves current number of items and stores it. <p>
224cdf0e10cSrcweir     * Has <b>OK</b> status if the count is not less than 0.
225cdf0e10cSrcweir     */
_getItemCount()226cdf0e10cSrcweir     public void _getItemCount() {
227cdf0e10cSrcweir 
228cdf0e10cSrcweir         itemCount = oObj.getItemCount() ;
229cdf0e10cSrcweir 
230cdf0e10cSrcweir         tRes.tested("getItemCount()", itemCount >= 0) ;
231cdf0e10cSrcweir     }
232cdf0e10cSrcweir 
233cdf0e10cSrcweir     /**
234cdf0e10cSrcweir     * After <code>addItem</code> and <code>addItems</code> methods
235cdf0e10cSrcweir     * test the following items must exist {..., "Item1", "Item2", "Item3"}
236cdf0e10cSrcweir     * Retrieves the item from the position which was ititially the last.<p>
237cdf0e10cSrcweir     * Has <b>OK</b> status if the "Item1" was retrieved. <p>
238cdf0e10cSrcweir     * The following method tests are to be executed before :
239cdf0e10cSrcweir     * <ul>
240cdf0e10cSrcweir     *  <li> <code> addItems </code> </li>
241cdf0e10cSrcweir     * </ul>
242cdf0e10cSrcweir     */
_getItem()243cdf0e10cSrcweir     public void _getItem() {
244cdf0e10cSrcweir         requiredMethod("addItems()") ;
245cdf0e10cSrcweir 
246cdf0e10cSrcweir         boolean result = true ;
247cdf0e10cSrcweir         String item = oObj.getItem(itemCount) ;
248cdf0e10cSrcweir         result = "Item1".equals(item) ;
249cdf0e10cSrcweir 
250cdf0e10cSrcweir         tRes.tested("getItem()", result) ;
251cdf0e10cSrcweir     }
252cdf0e10cSrcweir 
253cdf0e10cSrcweir     /**
254cdf0e10cSrcweir     * After <code>addItem</code> and <code>addItems</code> methods
255cdf0e10cSrcweir     * test the following items must exist {..., "Item1", "Item2", "Item3"}
256cdf0e10cSrcweir     * Retrieves all items. <p>
257cdf0e10cSrcweir     * Has <b>OK</b> status if the last three items retrieved are
258cdf0e10cSrcweir     * "Item1", "Item2" and "Item3". <p>
259cdf0e10cSrcweir     * The following method tests are to be executed before :
260cdf0e10cSrcweir     * <ul>
261cdf0e10cSrcweir     *  <li> <code> addItems </code> </li>
262cdf0e10cSrcweir     * </ul>
263cdf0e10cSrcweir     */
_getItems()264cdf0e10cSrcweir     public void _getItems() {
265cdf0e10cSrcweir         requiredMethod("addItems()") ;
266cdf0e10cSrcweir 
267cdf0e10cSrcweir         boolean result = true ;
268cdf0e10cSrcweir         String[] items = oObj.getItems() ;
269cdf0e10cSrcweir         for (int i = itemCount; i < (itemCount + 3); i++) {
270cdf0e10cSrcweir             result &= ("Item" + (i+1 - itemCount)).equals(items[i]) ;
271cdf0e10cSrcweir         }
272cdf0e10cSrcweir 
273cdf0e10cSrcweir         tRes.tested("getItems()", result) ;
274cdf0e10cSrcweir     }
275cdf0e10cSrcweir 
276cdf0e10cSrcweir     /**
277cdf0e10cSrcweir     * Gets line count and stores it. <p>
278cdf0e10cSrcweir     * Has <b>OK</b> status if no runtime exceptions occured.
279cdf0e10cSrcweir     */
_getDropDownLineCount()280cdf0e10cSrcweir     public void _getDropDownLineCount() {
281cdf0e10cSrcweir 
282cdf0e10cSrcweir         boolean result = true ;
283cdf0e10cSrcweir         lineCount = oObj.getDropDownLineCount() ;
284cdf0e10cSrcweir 
285cdf0e10cSrcweir         tRes.tested("getDropDownLineCount()", result) ;
286cdf0e10cSrcweir     }
287cdf0e10cSrcweir 
288cdf0e10cSrcweir     /**
289cdf0e10cSrcweir     * Sets a new value and then checks get value. <p>
290cdf0e10cSrcweir     * Has <b>OK</b> status if set and get values are equal. <p>
291cdf0e10cSrcweir     * The following method tests are to be completed successfully before :
292cdf0e10cSrcweir     * <ul>
293cdf0e10cSrcweir     *  <li> <code> getDropDownLineCount </code>  </li>
294cdf0e10cSrcweir     * </ul>
295cdf0e10cSrcweir     */
_setDropDownLineCount()296cdf0e10cSrcweir     public void _setDropDownLineCount() {
297cdf0e10cSrcweir         requiredMethod("getDropDownLineCount()") ;
298cdf0e10cSrcweir 
299cdf0e10cSrcweir         boolean result = true ;
300cdf0e10cSrcweir         oObj.setDropDownLineCount((short)(lineCount + 1)) ;
301cdf0e10cSrcweir         result = oObj.getDropDownLineCount() == lineCount + 1 ;
302cdf0e10cSrcweir 
303cdf0e10cSrcweir         tRes.tested("setDropDownLineCount()", result) ;
304cdf0e10cSrcweir     }
305cdf0e10cSrcweir 
306cdf0e10cSrcweir     /**
307cdf0e10cSrcweir     * Selects some item and gets selected item position. <p>
308cdf0e10cSrcweir     * Has <b> OK </b> status if position is equal to position set. <p>
309cdf0e10cSrcweir     * The following method tests are to be completed successfully before :
310cdf0e10cSrcweir     * <ul>
311cdf0e10cSrcweir     *  <li> <code> addItems </code> : to have some items </li>
312cdf0e10cSrcweir     * </ul>
313cdf0e10cSrcweir     */
_getSelectedItemPos()314cdf0e10cSrcweir     public void _getSelectedItemPos() {
315cdf0e10cSrcweir         requiredMethod("addItems()") ;
316cdf0e10cSrcweir 
317cdf0e10cSrcweir         boolean result = true ;
318cdf0e10cSrcweir         oObj.selectItemPos((short)1, true) ;
319cdf0e10cSrcweir         short pos = oObj.getSelectedItemPos() ;
320cdf0e10cSrcweir 
321cdf0e10cSrcweir         result = pos == 1 ;
322cdf0e10cSrcweir 
323cdf0e10cSrcweir         tRes.tested("getSelectedItemPos()", result) ;
324cdf0e10cSrcweir     }
325cdf0e10cSrcweir 
326cdf0e10cSrcweir     /**
327cdf0e10cSrcweir     * Clears all selections, then selects some items and gets selected
328cdf0e10cSrcweir     * item positions. <p>
329cdf0e10cSrcweir     * Has <b> OK </b> status if positions get are the same as were set.<p>
330cdf0e10cSrcweir     * The following method tests are to be completed successfully before :
331cdf0e10cSrcweir     * <ul>
332cdf0e10cSrcweir     *  <li> <code> selectItemsPos </code> </li>
333cdf0e10cSrcweir     * </ul>
334cdf0e10cSrcweir     */
_getSelectedItemsPos()335cdf0e10cSrcweir     public void _getSelectedItemsPos() {
336cdf0e10cSrcweir         requiredMethod("selectItemsPos()") ;
337cdf0e10cSrcweir 
338cdf0e10cSrcweir         boolean result = true ;
339cdf0e10cSrcweir         short cnt = oObj.getItemCount() ;
340cdf0e10cSrcweir         for (short i = 0; i < cnt; i++) {
341cdf0e10cSrcweir             oObj.selectItemPos(i, false) ;
342cdf0e10cSrcweir         }
343cdf0e10cSrcweir         oObj.selectItemsPos(new short[] {0, 2}, true) ;
344cdf0e10cSrcweir 
345cdf0e10cSrcweir         short[] items = oObj.getSelectedItemsPos() ;
346cdf0e10cSrcweir 
347cdf0e10cSrcweir         result = items != null && items.length == 2 &&
348cdf0e10cSrcweir             items[0] == 0 && items[1] == 2 ;
349cdf0e10cSrcweir 
350cdf0e10cSrcweir         tRes.tested("getSelectedItemsPos()", result) ;
351cdf0e10cSrcweir     }
352cdf0e10cSrcweir 
353cdf0e10cSrcweir     /**
354cdf0e10cSrcweir     * Unselects all items, selects some item and then gets selected item. <p>
355cdf0e10cSrcweir     * Has <b> OK </b> status if items selected and get are equal.
356cdf0e10cSrcweir     * The following method tests are to be completed successfully before :
357cdf0e10cSrcweir     * <ul>
358cdf0e10cSrcweir     *  <li> <code> addItems </code> : to have some items </li>
359cdf0e10cSrcweir     * </ul>
360cdf0e10cSrcweir     */
_getSelectedItem()361cdf0e10cSrcweir     public void _getSelectedItem() {
362cdf0e10cSrcweir         requiredMethod("addItems()") ;
363cdf0e10cSrcweir 
364cdf0e10cSrcweir         boolean result = true ;
365cdf0e10cSrcweir         short cnt = oObj.getItemCount() ;
366cdf0e10cSrcweir         for (short i = 0; i < cnt; i++) {
367cdf0e10cSrcweir             oObj.selectItemPos(i, false) ;
368cdf0e10cSrcweir         }
369cdf0e10cSrcweir         oObj.selectItem("Item3", true) ;
370cdf0e10cSrcweir         String item = oObj.getSelectedItem() ;
371cdf0e10cSrcweir 
372cdf0e10cSrcweir         result = "Item3".equals(item) ;
373cdf0e10cSrcweir 
374cdf0e10cSrcweir         tRes.tested("getSelectedItem()", result) ;
375cdf0e10cSrcweir     }
376cdf0e10cSrcweir 
377cdf0e10cSrcweir     /**
378cdf0e10cSrcweir     * Clears all selections, then selects some items positions and gets
379cdf0e10cSrcweir     *  selected items. <p>
380cdf0e10cSrcweir     * Has <b> OK </b> status if items get are the same as items on
381cdf0e10cSrcweir     * positions which were set.<p>
382cdf0e10cSrcweir     * The following method tests are to be completed successfully before :
383cdf0e10cSrcweir     * <ul>
384cdf0e10cSrcweir     *  <li> <code> selectItemsPos </code> </li>
385cdf0e10cSrcweir     *  <li> <code> getItem </code>: this method is used here for checking.
386cdf0e10cSrcweir     *   </li>
387cdf0e10cSrcweir     * </ul>
388cdf0e10cSrcweir     */
_getSelectedItems()389cdf0e10cSrcweir     public void _getSelectedItems() {
390cdf0e10cSrcweir         requiredMethod("selectItemsPos()") ;
391cdf0e10cSrcweir         requiredMethod("getItem()") ;
392cdf0e10cSrcweir 
393cdf0e10cSrcweir         boolean result = true ;
394cdf0e10cSrcweir         short cnt = oObj.getItemCount() ;
395cdf0e10cSrcweir         for (short i = 0; i < cnt; i++) {
396cdf0e10cSrcweir             oObj.selectItemPos(i, false) ;
397cdf0e10cSrcweir         }
398cdf0e10cSrcweir         oObj.selectItemsPos(new short[] {0, 2}, true) ;
399cdf0e10cSrcweir 
400cdf0e10cSrcweir         String[] items = oObj.getSelectedItems() ;
401cdf0e10cSrcweir         result = items != null && items.length == 2 &&
402cdf0e10cSrcweir             oObj.getItem((short)0).equals(items[0]) &&
403cdf0e10cSrcweir             oObj.getItem((short)2).equals(items[1]) ;
404cdf0e10cSrcweir 
405cdf0e10cSrcweir         tRes.tested("getSelectedItems()", result) ;
406cdf0e10cSrcweir     }
407cdf0e10cSrcweir 
408cdf0e10cSrcweir     /**
409cdf0e10cSrcweir     * Unselects all items, then selects a single item. <p>
410cdf0e10cSrcweir     * Has <b> OK </b> status if no runtime exceptions occured
411cdf0e10cSrcweir     * The following method tests are to be completed successfully before :
412cdf0e10cSrcweir     * <ul>
413cdf0e10cSrcweir     *  <li> <code> addItems </code> : to have some items </li>
414cdf0e10cSrcweir     * </ul>
415cdf0e10cSrcweir     */
_selectItemPos()416cdf0e10cSrcweir     public void _selectItemPos() {
417cdf0e10cSrcweir         requiredMethod("addItems()") ;
418cdf0e10cSrcweir 
419cdf0e10cSrcweir         boolean result = true ;
420cdf0e10cSrcweir         short cnt = oObj.getItemCount() ;
421cdf0e10cSrcweir         for (short i = 0; i < cnt; i++) {
422cdf0e10cSrcweir             oObj.selectItemPos(i, false) ;
423cdf0e10cSrcweir         }
424cdf0e10cSrcweir         oObj.selectItemPos((short)1, true) ;
425cdf0e10cSrcweir 
426cdf0e10cSrcweir         tRes.tested("selectItemPos()", result) ;
427cdf0e10cSrcweir     }
428cdf0e10cSrcweir 
429cdf0e10cSrcweir     /**
430cdf0e10cSrcweir     * Just selects some items. <p>
431cdf0e10cSrcweir     * Has <b> OK </b> status if no runtime exceptions occured
432cdf0e10cSrcweir     * The following method tests are to be completed successfully before :
433cdf0e10cSrcweir     * <ul>
434cdf0e10cSrcweir     *  <li> <code> addItems </code> : to have some items </li>
435cdf0e10cSrcweir     * </ul>
436cdf0e10cSrcweir     */
_selectItemsPos()437cdf0e10cSrcweir     public void _selectItemsPos() {
438cdf0e10cSrcweir         requiredMethod("addItems()") ;
439cdf0e10cSrcweir         requiredMethod("setMultipleMode()") ;
440cdf0e10cSrcweir 
441cdf0e10cSrcweir         boolean result = true ;
442cdf0e10cSrcweir         oObj.selectItemsPos(new short[] {0, 2}, true) ;
443cdf0e10cSrcweir 
444cdf0e10cSrcweir         tRes.tested("selectItemsPos()", result) ;
445cdf0e10cSrcweir     }
446cdf0e10cSrcweir 
447cdf0e10cSrcweir     /**
448cdf0e10cSrcweir     * Just selects an item. <p>
449cdf0e10cSrcweir     * Has <b> OK </b> status if no runtime exceptions occured
450cdf0e10cSrcweir     * The following method tests are to be completed successfully before :
451cdf0e10cSrcweir     * <ul>
452cdf0e10cSrcweir     *  <li> <code> addItems </code> : to have some items </li>
453cdf0e10cSrcweir     * </ul>
454cdf0e10cSrcweir     */
_selectItem()455cdf0e10cSrcweir     public void _selectItem() {
456cdf0e10cSrcweir         requiredMethod("addItems()") ;
457cdf0e10cSrcweir 
458cdf0e10cSrcweir         boolean result = true ;
459cdf0e10cSrcweir         oObj.selectItem("Item3", true) ;
460cdf0e10cSrcweir 
461cdf0e10cSrcweir         tRes.tested("selectItem()", result) ;
462cdf0e10cSrcweir     }
463cdf0e10cSrcweir 
464cdf0e10cSrcweir     /**
465cdf0e10cSrcweir     * Checks if multiple mode is set. <p>
466cdf0e10cSrcweir     * Has <b> OK </b> status if multiple mode is set. <p>
467cdf0e10cSrcweir     * The following method tests are to be completed successfully before :
468cdf0e10cSrcweir     * <ul>
469cdf0e10cSrcweir     *  <li> <code> setMultipleMode </code>  </li>
470cdf0e10cSrcweir     * </ul>
471cdf0e10cSrcweir     */
_isMutipleMode()472cdf0e10cSrcweir     public void _isMutipleMode() {
473cdf0e10cSrcweir         requiredMethod("setMultipleMode()") ;
474cdf0e10cSrcweir 
475cdf0e10cSrcweir         boolean result = true ;
476cdf0e10cSrcweir         result = oObj.isMutipleMode() ;
477cdf0e10cSrcweir 
478cdf0e10cSrcweir         tRes.tested("isMutipleMode()", result) ;
479cdf0e10cSrcweir     }
480cdf0e10cSrcweir 
481cdf0e10cSrcweir     /**
482cdf0e10cSrcweir     * Sets multiple mode. <p>
483cdf0e10cSrcweir     * Has <b> OK </b> status if no runtime exceptions occured
484cdf0e10cSrcweir     */
_setMultipleMode()485cdf0e10cSrcweir     public void _setMultipleMode() {
486cdf0e10cSrcweir 
487cdf0e10cSrcweir         boolean result = true ;
488cdf0e10cSrcweir         oObj.setMultipleMode(true) ;
489cdf0e10cSrcweir 
490cdf0e10cSrcweir         tRes.tested("setMultipleMode()", result) ;
491cdf0e10cSrcweir     }
492cdf0e10cSrcweir 
493cdf0e10cSrcweir     /**
494cdf0e10cSrcweir     * Just calls the method to make visible third item. <p>
495cdf0e10cSrcweir     * Has <b> OK </b> status if no runtime exceptions occured.<p>
496cdf0e10cSrcweir     * The following method tests are to be completed successfully before :
497cdf0e10cSrcweir     * <ul>
498cdf0e10cSrcweir     *  <li> <code> addItems </code> </li>
499cdf0e10cSrcweir     * </ul>
500cdf0e10cSrcweir     */
_makeVisible()501cdf0e10cSrcweir     public void _makeVisible() {
502cdf0e10cSrcweir         requiredMethod("addItems()") ;
503cdf0e10cSrcweir 
504cdf0e10cSrcweir         boolean result = true ;
505cdf0e10cSrcweir         oObj.makeVisible((short)2) ;
506cdf0e10cSrcweir 
507cdf0e10cSrcweir         tRes.tested("makeVisible()", result) ;
508cdf0e10cSrcweir     }
509cdf0e10cSrcweir }