bump product version to 4.2.0.1
[LibreOffice.git] / qadevOOo / tests / java / mod / _sch / ChartArea.java
blob66665a1adedd5ad5f4d5003a26665a5b31bbfd81
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;
28 import util.utils;
30 import com.sun.star.beans.XPropertySet;
31 import com.sun.star.chart.XChartDocument;
32 import com.sun.star.lang.XComponent;
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.ChartArea</code>. <p>
39 * Object implements the following interfaces :
40 * <ul>
41 * <li> <code>com::sun::star::drawing::FillProperties</code></li>
42 * <li> <code>com::sun::star::drawing::LineProperties</code></li>
43 * <li> <code>com::sun::star::beans::XPropertySet</code></li>
44 * </ul>
45 * The following files used by this test :
46 * <ul>
47 * <li><b> TransparencyChart.sxs </b> : to load predefined chart
48 * document where two 'automatic' transparency styles exists :
49 * 'Transparency 1' and 'Transparency 2'.</li>
50 * </ul> <p>
51 * @see com.sun.star.chart.ChartArea
52 * @see com.sun.star.drawing.FillProperties
53 * @see com.sun.star.drawing.LineProperties
54 * @see com.sun.star.beans.XPropertySet
55 * @see ifc.drawing._FillProperties
56 * @see ifc.drawing._LineProperties
57 * @see ifc.beans._XPropertySet
59 public class ChartArea extends TestCase {
60 XChartDocument xChartDoc = null;
62 /**
63 * Creates Chart document.
65 protected void initialize( TestParameters tParam, PrintWriter log ) {
66 // get a soffice factory object
67 SOfficeFactory SOF = SOfficeFactory.getFactory( (XMultiServiceFactory)tParam.getMSF());
69 try {
70 log.println( "creating a chartdocument" );
71 XComponent xComp = SOF.loadDocument(
72 utils.getFullTestURL("TransparencyChart.sxs"));
73 xChartDoc = UnoRuntime.queryInterface(XChartDocument.class,xComp);
74 } catch (com.sun.star.uno.Exception e) {
75 // Some exception occurs.FAILED
76 e.printStackTrace( log );
77 throw new StatusException( "Couldn't create document", e );
81 /**
82 * Disposes Chart document.
84 protected void cleanup( TestParameters tParam, PrintWriter log ) {
85 if( xChartDoc!=null ) {
86 log.println( " closing xChartDoc" );
87 util.DesktopTools.closeDoc(xChartDoc);
88 xChartDoc = null;
92 /**
93 * Creating a Testenvironment for the interfaces to be tested.
94 * Retrieved the instance of the service <code>com.sun.star.chart.ChartArea</code>
95 * using the interface <code>XChartDocument</code>.
96 * @see com.sun.star.chart.XChartDocument
97 * @see com.sun.star.chart.ChartArea
99 protected synchronized TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) {
101 // get the Area
102 log.println( "getting Area" );
103 XPropertySet oObj = xChartDoc.getArea();
105 log.println( "creating a new environment for chartdocument object" );
106 TestEnvironment tEnv = new TestEnvironment( oObj );
108 return tEnv;
109 } // finish method getTestEnvironment
111 } // finish class ChartArea