tdf#130857 qt weld: Introduce QtInstanceScrolledWindow
[LibreOffice.git] / qadevOOo / tests / java / mod / _inv / Invocation.java
blob0264fef40416ffe7d6b5befedf3741f2cdf1d0f1
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._inv;
21 import java.io.PrintWriter;
23 import lib.TestCase;
24 import lib.TestEnvironment;
25 import lib.TestParameters;
27 import com.sun.star.lang.XMultiServiceFactory;
28 import com.sun.star.uno.XInterface;
30 /**
31 * Test for object which is represented by service
32 * <code>com.sun.star.script.Invocation</code>. <p>
33 * Object implements the following interfaces :
34 * <ul>
35 * <li> <code>com::sun::star::lang::XSingleServiceFactory</code></li>
36 * </ul>
37 * @see com.sun.star.script.Invocation
38 * @see com.sun.star.lang.XSingleServiceFactory
39 * @see ifc.lang._XSingleServiceFactory
41 public class Invocation extends TestCase {
43 /**
44 * Creating a TestEnvironment for the interfaces to be tested.
45 * Creates service <code>com.sun.star.script.Invocation</code>.
46 * Object relations created :
47 * <ul>
48 * <li> <code>'XSingleServiceFactory.createInstance.negative'</code> :
49 * for interface {@link ifc.lang._XSingleServiceFactory} ;
50 * <code>String</code> relation; If its value 'true' then
51 * <code>createInstance</code> method for the object isn't
52 * supported. In this case object doesn't support this method.</li>
53 * <li> <code>'XSingleServiceFactory.arguments'</code> :
54 * for interface {@link ifc.lang._XSingleServiceFactory} ;
55 * has <code>Object[]</code> type. This relation is used as
56 * a parameter for <code>createInstanceWithArguments</code>
57 * method call. If this relation doesn't exist test pass
58 * zero length array as argument. Here
59 * <code>com.sun.star.io.Pipe</code> instance is passed.</li>
60 * <li> <code>'XSingleServiceFactory.MustSupport'</code> :
61 * for interface {@link ifc.lang._XSingleServiceFactory}.
62 * Specifies that created instance must support
63 * <code>com.sun.star.script.XInvocation</code> interface.
64 * </ul>
66 @Override
67 protected TestEnvironment createTestEnvironment(TestParameters tParam, PrintWriter log) throws Exception {
68 XMultiServiceFactory xMSF = tParam.getMSF();
70 XInterface xInt = (XInterface)xMSF.createInstance(
71 "com.sun.star.script.Invocation");
73 TestEnvironment tEnv = new TestEnvironment(xInt);
75 // the createInstance should fail according to the documentation
76 tEnv.addObjRelation(
77 "XSingleServiceFactory.createInstance.negative", "true");
79 // creating parameters to createInstanceWithArguments
80 Object[] args = new Object[1];
82 args[0] = xMSF.createInstance("com.suns.star.io.Pipe");
84 tEnv.addObjRelation(
85 "XSingleServiceFactory.arguments", args);
87 tEnv.addObjRelation("XSingleServiceFactory.MustSupport",
88 new Class[] {com.sun.star.script.XInvocation.class});
90 return tEnv;