merge the formfield patch from ooo-build
[ooovba.git] / qadevOOo / tests / java / ifc / chart / _ChartDataPointProperties.java
blobbebcace4471bc1e1a57a20e3ad6bc22d48b44927
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: _ChartDataPointProperties.java,v $
10 * $Revision: 1.4 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 package ifc.chart;
33 import lib.MultiPropertyTest;
34 import lib.Status;
35 import lib.StatusException;
36 import util.utils;
38 import com.sun.star.chart.XChartDocument;
39 import com.sun.star.chart.XDiagram;
41 /**
42 * Testing <code>com.sun.star.chart.ChartDataPointProperties</code>
43 * service properties :
44 * <ul>
45 * <li><code> DataCaption</code></li>
46 * <li><code> SymbolType</code></li>
47 * <li><code> SymbolBitmapURL</code></li>
48 * </ul> <p>
49 * The following predefined files needed to complete the test:
50 * <ul>
51 * <li> <code>poliball.gif</code> :
52 * for test of property 'SymbolBitmapURL' </li>
53 * <ul> <p>
54 * This test needs the following object relations :
55 * <ul>
56 * <li> <code>'CHARTDOC'</code> (of type <code>XChartDocument</code>):
57 * to have reference to chart document </li>
58 * <li> <code>'LINE'</code> (of type <code>XDiagram</code>):
59 * relation that use as parameter for method setDiagram of chart document </li>
60 * </ul> <p>
61 * @see com.sun.star.chart.ChartDataPointProperties
63 public class _ChartDataPointProperties extends MultiPropertyTest {
65 /**
66 * Retrieves object relations and prepares a chart document.
67 * @throws StatusException if one of relations not found.
69 protected void before() {
70 log.println("Setting Diagram type to LineDiagram");
71 XChartDocument doc = (XChartDocument) tEnv.getObjRelation("CHARTDOC");
72 if (doc == null) throw new StatusException(Status.failed
73 ("Relation 'CHARTDOC' not found"));
75 XDiagram Line = (XDiagram) tEnv.getObjRelation("LINE");
76 if (Line == null) throw new StatusException(Status.failed
77 ("Relation 'LINE' not found"));
79 doc.setDiagram(Line);
82 protected PropertyTester URLTester = new PropertyTester() {
83 protected Object getNewValue(String propName, Object oldValue)
84 throws java.lang.IllegalArgumentException {
85 return utils.getFullTestURL("poliball.gif");
89 /**
90 * Tests property 'SymbolBitmapURL' using file <code>polibal.gif</code>.
92 public void _SymbolBitmapURL() {
93 try {
94 oObj.setPropertyValue(
95 "SymbolType",
96 new Integer(com.sun.star.chart.ChartSymbolType.BITMAPURL) );
97 } catch(com.sun.star.lang.WrappedTargetException e) {
98 log.println("Exception while set property value");
99 e.printStackTrace(log);
100 throw new StatusException("Exception while set property value", e);
101 } catch(com.sun.star.lang.IllegalArgumentException e) {
102 log.println("Exception while set property value");
103 e.printStackTrace(log);
104 throw new StatusException("Exception while set property value", e);
105 } catch(com.sun.star.beans.PropertyVetoException e) {
106 log.println("Exception while set property value");
107 e.printStackTrace(log);
108 throw new StatusException("Exception while set property value", e);
109 } catch(com.sun.star.beans.UnknownPropertyException e) {
110 log.println("Exception while set property value");
111 e.printStackTrace(log);
112 throw new StatusException("Exception while set property value", e);
115 testProperty("SymbolBitmapURL", URLTester);