bump product version to 4.2.0.1
[LibreOffice.git] / qadevOOo / tests / java / ifc / chart / _ChartTwoAxisXSupplier.java
blob10b1345a6248b80f34ac8a5c5895ec26982f752c
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;
25 import com.sun.star.beans.XPropertySet;
26 import com.sun.star.chart.XChartDocument;
27 import com.sun.star.chart.XDiagram;
28 import com.sun.star.uno.UnoRuntime;
30 /**
31 * Testing <code>com.sun.star.chart.ChartTwoAxisXSupplier</code>
32 * service properties :
33 * <ul>
34 * <li><code> HasSecondaryXAxis</code></li>
35 * <li><code> HasSecondaryXAxisDescription</code></li>
36 * </ul> <p>
37 * This test needs the following object relations :
38 * <ul>
39 * <li> <code>'CHARTDOC'</code> (of type <code>XChartDocument</code>):
40 * to have reference to chart document </li>
41 * <li> <code>'BAR'</code> (of type <code>XDiagram</code>):
42 * relation that use as parameter for method setDiagram of chart document </li>
43 * </ul> <p>
44 * @see com.sun.star.chart.ChartTwoAxisXSupplier
46 public class _ChartTwoAxisXSupplier extends MultiPropertyTest {
48 XChartDocument doc = null;
49 XDiagram oldDiagram = null;
51 /**
52 * Retrieves object relations and prepares a chart document.
53 * @throws StatusException if one of relations not found.
55 protected void before() {
56 log.println("Setting Diagram type to BarDiagram");
57 doc = (XChartDocument) tEnv.getObjRelation("CHARTDOC");
58 if (doc == null) throw new StatusException(Status.failed
59 ("Relation 'CHARTDOC' not found"));
61 XDiagram bar = (XDiagram) tEnv.getObjRelation("BAR");
62 if (bar == null) throw new StatusException(Status.failed
63 ("Relation 'BAR' not found"));
65 oldDiagram = doc.getDiagram();
67 doc.setDiagram(bar);
68 log.println("Set it to 3D");
69 oObj = UnoRuntime.queryInterface( XPropertySet.class, doc.getDiagram() );
70 try {
71 oObj.setPropertyValue("Dim3D", new Boolean(true));
72 } catch(com.sun.star.lang.WrappedTargetException e) {
73 log.println("Exception while set property value");
74 e.printStackTrace(log);
75 throw new StatusException("Exception while set property value", e);
76 } catch(com.sun.star.lang.IllegalArgumentException e) {
77 log.println("Exception while set property value");
78 e.printStackTrace(log);
79 throw new StatusException("Exception while set property value", e);
80 } catch(com.sun.star.beans.PropertyVetoException e) {
81 log.println("Exception while set property value");
82 e.printStackTrace(log);
83 throw new StatusException("Exception while set property value", e);
84 } catch(com.sun.star.beans.UnknownPropertyException e) {
85 log.println("Exception while set property value");
86 e.printStackTrace(log);
87 throw new StatusException("Exception while set property value", e);
91 /**
92 * Sets the old diagram for a chart document.
94 protected void after() {
95 doc.setDiagram(oldDiagram);
97 } // EOF ChartTwoAxisXSupplier