bump product version to 5.0.4.1
[LibreOffice.git] / qadevOOo / tests / java / mod / _sch / ChXDataPoint.java
blobd6f2405b067946809bd2ff6a1cd3bd66fcfa2422
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.beans.XPropertySet;
31 import com.sun.star.chart.XChartDocument;
32 import com.sun.star.chart.XDiagram;
33 import com.sun.star.lang.XComponent;
34 import com.sun.star.uno.UnoRuntime;
36 /**
37 * Test for object which is represented by service
38 * <code>com.sun.star.chart.ChartDataPointProperties</code>. <p>
39 * Object implements the following interfaces
40 * <ul>
41 * <li> <code>com::sun::star::chart::ChartDataPointProperties</code></li>
42 * <li> <code>com::sun::star::drawing::FillProperties</code></li>
43 * <li> <code>com::sun::star::drawing::LineProperties</code></li>
44 * <li> <code>com::sun::star::style::CharacterProperties</code></li>
45 * <li> <code>com::sun::star::beans::XPropertySet</code></li>
46 * <li> <code>com::sun::star::chart::Chart3DBarProperties</code></li>
47 * </ul>
48 * The following files used by this test :
49 * <ul>
50 * <li><b> TransparencyChart.sxs </b> : to load predefined chart
51 * document where two 'automatic' transparency styles exists :
52 * 'Transparency 1' and 'Transparency 2'.</li>
53 * </ul> <p>
54 * @see com.sun.star.chart.ChartDataPointProperties
55 * @see com.sun.star.drawing.FillProperties
56 * @see com.sun.star.drawing.LineProperties
57 * @see com.sun.star.style.CharacterProperties
58 * @see com.sun.star.beans.XPropertySet
59 * @see com.sun.star.chart.Chart3DBarProperties
60 * @see ifc.chart._ChartDataPointProperties
61 * @see ifc.drawing._FillProperties
62 * @see ifc.drawing._LineProperties
63 * @see ifc.style._CharacterProperties
64 * @see ifc.beans._XPropertySet
65 * @see ifc.chart._Chart3DBarProperties
67 public class ChXDataPoint extends TestCase {
68 XChartDocument xChartDoc = null;
70 /**
71 * Creates Chart document.
73 @Override
74 protected void initialize( TestParameters tParam, PrintWriter log ) {
75 // get a soffice factory object
76 SOfficeFactory SOF = SOfficeFactory.getFactory( tParam.getMSF());
78 try {
79 log.println( "creating a chartdocument" );
80 XComponent xComp = SOF.loadDocument(
81 utils.getFullTestURL("TransparencyChart.sxs"));
82 xChartDoc = UnoRuntime.queryInterface(XChartDocument.class,xComp);
83 } catch (com.sun.star.uno.Exception e) {
84 // Some exception occurs.FAILED
85 e.printStackTrace( log );
86 throw new StatusException( "Couldn't create document", e );
90 /**
91 * Disposes Chart document.
93 @Override
94 protected void cleanup( TestParameters tParam, PrintWriter log ) {
95 if( xChartDoc!=null ) {
96 log.println( " closing xChartDoc" );
97 util.DesktopTools.closeDoc(xChartDoc);
98 xChartDoc = null;
103 * Creating a Testenvironment for the interfaces to be tested.
104 * Retrieves the diagram of the chart document. Obtains the properties of
105 * the specified data point. The obtained properties is the instance of
106 * the service <code>com.sun.star.chart.ChartDataPointProperties</code>.
107 * Creates a XY-diagram and bar-diagram also.
108 * Object relations created :
109 * <ul>
110 * <li> <code>'LINE'</code> for
111 * {@link ifc.chart._ChartDataPointProperties}(the created XY-diagram)</li>
112 * <li> <code>'CHARTDOC'</code> for
113 * {@link ifc.chart._ChartDataPointProperties},
114 * {@link ifc.chart._Chart3DBarProperties}(the chart document)</li>
115 * <li> <code>'BAR'</code> for
116 * {@link ifc.chart._Chart3DBarProperties}(the created bar-diagram)</li>
117 * </ul>
119 @Override
120 protected synchronized TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) {
122 XPropertySet oObj = null;
123 XDiagram oDiagram = null;
125 SOfficeFactory SOF = SOfficeFactory.getFactory( Param.getMSF());
127 // get the DataRowPoint_Point
128 try {
129 log.println( "getting ChXDataRowPoint_Point" );
130 oDiagram = xChartDoc.getDiagram();
131 oObj = oDiagram.getDataPointProperties(1,1);
132 } catch (com.sun.star.lang.IndexOutOfBoundsException e) {
133 // Some exception occurs.FAILED
134 e.printStackTrace( log );
135 throw new StatusException( "Couldn't get ChXDataRowPoint_Point", e );
138 log.println( "creating a new environment for chartdocument object" );
139 TestEnvironment tEnv = new TestEnvironment( oObj );
141 Object line = SOF.createDiagram(xChartDoc,"XYDiagram");
142 tEnv.addObjRelation("LINE",line);
144 Object bar = SOF.createDiagram(xChartDoc,"BarDiagram");
145 tEnv.addObjRelation("BAR",bar);
147 log.println( "adding ChartDocument as mod relation to environment" );
148 tEnv.addObjRelation("CHARTDOC", xChartDoc);
150 return tEnv;
151 } // finish method getTestEnvironment
153 } // finish class ChXDataPoint