merge the formfield patch from ooo-build
[ooovba.git] / qadevOOo / tests / java / ifc / document / _XExporter.java
blob5fee969b9863ceb1e7a739bfeea06845e8bfbed2
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: _XExporter.java,v $
10 * $Revision: 1.4 $
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.document;
34 import lib.MultiMethodTest;
35 import lib.Status;
36 import lib.StatusException;
38 import com.sun.star.document.XExporter;
39 import com.sun.star.lang.XComponent;
41 /**
42 * Testing <code>com.sun.star.document.XExporter</code>
43 * interface methods :
44 * <ul>
45 * <li><code> setSourceDocument()</code></li>
46 * </ul> <p>
47 * This test needs the following object relations :
48 * <ul>
49 * <li> <code>'SourceDocument'</code> (of type <code>XComponent</code>):
50 * the source document to be passed to the method. </li>
51 * <ul> <p>
52 * Test is <b> NOT </b> multithread compilant. <p>
53 * @see com.sun.star.document.XExporter
55 public class _XExporter extends MultiMethodTest {
57 public XExporter oObj = null;
58 public XComponent source = null ;
60 /**
61 * Retrieves object relations.
62 * @throws StatusException If one of relations not found.
64 public void before() {
65 source = (XComponent) tEnv.getObjRelation("SourceDocument") ;
67 if (source == null) throw new StatusException(Status.failed
68 ("Relation not found")) ;
71 /**
72 * Just calls the method. <p>
73 * Has <b> OK </b> status if no runtime exceptions occured.
74 * Usually this interface is supported both with <code>XFilter</code>
75 * where source document setting is checked.
77 public void _setSourceDocument() {
78 boolean result = true ;
80 try {
81 oObj.setSourceDocument(source);
83 catch (com.sun.star.lang.IllegalArgumentException ex) {
84 log.println("Exception while checking :");
85 ex.printStackTrace(log);
86 result = false;
89 tRes.tested("setSourceDocument()", result) ;