bump product version to 4.2.0.1
[LibreOffice.git] / qadevOOo / tests / java / mod / _sch / ChartLegend.java
blob9c821fd1702e36c3d851315b1e4e173eba9607f8
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._sch;
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;
28 import util.utils;
30 import com.sun.star.chart.XChartDocument;
31 import com.sun.star.drawing.XShape;
32 import com.sun.star.lang.XComponent;
33 import com.sun.star.lang.XMultiServiceFactory;
34 import com.sun.star.uno.UnoRuntime;
36 /**
37 * Test for object which is represented by service
38 * <code>com.sun.star.chart.ChartLegend</code>. <p>
39 * Object implements the following interfaces :
40 * <ul>
41 * <li> <code>com::sun::star::drawing::FillProperties</code></li>
42 * <li> <code>com::sun::star::drawing::XShape</code></li>
43 * <li> <code>com::sun::star::drawing::Shape</code></li>
44 * <li> <code>com::sun::star::chart::ChartLegend</code></li>
45 * <li> <code>com::sun::star::drawing::LineProperties</code></li>
46 * <li> <code>com::sun::star::beans::XPropertySet</code></li>
47 * <li> <code>com::sun::star::style::CharacterProperties</code></li>
48 * <li> <code>com::sun::star::drawing::XShapeDescriptor</code></li>
49 * <li> <code>com::sun::star::lang::XComponent</code></li>
50 * </ul>
51 * The following files used by this test :
52 * <ul>
53 * <li><b> TransparencyChart.sxs </b> : to load predefined chart
54 * document where two 'automatic' transparency styles exists :
55 * 'Transparency 1' and 'Transparency 2'.</li>
56 * </ul> <p>
57 * @see com.sun.star.drawing.FillProperties
58 * @see com.sun.star.drawing.XShape
59 * @see com.sun.star.drawing.Shape
60 * @see com.sun.star.chart.ChartLegend
61 * @see com.sun.star.drawing.LineProperties
62 * @see com.sun.star.beans.XPropertySet
63 * @see com.sun.star.style.CharacterProperties
64 * @see com.sun.star.drawing.XShapeDescriptor
65 * @see com.sun.star.lang.XComponent
66 * @see ifc.drawing._FillProperties
67 * @see ifc.drawing._XShape
68 * @see ifc.drawing._Shape
69 * @see ifc.chart._ChartLegend
70 * @see ifc.drawing._LineProperties
71 * @see ifc.beans._XPropertySet
72 * @see ifc.style._CharacterProperties
73 * @see ifc.drawing._XShapeDescriptor
74 * @see ifc.lang._XComponent
76 public class ChartLegend extends TestCase {
77 XChartDocument xChartDoc = null;
79 /**
80 * Creates Chart document.
82 protected void initialize( TestParameters tParam, PrintWriter log ) {
83 // get a soffice factory object
84 SOfficeFactory SOF = SOfficeFactory.getFactory( (XMultiServiceFactory)tParam.getMSF());
86 try {
87 log.println( "creating a chartdocument" );
88 XComponent xComp = SOF.loadDocument(
89 utils.getFullTestURL("TransparencyChart.sxs"));
90 xChartDoc = UnoRuntime.queryInterface(XChartDocument.class,xComp);
91 } catch (com.sun.star.uno.Exception e) {
92 // Some exception occurs.FAILED
93 e.printStackTrace( log );
94 throw new StatusException( "Couldn't create document", e );
98 /**
99 * Disposes Chart document.
101 protected void cleanup( TestParameters tParam, PrintWriter log ) {
102 if( xChartDoc!=null ) {
103 log.println( " closing xChartDoc" );
104 util.DesktopTools.closeDoc(xChartDoc);
105 xChartDoc = null;
110 * Creating a Testenvironment for the interfaces to be tested.
111 * Retrieves the diagram of the chart document. The retrieved
112 * diagram is the instance of the service
113 * <code>com.sun.star.chart.ChartLegend</code>.
115 protected synchronized TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) {
117 XShape oObj = null;
119 // get the Legend
120 log.println( "getting Legend" );
121 oObj = xChartDoc.getLegend();
123 log.println( "creating a new environment for chartdocument object" );
124 TestEnvironment tEnv = new TestEnvironment( oObj );
126 tEnv.addObjRelation("NoSetSize", "sch.ChartLegend");
127 return tEnv;
128 } // finish method getTestEnvironment
131 } // finish class ChartLegend