bump product version to 4.2.0.1
[LibreOffice.git] / qadevOOo / tests / java / ifc / chart / _ChartDataPointProperties.java
blob7f7c878ab934af57d02ae9dae0f89f2956966487
1 /*
2 * This file is part of the LibreOffice project.
4 * This Source Code Form is subject to the terms of the Mozilla Public
5 * License, v. 2.0. If a copy of the MPL was not distributed with this
6 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 * This file incorporates work covered by the following license notice:
10 * Licensed to the Apache Software Foundation (ASF) under one or more
11 * contributor license agreements. See the NOTICE file distributed
12 * with this work for additional information regarding copyright
13 * ownership. The ASF licenses this file to you under the Apache
14 * License, Version 2.0 (the "License"); you may not use this file
15 * except in compliance with the License. You may obtain a copy of
16 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
19 package ifc.chart;
21 import lib.MultiPropertyTest;
22 import lib.Status;
23 import lib.StatusException;
24 import util.utils;
26 import com.sun.star.chart.XChartDocument;
27 import com.sun.star.chart.XDiagram;
29 /**
30 * Testing <code>com.sun.star.chart.ChartDataPointProperties</code>
31 * service properties :
32 * <ul>
33 * <li><code> DataCaption</code></li>
34 * <li><code> SymbolType</code></li>
35 * <li><code> SymbolBitmapURL</code></li>
36 * </ul> <p>
37 * The following predefined files needed to complete the test:
38 * <ul>
39 * <li> <code>space-metal.jpg</code> :
40 * for test of property 'SymbolBitmapURL' </li>
41 * <ul> <p>
42 * This test needs the following object relations :
43 * <ul>
44 * <li> <code>'CHARTDOC'</code> (of type <code>XChartDocument</code>):
45 * to have reference to chart document </li>
46 * <li> <code>'LINE'</code> (of type <code>XDiagram</code>):
47 * relation that use as parameter for method setDiagram of chart document </li>
48 * </ul> <p>
49 * @see com.sun.star.chart.ChartDataPointProperties
51 public class _ChartDataPointProperties extends MultiPropertyTest {
53 /**
54 * Retrieves object relations and prepares a chart document.
55 * @throws StatusException if one of relations not found.
57 protected void before() {
58 log.println("Setting Diagram type to LineDiagram");
59 XChartDocument doc = (XChartDocument) tEnv.getObjRelation("CHARTDOC");
60 if (doc == null) throw new StatusException(Status.failed
61 ("Relation 'CHARTDOC' not found"));
63 XDiagram Line = (XDiagram) tEnv.getObjRelation("LINE");
64 if (Line == null) throw new StatusException(Status.failed
65 ("Relation 'LINE' not found"));
67 doc.setDiagram(Line);
70 protected PropertyTester URLTester = new PropertyTester() {
71 protected Object getNewValue(String propName, Object oldValue)
72 throws java.lang.IllegalArgumentException {
73 return utils.getFullTestURL("space-metal.jpg");
77 /**
78 * Tests property 'SymbolBitmapURL' using file <code>polibal.gif</code>.
80 public void _SymbolBitmapURL() {
81 try {
82 oObj.setPropertyValue(
83 "SymbolType",
84 new Integer(com.sun.star.chart.ChartSymbolType.BITMAPURL) );
85 } catch(com.sun.star.lang.WrappedTargetException e) {
86 log.println("Exception while set property value");
87 e.printStackTrace(log);
88 throw new StatusException("Exception while set property value", e);
89 } catch(com.sun.star.lang.IllegalArgumentException e) {
90 log.println("Exception while set property value");
91 e.printStackTrace(log);
92 throw new StatusException("Exception while set property value", e);
93 } catch(com.sun.star.beans.PropertyVetoException e) {
94 log.println("Exception while set property value");
95 e.printStackTrace(log);
96 throw new StatusException("Exception while set property value", e);
97 } catch(com.sun.star.beans.UnknownPropertyException e) {
98 log.println("Exception while set property value");
99 e.printStackTrace(log);
100 throw new StatusException("Exception while set property value", e);
103 testProperty("SymbolBitmapURL", URLTester);