1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: ChXChartAxis.java,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
33 import java
.io
.PrintWriter
;
35 import lib
.StatusException
;
37 import lib
.TestEnvironment
;
38 import lib
.TestParameters
;
39 import util
.SOfficeFactory
;
41 import com
.sun
.star
.beans
.XPropertySet
;
42 import com
.sun
.star
.chart
.XAxisYSupplier
;
43 import com
.sun
.star
.chart
.XChartDocument
;
44 import com
.sun
.star
.chart
.XDiagram
;
45 import com
.sun
.star
.drawing
.XShape
;
46 import com
.sun
.star
.lang
.XMultiServiceFactory
;
47 import com
.sun
.star
.uno
.UnoRuntime
;
50 * Test for object which is represented by service
51 * <code>com.sun.star.chart.ChartAxis</code>. <p>
52 * Object implements the following interfaces :
54 * <li> <code>com::sun::star::drawing::LineProperties</code></li>
55 * <li> <code>com::sun::star::style::CharacterProperties</code></li>
56 * <li> <code>com::sun::star::beans::XPropertySet</code></li>
57 * <li> <code>com::sun::star::chart::ChartAxis</code></li>
59 * @see com.sun.star.drawing.LineProperties
60 * @see com.sun.star.style.CharacterProperties
61 * @see com.sun.star.beans.XPropertySet
62 * @see com.sun.star.chart.ChartAxis
63 * @see ifc.drawing._LineProperties
64 * @see ifc.style._CharacterProperties
65 * @see ifc.beans._XPropertySet
66 * @see ifc.chart._ChartAxis
68 public class ChXChartAxis
extends TestCase
{
69 XChartDocument xChartDoc
= null;
72 * Creates Chart document.
74 protected void initialize( TestParameters tParam
, PrintWriter log
) {
75 // get a soffice factory object
76 SOfficeFactory SOF
= SOfficeFactory
.getFactory( (XMultiServiceFactory
)tParam
.getMSF());
79 log
.println( "creating a chartdocument" );
80 xChartDoc
= SOF
.createChartDoc(null);;
81 } catch (com
.sun
.star
.uno
.Exception e
) {
82 // Some exception occures.FAILED
83 e
.printStackTrace( log
);
84 throw new StatusException( "Couldn't create document", e
);
89 * Disposes Chart document.
91 protected void cleanup( TestParameters tParam
, PrintWriter log
) {
92 log
.println( " closing xChartDoc " );
93 util
.DesktopTools
.closeDoc(xChartDoc
);
97 * Creating a Testenvironment for the interfaces to be tested.
98 * Retrieves the diagram of the chart document. Then obtains the properties
99 * of the y-axis of the diagram using the interface
100 * <code>XAxisYSupplier</code>. The obatined property is the instance
101 * of the service <code>com.sun.star.chart.ChartAxis</code>.
102 * @see com.sun.star.chart.XAxisYSupplier
103 * @see com.sun.star.chart.ChartAxis
105 protected synchronized TestEnvironment
createTestEnvironment(TestParameters Param
, PrintWriter log
) {
107 XPropertySet oObj
= null;
108 XShape oDiagram
= null;
110 // create testobject here
112 log
.println( "getting Diagram" );
113 oDiagram
= (XDiagram
) xChartDoc
.getDiagram();
116 log
.println( "getting ChartAxis" );
117 XAxisYSupplier oAxisSup
= (XAxisYSupplier
)
118 UnoRuntime
.queryInterface(XAxisYSupplier
.class,oDiagram
);
119 oObj
= (XPropertySet
) oAxisSup
.getYAxis();
121 log
.println( "creating a new environment for chartdocument object" );
122 TestEnvironment tEnv
= new TestEnvironment( oObj
);
125 } // finish method getTestEnvironment
129 } // finish class ChXChartAxis