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 .
21 import java
.io
.PrintWriter
;
24 import lib
.TestEnvironment
;
25 import lib
.TestParameters
;
26 import util
.SOfficeFactory
;
28 import com
.sun
.star
.frame
.XDesktop
;
29 import com
.sun
.star
.text
.XTextDocument
;
30 import com
.sun
.star
.uno
.UnoRuntime
;
31 import com
.sun
.star
.uno
.XInterface
;
34 * Test for object which is represented by service
35 * <code>com.sun.star.frame.Desktop</code>. <p>
36 * Object implements the following interfaces :
38 * <li><code>com::sun::star::beans::XPropertySet</code></li>
39 * <li><code>com::sun::star::frame::XComponentLoader</code></li>
40 * <li><code>com::sun::star::frame::XDesktop</code></li>
41 * <li><code>com::sun::star::frame::XDispatchProvider</code></li>
42 * <li><code>com::sun::star::frame::XFrame</code></li>
43 * <li><code>com::sun::star::frame::XFramesSupplier</code></li>
44 * <li><code>com::sun::star::frame::XTasksSupplier</code></li>
45 * <li><code>com::sun::star::lang::XComponent</code></li>
46 * <li><code>com::sun::star::task::XStatusIndicatorFactory</code></li>
48 * @see com.sun.star.beans.XPropertySet
49 * @see com.sun.star.frame.XComponentLoader
50 * @see com.sun.star.frame.XDesktop
51 * @see com.sun.star.frame.XDispatchProvider
52 * @see com.sun.star.frame.XFrame
53 * @see com.sun.star.frame.XFramesSupplier
54 * @see com.sun.star.frame.XTasksSupplier
55 * @see com.sun.star.lang.XComponent
56 * @see com.sun.star.task.XStatusIndicatorFactory
57 * @see ifc.beans._XPropertySet
58 * @see ifc.frame._XComponentLoader
59 * @see ifc.frame._XDesktop
60 * @see ifc.frame._XDispatchProvider
61 * @see ifc.frame._XFrame
62 * @see ifc.frame._XFramesSupplier
63 * @see ifc.frame._XTasksSupplier
64 * @see ifc.lang._XComponent
65 * @see ifc.task._XStatusIndicatorFactory
67 public class Desktop
extends TestCase
{
69 XTextDocument xTextDoc
;
72 * Disposes the document, if exists, created in
73 * <code>createTestEnvironment</code> method.
76 protected void cleanup( TestParameters Param
, PrintWriter log
) {
78 log
.println("disposing xTextDoc");
80 if (xTextDoc
!= null) {
83 } catch (com
.sun
.star
.lang
.DisposedException de
) {}
88 * Creating a TestEnvironment for the interfaces to be tested.
89 * Creates service <code>com.sun.star.frame.Desktop</code>.
92 protected TestEnvironment
createTestEnvironment(TestParameters Param
, PrintWriter log
) throws Exception
{
94 // get a soffice factory object
95 SOfficeFactory SOF
= SOfficeFactory
.getFactory( Param
.getMSF());
97 log
.println( "creating a text document" );
98 xTextDoc
= SOF
.createTextDoc(null);
100 XInterface oObj
= (XInterface
)Param
.getMSF().createInstance(
101 "com.sun.star.comp.framework.Desktop");
103 TestEnvironment tEnv
= new TestEnvironment( oObj
);
105 tEnv
.addObjRelation("XDispatchProvider.URL", ".uno:Open");
107 tEnv
.addObjRelation("Desktop",UnoRuntime
.queryInterface(XDesktop
.class,oObj
));
110 } // finish method getTestEnvironment