1 /************************************************************************* 2 * 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * Copyright 2000, 2010 Oracle and/or its affiliates. 6 * 7 * OpenOffice.org - a multi-platform office productivity suite 8 * 9 * This file is part of OpenOffice.org. 10 * 11 * OpenOffice.org is free software: you can redistribute it and/or modify 12 * it under the terms of the GNU Lesser General Public License version 3 13 * only, as published by the Free Software Foundation. 14 * 15 * OpenOffice.org is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * GNU Lesser General Public License version 3 for more details 19 * (a copy is included in the LICENSE file that accompanied this code). 20 * 21 * You should have received a copy of the GNU Lesser General Public License 22 * version 3 along with OpenOffice.org. If not, see 23 * <http://www.openoffice.org/license.html> 24 * for a copy of the LGPLv3 License. 25 * 26 ************************************************************************/ 27 28 package mod._sch; 29 30 import java.io.PrintWriter; 31 32 import lib.StatusException; 33 import lib.TestCase; 34 import lib.TestEnvironment; 35 import lib.TestParameters; 36 import util.SOfficeFactory; 37 import util.utils; 38 39 import com.sun.star.beans.XPropertySet; 40 import com.sun.star.chart.XChartDocument; 41 import com.sun.star.lang.XComponent; 42 import com.sun.star.lang.XMultiServiceFactory; 43 import com.sun.star.uno.UnoRuntime; 44 45 /** 46 * Test for object which is represented by service 47 * <code>com.sun.star.chart.ChartArea</code>. <p> 48 * Object implements the following interfaces : 49 * <ul> 50 * <li> <code>com::sun::star::drawing::FillProperties</code></li> 51 * <li> <code>com::sun::star::drawing::LineProperties</code></li> 52 * <li> <code>com::sun::star::beans::XPropertySet</code></li> 53 * </ul> 54 * The following files used by this test : 55 * <ul> 56 * <li><b> TransparencyChart.sxs </b> : to load predefined chart 57 * document where two 'automatic' transparency styles exists : 58 * 'Transparency 1' and 'Transparency 2'.</li> 59 * </ul> <p> 60 * @see com.sun.star.chart.ChartArea 61 * @see com.sun.star.drawing.FillProperties 62 * @see com.sun.star.drawing.LineProperties 63 * @see com.sun.star.beans.XPropertySet 64 * @see ifc.drawing._FillProperties 65 * @see ifc.drawing._LineProperties 66 * @see ifc.beans._XPropertySet 67 */ 68 public class ChartArea extends TestCase { 69 XChartDocument xChartDoc = null; 70 71 /** 72 * Creates Chart document. 73 */ 74 protected void initialize( TestParameters tParam, PrintWriter log ) { 75 // get a soffice factory object 76 SOfficeFactory SOF = SOfficeFactory.getFactory( (XMultiServiceFactory)tParam.getMSF()); 77 78 try { 79 log.println( "creating a chartdocument" ); 80 XComponent xComp = SOF.loadDocument( 81 utils.getFullTestURL("TransparencyChart.sxs")); 82 xChartDoc = (XChartDocument) 83 UnoRuntime.queryInterface(XChartDocument.class,xComp); 84 } catch (com.sun.star.uno.Exception e) { 85 // Some exception occures.FAILED 86 e.printStackTrace( log ); 87 throw new StatusException( "Couldn't create document", e ); 88 } 89 } 90 91 /** 92 * Disposes Chart document. 93 */ 94 protected void cleanup( TestParameters tParam, PrintWriter log ) { 95 if( xChartDoc!=null ) { 96 log.println( " closing xChartDoc" ); 97 util.DesktopTools.closeDoc(xChartDoc); 98 xChartDoc = null; 99 } 100 } 101 102 /** 103 * Creating a Testenvironment for the interfaces to be tested. 104 * Retrieved the instance of the service <code>com.sun.star.chart.ChartArea</code> 105 * using the interface <code>XChartDocument</code>. 106 * @see com.sun.star.chart.XChartDocument 107 * @see com.sun.star.chart.ChartArea 108 */ 109 protected synchronized TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) { 110 111 // get the Area 112 log.println( "getting Area" ); 113 XPropertySet oObj = (XPropertySet) xChartDoc.getArea(); 114 115 log.println( "creating a new environment for chartdocument object" ); 116 TestEnvironment tEnv = new TestEnvironment( oObj ); 117 118 return tEnv; 119 } // finish method getTestEnvironment 120 121 } // finish class ChartArea 122 123