bump product version to 4.2.0.1
[LibreOffice.git] / qadevOOo / tests / java / mod / _sch / ChartGrid.java
blobd8a6b44c0511dc8073c78d48343097684da9b733
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.XAxisXSupplier;
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.ChartGrid</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::beans::XPropertySet</code></li>
43 * </ul>
44 * @see com.sun.star.chart.ChartGrid
45 * @see com.sun.star.drawing.LineProperties
46 * @see com.sun.star.beans.XPropertySet
47 * @see ifc.drawing._LineProperties
48 * @see ifc.beans._XPropertySet
50 public class ChartGrid extends TestCase {
51 XChartDocument xChartDoc = null;
53 /**
54 * Creates Chart document.
56 protected void initialize( TestParameters tParam, PrintWriter log ) {
57 // get a soffice factory object
58 SOfficeFactory SOF = SOfficeFactory.getFactory( (XMultiServiceFactory)tParam.getMSF());
60 try {
61 log.println( "creating a chartdocument" );
62 xChartDoc = SOF.createChartDoc(null);
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 );
70 /**
71 * Disposes Chart document.
73 protected void cleanup( TestParameters tParam, PrintWriter log ) {
74 if( xChartDoc!=null ) {
75 log.println( " closing xChartDoc" );
76 util.DesktopTools.closeDoc(xChartDoc);
77 xChartDoc = null;
81 /**
82 * Creating a Testenvironment for the interfaces to be tested.
83 * Retrieves the diagram of the chart document. Then obtains
84 * the properties of the main grid of the x-axis of the diagram
85 * using the interface <code>XAxisXSupplier</code>. This properties is
86 * the instance of the service <code>com.sun.star.chart.ChartGrid</code>.
87 * @see com.sun.star.chart.XAxisXSupplier
88 * @see com.sun.star.chart.ChartGrid
90 protected synchronized TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) {
91 XPropertySet oObj = null;
92 XShape oDiagram = null;
94 // get the Diagram
95 log.println( "getting Diagram" );
96 oDiagram = xChartDoc.getDiagram();
98 // get the Grid
99 log.println( "getting ChartGrid" );
100 XAxisXSupplier oAxisSup = UnoRuntime.queryInterface(XAxisXSupplier.class,oDiagram);
101 oObj = oAxisSup.getXMainGrid();
103 log.println( "creating a new environment for chartdocument object" );
104 TestEnvironment tEnv = new TestEnvironment( oObj );
106 return tEnv;
107 } // finish method getTestEnvironment
110 } // finish class ChartGrid