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 .
21 import java
.io
.PrintWriter
;
23 import lib
.StatusException
;
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
.XDrawPagesSupplier
;
31 import com
.sun
.star
.lang
.XComponent
;
32 import com
.sun
.star
.uno
.UnoRuntime
;
33 import com
.sun
.star
.uno
.XInterface
;
36 * Test for object which is represented by service
37 * <code>com.sun.star.drawing.DrawPages</code>. <p>
38 * Object implements the following interfaces :
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>
44 * @see com.sun.star.drawing.DrawPages
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 SdDrawPagesAccess
extends TestCase
{
56 * Creates Drawing document.
59 protected void initialize(TestParameters Param
, PrintWriter log
) throws Exception
{
60 // get a soffice factory object
61 SOfficeFactory SOF
= SOfficeFactory
.getFactory(
64 log
.println( "creating a draw document" );
65 xDrawDoc
= SOF
.createDrawDoc(null);
69 * Disposes Drawing document.
72 protected void cleanup( TestParameters Param
, PrintWriter log
) {
73 log
.println("disposing xDrawDoc");
74 util
.DesktopTools
.closeDoc(xDrawDoc
);
78 * Creating a TestEnvironment for the interfaces to be tested.
79 * Retrieves the collection of the draw pages from the drawing document using
80 * the interface <code>XDrawPagesSupplier</code>. Inserts two new draw pages.
81 * The retrieved collection is the instance of the service
82 * <code>com.sun.star.drawing.DrawPages</code>.
83 * @see com.sun.star.drawing.DrawPages
86 public TestEnvironment
createTestEnvironment(
87 TestParameters Param
, PrintWriter log
) throws StatusException
{
89 // creation of testobject here
90 // first we write what we are intend to do to log file
91 log
.println( "creating a test environment" );
93 // get the drawpage of drawing here
94 log
.println( "getting Drawpages" );
95 XDrawPagesSupplier oDPS
= UnoRuntime
.queryInterface(XDrawPagesSupplier
.class, xDrawDoc
);
96 XDrawPages oDP
= oDPS
.getDrawPages();
97 oDP
.insertNewByIndex(1);
98 oDP
.insertNewByIndex(2);
99 XInterface oObj
= oDP
;
101 log
.println( "creating a new environment for drawpage object" );
102 TestEnvironment tEnv
= new TestEnvironment( oObj
);
105 } // finish method createTestEnvironment
108 } // finish class SdDrawPagesAccess