tdf#130857 qt weld: Introduce QtInstanceScrolledWindow
[LibreOffice.git] / qadevOOo / tests / java / mod / _sw / SwXDrawPage.java
blobd6d44644e464b4ce56607c06262e46aa5b7b65fe
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.InstCreator;
28 import util.SOfficeFactory;
29 import util.ShapeDsc;
31 import com.sun.star.drawing.XDrawPage;
32 import com.sun.star.drawing.XDrawPageSupplier;
33 import com.sun.star.drawing.XShapes;
34 import com.sun.star.text.XTextDocument;
35 import com.sun.star.uno.UnoRuntime;
36 import com.sun.star.uno.XInterface;
38 /**
39 * Test for object which is represented by service
40 * <code>com.sun.star.drawing.DrawPage</code>. <p>
41 * Object implements the following interfaces :
42 * <ul>
43 * <li> <code>com::sun::star::drawing::GenericDrawPage</code></li>
44 * <li> <code>com::sun::star::drawing::XShapeBinder</code></li>
45 * <li> <code>com::sun::star::drawing::XShapeGrouper</code></li>
46 * <li> <code>com::sun::star::drawing::XShapes</code></li>
47 * <li> <code>com::sun::star::lang::XServiceInfo</code></li>
48 * <li> <code>com::sun::star::beans::XPropertySet</code></li>
49 * <li> <code>com::sun::star::container::XIndexAccess</code></li>
50 * <li> <code>com::sun::star::container::XElementAccess</code></li>
51 * <li> <code>com::sun::star::drawing::XMasterPageTarget</code></li>
52 * <li> <code>com::sun::star::container::XNamed</code></li>
53 * <li> <code>com::sun::star::drawing::XShapeCombiner</code></li>
54 * </ul> <p>
55 * This object test <b> is NOT </b> designed to be run in several
56 * threads concurrently.
57 * @see com.sun.star.drawing.GenericDrawPage
58 * @see com.sun.star.drawing.XShapeBinder
59 * @see com.sun.star.drawing.XShapeGrouper
60 * @see com.sun.star.drawing.XShapes
61 * @see com.sun.star.lang.XServiceInfo
62 * @see com.sun.star.beans.XPropertySet
63 * @see com.sun.star.container.XIndexAccess
64 * @see com.sun.star.container.XElementAccess
65 * @see com.sun.star.drawing.XMasterPageTarget
66 * @see com.sun.star.container.XNamed
67 * @see com.sun.star.drawing.XShapeCombiner
68 * @see ifc.drawing._GenericDrawPage
69 * @see ifc.drawing._XShapeBinder
70 * @see ifc.drawing._XShapeGrouper
71 * @see ifc.drawing._XShapes
72 * @see ifc.lang._XServiceInfo
73 * @see ifc.beans._XPropertySet
74 * @see ifc.container._XIndexAccess
75 * @see ifc.container._XElementAccess
76 * @see ifc.drawing._XMasterPageTarget
77 * @see ifc.container._XNamed
78 * @see ifc.drawing._XShapeCombiner
80 public class SwXDrawPage extends TestCase {
81 XTextDocument xTextDoc;
83 /**
84 * Creates text document.
86 @Override
87 protected void initialize( TestParameters tParam, PrintWriter log ) throws Exception {
88 SOfficeFactory SOF = SOfficeFactory.getFactory( tParam.getMSF() );
89 log.println( "creating a textdocument" );
90 xTextDoc = SOF.createTextDoc( null );
93 /**
94 * Disposes text document.
96 @Override
97 protected void cleanup( TestParameters tParam, PrintWriter log ) {
98 log.println( " disposing xTextDoc " );
99 util.DesktopTools.closeDoc(xTextDoc);
103 * Creating a TestEnvironment for the interfaces to be tested. After
104 * obtaining DrawPage object several shapes are inserted to it.
105 * Object relations created :
106 * <ul>
107 * <li> <code>'Shape'</code> for
108 * {@link ifc.drawing._XShapes} : shape creator. </li>
109 * <li> <code>'DrawPage'</code> for
110 * {@link ifc.drawing._XShapeBinder},
111 * {@link ifc.drawing._XShapeCombiner},
112 * {@link ifc.drawing._XShapeGrouper} : DrawPage component we are
113 * testing.</li>
114 * </ul>
116 @Override
117 public TestEnvironment createTestEnvironment(
118 TestParameters Param, PrintWriter log ) throws StatusException {
119 XInterface oObj = null;
120 XDrawPageSupplier XDPSupp;
121 XDrawPage xDP = null;
122 XShapes oShapes = null;
124 log.println( "creating a test environment" );
125 SOfficeFactory SOF = SOfficeFactory.getFactory( Param.getMSF() );
126 XDPSupp = UnoRuntime.queryInterface
127 (XDrawPageSupplier.class, xTextDoc);
128 xDP = XDPSupp.getDrawPage();
129 oObj = xDP;
131 log.println( "inserting some Shapes" );
132 oShapes = UnoRuntime.queryInterface(XShapes.class, oObj);
133 oShapes.add(SOF.createShape(xTextDoc,2000,1500,1000,1000,"Line"));
134 oShapes.add(SOF.createShape(xTextDoc,3000,4500,15000,1000,"Ellipse"));
135 oShapes.add(SOF.createShape(xTextDoc,5000,3500,7500,5000,"Rectangle"));
137 log.println( "creating a new environment for bodytext object" );
138 TestEnvironment tEnv = new TestEnvironment( oObj );
140 ShapeDsc sDsc = new ShapeDsc(15000,13500,7500,10000,"Rectangle");
141 log.println( "adding Shape as mod relation to environment" );
142 tEnv.addObjRelation("Shape", new InstCreator( xTextDoc, sDsc));
143 tEnv.addObjRelation("DrawPage", oObj);
145 return tEnv;
146 } // finish method getTestEnvironment
148 } // finish class SwXDrawPage