tdf#130857 qt weld: Introduce QtInstanceScrolledWindow
[LibreOffice.git] / qadevOOo / tests / java / mod / _sw / SwXPrintSettings.java
blob109b947f6bb5469d7ebc4ad39efdd0e7dd65bcf7
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.TestCase;
24 import lib.TestEnvironment;
25 import lib.TestParameters;
26 import util.SOfficeFactory;
28 import com.sun.star.lang.XMultiServiceFactory;
29 import com.sun.star.text.XTextDocument;
30 import com.sun.star.uno.UnoRuntime;
31 import com.sun.star.uno.XInterface;
32 import com.sun.star.view.XPrintSettingsSupplier;
34 /**
35 * Test for object which is represented by service
36 * <code>com.sun.star.text.PrintSettings</code>. <p>
37 * Object implements the following interfaces :
38 * <ul>
39 * <li> <code>com::sun::star::text::PrintSettings</code></li>
40 * </ul> <p>
41 * This object test <b> is NOT </b> designed to be run in several
42 * threads concurrently.
43 * @see com.sun.star.text.PrintSettings
44 * @see ifc.text._PrintSettings
46 public class SwXPrintSettings extends TestCase {
47 XTextDocument xTextDoc;
49 /**
50 * Creates text document.
52 @Override
53 protected void initialize( TestParameters tParam, PrintWriter log ) throws Exception {
54 SOfficeFactory SOF = SOfficeFactory.getFactory( tParam.getMSF() );
55 log.println( "creating a textdocument" );
56 xTextDoc = SOF.createTextDoc( null );
59 /**
60 * Disposes text document.
62 @Override
63 protected void cleanup( TestParameters tParam, PrintWriter log ) {
64 log.println( " disposing xTextDoc " );
65 util.DesktopTools.closeDoc(xTextDoc);
68 /**
69 * Creating a TestEnvironment for the interfaces to be tested.
70 * Creates an instance of the service
71 * <code>com.sun.star.text.GlobalSettings</code>, then print settings are
72 * gotten using <code>XPrintSettingsSupplier</code> interface.
74 @Override
75 public TestEnvironment createTestEnvironment(
76 TestParameters tParam, PrintWriter log ) throws Exception {
77 XInterface oObj = null;
78 Object oInst = null;
80 log.println( "creating a test environment" );
81 XMultiServiceFactory myMSF = tParam.getMSF();
82 oInst = myMSF.createInstance("com.sun.star.text.GlobalSettings");
83 XPrintSettingsSupplier xPSS = UnoRuntime.queryInterface(XPrintSettingsSupplier.class, oInst);
84 oObj = xPSS.getPrintSettings();
86 TestEnvironment tEnv = new TestEnvironment(oObj);
87 return tEnv;
88 } // finish method getTestEnvironment
90 } // finish class SwXPrintSettings