xref: /AOO41X/main/qadevOOo/tests/java/ifc/chart/_ChartAxisXSupplier.java (revision cdf0e10c4e3984b49a9502b011690b615761d4a3)
1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 package ifc.chart;
29 
30 import lib.MultiPropertyTest;
31 
32 /**
33 * Testing <code>com.sun.star.chart.ChartAxisXSupplier</code>
34 * service properties :
35 * <ul>
36 *  <li><code> HasXAxis</code></li>
37 *  <li><code> HasXAxisDescription</code></li>
38 *  <li><code> HasXAxisGrid</code></li>
39 *  <li><code> HasXAxisHelpGrid</code></li>
40 *  <li><code> HasXAxisTitle</code></li>
41 * </ul> <p>
42 * @see com.sun.star.chart.ChartAxisXSupplier
43 */
44 public class _ChartAxisXSupplier extends MultiPropertyTest {
45     public void _HasXAxis() {
46         try {
47             log.println("Property HasXAxis");
48             boolean res = ((Boolean)oObj.getPropertyValue(
49                                             "HasXAxis")).booleanValue();
50             if (!res)
51                 oObj.setPropertyValue("HasXAxis", Boolean.TRUE);
52             // test connected property HasXAxisDescription
53             if (!((Boolean)oObj.getPropertyValue(
54                                         "HasXAxisDescription")).booleanValue())
55                 oObj.setPropertyValue("HasXAxisDescription", Boolean.TRUE);
56 
57             oObj.setPropertyValue("HasXAxis", Boolean.FALSE);
58             boolean setVal = ((Boolean)oObj.getPropertyValue(
59                                                 "HasXAxis")).booleanValue();
60             log.println("Start value: " + setVal);
61             // description should also be false now
62             setVal |= ((Boolean)oObj.getPropertyValue(
63                                      "HasXAxisDescription")).booleanValue();
64             log.println("Connected value axis description: " + setVal);
65 
66             oObj.setPropertyValue("HasXAxis", Boolean.TRUE);
67             setVal |= !((Boolean)oObj.getPropertyValue(
68                                                 "HasXAxis")).booleanValue();
69             log.println("Changed value: " + !setVal);
70 
71             // description should be true again
72             setVal |= !((Boolean)oObj.getPropertyValue(
73                                      "HasXAxisDescription")).booleanValue();
74             log.println("Changed connected value axis description: " + !setVal);
75 
76             tRes.tested("HasXAxis", !setVal);
77             // leave axis untouched
78             oObj.setPropertyValue("HasXAxis", new Boolean(res));
79         }
80         catch (com.sun.star.lang.WrappedTargetException e) {
81             log.println(e.getMessage());
82             e.printStackTrace(log);
83             tRes.tested("HasXAxis", false);
84         }
85         catch (com.sun.star.lang.IllegalArgumentException e) {
86             log.println(e.getMessage());
87             e.printStackTrace(log);
88             tRes.tested("HasXAxis", false);
89         }
90         catch (com.sun.star.beans.UnknownPropertyException e) {
91             log.println(e.getMessage());
92             e.printStackTrace(log);
93             tRes.tested("HasXAxis", false);
94         }
95         catch (com.sun.star.beans.PropertyVetoException e) {
96             log.println(e.getMessage());
97             e.printStackTrace(log);
98             tRes.tested("HasXAxis", false);
99         }
100     }
101 
102     public void _HasXAxisDescription() {
103         requiredMethod("HasXAxis");
104         try {
105             log.println("Property HasXAxisDescription");
106             if (!((Boolean)oObj.getPropertyValue("HasXAxis")).booleanValue())
107                 oObj.setPropertyValue("HasXAxis", Boolean.TRUE);
108 
109             boolean res = ((Boolean)oObj.getPropertyValue(
110                                         "HasXAxisDescription")).booleanValue();
111             log.println("Start value: " + res);
112 
113             oObj.setPropertyValue("HasXAxisDescription", new Boolean(!res));
114             boolean setValue = ((Boolean)oObj.getPropertyValue(
115                                         "HasXAxisDescription")).booleanValue();
116             log.println("Changed value: " + setValue);
117             tRes.tested("HasXAxisDescription", res != setValue);
118         }
119         catch (com.sun.star.lang.WrappedTargetException e) {
120             log.println(e.getMessage());
121             e.printStackTrace(log);
122             tRes.tested("HasXAxisDescription", false);
123         }
124         catch (com.sun.star.lang.IllegalArgumentException e) {
125             log.println(e.getMessage());
126             e.printStackTrace(log);
127             tRes.tested("HasXAxisDescription", false);
128         }
129         catch (com.sun.star.beans.UnknownPropertyException e) {
130             log.println(e.getMessage());
131             e.printStackTrace(log);
132             tRes.tested("HasXAxisDescription", false);
133         }
134         catch (com.sun.star.beans.PropertyVetoException e) {
135             log.println(e.getMessage());
136             e.printStackTrace(log);
137             tRes.tested("HasXAxisDescription", false);
138         }
139     }
140 } // EOF ChartAxisXSupplier
141 
142