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 .
21 import java
.io
.PrintWriter
;
23 import lib
.StatusException
;
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
.XAxisXSupplier
;
31 import com
.sun
.star
.chart
.XChartDocument
;
32 import com
.sun
.star
.drawing
.XShape
;
33 import com
.sun
.star
.uno
.UnoRuntime
;
36 * Test for object which is represented by service
37 * <code>com.sun.star.chart.ChartGrid</code>. <p>
38 * Object implements the following interfaces :
40 * <li> <code>com::sun::star::drawing::LineProperties</code></li>
41 * <li> <code>com::sun::star::beans::XPropertySet</code></li>
43 * @see com.sun.star.chart.ChartGrid
44 * @see com.sun.star.drawing.LineProperties
45 * @see com.sun.star.beans.XPropertySet
46 * @see ifc.drawing._LineProperties
47 * @see ifc.beans._XPropertySet
49 public class ChartGrid
extends TestCase
{
50 XChartDocument xChartDoc
= null;
53 * Creates Chart document.
56 protected void initialize( TestParameters tParam
, PrintWriter log
) {
57 // get a soffice factory object
58 SOfficeFactory SOF
= SOfficeFactory
.getFactory( tParam
.getMSF());
61 log
.println( "creating a chartdocument" );
62 xChartDoc
= SOF
.createChartDoc();
63 } catch (com
.sun
.star
.uno
.Exception e
) {
64 // Some exception occurs.FAILED
65 e
.printStackTrace( log
);
66 throw new StatusException( "Couldn't create document", e
);
71 * Disposes Chart document.
74 protected void cleanup( TestParameters tParam
, PrintWriter log
) {
75 if( xChartDoc
!=null ) {
76 log
.println( " closing xChartDoc" );
77 util
.DesktopTools
.closeDoc(xChartDoc
);
83 * Creating a Testenvironment for the interfaces to be tested.
84 * Retrieves the diagram of the chart document. Then obtains
85 * the properties of the main grid of the x-axis of the diagram
86 * using the interface <code>XAxisXSupplier</code>. This properties is
87 * the instance of the service <code>com.sun.star.chart.ChartGrid</code>.
88 * @see com.sun.star.chart.XAxisXSupplier
89 * @see com.sun.star.chart.ChartGrid
92 protected synchronized TestEnvironment
createTestEnvironment(TestParameters Param
, PrintWriter log
) {
93 XPropertySet oObj
= null;
94 XShape oDiagram
= null;
97 log
.println( "getting Diagram" );
98 oDiagram
= xChartDoc
.getDiagram();
101 log
.println( "getting ChartGrid" );
102 XAxisXSupplier oAxisSup
= UnoRuntime
.queryInterface(XAxisXSupplier
.class,oDiagram
);
103 oObj
= oAxisSup
.getXMainGrid();
105 log
.println( "creating a new environment for chartdocument object" );
106 TestEnvironment tEnv
= new TestEnvironment( oObj
);
109 } // finish method getTestEnvironment
112 } // finish class ChartGrid