bump product version to 5.0.4.1
[LibreOffice.git] / qadevOOo / tests / java / ifc / drawing / _XControlShape.java
blob4dfb8dbe428cd78b0bac1cdc59e7ff6207aefb87
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 XControlModel model = null;
53 /**
54 * Test calls the method. <p>
55 * Has <b> OK </b> status if the method successfully returns
56 * and no exceptions were thrown. <p>
58 public void _getControl() {
59 model = oObj.getControl() ;
61 tRes.tested("getControl()", true) ;
64 /**
65 * With the help of document passed as relation, a new button control
66 * model is created and set as a control. <p>
67 * Has <b> OK </b> status if <code>getControl()</code> method returns
68 * the same control as was set. <p>
69 * The following method tests are to be completed successfully before :
70 * <ul>
71 * <li> <code> getControl() </code> </li>
72 * </ul>
74 public void _setControl() {
75 requiredMethod("getControl()") ;
77 XInterface oNewControl = FormTools.createControl
78 ((XComponent)tEnv.getObjRelation("xDoc"), "ComboBox") ;
80 XControlModel xControl = UnoRuntime.queryInterface
81 (XControlModel.class, oNewControl) ;
83 oObj.setControl(xControl) ;
85 XControlModel gControl = oObj.getControl() ;
87 if (oNewControl.equals(gControl))
88 tRes.tested("setControl()", true) ;
89 else {
90 log.println("Control set is not equal to control get") ;
91 tRes.tested("setControl()", false) ;
95 } // finish class _XControlShape