merge the formfield patch from ooo-build
[ooovba.git] / qadevOOo / tests / java / ifc / beans / _XPropertyWithState.java
blobc7d0196011787d776eaeaf11721a152d8d8f0706
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: _XPropertyWithState.java,v $
10 * $Revision: 1.5 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 package ifc.beans;
33 import com.sun.star.beans.PropertyState;
34 import com.sun.star.uno.XInterface;
35 import lib.MultiMethodTest;
37 import com.sun.star.beans.XPropertyWithState;
38 import lib.Status;
39 import lib.StatusException;
41 /**
42 * Testing <code>com.sun.star.beans.XPropertyWithState</code>
43 * interface methods :
44 * <ul>
45 * <li><code> getDefaultAsProperty()</code></li>
46 * <li><code> getStateAsProperty()</code></li>
47 * <li><code> setToDefaultAsProperty()</code></li>
48 * </ul> <p>
49 * @see com.sun.star.beans.XPropertyWithState
52 public class _XPropertyWithState extends MultiMethodTest {
54 /**
55 * the test object
57 public XPropertyWithState oObj;
60 /**
61 * Test calls the method.
62 * Test has ok status if no
63 * <CODE>com.sun.star.lang.WrappedTargetException</CODE>
64 * was thrown
66 public void _getDefaultAsProperty() {
67 try{
69 XInterface defaultState = (XInterface) oObj.getDefaultAsProperty();
71 } catch (com.sun.star.lang.WrappedTargetException e){
72 e.printStackTrace(log);
73 throw new StatusException(Status.failed("'com.sun.star.lang.WrappedTargetException' was thrown"));
76 tRes.tested("getDefaultAsProperty()", true);
79 /**
80 * Test is ok if <CODE>getStateAsProperty()</CODE> returns
81 * as <CODE>PropertyState</CODE> which is not <CODE>null</CODE>
83 public void _getStateAsProperty() {
85 boolean res = true;
87 PropertyState propState = oObj.getStateAsProperty();
89 if (propState == null) {
90 log.println("the returned PropertyState is null -> FALSE");
91 res = false;
94 tRes.tested("getStateAsProperty()", res);
97 /**
98 * Test calls the method.
99 * Test has ok status if no
100 * <CODE>com.sun.star.lang.WrappedTargetException</CODE>
101 * was thrown
103 public void _setToDefaultAsProperty() {
104 try{
106 oObj.setToDefaultAsProperty();
108 } catch (com.sun.star.lang.WrappedTargetException e){
109 e.printStackTrace(log);
110 throw new StatusException(Status.failed("'com.sun.star.lang.WrappedTargetException' was thrown"));
113 tRes.tested("setToDefaultAsProperty()", true);