1 /************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 23 24 package mod._sch; 25 26 import java.io.PrintWriter; 27 28 import lib.StatusException; 29 import lib.TestCase; 30 import lib.TestEnvironment; 31 import lib.TestParameters; 32 import util.SOfficeFactory; 33 34 import com.sun.star.chart.XChartDocument; 35 import com.sun.star.drawing.XShape; 36 import com.sun.star.lang.XMultiServiceFactory; 37 38 /** 39 * Test for object which is represented by service 40 * <code>com.sun.star.chart.ChartTitle</code>. <p> 41 * Object implements the following interfaces : 42 * <ul> 43 * <li> <code>com::sun::star::lang::XComponent</code></li> 44 * <li> <code>com::sun::star::chart::ChartTitle</code></li> 45 * <li> <code>com::sun::star::drawing::XShape</code></li> 46 * <li> <code>com::sun::star::drawing::XShapeDescriptor</code></li> 47 * <li> <code>com::sun::star::style::CharacterProperties</code></li> 48 * <li> <code>com::sun::star::beans::XPropertySet</code></li> 49 * <li> <code>com::sun::star::drawing::Shape</code></li> 50 * </ul> 51 * @see com.sun.star.lang.XComponent 52 * @see com.sun.star.chart.ChartTitle 53 * @see com.sun.star.drawing.XShape 54 * @see com.sun.star.drawing.XShapeDescriptor 55 * @see com.sun.star.style.CharacterProperties 56 * @see com.sun.star.beans.XPropertySet 57 * @see com.sun.star.drawing.Shape 58 * @see ifc.lang._XComponent 59 * @see ifc.chart._ChartTitle 60 * @see ifc.drawing._XShape 61 * @see ifc.drawing._XShapeDescriptor 62 * @see ifc.style._CharacterProperties 63 * @see ifc.beans._XPropertySet 64 * @see ifc.drawing._Shape 65 */ 66 public class ChartTitle extends TestCase { 67 XChartDocument xChartDoc = null; 68 69 /** 70 * Creates Chart document. 71 */ initialize( TestParameters tParam, PrintWriter log )72 protected void initialize( TestParameters tParam, PrintWriter log ) { 73 // get a soffice factory object 74 SOfficeFactory SOF = SOfficeFactory.getFactory( (XMultiServiceFactory)tParam.getMSF()); 75 76 try { 77 log.println( "creating a chartdocument" ); 78 xChartDoc = SOF.createChartDoc(null); 79 } catch (com.sun.star.uno.Exception e) { 80 // Some exception occured.FAILED 81 e.printStackTrace( log ); 82 throw new StatusException( "Couldn't create document", e ); 83 } 84 } 85 86 /** 87 * Disposes Chart document. 88 */ cleanup( TestParameters tParam, PrintWriter log )89 protected void cleanup( TestParameters tParam, PrintWriter log ) { 90 if( xChartDoc!=null ) { 91 log.println( " closing xChartDoc" ); 92 util.DesktopTools.closeDoc(xChartDoc); 93 xChartDoc = null; 94 } 95 } 96 97 /** 98 * Creating a Testenvironment for the interfaces to be tested. 99 * Retrieves the shape of the main title of the chart document. 100 * The retrieved shape is the instance of the service 101 * <code>com.sun.star.chart.ChartTitle</code>. 102 */ createTestEnvironment(TestParameters Param, PrintWriter log)103 protected synchronized TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) { 104 105 // get the Title 106 log.println( "getting Title" ); 107 XShape oObj = (XShape) xChartDoc.getTitle(); 108 109 log.println( "creating a new environment for chartdocument object" ); 110 TestEnvironment tEnv = new TestEnvironment( oObj ); 111 tEnv.addObjRelation("NoSetSize","sch.ChartTitle"); 112 return tEnv; 113 } // finish method getTestEnvironment 114 115 } // finish class ChXChartObject_Title 116 117