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 .
21 import lib
.MultiPropertyTest
;
24 * Testing <code>com.sun.star.chart.ChartAxisXSupplier</code>
25 * service properties :
27 * <li><code> HasXAxis</code></li>
28 * <li><code> HasXAxisDescription</code></li>
29 * <li><code> HasXAxisGrid</code></li>
30 * <li><code> HasXAxisHelpGrid</code></li>
31 * <li><code> HasXAxisTitle</code></li>
33 * @see com.sun.star.chart.ChartAxisXSupplier
35 public class _ChartAxisXSupplier
extends MultiPropertyTest
{
36 public void _HasXAxis() {
38 log
.println("Property HasXAxis");
39 boolean res
= ((Boolean
)oObj
.getPropertyValue(
40 "HasXAxis")).booleanValue();
42 oObj
.setPropertyValue("HasXAxis", Boolean
.TRUE
);
43 // test connected property HasXAxisDescription
44 if (!((Boolean
)oObj
.getPropertyValue(
45 "HasXAxisDescription")).booleanValue())
46 oObj
.setPropertyValue("HasXAxisDescription", Boolean
.TRUE
);
48 oObj
.setPropertyValue("HasXAxis", Boolean
.FALSE
);
49 boolean setVal
= ((Boolean
)oObj
.getPropertyValue(
50 "HasXAxis")).booleanValue();
51 log
.println("Start value: " + setVal
);
52 // description should also be false now
53 setVal
|= ((Boolean
)oObj
.getPropertyValue(
54 "HasXAxisDescription")).booleanValue();
55 log
.println("Connected value axis description: " + setVal
);
57 oObj
.setPropertyValue("HasXAxis", Boolean
.TRUE
);
58 setVal
|= !((Boolean
)oObj
.getPropertyValue(
59 "HasXAxis")).booleanValue();
60 log
.println("Changed value: " + !setVal
);
62 // description should be true again
63 setVal
|= !((Boolean
)oObj
.getPropertyValue(
64 "HasXAxisDescription")).booleanValue();
65 log
.println("Changed connected value axis description: " + !setVal
);
67 tRes
.tested("HasXAxis", !setVal
);
68 // leave axis untouched
69 oObj
.setPropertyValue("HasXAxis", Boolean
.valueOf(res
));
71 catch (com
.sun
.star
.lang
.WrappedTargetException e
) {
72 log
.println(e
.getMessage());
73 e
.printStackTrace(log
);
74 tRes
.tested("HasXAxis", false);
76 catch (com
.sun
.star
.lang
.IllegalArgumentException e
) {
77 log
.println(e
.getMessage());
78 e
.printStackTrace(log
);
79 tRes
.tested("HasXAxis", false);
81 catch (com
.sun
.star
.beans
.UnknownPropertyException e
) {
82 log
.println(e
.getMessage());
83 e
.printStackTrace(log
);
84 tRes
.tested("HasXAxis", false);
86 catch (com
.sun
.star
.beans
.PropertyVetoException e
) {
87 log
.println(e
.getMessage());
88 e
.printStackTrace(log
);
89 tRes
.tested("HasXAxis", false);
93 public void _HasXAxisDescription() {
94 requiredMethod("HasXAxis");
96 log
.println("Property HasXAxisDescription");
97 if (!((Boolean
)oObj
.getPropertyValue("HasXAxis")).booleanValue())
98 oObj
.setPropertyValue("HasXAxis", Boolean
.TRUE
);
100 boolean res
= ((Boolean
)oObj
.getPropertyValue(
101 "HasXAxisDescription")).booleanValue();
102 log
.println("Start value: " + res
);
104 oObj
.setPropertyValue("HasXAxisDescription", Boolean
.valueOf(!res
));
105 boolean setValue
= ((Boolean
)oObj
.getPropertyValue(
106 "HasXAxisDescription")).booleanValue();
107 log
.println("Changed value: " + setValue
);
108 tRes
.tested("HasXAxisDescription", res
!= setValue
);
110 catch (com
.sun
.star
.lang
.WrappedTargetException e
) {
111 log
.println(e
.getMessage());
112 e
.printStackTrace(log
);
113 tRes
.tested("HasXAxisDescription", false);
115 catch (com
.sun
.star
.lang
.IllegalArgumentException e
) {
116 log
.println(e
.getMessage());
117 e
.printStackTrace(log
);
118 tRes
.tested("HasXAxisDescription", false);
120 catch (com
.sun
.star
.beans
.UnknownPropertyException e
) {
121 log
.println(e
.getMessage());
122 e
.printStackTrace(log
);
123 tRes
.tested("HasXAxisDescription", false);
125 catch (com
.sun
.star
.beans
.PropertyVetoException e
) {
126 log
.println(e
.getMessage());
127 e
.printStackTrace(log
);
128 tRes
.tested("HasXAxisDescription", false);
131 } // EOF ChartAxisXSupplier