tdf#130857 qt weld: Introduce QtInstanceScrolledWindow
[LibreOffice.git] / qadevOOo / tests / java / mod / _sw / SwXFieldMaster.java
blobce1009e052488453777939bbe93f18f16f982e88
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._sw;
21 import java.io.PrintWriter;
23 import lib.StatusException;
24 import lib.TestCase;
25 import lib.TestEnvironment;
26 import lib.TestParameters;
27 import util.SOfficeFactory;
29 import com.sun.star.lang.XMultiServiceFactory;
30 import com.sun.star.text.XTextDocument;
31 import com.sun.star.uno.UnoRuntime;
32 import com.sun.star.uno.XInterface;
34 /**
35 * Test for object which is represented by service
36 * <code>com.sun.star.text.FieldMaster.Database</code>. <p>
37 * Object implements the following interfaces :
38 * <ul>
39 * <li> <code>com::sun::star::text::TextFieldMaster</code></li>
40 * <li> <code>com::sun::star::beans::XPropertySet</code></li>
41 * </ul> <p>
42 * This object test <b> is NOT </b> designed to be run in several
43 * threads concurrently.
44 * @see com.sun.star.text.TextFieldMaster
45 * @see com.sun.star.text.FieldMaster.Database
46 * @see com.sun.star.beans.XPropertySet
47 * @see ifc.text._TextFieldMaster
48 * @see ifc.beans._XPropertySet
50 public class SwXFieldMaster extends TestCase {
51 XTextDocument xTextDoc;
53 /**
54 * Creates text document.
56 @Override
57 protected void initialize( TestParameters tParam, PrintWriter log ) throws Exception {
58 SOfficeFactory SOF = SOfficeFactory.getFactory( tParam.getMSF() );
59 log.println( "creating a textdocument" );
60 xTextDoc = SOF.createTextDoc( null );
63 /**
64 * Disposes text document.
66 @Override
67 protected void cleanup( TestParameters tParam, PrintWriter log ) {
68 log.println( " disposing xTextDoc " );
69 util.DesktopTools.closeDoc(xTextDoc);
73 /**
74 * Creating a TestEnvironment for the interfaces to be tested.
75 * Creates an instance of the service
76 * <code>com.sun.star.text.FieldMaster.Database</code>.
78 @Override
79 public TestEnvironment createTestEnvironment(
80 TestParameters tParam, PrintWriter log ) throws StatusException {
81 XInterface oObj = null;
83 log.println( "creating a test environment" );
84 try {
85 XMultiServiceFactory oDocMSF = UnoRuntime.queryInterface( XMultiServiceFactory.class, xTextDoc );
86 oObj = (XInterface)
87 oDocMSF.createInstance( "com.sun.star.text.FieldMaster.Database" );
88 } catch ( com.sun.star.uno.Exception e ) {
89 log.println("Couldn't create instance");
90 e.printStackTrace(log);
93 log.println( "creating a new environment for FieldMaster object" );
94 TestEnvironment tEnv = new TestEnvironment( oObj );
95 return tEnv;
96 } // finish method getTestEnvironment
98 } // finish class SwXFieldMaster