tdf#130857 qt weld: Introduce QtInstanceScrolledWindow
[LibreOffice.git] / qadevOOo / tests / java / mod / _sch / ChartLine.java
blob69c0a510aa81d7238fb427174026abf795f772fa
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.TestCase;
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;
34 /**
35 * Test for object which is represented by service
36 * <code>com.sun.star.chart.ChartLine</code>. <p>
37 * Object implements the following interfaces :
38 * <ul>
39 * <li> <code>com::sun::star::drawing::LineProperties</code></li>
40 * <li> <code>com::sun::star::beans::XPropertySet</code></li>
41 * </ul>
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;
50 /**
51 * Creates Chart document.
53 @Override
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();
61 /**
62 * Disposes Chart document.
64 @Override
65 protected void cleanup( TestParameters tParam, PrintWriter log ) {
66 if( xChartDoc!=null ) {
67 log.println( " closing xChartDoc" );
68 util.DesktopTools.closeDoc(xChartDoc);
69 xChartDoc = null;
73 /**
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
81 @Override
82 protected TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) throws Exception {
84 XPropertySet oObj = null;
85 XDiagram oDiagram = null;
86 SOfficeFactory SOF = null;
88 //get LineDiagram
89 SOF = SOfficeFactory.getFactory( Param.getMSF());
90 oDiagram = SOF.createDiagram(xChartDoc, "LineDiagram");
92 log.println( "getting Line-Diagram" );
93 xChartDoc.setDiagram(oDiagram);
95 // get the Line
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 );
107 return tEnv;
108 } // finish method getTestEnvironment
111 } // finish class ChartLine