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