tdf#130857 qt weld: Implement QtInstanceWidget::strip_mnemonic
[LibreOffice.git] / qadevOOo / tests / java / ifc / awt / _XControlContainer.java
blob0c7e636209f8ec5b46fb256203cf32cb4ace8593
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;
23 import com.sun.star.awt.XControl;
24 import com.sun.star.awt.XControlContainer;
26 /**
27 * Testing <code>com.sun.star.awt.XControlContainer</code>
28 * interface methods:
29 * <ul>
30 * <li><code> setStatusText() </code></li>
31 * <li><code> addControl() </code></li>
32 * <li><code> removeControl() </code></li>
33 * <li><code> getControl() </code></li>
34 * <li><code> getControls() </code></li>
35 * </ul><p>
36 * This test needs the following object relations :
37 * <ul>
38 * <li> <code>'CONTROL1'</code> (of type <code>XControl</code>):
39 * used as a parameter to addControl(), getControl() and removeControl()</li>
40 * <li> <code>'CONTROL2'</code> (of type <code>XControl</code>):
41 * used as a parameter to addControl(), getControl() and removeControl()</li>
42 * <ul> <p>
43 * Test is <b> NOT </b> multithread compliant. <p>
44 * @see com.sun.star.awt.XControlContainer
46 public class _XControlContainer extends MultiMethodTest {
47 public XControlContainer oObj = null;
49 /**
50 * Test calls the method. <p>
51 * Has <b> OK </b> status if the method successfully returns
52 * and no exceptions were thrown.
54 public void _setStatusText() {
55 oObj.setStatusText("testing XControlContainer::setStatusText(String)");
56 tRes.tested("setStatusText()",true);
59 /**
60 * Test calls the method twice - two controls gotten from object relations
61 * 'CONTROL1' and 'CONTROL2' added to container.<p>
62 * Has <b> OK </b> status if the method successfully returns
63 * and no exceptions were thrown.
65 public void _addControl() {
66 oObj.addControl("CONTROL1", (XControl)tEnv.getObjRelation("CONTROL1"));
67 oObj.addControl("CONTROL2", (XControl)tEnv.getObjRelation("CONTROL2"));
68 tRes.tested("addControl()",true);
71 /**
72 * Test calls the method with object relation 'CONTROL1' as a
73 * parameter. Then control gotten from container is checked, and if returned
74 * value is null then another control 'CONTROL2' is removed from container,
75 * otherwise returned value of method test is 'false'.<p>
76 * Has <b> OK </b> status if control is removed successfully.<p>
77 * The following method tests are to be completed successfully before :
78 * <ul>
79 * <li> <code> addControl() </code> : adds control to a container </li>
80 * <li> <code> getControl() </code> : gets control from container </li>
81 * <li> <code> getControls() </code> : gets controls from container</li>
82 * </ul>
84 public void _removeControl() {
85 boolean result = true;
87 requiredMethod("addControl()");
88 requiredMethod("getControl()");
89 requiredMethod("getControls()");
90 oObj.removeControl( (XControl) tEnv.getObjRelation("CONTROL1") );
91 XControl ctrl = oObj.getControl("CONTROL1");
92 if (ctrl != null) {
93 result = false;
94 log.println("'removeControl()' fails; Control still exists");
95 } else {
96 oObj.removeControl( (XControl) tEnv.getObjRelation("CONTROL2") );
98 tRes.tested("removeControl()", result);
102 * Test calls the method with 'CONTROL1' as a parameter, then we just
103 * compare returned object and object relation 'CONTROL1'.<p>
104 * Has <b> OK </b> status if value returned by the method is equal to
105 * a corresponding object relation.<p>
106 * The following method tests are to be completed successfully before :
107 * <ul>
108 * <li> <code> addControl() </code> : adds control to a container </li>
109 * </ul>
111 public void _getControl() {
112 requiredMethod("addControl()");
113 XControl xCtrlComp = oObj.getControl("CONTROL1");
114 XControl xCl = (XControl) tEnv.getObjRelation("CONTROL1");
115 tRes.tested("getControl()", xCtrlComp.equals(xCl));
119 * Test calls the method, then returned value is checked.<p>
120 * Has <b> OK </b> status if returned array consists of at least two
121 * elements.<p>
122 * The following method tests are to be completed successfully before :
123 * <ul>
124 * <li> <code> addControl() </code> : adds control to a container </li>
125 * </ul>
127 public void _getControls() {
128 requiredMethod("addControl()");
129 XControl[] xCtrls = oObj.getControls();
130 tRes.tested("getControls()",xCtrls.length >= 2);