Branch libreoffice-5-0-4
[LibreOffice.git] / qadevOOo / tests / java / ifc / chart / _StackableDiagram.java
blob9fbb2bed273ee7378d7187c93fd2e38049e25ee2
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.StackableDiagram</code>
32 * service properties :
33 * <ul>
34 * <li><code> Percent</code></li>
35 * <li><code> Stacked</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>'STACK'</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.StackableDiagram
46 public class _StackableDiagram 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 @Override
56 protected void before() {
57 log.println("Setting Diagram type to LineDiagram");
58 doc = (XChartDocument) tEnv.getObjRelation("CHARTDOC");
59 if (doc == null) throw new StatusException(Status.failed
60 ("Relation 'CHARTDOC' not found"));
62 XDiagram stack = (XDiagram) tEnv.getObjRelation("STACK");
63 if (stack == null) throw new StatusException(Status.failed
64 ("Relation 'STACK' not found"));
66 oldDiagram = doc.getDiagram();
68 doc.setDiagram(stack);
69 oObj = UnoRuntime.queryInterface( XPropertySet.class, doc.getDiagram() );
72 /**
73 * Sets the old diagram for a chart document.
75 @Override
76 protected void after() {
77 doc.setDiagram(oldDiagram);
80 } // EOF StackableDiagram