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
;
28 import com
.sun
.star
.beans
.XPropertySet
;
29 import com
.sun
.star
.chart
.XChartDocument
;
30 import com
.sun
.star
.chart
.XDiagram
;
31 import com
.sun
.star
.uno
.AnyConverter
;
32 import com
.sun
.star
.uno
.Type
;
35 * Test for object which is represented by service
36 * <code>com.sun.star.chart.ChartLine</code>. <p>
37 * Object implements the following interfaces :
39 * <li> <code>com::sun::star::drawing::LineProperties</code></li>
40 * <li> <code>com::sun::star::beans::XPropertySet</code></li>
42 * @see com.sun.star.drawing.LineProperties
43 * @see com.sun.star.beans.XPropertySet
44 * @see ifc.drawing._LineProperties
45 * @see ifc.beans._XPropertySet
47 public class ChartLine
extends TestCase
{
48 XChartDocument xChartDoc
= null;
51 * Creates Chart document.
54 protected void initialize( TestParameters tParam
, PrintWriter log
) throws Exception
{
55 // get a soffice factory object
56 SOfficeFactory SOF
= SOfficeFactory
.getFactory( tParam
.getMSF());
57 log
.println( "creating a chartdocument" );
58 xChartDoc
= SOF
.createChartDoc();
62 * Disposes Chart document.
65 protected void cleanup( TestParameters tParam
, PrintWriter log
) {
66 if( xChartDoc
!=null ) {
67 log
.println( " closing xChartDoc" );
68 util
.DesktopTools
.closeDoc(xChartDoc
);
74 * Creating a TestEnvironment for the interfaces to be tested.
75 * Creates a bar diagram and sets the created diagram for the chart document.
76 * Retrieves the property <code>'DataMeanValueProperties'</code> of
77 * the specified data row. The retrieved property is the instance of
78 * the service <code>com.sun.star.chart.ChartLine</code>.
79 * @see com.sun.star.chart.ChartLine
82 protected TestEnvironment
createTestEnvironment(TestParameters Param
, PrintWriter log
) throws Exception
{
84 XPropertySet oObj
= null;
85 XDiagram oDiagram
= null;
86 SOfficeFactory SOF
= null;
89 SOF
= SOfficeFactory
.getFactory( Param
.getMSF());
90 oDiagram
= SOF
.createDiagram(xChartDoc
, "LineDiagram");
92 log
.println( "getting Line-Diagram" );
93 xChartDoc
.setDiagram(oDiagram
);
96 log
.println( "getting Line" );
97 XPropertySet RowProps
= oDiagram
.getDataRowProperties(1);
98 RowProps
.setPropertyValue("MeanValue", Boolean
.TRUE
);
99 oObj
= (XPropertySet
) AnyConverter
.toObject(
100 new Type(XPropertySet
.class),
101 RowProps
.getPropertyValue("DataMeanValueProperties"));
103 log
.println( "creating a new environment for chartdocument object" );
104 TestEnvironment tEnv
= new TestEnvironment( oObj
);
108 } // finish method getTestEnvironment
111 } // finish class ChartLine