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: ChartGrid.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
.XAxisXSupplier
;
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.ChartGrid</code>. <p>
52 * Object implements the following interfaces :
54 * <li> <code>com::sun::star::drawing::LineProperties</code></li>
55 * <li> <code>com::sun::star::beans::XPropertySet</code></li>
57 * @see com.sun.star.chart.ChartGrid
58 * @see com.sun.star.drawing.LineProperties
59 * @see com.sun.star.beans.XPropertySet
60 * @see ifc.drawing._LineProperties
61 * @see ifc.beans._XPropertySet
63 public class ChartGrid
extends TestCase
{
64 XChartDocument xChartDoc
= null;
67 * Creates Chart document.
69 protected void initialize( TestParameters tParam
, PrintWriter log
) {
70 // get a soffice factory object
71 SOfficeFactory SOF
= SOfficeFactory
.getFactory( (XMultiServiceFactory
)tParam
.getMSF());
74 log
.println( "creating a chartdocument" );
75 xChartDoc
= SOF
.createChartDoc(null);;
76 } catch (com
.sun
.star
.uno
.Exception e
) {
77 // Some exception occures.FAILED
78 e
.printStackTrace( log
);
79 throw new StatusException( "Couldn't create document", e
);
84 * Disposes Chart document.
86 protected void cleanup( TestParameters tParam
, PrintWriter log
) {
87 log
.println( " closing xChartDoc " );
88 util
.DesktopTools
.closeDoc(xChartDoc
);
92 * Creating a Testenvironment for the interfaces to be tested.
93 * Retrieves the diagram of the chart document. Then obtains
94 * the properties of the main grid of the x-axis of the diagram
95 * using the interface <code>XAxisXSupplier</code>. This properties is
96 * the instance of the service <code>com.sun.star.chart.ChartGrid</code>.
97 * @see com.sun.star.chart.XAxisXSupplier
98 * @see com.sun.star.chart.ChartGrid
100 protected synchronized TestEnvironment
createTestEnvironment(TestParameters Param
, PrintWriter log
) {
101 XPropertySet oObj
= null;
102 XShape oDiagram
= null;
105 log
.println( "getting Diagram" );
106 oDiagram
= (XDiagram
) xChartDoc
.getDiagram();
109 log
.println( "getting ChartGrid" );
110 XAxisXSupplier oAxisSup
= (XAxisXSupplier
)
111 UnoRuntime
.queryInterface(XAxisXSupplier
.class,oDiagram
);
112 oObj
= (XPropertySet
) oAxisSup
.getXMainGrid();
114 log
.println( "creating a new environment for chartdocument object" );
115 TestEnvironment tEnv
= new TestEnvironment( oObj
);
118 } // finish method getTestEnvironment
121 } // finish class ChartGrid