bump product version to 5.0.4.1
[LibreOffice.git] / qadevOOo / tests / java / mod / _sw / SwXTextFieldMasters.java
blobf3cb6f0e7a95cbb7a1886ad18d1039513729ab6f
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.text.XTextDocument;
30 import com.sun.star.text.XTextFieldsSupplier;
31 import com.sun.star.uno.UnoRuntime;
32 import com.sun.star.uno.XInterface;
34 /**
36 * initial description
37 * @see com.sun.star.container.XContainer
38 * @see com.sun.star.container.XElementAccess
39 * @see com.sun.star.container.XNameAccess
40 * @see com.sun.star.container.XNameContainer
41 * @see com.sun.star.container.XNameReplace
44 public class SwXTextFieldMasters extends TestCase {
46 XTextDocument xTextDoc;
48 /**
49 * in general this method creates a testdocument
51 * @param tParam class which contains additional test parameters
52 * @param log class to log the test state and result
55 * @see TestParameters
56 * @see PrintWriter
59 @Override
60 protected void initialize( TestParameters tParam, PrintWriter log ) {
61 SOfficeFactory SOF = SOfficeFactory.getFactory( tParam.getMSF() );
63 try {
64 log.println( "creating a textdocument" );
65 xTextDoc = SOF.createTextDoc( null );
66 } catch ( com.sun.star.uno.Exception e ) {
67 // Some exception occurs.FAILED
68 e.printStackTrace( log );
69 throw new StatusException( "Couldn't create document", e );
73 /**
74 * in general this method disposes the testenvironment and document
76 * @param tParam class which contains additional test parameters
77 * @param log class to log the test state and result
80 * @see TestParameters
81 * @see PrintWriter
84 @Override
85 protected void cleanup( TestParameters tParam, PrintWriter log ) {
86 log.println( " disposing xTextDoc " );
87 util.DesktopTools.closeDoc(xTextDoc);
91 /**
92 * creating a Testenvironment for the interfaces to be tested
94 * @param tParam class which contains additional test parameters
95 * @param log class to log the test state and result
97 * @return Status class
99 * @see TestParameters
100 * @see PrintWriter
102 @Override
103 public TestEnvironment createTestEnvironment( TestParameters tParam,
104 PrintWriter log )
105 throws StatusException {
107 XInterface oObj = null;
109 // creation of testobject here
110 // first we write what we are intend to do to log file
111 log.println( "creating a test environment" );
114 // create testobject here
115 try {
116 XTextFieldsSupplier oTFS = UnoRuntime.queryInterface( XTextFieldsSupplier.class, xTextDoc );
118 oObj = oTFS.getTextFieldMasters();
121 catch (Exception ex) {
122 log.println("Couldn't create instance");
123 ex.printStackTrace(log);
126 log.println( "creating a new environment for FieldMasters object" );
127 TestEnvironment tEnv = new TestEnvironment( oObj );
129 return tEnv;
130 } // finish method getTestEnvironment
131 } // finish class SwXTextFieldMasters