bump product version to 5.0.4.1
[LibreOffice.git] / qadevOOo / tests / java / mod / _sch / ChXChartAxis.java
blob1a8a7f20c857f495cbf58e57e4e4d03e2ae8f23e
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;
29 import com.sun.star.beans.XPropertySet;
30 import com.sun.star.chart.XAxisYSupplier;
31 import com.sun.star.chart.XChartDocument;
32 import com.sun.star.drawing.XShape;
33 import com.sun.star.uno.UnoRuntime;
35 /**
36 * Test for object which is represented by service
37 * <code>com.sun.star.chart.ChartAxis</code>. <p>
38 * Object implements the following interfaces :
39 * <ul>
40 * <li> <code>com::sun::star::drawing::LineProperties</code></li>
41 * <li> <code>com::sun::star::style::CharacterProperties</code></li>
42 * <li> <code>com::sun::star::beans::XPropertySet</code></li>
43 * <li> <code>com::sun::star::chart::ChartAxis</code></li>
44 * </ul>
45 * @see com.sun.star.drawing.LineProperties
46 * @see com.sun.star.style.CharacterProperties
47 * @see com.sun.star.beans.XPropertySet
48 * @see com.sun.star.chart.ChartAxis
49 * @see ifc.drawing._LineProperties
50 * @see ifc.style._CharacterProperties
51 * @see ifc.beans._XPropertySet
52 * @see ifc.chart._ChartAxis
54 public class ChXChartAxis extends TestCase {
55 XChartDocument xChartDoc = null;
57 /**
58 * Creates Chart document.
60 @Override
61 protected void initialize( TestParameters tParam, PrintWriter log ) {
62 // get a soffice factory object
63 SOfficeFactory SOF = SOfficeFactory.getFactory( tParam.getMSF());
65 try {
66 log.println( "creating a chartdocument" );
67 xChartDoc = SOF.createChartDoc();
68 } catch (com.sun.star.uno.Exception e) {
69 // Some exception occurs.FAILED
70 e.printStackTrace( log );
71 throw new StatusException( "Couldn't create document", e );
75 /**
76 * Disposes Chart document.
78 @Override
79 protected void cleanup( TestParameters tParam, PrintWriter log ) {
80 if( xChartDoc!=null ) {
81 log.println( " closing xChartDoc" );
82 util.DesktopTools.closeDoc(xChartDoc);
83 xChartDoc = null;
87 /**
88 * Creating a Testenvironment for the interfaces to be tested.
89 * Retrieves the diagram of the chart document. Then obtains the properties
90 * of the y-axis of the diagram using the interface
91 * <code>XAxisYSupplier</code>. The obatined property is the instance
92 * of the service <code>com.sun.star.chart.ChartAxis</code>.
93 * @see com.sun.star.chart.XAxisYSupplier
94 * @see com.sun.star.chart.ChartAxis
96 @Override
97 protected synchronized TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) {
99 XPropertySet oObj = null;
100 XShape oDiagram = null;
102 // create testobject here
103 // get the Diagram
104 log.println( "getting Diagram" );
105 oDiagram = xChartDoc.getDiagram();
107 // get the Axis
108 log.println( "getting ChartAxis" );
109 XAxisYSupplier oAxisSup = UnoRuntime.queryInterface(XAxisYSupplier.class,oDiagram);
110 oObj = oAxisSup.getYAxis();
112 log.println( "creating a new environment for chartdocument object" );
113 TestEnvironment tEnv = new TestEnvironment( oObj );
115 return tEnv;
116 } // finish method getTestEnvironment
120 } // finish class ChXChartAxis