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 38 import com.sun.star.chart.XChartDocument; 39 import com.sun.star.drawing.XShape; 40 import com.sun.star.lang.XMultiServiceFactory; 41 42 /** 43 * Test for object which is represented by service 44 * <code>com.sun.star.chart.ChartTitle</code>. <p> 45 * Object implements the following interfaces : 46 * <ul> 47 * <li> <code>com::sun::star::lang::XComponent</code></li> 48 * <li> <code>com::sun::star::chart::ChartTitle</code></li> 49 * <li> <code>com::sun::star::drawing::XShape</code></li> 50 * <li> <code>com::sun::star::drawing::XShapeDescriptor</code></li> 51 * <li> <code>com::sun::star::style::CharacterProperties</code></li> 52 * <li> <code>com::sun::star::beans::XPropertySet</code></li> 53 * <li> <code>com::sun::star::drawing::Shape</code></li> 54 * </ul> 55 * @see com.sun.star.lang.XComponent 56 * @see com.sun.star.chart.ChartTitle 57 * @see com.sun.star.drawing.XShape 58 * @see com.sun.star.drawing.XShapeDescriptor 59 * @see com.sun.star.style.CharacterProperties 60 * @see com.sun.star.beans.XPropertySet 61 * @see com.sun.star.drawing.Shape 62 * @see ifc.lang._XComponent 63 * @see ifc.chart._ChartTitle 64 * @see ifc.drawing._XShape 65 * @see ifc.drawing._XShapeDescriptor 66 * @see ifc.style._CharacterProperties 67 * @see ifc.beans._XPropertySet 68 * @see ifc.drawing._Shape 69 */ 70 public class ChartTitle extends TestCase { 71 XChartDocument xChartDoc = null; 72 73 /** 74 * Creates Chart document. 75 */ 76 protected void initialize( TestParameters tParam, PrintWriter log ) { 77 // get a soffice factory object 78 SOfficeFactory SOF = SOfficeFactory.getFactory( (XMultiServiceFactory)tParam.getMSF()); 79 80 try { 81 log.println( "creating a chartdocument" ); 82 xChartDoc = SOF.createChartDoc(null);; 83 } catch (com.sun.star.uno.Exception e) { 84 // Some exception occures.FAILED 85 e.printStackTrace( log ); 86 throw new StatusException( "Couldn't create document", e ); 87 } 88 } 89 90 /** 91 * Disposes Chart document. 92 */ 93 protected void cleanup( TestParameters tParam, PrintWriter log ) { 94 if( xChartDoc!=null ) { 95 log.println( " closing xChartDoc" ); 96 util.DesktopTools.closeDoc(xChartDoc); 97 xChartDoc = null; 98 } 99 } 100 101 /** 102 * Creating a Testenvironment for the interfaces to be tested. 103 * Retrieves the shape of the main title of the chart document. 104 * The retrieved shape is the instance of the service 105 * <code>com.sun.star.chart.ChartTitle</code>. 106 */ 107 protected synchronized TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) { 108 109 // get the Title 110 log.println( "getting Title" ); 111 XShape oObj = (XShape) xChartDoc.getTitle(); 112 113 log.println( "creating a new environment for chartdocument object" ); 114 TestEnvironment tEnv = new TestEnvironment( oObj ); 115 tEnv.addObjRelation("NoSetSize","sch.ChartTitle"); 116 return tEnv; 117 } // finish method getTestEnvironment 118 119 } // finish class ChXChartObject_Title 120 121