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.ChartDataPointProperties</code>. <p>
38 * Object implements the following interfaces
40 * <li> <code>com::sun::star::chart::ChartDataPointProperties</code></li>
41 * <li> <code>com::sun::star::drawing::FillProperties</code></li>
42 * <li> <code>com::sun::star::drawing::LineProperties</code></li>
43 * <li> <code>com::sun::star::style::CharacterProperties</code></li>
44 * <li> <code>com::sun::star::beans::XPropertySet</code></li>
45 * <li> <code>com::sun::star::chart::Chart3DBarProperties</code></li>
47 * The following files used by this test :
49 * <li><b> TransparencyChart.sxs </b> : to load predefined chart
50 * document where two 'automatic' transparency styles exists :
51 * 'Transparency 1' and 'Transparency 2'.</li>
53 * @see com.sun.star.chart.ChartDataPointProperties
54 * @see com.sun.star.drawing.FillProperties
55 * @see com.sun.star.drawing.LineProperties
56 * @see com.sun.star.style.CharacterProperties
57 * @see com.sun.star.beans.XPropertySet
58 * @see com.sun.star.chart.Chart3DBarProperties
59 * @see ifc.chart._ChartDataPointProperties
60 * @see ifc.drawing._FillProperties
61 * @see ifc.drawing._LineProperties
62 * @see ifc.style._CharacterProperties
63 * @see ifc.beans._XPropertySet
64 * @see ifc.chart._Chart3DBarProperties
66 public class ChXDataPoint
extends TestCase
{
67 XChartDocument xChartDoc
= null;
70 * Creates Chart document.
73 protected void initialize( TestParameters tParam
, PrintWriter log
) throws Exception
{
74 // get a soffice factory object
75 SOfficeFactory SOF
= SOfficeFactory
.getFactory( tParam
.getMSF());
76 log
.println( "creating a chartdocument" );
77 XComponent xComp
= SOF
.loadDocument(
78 utils
.getFullTestURL("TransparencyChart.sxs"));
79 xChartDoc
= UnoRuntime
.queryInterface(XChartDocument
.class,xComp
);
83 * Disposes Chart document.
86 protected void cleanup( TestParameters tParam
, PrintWriter log
) {
87 if( xChartDoc
!=null ) {
88 log
.println( " closing xChartDoc" );
89 util
.DesktopTools
.closeDoc(xChartDoc
);
95 * Creating a TestEnvironment for the interfaces to be tested.
96 * Retrieves the diagram of the chart document. Obtains the properties of
97 * the specified data point. The obtained properties is the instance of
98 * the service <code>com.sun.star.chart.ChartDataPointProperties</code>.
99 * Creates a XY-diagram and bar-diagram also.
100 * Object relations created :
102 * <li> <code>'LINE'</code> for
103 * {@link ifc.chart._ChartDataPointProperties}(the created XY-diagram)</li>
104 * <li> <code>'CHARTDOC'</code> for
105 * {@link ifc.chart._ChartDataPointProperties},
106 * {@link ifc.chart._Chart3DBarProperties}(the chart document)</li>
107 * <li> <code>'BAR'</code> for
108 * {@link ifc.chart._Chart3DBarProperties}(the created bar-diagram)</li>
112 protected TestEnvironment
createTestEnvironment(TestParameters Param
, PrintWriter log
) throws Exception
{
114 XPropertySet oObj
= null;
115 XDiagram oDiagram
= null;
117 SOfficeFactory SOF
= SOfficeFactory
.getFactory( Param
.getMSF());
119 // get the DataRowPoint_Point
120 log
.println( "getting ChXDataRowPoint_Point" );
121 oDiagram
= xChartDoc
.getDiagram();
122 oObj
= oDiagram
.getDataPointProperties(1,1);
124 log
.println( "creating a new environment for chartdocument object" );
125 TestEnvironment tEnv
= new TestEnvironment( oObj
);
127 Object line
= SOF
.createDiagram(xChartDoc
,"XYDiagram");
128 tEnv
.addObjRelation("LINE",line
);
130 Object bar
= SOF
.createDiagram(xChartDoc
,"BarDiagram");
131 tEnv
.addObjRelation("BAR",bar
);
133 log
.println( "adding ChartDocument as mod relation to environment" );
134 tEnv
.addObjRelation("CHARTDOC", xChartDoc
);
137 } // finish method getTestEnvironment
139 } // finish class ChXDataPoint