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