tdf#130857 qt weld: Introduce QtInstanceScrolledWindow
[LibreOffice.git] / qadevOOo / tests / java / mod / _fwk / ModuleManager.java
bloba700bffaf8a070c6eec208f919327bc881b9831f
1 /*
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 .
19 package mod._fwk;
21 import com.sun.star.beans.PropertyValue;
22 import com.sun.star.frame.XController;
23 import com.sun.star.frame.XFrame;
24 import com.sun.star.frame.XModel;
25 import com.sun.star.lang.XComponent;
26 import lib.*;
27 import util.DesktopTools;
28 import util.SOfficeFactory;
31 import com.sun.star.uno.Exception;
32 import com.sun.star.uno.UnoRuntime;
33 import com.sun.star.uno.XInterface;
34 import java.io.PrintWriter;
35 import com.sun.star.sheet.XSpreadsheetDocument;
36 import com.sun.star.text.XTextDocument;
38 /** Test for object that implements the following interfaces :
39 * <ul>
40 * <li><code>com::sun::star::frame::XModuleManager</code></li>
41 * <li><code>com::sun::star::container::XNameAccess</code></li>
42 * <li><code>com::sun::star::container::XElementAccess</code></li>
43 * </ul><p>
44 * @see com.sun.star.frame.XModuleManager
45 * @see com.sun.star.container.XNameAccess
46 * @see com.sun.star.container.XElementAccess
47 * @see ifc.frame._XModuleManager
48 * @see ifc.container._XNameAccess
49 * @see ifc.container._XElementAccess
51 public class ModuleManager extends TestCase {
53 XTextDocument xTextDoc = null;
54 XComponent xWebDoc = null;
55 XComponent xGlobalDoc = null;
56 XSpreadsheetDocument xSheetDoc = null;
57 XComponent xDrawDoc = null;
58 XComponent xImpressDoc = null;
59 XComponent xMathDoc = null;
61 /** Creating a TestEnvironment for the interfaces to be tested.
62 * @param Param test parameters
63 * @param log simple logger
64 * @throws StatusException was thrown on error
65 * @return the test environment
67 @Override
68 public TestEnvironment createTestEnvironment( TestParameters Param,
69 PrintWriter log ) throws Exception {
71 XInterface oObj = (XInterface)Param.getMSF().createInstance(
72 "com.sun.star.comp.framework.ModuleManager");
73 // get a soffice factory object
74 SOfficeFactory SOF = SOfficeFactory.getFactory(
75 Param.getMSF());
77 // get text document interfaces
78 log.println("creating a text document");
79 xTextDoc = SOF.createTextDoc(null);
80 XModel xTextMode1 = UnoRuntime.queryInterface(XModel.class,
81 xTextDoc);
82 XController xTextController = xTextMode1.getCurrentController();
83 XFrame xTextFrame = xTextController.getFrame();
86 // get webdoc interfaces
87 log.println("creating a web document");
88 xWebDoc = SOF.loadDocument("private:factory/swriter/web");
89 XModel xWebMode1 = UnoRuntime.queryInterface(XModel.class,
90 xWebDoc);
91 XController xWebController = xWebMode1.getCurrentController();
92 XFrame xWebFrame = xWebController.getFrame();
94 // get global document interfaces
95 log.println("creating a global document");
96 xGlobalDoc = SOF.loadDocument("private:factory/swriter/GlobalDocument");
97 XModel xGlobalMode1 = UnoRuntime.queryInterface(XModel.class,
98 xGlobalDoc);
99 XController xGlobalController = xGlobalMode1.getCurrentController();
100 XFrame xGlobalFrame = xGlobalController.getFrame();
102 // get clac interfaces
103 log.println("creating a spreadsheetdocument");
104 xSheetDoc = SOF.createCalcDoc(null);
105 XModel xSheetMode1 = UnoRuntime.queryInterface(XModel.class,
106 xSheetDoc);
108 XController xSheetController = xSheetMode1.getCurrentController();
109 XFrame xSheetFrame = xSheetController.getFrame();
110 // get draw interfaces
111 log.println("creating a draw document");
112 xDrawDoc = SOF.createDrawDoc(null);
113 XModel xDrawMode1 = UnoRuntime.queryInterface(XModel.class,
114 xDrawDoc);
115 XController xDrawController = xDrawMode1.getCurrentController();
116 XFrame xDrawFrame = xDrawController.getFrame();
118 // get impress interfaces
119 log.println("creating an impress document");
120 xImpressDoc = SOF.createImpressDoc(null);
121 XModel xImpressMode1 = UnoRuntime.queryInterface(XModel.class,
122 xImpressDoc);
123 XController xImpressController = xImpressMode1.getCurrentController();
124 XFrame xImpressFrame = xImpressController.getFrame();
126 // get math interfaces
127 log.println("creating a math document");
128 xMathDoc = SOF.createMathDoc(null);
129 XModel xMathMode1 = UnoRuntime.queryInterface(XModel.class,
130 xMathDoc);
131 XController xMathController = xMathMode1.getCurrentController();
132 XFrame xMathFrame = xMathController.getFrame();
134 PropertyValue[] xFrameSeq = new PropertyValue[7];
135 xFrameSeq[0] = new PropertyValue();
136 xFrameSeq[0].Name = "com.sun.star.text.TextDocument";
137 xFrameSeq[0].Value = xTextFrame;
138 xFrameSeq[1] = new PropertyValue();
139 xFrameSeq[1].Name = "com.sun.star.text.WebDocument";
140 xFrameSeq[1].Value = xWebFrame;
141 xFrameSeq[2] = new PropertyValue();
142 xFrameSeq[2].Name = "com.sun.star.text.GlobalDocument";
143 xFrameSeq[2].Value = xGlobalFrame;
144 xFrameSeq[3] = new PropertyValue();
145 xFrameSeq[3].Name = "com.sun.star.sheet.SpreadsheetDocument";
146 xFrameSeq[3].Value = xSheetFrame;
147 xFrameSeq[4] = new PropertyValue();
148 xFrameSeq[4].Name = "com.sun.star.drawing.DrawingDocument";
149 xFrameSeq[4].Value = xDrawFrame;
150 xFrameSeq[5] = new PropertyValue();
151 xFrameSeq[5].Name = "com.sun.star.formula.FormulaProperties";
152 xFrameSeq[5].Value = xMathFrame;
153 xFrameSeq[6] = new PropertyValue();
154 xFrameSeq[6].Name = "com.sun.star.presentation.PresentationDocument";
155 xFrameSeq[6].Value = xImpressFrame;
157 PropertyValue[] xControllerSeq = new PropertyValue[7];
158 xControllerSeq[0] = new PropertyValue();
159 xControllerSeq[0].Name = "com.sun.star.text.TextDocument";
160 xControllerSeq[0].Value = xTextController;
161 xControllerSeq[1] = new PropertyValue();
162 xControllerSeq[1].Name = "com.sun.star.text.WebDocument";
163 xControllerSeq[1].Value = xWebController;
164 xControllerSeq[2] = new PropertyValue();
165 xControllerSeq[2].Name = "com.sun.star.text.GlobalDocument";
166 xControllerSeq[2].Value = xGlobalController;
167 xControllerSeq[3] = new PropertyValue();
168 xControllerSeq[3].Name = "com.sun.star.sheet.SpreadsheetDocument";
169 xControllerSeq[3].Value = xSheetController;
170 xControllerSeq[4] = new PropertyValue();
171 xControllerSeq[4].Name = "com.sun.star.drawing.DrawingDocument";
172 xControllerSeq[4].Value = xDrawController;
173 xControllerSeq[5] = new PropertyValue();
174 xControllerSeq[5].Name = "com.sun.star.formula.FormulaProperties";
175 xControllerSeq[5].Value = xMathController;
176 xControllerSeq[6] = new PropertyValue();
177 xControllerSeq[6].Name = "com.sun.star.presentation.PresentationDocument";
178 xControllerSeq[6].Value = xImpressController;
180 PropertyValue[] xModelSeq = new PropertyValue[7];
181 xModelSeq[0] = new PropertyValue();
182 xModelSeq[0].Name = "com.sun.star.text.TextDocument";
183 xModelSeq[0].Value = xTextMode1;
184 xModelSeq[1] = new PropertyValue();
185 xModelSeq[1].Name = "com.sun.star.text.WebDocument";
186 xModelSeq[1].Value = xWebMode1;
187 xModelSeq[2] = new PropertyValue();
188 xModelSeq[2].Name = "com.sun.star.text.GlobalDocument";
189 xModelSeq[2].Value = xGlobalMode1;
190 xModelSeq[3] = new PropertyValue();
191 xModelSeq[3].Name = "com.sun.star.sheet.SpreadsheetDocument";
192 xModelSeq[3].Value = xSheetMode1;
193 xModelSeq[4] = new PropertyValue();
194 xModelSeq[4].Name = "com.sun.star.drawing.DrawingDocument";
195 xModelSeq[4].Value = xDrawMode1;
196 xModelSeq[5] = new PropertyValue();
197 xModelSeq[5].Name = "com.sun.star.presentation.PresentationDocument";
198 xModelSeq[5].Value = xImpressMode1;
199 xModelSeq[6] = new PropertyValue();
200 xModelSeq[6].Name = "com.sun.star.formula.FormulaProperties";
201 xModelSeq[6].Value = xMathMode1;
203 TestEnvironment tEnv = new TestEnvironment( oObj );
206 tEnv.addObjRelation("XModuleManager.XFrame", xFrameSeq);
207 tEnv.addObjRelation("XModuleManager.XController", xControllerSeq);
208 tEnv.addObjRelation("XModuleManager.XModel", xModelSeq);
209 return tEnv;
210 } // finish method getTestEnvironment
212 /** Disposes text document.
213 * @param tParam test parameters
214 * @param log simple logger
216 @Override
217 protected void cleanup( TestParameters tParam, PrintWriter log ) {
218 log.println( " closing all documents " );
219 DesktopTools.closeDoc(xTextDoc);
220 DesktopTools.closeDoc(xWebDoc);
221 DesktopTools.closeDoc(xGlobalDoc);
222 DesktopTools.closeDoc(xSheetDoc);
223 DesktopTools.closeDoc(xDrawDoc);
224 DesktopTools.closeDoc(xImpressDoc);
225 DesktopTools.closeDoc(xMathDoc);