1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2000, 2010 Oracle and/or its affiliates.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * This file is part of OpenOffice.org.
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.
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).
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.
26 ************************************************************************/
30 import com
.sun
.star
.sheet
.DataPilotFieldAutoShowInfo
;
31 import com
.sun
.star
.sheet
.DataPilotFieldLayoutInfo
;
32 import com
.sun
.star
.sheet
.DataPilotFieldReference
;
33 import com
.sun
.star
.sheet
.DataPilotFieldSortInfo
;
34 import lib
.MultiPropertyTest
;
37 * Testing <code>com.sun.star.sheet.DataPilotField</code>
38 * service properties :
40 * <li><code> Orientation</code></li>
41 * <li><code> Function</code></li>
43 * Properties testing is automated by <code>lib.MultiPropertyTest</code>.
44 * @see com.sun.star.sheet.DataPilotField
46 public class _DataPilotField
extends MultiPropertyTest
{
49 *This class is destined to custom test of property <code>SortInfo</code>.
51 protected PropertyTester SortInfoTester
= new PropertyTester() {
52 protected Object
getNewValue(String propName
, Object oldValue
) {
53 DataPilotFieldSortInfo sortInfo
= new DataPilotFieldSortInfo();
54 sortInfo
.Mode
= com
.sun
.star
.sheet
.DataPilotFieldSortMode
.MANUAL
;
55 sortInfo
.IsAscending
= false;
56 sortInfo
.Field
= "COL1";
57 log
.println("Having Value and returning a new one");
58 return sortInfo
.equals(oldValue
) ?
null : sortInfo
;
63 * Test property <code>SortInfo</code> using custom <code>PropertyTest</code>.
65 public void _SortInfo() {
66 testProperty("SortInfo", SortInfoTester
);
69 public void _HasSortInfo() {
70 requiredMethod("SortInfo");
71 testProperty("HasSortInfo");
75 *This class is destined to custom test of property <code>LayoutInfo</code>.
77 protected PropertyTester LayoutInfoTester
= new PropertyTester() {
78 protected Object
getNewValue(String propName
, Object oldValue
) {
79 DataPilotFieldLayoutInfo layoutInfo
= new DataPilotFieldLayoutInfo();
80 layoutInfo
.LayoutMode
= com
.sun
.star
.sheet
.DataPilotFieldLayoutMode
.OUTLINE_SUBTOTALS_BOTTOM
;
81 layoutInfo
.AddEmptyLines
= true;
82 log
.println("Having Value and returning a new one");
83 return layoutInfo
.equals(oldValue
) ?
null : layoutInfo
;
88 * Test property <code>LayoutInfo</code> using custom <code>PropertyTest</code>.
90 public void _LayoutInfo() {
91 testProperty("LayoutInfo", LayoutInfoTester
);
94 public void _HasLayoutInfo() {
95 requiredMethod("LayoutInfo");
96 testProperty("HasLayoutInfo");
100 *This class is destined to custom test of property <code>AutoShowInfo</code>.
102 protected PropertyTester AutoShowInfoTester
= new PropertyTester() {
103 protected Object
getNewValue(String propName
, Object oldValue
) {
104 DataPilotFieldAutoShowInfo AutoShowInfo
= new DataPilotFieldAutoShowInfo();
105 AutoShowInfo
.DataField
= "Col1";
106 AutoShowInfo
.IsEnabled
= true;
107 log
.println("Having Value and returning a new one");
108 return AutoShowInfo
.equals(oldValue
) ?
null : AutoShowInfo
;
113 * Test property <code>AutoShowInfo</code> using custom <code>PropertyTest</code>.
115 public void _AutoShowInfo() {
116 testProperty("AutoShowInfo", AutoShowInfoTester
);
119 public void _HasAutoShowInfo() {
120 requiredMethod("AutoShowInfo");
121 testProperty("HasAutoShowInfo");
125 *This class is destined to custom test of property <code>Reference</code>.
127 protected PropertyTester ReferenceTester
= new PropertyTester() {
128 protected Object
getNewValue(String propName
, Object oldValue
) {
129 DataPilotFieldReference Reference
= new DataPilotFieldReference();
130 Reference
.ReferenceField
="Col1";
131 Reference
.ReferenceItemType
= com
.sun
.star
.sheet
.DataPilotFieldReferenceItemType
.NAMED
;
132 log
.println("Having Value and returning a new one");
133 return Reference
.equals(oldValue
) ?
null : Reference
;
138 * Test property <code>Reference</code> using custom <code>PropertyTest</code>.
140 public void _Reference() {
141 testProperty("Reference", ReferenceTester
);
144 public void _HasReference() {
145 requiredMethod("Reference");
146 testProperty("HasReference");
150 * this property can only set a true value to false, fo ungrouping purposes
152 public void _IsGroupField() {
153 boolean result
= true;
155 Boolean propValue
= (Boolean
) oObj
.getPropertyValue ("IsGroupField");
156 if (propValue
.booleanValue ()) {
157 oObj
.setPropertyValue ("IsGroupField", Boolean
.FALSE
);
158 Boolean propV
= (Boolean
) oObj
.getPropertyValue ("IsGroupField");
159 result
= !propV
.booleanValue ();
161 } catch (Exception e
) {
162 log
.println ("Exception while getting Property 'IsGroupField'"+e
);
165 tRes
.tested ("IsGroupField",result
);