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
.SOfficeFactory
;
29 import com
.sun
.star
.beans
.XPropertySet
;
30 import com
.sun
.star
.chart
.XChartDocument
;
31 import com
.sun
.star
.chart
.XDiagram
;
32 import com
.sun
.star
.lang
.XComponent
;
33 import com
.sun
.star
.uno
.UnoRuntime
;
36 * Test for object which is represented by service
37 * <code>com.sun.star.chart.ChartDataRowProperties</code>. <p>
38 * Object implements the following interfaces :
40 * <li> <code>com::sun::star::drawing::FillProperties</code></li>
41 * <li> <code>com::sun::star::chart::ChartStatistics</code></li>
42 * <li> <code>com::sun::star::chart::ChartDataRowProperties</code></li>
43 * <li> <code>com::sun::star::drawing::LineProperties</code></li>
44 * <li> <code>com::sun::star::beans::XPropertySet</code></li>
45 * <li> <code>com::sun::star::chart::ChartDataPointProperties</code></li>
46 * <li> <code>com::sun::star::chart::Chart3DBarProperties</code></li>
47 * <li> <code>com::sun::star::style::CharacterProperties</code></li>
49 * The following files used by this test :
51 * <li><b> TransparencyChart.sxs </b> : to load predefined chart
52 * document where two 'automatic' transparency styles exists :
53 * 'Transparency 1' and 'Transparency 2'.</li>
55 * @see com.sun.star.drawing.FillProperties
56 * @see com.sun.star.chart.ChartStatistics
57 * @see com.sun.star.chart.ChartDataRowProperties
58 * @see com.sun.star.drawing.LineProperties
59 * @see com.sun.star.beans.XPropertySet
60 * @see com.sun.star.chart.ChartDataPointProperties
61 * @see com.sun.star.chart.Chart3DBarProperties
62 * @see com.sun.star.style.CharacterProperties
63 * @see ifc.drawing._FillProperties
64 * @see ifc.chart._ChartStatistics
65 * @see ifc.chart._ChartDataRowProperties
66 * @see ifc.drawing._LineProperties
67 * @see ifc.beans._XPropertySet
68 * @see ifc.chart._ChartDataPointProperties
69 * @see ifc.chart._Chart3DBarProperties
70 * @see ifc.style._CharacterProperties
72 public class ChXDataRow
extends TestCase
{
73 XChartDocument xChartDoc
= null;
76 * Creates Chart document.
79 protected void initialize( TestParameters tParam
, PrintWriter log
) throws Exception
{
80 // get a soffice factory object
81 SOfficeFactory SOF
= SOfficeFactory
.getFactory( tParam
.getMSF());
82 log
.println( "creating a chartdocument" );
83 XComponent xComp
= SOF
.loadDocument(
84 utils
.getFullTestURL("TransparencyChart.sxs"));
85 xChartDoc
= UnoRuntime
.queryInterface(XChartDocument
.class,xComp
);
89 * Disposes Chart document.
92 protected synchronized void cleanup( TestParameters tParam
, PrintWriter log
) {
93 if( xChartDoc
!=null ) {
94 log
.println( " closing xChartDoc" );
95 util
.DesktopTools
.closeDoc(xChartDoc
);
102 * Creating a TestEnvironment for the interfaces to be tested.
103 * Retrieves the diagram of the chart document. Obtains the properties of
104 * the specified data row. The obtained properties is the instance of
105 * the service <code>com.sun.star.chart.ChartDataRowProperties</code>.
106 * Creates a XY-diagram and bar-diagram also.
107 * Object relations created :
109 * <li> <code>'LINE'</code> for
110 * {@link ifc.chart._ChartDataPointProperties}(the created XY-diagram)</li>
111 * <li> <code>'CHARTDOC'</code> for
112 * {@link ifc.chart._ChartDataPointProperties},
113 * {@link ifc.chart._Chart3DBarProperties}(the chart document)</li>
114 * <li> <code>'BAR'</code> for
115 * {@link ifc.chart._Chart3DBarProperties}(the created bar-diagram)</li>
119 protected TestEnvironment
createTestEnvironment(TestParameters Param
, PrintWriter log
) throws Exception
{
121 XPropertySet oObj
= null;
122 XDiagram oDiagram
= null;
123 // get the ChXDataRowPoint_Row
124 log
.println( "getting ChXDataRowPoint_Row" );
125 oDiagram
= xChartDoc
.getDiagram();
126 oObj
= oDiagram
.getDataRowProperties(1);
128 log
.println( "creating a new environment for chartdocument object" );
129 TestEnvironment tEnv
= new TestEnvironment( oObj
);
131 SOfficeFactory SOF
= SOfficeFactory
.getFactory( Param
.getMSF());
133 Object line
= SOF
.createDiagram(xChartDoc
,"XYDiagram");
134 tEnv
.addObjRelation("LINE",line
);
136 Object bar
= SOF
.createDiagram(xChartDoc
,"BarDiagram");
137 tEnv
.addObjRelation("BAR",bar
);
139 log
.println( "adding ChartDocument as mod relation to environment" );
140 tEnv
.addObjRelation("CHARTDOC", xChartDoc
);
143 } // finish method getTestEnvironment
146 } // finish class ChXDataRow