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
.XFrame
;
29 import com
.sun
.star
.text
.XTextDocument
;
30 import com
.sun
.star
.uno
.UnoRuntime
;
31 import com
.sun
.star
.uno
.XInterface
;
32 import com
.sun
.star
.util
.XCloseable
;
35 * Test for object that implements the following interfaces :
37 * <li><code>com::sun::star::frame::XDispatchProvider</code></li>
38 * <li><code>com::sun::star::frame::XFrame</code></li>
39 * <li><code>com::sun::star::frame::XFramesSupplier</code></li>
40 * <li><code>com::sun::star::task::XStatusIndicatorFactory</code></li>
41 * <li><code>com::sun::star::lang::XComponent</code></li>
43 * @see com.sun.star.frame.XDispatchProvider
44 * @see com.sun.star.frame.XFrame
45 * @see com.sun.star.frame.XFramesSupplier
46 * @see com.sun.star.task.XStatusIndicatorFactory
47 * @see com.sun.star.lang.XComponent
48 * @see ifc.frame._XDispatchProvider
49 * @see ifc.frame._XFrame
50 * @see ifc.frame._XFramesSupplier
51 * @see ifc.task._XStatusIndicatorFactory
52 * @see ifc.lang._XComponent
54 public class Frame
extends TestCase
{
56 XTextDocument xTextDoc
;
61 * Creates a text document and obtains a frame of current controller.
64 public TestEnvironment
createTestEnvironment( TestParameters Param
,
65 PrintWriter log
) throws Exception
{
67 XInterface oObj
= null;
69 log
.println( "creating a test environment" );
71 // get a soffice factory object
72 SOfficeFactory SOF
= SOfficeFactory
.getFactory( Param
.getMSF());
74 log
.println( "creating a text document" );
75 xTextDoc
= SOF
.createTextDoc(null);
77 frame
= xTextDoc
.getCurrentController().getFrame();
78 oObj
= UnoRuntime
.queryInterface(XInterface
.class, frame
);
80 log
.println(util
.utils
.getImplName(oObj
));
82 TestEnvironment tEnv
= new TestEnvironment( oObj
);
84 tEnv
.addObjRelation("XDispatchProvider.URL",
85 ".uno:SwitchControlDesignMode");
88 } // finish method getTestEnvironment
92 * Disposes the document created and finally disposes
93 * the frame containing the document (for case when the frame
94 * contains no model after some interface manipulations).
97 protected void cleanup( TestParameters Param
, PrintWriter log
) {
99 XCloseable xTextClose
= UnoRuntime
.queryInterface(XCloseable
.class, xTextDoc
);
100 xTextClose
.close(true);
101 } catch(Exception e
){}