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
;
24 import lib
.TestEnvironment
;
25 import lib
.TestParameters
;
26 import util
.DrawTools
;
27 import util
.SOfficeFactory
;
29 import com
.sun
.star
.drawing
.XShape
;
30 import com
.sun
.star
.lang
.XComponent
;
31 import com
.sun
.star
.uno
.UnoRuntime
;
32 import com
.sun
.star
.uno
.XInterface
;
34 public class ScShapeObj
extends TestCase
{
36 static XComponent xSheetDoc
;
39 protected void initialize( TestParameters tParam
, PrintWriter log
) throws Exception
{
40 SOfficeFactory SOF
= SOfficeFactory
.getFactory( tParam
.getMSF() );
41 log
.println( "creating a sheetdoc" );
42 xSheetDoc
= UnoRuntime
.queryInterface(XComponent
.class, SOF
.createCalcDoc(null));
46 protected void cleanup( TestParameters tParam
, PrintWriter log
) {
47 log
.println( " disposing xSheetDoc " );
48 util
.DesktopTools
.closeDoc(xSheetDoc
);
52 * Creating a TestEnvironment for the interfaces to be tested.
53 * Creates an instance of the service
54 * <code>com.sun.star.drawing.EllipseShape</code> as tested component
55 * and adds it to the document.
56 * Object relations created :
58 * <li> <code>'Style1', 'Style2'</code> for
59 * {@link ifc.drawing._Shape} :
60 * two values of 'Style' property. The first is taken
61 * from the shape tested, the second from another
62 * shape added to the draw page. </li>
63 * <li> <code>'XTEXTINFO'</code> for
64 * {@link ifc.text._XText} :
65 * creator which can create instances of
66 * <code>com.sun.star.text.TextField.URL</code>
71 protected TestEnvironment createTestEnvironment
72 (TestParameters tParam
, PrintWriter log
) {
74 XInterface oObj
= null;
77 // creation of testobject here
78 // first we write what we are intend to do to log file
79 log
.println( "creating a test environment" );
81 SOfficeFactory SOF
= SOfficeFactory
.getFactory( tParam
.getMSF());
82 oShape
= SOF
.createShape(xSheetDoc
,5000, 3500, 7500, 5000,"Rectangle");
83 DrawTools
.getShapes(DrawTools
.getDrawPage(xSheetDoc
,0)).add(oShape
);
86 for (int i
=0; i
< 10; i
++) {
87 DrawTools
.getShapes(DrawTools
.getDrawPage(xSheetDoc
,0)).add(
88 SOF
.createShape(xSheetDoc
,
89 5000, 3500, 7510 + 10 * i
, 5010 + 10 * i
, "Rectangle"));
92 // create test environment here
93 TestEnvironment tEnv
= new TestEnvironment( oShape
);
95 log
.println("Implementation name: "+util
.utils
.getImplName(oObj
));
96 tEnv
.addObjRelation("DOCUMENT",xSheetDoc
);
99 } // finish method getTestEnvironment
101 } // finish class ScShapeObj