Version 3.6.0.4, tag libreoffice-3.6.0.4
[LibreOffice.git] / qadevOOo / tests / java / ifc / drawing / _XControlShape.java
blob7141ce155f3ffc7945077dcddae44b42d13c4646
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2000, 2010 Oracle and/or its affiliates.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * This file is part of OpenOffice.org.
11 * OpenOffice.org is free software: you can redistribute it and/or modify
12 * it under the terms of the GNU Lesser General Public License version 3
13 * only, as published by the Free Software Foundation.
15 * OpenOffice.org is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU Lesser General Public License version 3 for more details
19 * (a copy is included in the LICENSE file that accompanied this code).
21 * You should have received a copy of the GNU Lesser General Public License
22 * version 3 along with OpenOffice.org. If not, see
23 * <http://www.openoffice.org/license.html>
24 * for a copy of the LGPLv3 License.
26 ************************************************************************/
28 package ifc.drawing;
30 import lib.MultiMethodTest;
31 import util.FormTools;
33 import com.sun.star.awt.XControlModel;
34 import com.sun.star.drawing.XControlShape;
35 import com.sun.star.lang.XComponent;
36 import com.sun.star.uno.UnoRuntime;
37 import com.sun.star.uno.XInterface;
39 /**
40 * Testing <code>com.sun.star.drawing.XControlShape</code>
41 * interface methods :
42 * <ul>
43 * <li><code> getControl()</code></li>
44 * <li><code> setControl()</code></li>
45 * </ul> <p>
46 * This test needs the following object relations :
47 * <ul>
48 * <li> <code>'xDoc'</code> (of type <code>XComponent</code>):
49 * the document where shape tested is situated. This document
50 * must also implement <code>XMultiServiceFactory</code> interface
51 * to create some control model. </li>
52 * <ul> <p>
53 * Test is <b> NOT </b> multithread compilant. <p>
54 * @see com.sun.star.drawing.XControlShape
56 public class _XControlShape extends MultiMethodTest {
58 public XControlShape oObj = null;
60 XControlModel model = null;
62 /**
63 * Test calls the method. <p>
64 * Has <b> OK </b> status if the method successfully returns
65 * and no exceptions were thrown. <p>
67 public void _getControl() {
68 model = oObj.getControl() ;
70 tRes.tested("getControl()", true) ;
73 /**
74 * With the help of document passed as relation, a new button control
75 * model is created and set as a control. <p>
76 * Has <b> OK </b> status if <code>getControl()</code> method returns
77 * the same control as was set. <p>
78 * The following method tests are to be completed successfully before :
79 * <ul>
80 * <li> <code> getControl() </code> </li>
81 * </ul>
83 public void _setControl() {
84 requiredMethod("getControl()") ;
86 XInterface oNewControl = FormTools.createControl
87 ((XComponent)tEnv.getObjRelation("xDoc"), "ComboBox") ;
89 XControlModel xControl = (XControlModel) UnoRuntime.queryInterface
90 (XControlModel.class, oNewControl) ;
92 oObj.setControl(xControl) ;
94 XControlModel gControl = oObj.getControl() ;
96 if (oNewControl.equals(gControl))
97 tRes.tested("setControl()", true) ;
98 else {
99 log.println("Control set is not equal to control get") ;
100 tRes.tested("setControl()", false) ;
104 } // finish class _XControlShape