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 com
.sun
.star
.sheet
.DataPilotFieldAutoShowInfo
;
22 import com
.sun
.star
.sheet
.DataPilotFieldLayoutInfo
;
23 import com
.sun
.star
.sheet
.DataPilotFieldReference
;
24 import com
.sun
.star
.sheet
.DataPilotFieldSortInfo
;
25 import lib
.MultiPropertyTest
;
28 * Testing <code>com.sun.star.sheet.DataPilotField</code>
29 * service properties :
31 * <li><code> Orientation</code></li>
32 * <li><code> Function</code></li>
34 * Properties testing is automated by <code>lib.MultiPropertyTest</code>.
35 * @see com.sun.star.sheet.DataPilotField
37 public class _DataPilotField
extends MultiPropertyTest
{
40 *This class is destined to custom test of property <code>SortInfo</code>.
42 protected PropertyTester SortInfoTester
= new PropertyTester() {
44 protected Object
getNewValue(String propName
, Object oldValue
) {
45 DataPilotFieldSortInfo sortInfo
= new DataPilotFieldSortInfo();
46 sortInfo
.Mode
= com
.sun
.star
.sheet
.DataPilotFieldSortMode
.MANUAL
;
47 sortInfo
.IsAscending
= false;
48 sortInfo
.Field
= "COL1";
49 log
.println("Having Value and returning a new one");
50 return sortInfo
.equals(oldValue
) ?
null : sortInfo
;
55 * Test property <code>SortInfo</code> using custom <code>PropertyTest</code>.
57 public void _SortInfo() {
58 testProperty("SortInfo", SortInfoTester
);
61 public void _HasSortInfo() {
62 requiredMethod("SortInfo");
63 testProperty("HasSortInfo");
67 *This class is destined to custom test of property <code>LayoutInfo</code>.
69 protected PropertyTester LayoutInfoTester
= new PropertyTester() {
71 protected Object
getNewValue(String propName
, Object oldValue
) {
72 DataPilotFieldLayoutInfo layoutInfo
= new DataPilotFieldLayoutInfo();
73 layoutInfo
.LayoutMode
= com
.sun
.star
.sheet
.DataPilotFieldLayoutMode
.OUTLINE_SUBTOTALS_BOTTOM
;
74 layoutInfo
.AddEmptyLines
= true;
75 log
.println("Having Value and returning a new one");
76 return layoutInfo
.equals(oldValue
) ?
null : layoutInfo
;
81 * Test property <code>LayoutInfo</code> using custom <code>PropertyTest</code>.
83 public void _LayoutInfo() {
84 testProperty("LayoutInfo", LayoutInfoTester
);
87 public void _HasLayoutInfo() {
88 requiredMethod("LayoutInfo");
89 testProperty("HasLayoutInfo");
93 *This class is destined to custom test of property <code>AutoShowInfo</code>.
95 protected PropertyTester AutoShowInfoTester
= new PropertyTester() {
97 protected Object
getNewValue(String propName
, Object oldValue
) {
98 DataPilotFieldAutoShowInfo AutoShowInfo
= new DataPilotFieldAutoShowInfo();
99 AutoShowInfo
.DataField
= "Col1";
100 AutoShowInfo
.IsEnabled
= true;
101 log
.println("Having Value and returning a new one");
102 return AutoShowInfo
.equals(oldValue
) ?
null : AutoShowInfo
;
107 * Test property <code>AutoShowInfo</code> using custom <code>PropertyTest</code>.
109 public void _AutoShowInfo() {
110 testProperty("AutoShowInfo", AutoShowInfoTester
);
113 public void _HasAutoShowInfo() {
114 requiredMethod("AutoShowInfo");
115 testProperty("HasAutoShowInfo");
119 *This class is destined to custom test of property <code>Reference</code>.
121 protected PropertyTester ReferenceTester
= new PropertyTester() {
123 protected Object
getNewValue(String propName
, Object oldValue
) {
124 DataPilotFieldReference Reference
= new DataPilotFieldReference();
125 Reference
.ReferenceField
="Col1";
126 Reference
.ReferenceItemType
= com
.sun
.star
.sheet
.DataPilotFieldReferenceItemType
.NAMED
;
127 log
.println("Having Value and returning a new one");
128 return Reference
.equals(oldValue
) ?
null : Reference
;
133 * Test property <code>Reference</code> using custom <code>PropertyTest</code>.
135 public void _Reference() {
136 testProperty("Reference", ReferenceTester
);
139 public void _HasReference() {
140 requiredMethod("Reference");
141 testProperty("HasReference");
145 * this property can only set a true value to false, fo ungrouping purposes
147 public void _IsGroupField() {
148 boolean result
= true;
150 Boolean propValue
= (Boolean
) oObj
.getPropertyValue ("IsGroupField");
151 if (propValue
.booleanValue ()) {
152 oObj
.setPropertyValue ("IsGroupField", Boolean
.FALSE
);
153 Boolean propV
= (Boolean
) oObj
.getPropertyValue ("IsGroupField");
154 result
= !propV
.booleanValue ();
156 } catch (Exception e
) {
157 log
.println ("Exception while getting Property 'IsGroupField'"+e
);
160 tRes
.tested ("IsGroupField",result
);