Branch libreoffice-5-0-4
[LibreOffice.git] / qadevOOo / tests / java / ifc / chart / _ChartDataPointProperties.java
blobfbf59aa5dac66d72dd488051e0608fd8171bbf06
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 @Override
58 protected void before() {
59 log.println("Setting Diagram type to LineDiagram");
60 XChartDocument doc = (XChartDocument) tEnv.getObjRelation("CHARTDOC");
61 if (doc == null) throw new StatusException(Status.failed
62 ("Relation 'CHARTDOC' not found"));
64 XDiagram Line = (XDiagram) tEnv.getObjRelation("LINE");
65 if (Line == null) throw new StatusException(Status.failed
66 ("Relation 'LINE' not found"));
68 doc.setDiagram(Line);
71 protected PropertyTester URLTester = new PropertyTester() {
72 @Override
73 protected Object getNewValue(String propName, Object oldValue)
74 throws java.lang.IllegalArgumentException {
75 return utils.getFullTestURL("space-metal.jpg");
79 /**
80 * Tests property 'SymbolBitmapURL' using file <code>polibal.gif</code>.
82 public void _SymbolBitmapURL() {
83 try {
84 oObj.setPropertyValue(
85 "SymbolType",
86 Integer.valueOf(com.sun.star.chart.ChartSymbolType.BITMAPURL) );
87 } catch(com.sun.star.lang.WrappedTargetException e) {
88 log.println("Exception while set property value");
89 e.printStackTrace(log);
90 throw new StatusException("Exception while set property value", e);
91 } catch(com.sun.star.lang.IllegalArgumentException e) {
92 log.println("Exception while set property value");
93 e.printStackTrace(log);
94 throw new StatusException("Exception while set property value", e);
95 } catch(com.sun.star.beans.PropertyVetoException e) {
96 log.println("Exception while set property value");
97 e.printStackTrace(log);
98 throw new StatusException("Exception while set property value", e);
99 } catch(com.sun.star.beans.UnknownPropertyException e) {
100 log.println("Exception while set property value");
101 e.printStackTrace(log);
102 throw new StatusException("Exception while set property value", e);
105 testProperty("SymbolBitmapURL", URLTester);