tdf#130857 qt weld: Implement QtInstanceWidget::strip_mnemonic
[LibreOffice.git] / qadevOOo / tests / java / ifc / drawing / _XControlShape.java
blobfadf945a8676527722f868dff78f76fb403f6302
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.drawing;
21 import lib.MultiMethodTest;
22 import util.FormTools;
24 import com.sun.star.awt.XControlModel;
25 import com.sun.star.drawing.XControlShape;
26 import com.sun.star.lang.XComponent;
27 import com.sun.star.uno.UnoRuntime;
28 import com.sun.star.uno.XInterface;
30 /**
31 * Testing <code>com.sun.star.drawing.XControlShape</code>
32 * interface methods :
33 * <ul>
34 * <li><code> getControl()</code></li>
35 * <li><code> setControl()</code></li>
36 * </ul> <p>
37 * This test needs the following object relations :
38 * <ul>
39 * <li> <code>'xDoc'</code> (of type <code>XComponent</code>):
40 * the document where shape tested is situated. This document
41 * must also implement <code>XMultiServiceFactory</code> interface
42 * to create some control model. </li>
43 * <ul> <p>
44 * Test is <b> NOT </b> multithread compliant. <p>
45 * @see com.sun.star.drawing.XControlShape
47 public class _XControlShape extends MultiMethodTest {
49 public XControlShape oObj = null;
51 /**
52 * Test calls the method. <p>
53 * Has <b> OK </b> status if the method successfully returns
54 * and no exceptions were thrown. <p>
56 public void _getControl() {
57 oObj.getControl();
58 tRes.tested("getControl()", true) ;
61 /**
62 * With the help of document passed as relation, a new button control
63 * model is created and set as a control. <p>
64 * Has <b> OK </b> status if <code>getControl()</code> method returns
65 * the same control as was set. <p>
66 * The following method tests are to be completed successfully before :
67 * <ul>
68 * <li> <code> getControl() </code> </li>
69 * </ul>
71 public void _setControl()
72 throws com.sun.star.uno.Exception
74 requiredMethod("getControl()") ;
76 XInterface oNewControl = FormTools.createControl
77 ((XComponent)tEnv.getObjRelation("xDoc"), "ComboBox") ;
79 XControlModel xControl = UnoRuntime.queryInterface
80 (XControlModel.class, oNewControl) ;
82 oObj.setControl(xControl) ;
84 XControlModel gControl = oObj.getControl() ;
86 if (oNewControl.equals(gControl))
87 tRes.tested("setControl()", true) ;
88 else {
89 log.println("Control set is not equal to control get") ;
90 tRes.tested("setControl()", false) ;
94 } // finish class _XControlShape