tdf#130857 qt weld: Implement QtInstanceWidget::strip_mnemonic
[LibreOffice.git] / qadevOOo / tests / java / ifc / frame / _XComponentLoader.java
blobafda3657a1a859f37cc7cb4e6e145aae56d3af80
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 ifc.frame;
21 import lib.MultiMethodTest;
23 import com.sun.star.beans.PropertyState;
24 import com.sun.star.beans.PropertyValue;
25 import com.sun.star.frame.XComponentLoader;
26 import com.sun.star.lang.XComponent;
29 /**
30 * Testing <code>com.sun.star.frame.XComponentLoader</code>
31 * interface methods:
32 * <ul>
33 * <li><code> loadComponentFromURL() </code></li>
34 * </ul><p>
35 * Test is <b> NOT </b> multithread compliant. <p>
36 * @see com.sun.star.frame.XComponentLoader
38 public class _XComponentLoader extends MultiMethodTest {
39 public XComponentLoader oObj = null; // oObj filled by MultiMethodTest
41 /**
42 * Method which tests the objects ability to load a
43 * component from URL. All available components are loaded by turns. <p>
44 * Has <b> OK </b> status if the method successfully returns
45 * and no exceptions were thrown. <p>
46 * @see XComponent
48 public void _loadComponentFromURL() throws Exception {
49 boolean result = true;
51 log.println("testing loadComponentFromURL() ... ");
52 try {
53 PropertyValue [] szEmptyArgs = new PropertyValue [0];
54 String frameName = "_blank";
55 XComponent oDoc = null;
57 log.println("load writer doc that contains links");
58 PropertyValue [] szArgs = new PropertyValue [1];
59 PropertyValue Arg = new PropertyValue();
60 Arg.Name = "UpdateDocMode";
61 Arg.Value = Short.valueOf(com.sun.star.document.UpdateDocMode.NO_UPDATE);
62 szArgs[0]=Arg;
63 String url = util.utils.getFullTestURL("Writer_link.sxw");
64 log.println("try to load '" + url + "'");
65 oDoc = oObj.loadComponentFromURL(
66 url, frameName, 0, szArgs);
68 waitForEventIdle();
70 oDoc.dispose();
72 url = util.utils.getFullTestURL("Calc_Link.sxc");
73 log.println("try to load '" + url + "'");
74 oDoc = oObj.loadComponentFromURL(
75 url, frameName, 0, szArgs);
77 waitForEventIdle();
79 oDoc.dispose();
83 log.println("load a blank impress doc");
84 Arg.Name = "OpenFlags";
85 Arg.Value = "S";
86 Arg.Handle = -1;
87 Arg.State = PropertyState.DEFAULT_VALUE;
88 szArgs[0]=Arg;
89 oDoc = oObj.loadComponentFromURL(
90 "private:factory/simpress", frameName, 0, szArgs );
92 log.println("disposing impress doc");
93 oDoc.dispose();
95 log.println("load a blank writer doc");
96 oDoc = oObj.loadComponentFromURL(
97 "private:factory/swriter", frameName, 0, szEmptyArgs );
99 log.println("disposing writer doc");
100 oDoc.dispose();
102 log.println("load a blank calc doc");
103 oDoc = oObj.loadComponentFromURL(
104 "private:factory/scalc", frameName, 0, szEmptyArgs );
106 log.println("disposing calc doc");
107 oDoc.dispose();
109 log.println("load a blank draw doc");
110 oDoc = oObj.loadComponentFromURL(
111 "private:factory/sdraw", frameName, 0, szEmptyArgs );
113 log.println("disposing draw doc");
114 oDoc.dispose();
116 log.println("load a blank math doc");
117 oDoc = oObj.loadComponentFromURL(
118 "private:factory/smath", frameName, 0, szEmptyArgs );
120 log.println("disposing math doc");
121 oDoc.dispose();
124 catch (com.sun.star.lang.IllegalArgumentException e) {
125 log.println("Exception occurred while loading");
126 e.printStackTrace(log);
127 result=false;
129 catch (com.sun.star.io.IOException e) {
130 log.println("Exception occurred while loading");
131 e.printStackTrace(log);
132 result=false;
135 tRes.tested("loadComponentFromURL()", result);