merge the formfield patch from ooo-build
[ooovba.git] / qadevOOo / tests / java / mod / _sch / ChartLegend.java
blob943deb367c6a7c74b2d004647d667ceb67da9ef0
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: ChartLegend.java,v $
10 * $Revision: 1.6 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 package mod._sch;
33 import java.io.PrintWriter;
35 import lib.StatusException;
36 import lib.TestCase;
37 import lib.TestEnvironment;
38 import lib.TestParameters;
39 import util.SOfficeFactory;
40 import util.utils;
42 import com.sun.star.chart.XChartDocument;
43 import com.sun.star.drawing.XShape;
44 import com.sun.star.lang.XComponent;
45 import com.sun.star.lang.XMultiServiceFactory;
46 import com.sun.star.uno.UnoRuntime;
48 /**
49 * Test for object which is represented by service
50 * <code>com.sun.star.chart.ChartLegend</code>. <p>
51 * Object implements the following interfaces :
52 * <ul>
53 * <li> <code>com::sun::star::drawing::FillProperties</code></li>
54 * <li> <code>com::sun::star::drawing::XShape</code></li>
55 * <li> <code>com::sun::star::drawing::Shape</code></li>
56 * <li> <code>com::sun::star::chart::ChartLegend</code></li>
57 * <li> <code>com::sun::star::drawing::LineProperties</code></li>
58 * <li> <code>com::sun::star::beans::XPropertySet</code></li>
59 * <li> <code>com::sun::star::style::CharacterProperties</code></li>
60 * <li> <code>com::sun::star::drawing::XShapeDescriptor</code></li>
61 * <li> <code>com::sun::star::lang::XComponent</code></li>
62 * </ul>
63 * The following files used by this test :
64 * <ul>
65 * <li><b> TransparencyChart.sxs </b> : to load predefined chart
66 * document where two 'automatic' transparency styles exists :
67 * 'Transparency 1' and 'Transparency 2'.</li>
68 * </ul> <p>
69 * @see com.sun.star.drawing.FillProperties
70 * @see com.sun.star.drawing.XShape
71 * @see com.sun.star.drawing.Shape
72 * @see com.sun.star.chart.ChartLegend
73 * @see com.sun.star.drawing.LineProperties
74 * @see com.sun.star.beans.XPropertySet
75 * @see com.sun.star.style.CharacterProperties
76 * @see com.sun.star.drawing.XShapeDescriptor
77 * @see com.sun.star.lang.XComponent
78 * @see ifc.drawing._FillProperties
79 * @see ifc.drawing._XShape
80 * @see ifc.drawing._Shape
81 * @see ifc.chart._ChartLegend
82 * @see ifc.drawing._LineProperties
83 * @see ifc.beans._XPropertySet
84 * @see ifc.style._CharacterProperties
85 * @see ifc.drawing._XShapeDescriptor
86 * @see ifc.lang._XComponent
88 public class ChartLegend extends TestCase {
89 XChartDocument xChartDoc = null;
91 /**
92 * Creates Chart document.
94 protected void initialize( TestParameters tParam, PrintWriter log ) {
95 // get a soffice factory object
96 SOfficeFactory SOF = SOfficeFactory.getFactory( (XMultiServiceFactory)tParam.getMSF());
98 try {
99 log.println( "creating a chartdocument" );
100 XComponent xComp = SOF.loadDocument(
101 utils.getFullTestURL("TransparencyChart.sxs"));
102 xChartDoc = (XChartDocument)
103 UnoRuntime.queryInterface(XChartDocument.class,xComp);
104 } catch (com.sun.star.uno.Exception e) {
105 // Some exception occures.FAILED
106 e.printStackTrace( log );
107 throw new StatusException( "Couldn't create document", e );
112 * Disposes Chart document.
114 protected void cleanup( TestParameters tParam, PrintWriter log ) {
115 log.println( " closing xChartDoc " );
116 util.DesktopTools.closeDoc(xChartDoc);
120 * Creating a Testenvironment for the interfaces to be tested.
121 * Retrieves the diagram of the chart document. The retrieved
122 * diagram is the instance of the service
123 * <code>com.sun.star.chart.ChartLegend</code>.
125 protected synchronized TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) {
127 XShape oObj = null;
129 // get the Legend
130 log.println( "getting Legend" );
131 oObj = (XShape) xChartDoc.getLegend();
133 log.println( "creating a new environment for chartdocument object" );
134 TestEnvironment tEnv = new TestEnvironment( oObj );
136 tEnv.addObjRelation("NoSetSize", "sch.ChartLegend");
137 return tEnv;
138 } // finish method getTestEnvironment
141 } // finish class ChartLegend