bump product version to 4.2.0.1
[LibreOffice.git] / qadevOOo / tests / java / ifc / sheet / _DataPilotField.java
blobf16b968082f63c1ec63ca12d0f045d28063c3a3f
1 /*
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 .
19 package ifc.sheet;
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;
27 /**
28 * Testing <code>com.sun.star.sheet.DataPilotField</code>
29 * service properties :
30 * <ul>
31 * <li><code> Orientation</code></li>
32 * <li><code> Function</code></li>
33 * </ul> <p>
34 * Properties testing is automated by <code>lib.MultiPropertyTest</code>.
35 * @see com.sun.star.sheet.DataPilotField
37 public class _DataPilotField extends MultiPropertyTest {
39 /**
40 *This class is destined to custom test of property <code>SortInfo</code>.
42 protected PropertyTester SortInfoTester = new PropertyTester() {
43 protected Object getNewValue(String propName, Object oldValue) {
44 DataPilotFieldSortInfo sortInfo = new DataPilotFieldSortInfo();
45 sortInfo.Mode = com.sun.star.sheet.DataPilotFieldSortMode.MANUAL;
46 sortInfo.IsAscending = false;
47 sortInfo.Field = "COL1";
48 log.println("Having Value and returning a new one");
49 return sortInfo.equals(oldValue) ? null : sortInfo;
53 /**
54 * Test property <code>SortInfo</code> using custom <code>PropertyTest</code>.
56 public void _SortInfo() {
57 testProperty("SortInfo", SortInfoTester);
60 public void _HasSortInfo() {
61 requiredMethod("SortInfo");
62 testProperty("HasSortInfo");
65 /**
66 *This class is destined to custom test of property <code>LayoutInfo</code>.
68 protected PropertyTester LayoutInfoTester = new PropertyTester() {
69 protected Object getNewValue(String propName, Object oldValue) {
70 DataPilotFieldLayoutInfo layoutInfo = new DataPilotFieldLayoutInfo();
71 layoutInfo.LayoutMode = com.sun.star.sheet.DataPilotFieldLayoutMode.OUTLINE_SUBTOTALS_BOTTOM;
72 layoutInfo.AddEmptyLines = true;
73 log.println("Having Value and returning a new one");
74 return layoutInfo.equals(oldValue) ? null : layoutInfo;
78 /**
79 * Test property <code>LayoutInfo</code> using custom <code>PropertyTest</code>.
81 public void _LayoutInfo() {
82 testProperty("LayoutInfo", LayoutInfoTester);
85 public void _HasLayoutInfo() {
86 requiredMethod("LayoutInfo");
87 testProperty("HasLayoutInfo");
90 /**
91 *This class is destined to custom test of property <code>AutoShowInfo</code>.
93 protected PropertyTester AutoShowInfoTester = new PropertyTester() {
94 protected Object getNewValue(String propName, Object oldValue) {
95 DataPilotFieldAutoShowInfo AutoShowInfo = new DataPilotFieldAutoShowInfo();
96 AutoShowInfo.DataField = "Col1";
97 AutoShowInfo.IsEnabled = true;
98 log.println("Having Value and returning a new one");
99 return AutoShowInfo.equals(oldValue) ? null : AutoShowInfo;
104 * Test property <code>AutoShowInfo</code> using custom <code>PropertyTest</code>.
106 public void _AutoShowInfo() {
107 testProperty("AutoShowInfo", AutoShowInfoTester);
110 public void _HasAutoShowInfo() {
111 requiredMethod("AutoShowInfo");
112 testProperty("HasAutoShowInfo");
116 *This class is destined to custom test of property <code>Reference</code>.
118 protected PropertyTester ReferenceTester = new PropertyTester() {
119 protected Object getNewValue(String propName, Object oldValue) {
120 DataPilotFieldReference Reference = new DataPilotFieldReference();
121 Reference.ReferenceField="Col1";
122 Reference.ReferenceItemType = com.sun.star.sheet.DataPilotFieldReferenceItemType.NAMED;
123 log.println("Having Value and returning a new one");
124 return Reference.equals(oldValue) ? null : Reference;
129 * Test property <code>Reference</code> using custom <code>PropertyTest</code>.
131 public void _Reference() {
132 testProperty("Reference", ReferenceTester);
135 public void _HasReference() {
136 requiredMethod("Reference");
137 testProperty("HasReference");
141 * this property can only set a true value to false, fo ungrouping purposes
143 public void _IsGroupField() {
144 boolean result = true;
145 try {
146 Boolean propValue = (Boolean) oObj.getPropertyValue ("IsGroupField");
147 if (propValue.booleanValue ()) {
148 oObj.setPropertyValue ("IsGroupField", Boolean.FALSE);
149 Boolean propV = (Boolean) oObj.getPropertyValue ("IsGroupField");
150 result = !propV.booleanValue ();
152 } catch (Exception e) {
153 log.println ("Exception while getting Property 'IsGroupField'"+e);
154 result = false;
156 tRes.tested ("IsGroupField",result);