tdf#130857 qt weld: Implement QtInstanceWidget::strip_mnemonic
[LibreOffice.git] / qadevOOo / tests / java / ifc / chart / _XDiagram.java
blobde51ea2e1082f243e5873b950be4ad11e2189a31
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.MultiMethodTest;
22 import lib.Status;
23 import lib.StatusException;
25 import com.sun.star.beans.XPropertySet;
26 import com.sun.star.chart.XDiagram;
28 /**
29 * Testing <code>com.sun.star.chart.XDiagram</code>
30 * interface methods :
31 * <ul>
32 * <li><code> getDiagramType()</code></li>
33 * <li><code> getDataRowProperties()</code></li>
34 * <li><code> getDataPointProperties()</code></li>
35 * </ul> <p>
36 * This test needs the following object relations :
37 * <ul>
38 * <li> <code>'ROWAMOUNT'</code> (of type <code>Integer</code>):
39 * to have amount of rows </li>
40 * <li> <code>'COLAMOUNT'</code> (of type <code>Integer</code>):
41 * to have amount of columns </li>
42 * <ul> <p>
43 * @see com.sun.star.chart.XDiagram
45 public class _XDiagram extends MultiMethodTest {
47 public XDiagram oObj = null;
48 boolean result = true;
49 Integer rowamount = null;
50 Integer colamount = null;
52 /**
53 * Retrieves object relations.
54 * @throws StatusException If one of relations not found.
56 @Override
57 public void before() {
58 rowamount = (Integer)tEnv.getObjRelation("ROWAMOUNT");
59 if (rowamount == null) throw new StatusException(Status.failed
60 ("Relation 'ROWAMOUNT' not found"));
62 colamount = (Integer)tEnv.getObjRelation("COLAMOUNT");
63 if (colamount == null) throw new StatusException(Status.failed
64 ("Relation 'COLAMOUNT' not found"));
67 /**
68 * Test calls the method and checks returned value. <p>
69 * Has <b> OK </b> status if returned value start from 'com.sun.star.chart.' <p>
71 public void _getDiagramType() {
72 result = true;
74 String stype = oObj.getDiagramType();
75 log.println("Current Diagram Type is " + stype);
76 result = stype.startsWith("com.sun.star.chart.");
78 tRes.tested("getDiagramType()", result);
81 /**
82 * Test calls the method for every row and checks returned value. <p>
83 * Has <b> OK </b> status if returned value for every row isn't null and
84 * no exceptions were thrown. <p>
86 public void _getDataRowProperties() {
87 result = true;
89 int rows = rowamount.intValue();
90 rows -= 1;
91 XPropertySet props = null;
93 log.println("There are " + rows + " rows.");
94 try {
95 for (int i = 0; i < rows; i++) {
96 props = oObj.getDataRowProperties(i);
97 if (props != null) {
98 log.println("Row " + i + " - OK");
99 } else {
100 log.println("Row " + i + " - FAILED");
101 result = false;
104 } catch (com.sun.star.lang.IndexOutOfBoundsException e) {
105 log.println("Exception while get data row properties");
106 e.printStackTrace(log);
107 result = false;
110 tRes.tested("getDataRowProperties()", result);
114 * Test calls the method for every point and checks returned value. <p>
115 * Has <b> OK </b> status if returned value for every point isn't null and
116 * no exceptions were thrown. <p>
118 public void _getDataPointProperties() {
119 result = true;
121 int rows = rowamount.intValue();
122 int cols = colamount.intValue();
123 XPropertySet props = null;
125 log.println("There are " + rows + " rows and " + cols + " cols.");
127 try {
128 for (int i = 0; i < rows; i++)
129 for (int j = 0; j < cols; j++) {
130 props = oObj.getDataPointProperties(i, j);
131 if (props != null) {
132 log.println("Row " + i + " Col " + j + " - OK");
133 } else {
134 log.println("Row " + i + " Col " + j + " - FAILED");
135 result = false;
138 } catch(com.sun.star.lang.IndexOutOfBoundsException e) {
139 log.println("Exception while get data point properties");
140 e.printStackTrace(log);
141 result = false;
144 tRes.tested("getDataPointProperties()", result);