tdf#130857 qt weld: Introduce QtInstanceScrolledWindow
[LibreOffice.git] / qadevOOo / tests / java / mod / _sd / SdMasterPagesAccess.java
blob6477620876d114fa5392e120eb8ca73dab94ab56
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._sd;
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.drawing.XDrawPages;
30 import com.sun.star.drawing.XMasterPagesSupplier;
31 import com.sun.star.lang.XComponent;
32 import com.sun.star.uno.UnoRuntime;
33 import com.sun.star.uno.XInterface;
35 /**
36 * Test for object which is represented by service
37 * <code>com.sun.star.drawing.MasterPages</code>. <p>
38 * Object implements the following interfaces :
39 * <ul>
40 * <li> <code>com::sun::star::container::XIndexAccess</code></li>
41 * <li> <code>com::sun::star::container::XElementAccess</code></li>
42 * <li> <code>com::sun::star::drawing::XDrawPages</code></li>
43 * </ul>
44 * @see com.sun.star.drawing.MasterPages
45 * @see com.sun.star.container.XIndexAccess
46 * @see com.sun.star.container.XElementAccess
47 * @see com.sun.star.drawing.XDrawPages
48 * @see ifc.container._XIndexAccess
49 * @see ifc.container._XElementAccess
50 * @see ifc.drawing._XDrawPages
52 public class SdMasterPagesAccess extends TestCase {
53 XComponent xDrawDoc;
55 /**
56 * Creates Drawing document.
58 @Override
59 protected void initialize(TestParameters Param, PrintWriter log) throws Exception {
60 // get a soffice factory object
61 SOfficeFactory SOF = SOfficeFactory.getFactory(
62 Param.getMSF());
63 log.println( "creating a draw document" );
64 xDrawDoc = SOF.createDrawDoc(null);
67 /**
68 * Disposes Drawing document.
70 @Override
71 protected void cleanup( TestParameters Param, PrintWriter log) {
72 log.println("disposing xDrawDoc");
73 util.DesktopTools.closeDoc(xDrawDoc);
76 /**
77 * Creating a TestEnvironment for the interfaces to be tested.
78 * Retrieves the collection of the master pages from the document using the
79 * interface <code>XMasterPagesSupplier</code>. Inserts two new draw pages.
80 * The retrieved collection is the instance of the service
81 * <code>com.sun.star.drawing.MasterPages</code>.
82 * @see com.sun.star.drawing.XMasterPagesSupplier
83 * @see com.sun.star.drawing.MasterPages
85 @Override
86 public TestEnvironment createTestEnvironment(
87 TestParameters Param, PrintWriter log) throws StatusException {
89 log.println( "creating a test environment" );
91 // get the MasterPages here
92 log.println( "getting MasterPages" );
93 XMasterPagesSupplier oMPS = UnoRuntime.queryInterface( XMasterPagesSupplier.class, xDrawDoc);
94 XDrawPages oMP = oMPS.getMasterPages();
95 log.println( "insert MasterPages" );
96 oMP.insertNewByIndex(1);
97 oMP.insertNewByIndex(2);
98 XInterface oObj = oMP;
100 log.println( "creating a new environment for MasterPagesAccess object" );
101 TestEnvironment tEnv = new TestEnvironment( oObj );
103 return tEnv;
104 } // finish method createTestEnvironment
106 } // finish class SdMasterPagesAccess