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 import java.io.PrintWriter; 30 31 import lib.StatusException; 32 import lib.TestCase; 33 import lib.TestEnvironment; 34 import lib.TestParameters; 35 import util.SOfficeFactory; 36 37 import com.sun.star.chart.XChartData; 38 import com.sun.star.chart.XChartDocument; 39 import com.sun.star.lang.XMultiServiceFactory; 40 41 /** 42 * Test for object which is represented by service 43 * <code>com.sun.star.chart.ChartData</code>. <p> 44 * Object implements the following interfaces : 45 * <ul> 46 * <li> <code>com::sun::star::chart::XChartData</code></li> 47 * </ul> 48 * @see com.sun.star.chart.ChartData 49 * @see com.sun.star.chart.XChartData 50 * @see ifc.chart._XChartData 51 */ 52 public class ChXChartData extends TestCase { 53 XChartDocument xChartDoc = null; 54 55 /** 56 * Creates Chart document. 57 */ 58 protected void initialize( TestParameters tParam, PrintWriter log ) { 59 // get a soffice factory object 60 SOfficeFactory SOF = SOfficeFactory.getFactory( (XMultiServiceFactory)tParam.getMSF()); 61 62 try { 63 log.println( "creating a chartdocument" ); 64 xChartDoc = SOF.createChartDoc(null);; 65 } catch (com.sun.star.uno.Exception e) { 66 // Some exception occures.FAILED 67 e.printStackTrace( log ); 68 throw new StatusException( "Couldn't create document", e ); 69 } 70 } 71 72 /** 73 * Disposes Chart document. 74 */ 75 protected void cleanup( TestParameters tParam, PrintWriter log ) { 76 if( xChartDoc!=null ) { 77 log.println( " closing xChartDoc" ); 78 util.DesktopTools.closeDoc(xChartDoc); 79 xChartDoc = null; 80 } 81 } 82 83 /** 84 * Creating a Testenvironment for the interfaces to be tested. 85 * Retrieves the data source of the chart. This data source is the instance 86 * of the service <code>com.sun.star.chart.ChartData</code>. 87 * @see com.sun.star.chart.ChartData 88 */ 89 protected synchronized TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) { 90 91 // get the Data 92 log.println( "getting Data" ); 93 XChartData oObj = (XChartData) xChartDoc.getData(); 94 95 log.println( "creating a new environment for chartdocument object" ); 96 TestEnvironment tEnv = new TestEnvironment( oObj ); 97 98 return tEnv; 99 } // finish method getTestEnvironment 100 101 } // finish class ChXChartData 102 103