bump product version to 4.2.0.1
[LibreOffice.git] / qadevOOo / tests / java / mod / _sch / ChXChartAxis.java
blob1ca86afedcd587e528a25cfe2a187c8455ef13aa
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.lang.XMultiServiceFactory;
34 import com.sun.star.uno.UnoRuntime;
36 /**
37 * Test for object which is represented by service
38 * <code>com.sun.star.chart.ChartAxis</code>. <p>
39 * Object implements the following interfaces :
40 * <ul>
41 * <li> <code>com::sun::star::drawing::LineProperties</code></li>
42 * <li> <code>com::sun::star::style::CharacterProperties</code></li>
43 * <li> <code>com::sun::star::beans::XPropertySet</code></li>
44 * <li> <code>com::sun::star::chart::ChartAxis</code></li>
45 * </ul>
46 * @see com.sun.star.drawing.LineProperties
47 * @see com.sun.star.style.CharacterProperties
48 * @see com.sun.star.beans.XPropertySet
49 * @see com.sun.star.chart.ChartAxis
50 * @see ifc.drawing._LineProperties
51 * @see ifc.style._CharacterProperties
52 * @see ifc.beans._XPropertySet
53 * @see ifc.chart._ChartAxis
55 public class ChXChartAxis extends TestCase {
56 XChartDocument xChartDoc = null;
58 /**
59 * Creates Chart document.
61 protected void initialize( TestParameters tParam, PrintWriter log ) {
62 // get a soffice factory object
63 SOfficeFactory SOF = SOfficeFactory.getFactory( (XMultiServiceFactory)tParam.getMSF());
65 try {
66 log.println( "creating a chartdocument" );
67 xChartDoc = SOF.createChartDoc(null);
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 protected void cleanup( TestParameters tParam, PrintWriter log ) {
79 if( xChartDoc!=null ) {
80 log.println( " closing xChartDoc" );
81 util.DesktopTools.closeDoc(xChartDoc);
82 xChartDoc = null;
86 /**
87 * Creating a Testenvironment for the interfaces to be tested.
88 * Retrieves the diagram of the chart document. Then obtains the properties
89 * of the y-axis of the diagram using the interface
90 * <code>XAxisYSupplier</code>. The obatined property is the instance
91 * of the service <code>com.sun.star.chart.ChartAxis</code>.
92 * @see com.sun.star.chart.XAxisYSupplier
93 * @see com.sun.star.chart.ChartAxis
95 protected synchronized TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) {
97 XPropertySet oObj = null;
98 XShape oDiagram = null;
100 // create testobject here
101 // get the Diagram
102 log.println( "getting Diagram" );
103 oDiagram = xChartDoc.getDiagram();
105 // get the Axis
106 log.println( "getting ChartAxis" );
107 XAxisYSupplier oAxisSup = UnoRuntime.queryInterface(XAxisYSupplier.class,oDiagram);
108 oObj = oAxisSup.getYAxis();
110 log.println( "creating a new environment for chartdocument object" );
111 TestEnvironment tEnv = new TestEnvironment( oObj );
113 return tEnv;
114 } // finish method getTestEnvironment
118 } // finish class ChXChartAxis