Branch libreoffice-5-0-4
[LibreOffice.git] / qadevOOo / tests / java / ifc / chart / _StockDiagram.java
blob32c0200241d0d747f8940884f35e87aad4f9112f
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.StockDiagram</code>
32 * service properties :
33 * <ul>
34 * <li><code> Volume</code></li>
35 * <li><code> UpDown</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>'STOCK'</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.StockDiagram
46 public class _StockDiagram extends MultiPropertyTest {
48 XDiagram oldDiagram = null;
49 XChartDocument doc = null;
51 /**
52 * Retrieves object relations and prepares a chart document.
53 * @throws StatusException if one of relations not found.
55 @Override
56 protected void before() {
57 log.println("Setting Diagram type to StockDiagram");
58 doc = (XChartDocument) tEnv.getObjRelation("CHARTDOC");
59 if (doc == null) throw new StatusException(Status.failed
60 ("Relation 'CHARTDOC' not found"));
62 XDiagram stock = (XDiagram) tEnv.getObjRelation("STOCK");
63 if (stock == null) throw new StatusException(Status.failed
64 ("Relation 'STOCK' not found"));
66 oldDiagram = doc.getDiagram();
67 doc.setDiagram(stock);
68 oObj = UnoRuntime.queryInterface(XPropertySet.class, doc.getDiagram());
71 /**
72 * Sets the old diagram for a chart document.
74 @Override
75 protected void after() {
76 doc.setDiagram(oldDiagram);