bump product version to 5.0.4.1
[LibreOffice.git] / qadevOOo / tests / java / mod / _sch / ChXDataRow.java
blobbf3bfdb0d4351f1c89c7a894f12c6cc8601cc408
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.ChartDataRowProperties</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::chart::ChartStatistics</code></li>
43 * <li> <code>com::sun::star::chart::ChartDataRowProperties</code></li>
44 * <li> <code>com::sun::star::drawing::LineProperties</code></li>
45 * <li> <code>com::sun::star::beans::XPropertySet</code></li>
46 * <li> <code>com::sun::star::chart::ChartDataPointProperties</code></li>
47 * <li> <code>com::sun::star::chart::Chart3DBarProperties</code></li>
48 * <li> <code>com::sun::star::style::CharacterProperties</code></li>
49 * </ul>
50 * The following files used by this test :
51 * <ul>
52 * <li><b> TransparencyChart.sxs </b> : to load predefined chart
53 * document where two 'automatic' transparency styles exists :
54 * 'Transparency 1' and 'Transparency 2'.</li>
55 * </ul> <p>
56 * @see com.sun.star.drawing.FillProperties
57 * @see com.sun.star.chart.ChartStatistics
58 * @see com.sun.star.chart.ChartDataRowProperties
59 * @see com.sun.star.drawing.LineProperties
60 * @see com.sun.star.beans.XPropertySet
61 * @see com.sun.star.chart.ChartDataPointProperties
62 * @see com.sun.star.chart.Chart3DBarProperties
63 * @see com.sun.star.style.CharacterProperties
64 * @see ifc.drawing._FillProperties
65 * @see ifc.chart._ChartStatistics
66 * @see ifc.chart._ChartDataRowProperties
67 * @see ifc.drawing._LineProperties
68 * @see ifc.beans._XPropertySet
69 * @see ifc.chart._ChartDataPointProperties
70 * @see ifc.chart._Chart3DBarProperties
71 * @see ifc.style._CharacterProperties
73 public class ChXDataRow extends TestCase {
74 XChartDocument xChartDoc = null;
76 /**
77 * Creates Chart document.
79 @Override
80 protected void initialize( TestParameters tParam, PrintWriter log ) {
81 // get a soffice factory object
82 SOfficeFactory SOF = SOfficeFactory.getFactory( tParam.getMSF());
84 try {
85 log.println( "creating a chartdocument" );
86 XComponent xComp = SOF.loadDocument(
87 utils.getFullTestURL("TransparencyChart.sxs"));
88 xChartDoc = UnoRuntime.queryInterface(XChartDocument.class,xComp);
89 } catch (com.sun.star.uno.Exception e) {
90 // Some exception occurs.FAILED
91 e.printStackTrace( log );
92 throw new StatusException( "Couldn't create document", e );
96 /**
97 * Disposes Chart document.
99 @Override
100 protected synchronized void cleanup( TestParameters tParam, PrintWriter log ) {
101 if( xChartDoc!=null ) {
102 log.println( " closing xChartDoc" );
103 util.DesktopTools.closeDoc(xChartDoc);
104 xChartDoc = null;
110 * Creating a Testenvironment for the interfaces to be tested.
111 * Retrieves the diagram of the chart document. Obtains the properties of
112 * the specified data row. The obtained properties is the instance of
113 * the service <code>com.sun.star.chart.ChartDataRowProperties</code>.
114 * Creates a XY-diagram and bar-diagram also.
115 * Object relations created :
116 * <ul>
117 * <li> <code>'LINE'</code> for
118 * {@link ifc.chart._ChartDataPointProperties}(the created XY-diagram)</li>
119 * <li> <code>'CHARTDOC'</code> for
120 * {@link ifc.chart._ChartDataPointProperties},
121 * {@link ifc.chart._Chart3DBarProperties}(the chart document)</li>
122 * <li> <code>'BAR'</code> for
123 * {@link ifc.chart._Chart3DBarProperties}(the created bar-diagram)</li>
124 * </ul>
126 @Override
127 protected TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) {
129 XPropertySet oObj = null;
130 XDiagram oDiagram = null;
131 // get the ChXDataRowPoint_Row
132 try {
133 log.println( "getting ChXDataRowPoint_Row" );
134 oDiagram = xChartDoc.getDiagram();
135 oObj = oDiagram.getDataRowProperties(1);
136 } catch (com.sun.star.lang.IndexOutOfBoundsException e) {
137 // Some exception occurs.FAILED
138 e.printStackTrace( log );
139 throw new StatusException( "Couldn't get ChXDataRowPoint_Row", e );
142 log.println( "creating a new environment for chartdocument object" );
143 TestEnvironment tEnv = new TestEnvironment( oObj );
145 SOfficeFactory SOF = SOfficeFactory.getFactory( Param.getMSF());
147 Object line = SOF.createDiagram(xChartDoc,"XYDiagram");
148 tEnv.addObjRelation("LINE",line);
150 Object bar = SOF.createDiagram(xChartDoc,"BarDiagram");
151 tEnv.addObjRelation("BAR",bar);
153 log.println( "adding ChartDocument as mod relation to environment" );
154 tEnv.addObjRelation("CHARTDOC", xChartDoc);
156 return tEnv;
157 } // finish method getTestEnvironment
160 } // finish class ChXDataRow