bump product version to 4.2.0.1
[LibreOffice.git] / qadevOOo / tests / java / mod / _fwl / FrameLoaderFactory.java
blob4260ac3156761d19f56c1f062b65d8ca816cd64a
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._fwl;
21 import com.sun.star.beans.NamedValue;
22 import java.io.PrintWriter;
24 import lib.Status;
25 import lib.StatusException;
26 import lib.TestCase;
27 import lib.TestEnvironment;
28 import lib.TestParameters;
29 import util.utils;
31 import com.sun.star.container.XNameAccess;
32 import com.sun.star.lang.XMultiServiceFactory;
33 import com.sun.star.uno.UnoRuntime;
34 import com.sun.star.uno.XInterface;
36 /**
37 * Test for object which is represented by service
38 * <code>com.sun.star.frame.FrameLoaderFactory</code>. <p>
40 * Object implements the following interfaces :
41 * <ul>
42 * <li> <code>com::sun::star::container::XNameAccess</code></li>
43 * <li> <code>com::sun::star::container::XElementAccess</code></li>
44 * <li> <code>com::sun::star::lang::XMultiServiceFactory</code></li>
45 * </ul> <p>
47 * @see com.sun.star.container.XNameAccess
48 * @see com.sun.star.container.XElementAccess
49 * @see com.sun.star.lang.XMultiServiceFactory
50 * @see ifc.container._XNameAccess
51 * @see ifc.container._XElementAccess
52 * @see ifc.lang._XMultiServiceFactory
54 public class FrameLoaderFactory extends TestCase {
56 /**
57 * Creating a Testenvironment for the interfaces to be tested.
58 * Creates an instance of the service
59 * <code>com.sun.star.frame.FrameLoaderFactory</code>. <p>
61 protected TestEnvironment createTestEnvironment
62 (TestParameters Param, PrintWriter log) {
63 XInterface oObj = null;
64 Object oInterface = null ;
66 try {
67 oInterface = ((XMultiServiceFactory)Param.getMSF()).createInstance
68 ("com.sun.star.frame.FrameLoaderFactory") ;
69 } catch (com.sun.star.uno.Exception e) {
70 log.println("Couldn't get service");
71 e.printStackTrace(log);
72 throw new StatusException("Couldn't get FrameLoaderFactory", e );
75 if (oInterface == null) {
76 log.println("Service wasn't created") ;
77 throw new StatusException(Status.failed("Service wasn't created")) ;
80 oObj = (XInterface) oInterface ;
81 log.println("ImplName: "+utils.getImplName(oObj));
83 log.println( "creating a new environment for object" );
84 TestEnvironment tEnv = new TestEnvironment( oObj );
86 XNameAccess xNA = UnoRuntime.queryInterface
87 (XNameAccess.class, oObj);
88 tEnv.addObjRelation("XMSF.serviceNames", xNA.getElementNames());
90 // com.sun.star.container.XContainerQuery
91 NamedValue[] querySequenze = new NamedValue[1];
92 NamedValue query = new NamedValue();
93 query.Name = "Name";
94 query.Value = "com.sun.star.frame.Bibliography";
95 querySequenze[0] = query;
97 tEnv.addObjRelation("XContainerQuery.createSubSetEnumerationByProperties",
98 querySequenze);
100 return tEnv;
101 } // finish method getTestEnvironment