Update ooo320-m1
[ooovba.git] / qadevOOo / tests / java / ifc / sheet / _SheetSortDescriptor.java
blob5046b6dfc506bf0644c53230f8f647716e26812b
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: _SheetSortDescriptor.java,v $
10 * $Revision: 1.4 $
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 ************************************************************************/
31 package ifc.sheet;
33 import lib.MultiMethodTest;
34 import util.ValueChanger;
36 import com.sun.star.beans.PropertyValue;
37 import com.sun.star.beans.XPropertySet;
38 import com.sun.star.table.CellAddress;
39 import com.sun.star.util.XSortable;
41 /**
42 * Testing <code>com.sun.star.sheet.SheetSortDescriptor</code>
43 * service properties: <p>
44 * <ul>
45 * <li><code>BindFormatsToContent</code></li>
46 * <li><code>CopyOutputData</code></li>
47 * <li><code>IsCaseSensitive</code></li>
48 * <li><code>IsUserListEnabled</code></li>
49 * <li><code>OutputPosition</code></li>
50 * <li><code>SortAscending</code></li>
51 * <li><code>UserListIndex</code></li>
52 * </ul> <p>
53 * @see com.sun.star.sheet.SheetSortDescriptor
55 public class _SheetSortDescriptor extends MultiMethodTest {
57 public XPropertySet oObj = null;
58 public XSortable xSORT = null;
59 public PropertyValue[] props = null;
61 public void _BindFormatsToContent() {
62 xSORT = (XSortable) tEnv.getObjRelation("xSORT");
63 props = xSORT.createSortDescriptor();
64 changeProp("BindFormatsToContent",5);
67 public void _CopyOutputData() {
68 changeProp("CopyOutputData",6);
71 public void _IsCaseSensitive() {
72 changeProp("IsCaseSensitive",4);
75 public void _IsUserListEnabled() {
76 changeProp("IsUserListEnabled",8);
79 public void _OutputPosition() {
80 changeProp("OutputPosition",7);
83 public void _SortAscending() {
84 //changeProp("SortAscending",3);
85 log.println("Property 'SortAscending' is not part of the "+
86 "property array");
87 log.println("Available properties:");
88 for (int i=0; i<props.length;i++) {
89 log.println("\t"+props[i].Name);
91 tRes.tested("SortAscending",false);
94 public void _UserListIndex() {
95 changeProp("UserListIndex",9);
98 public void changeProp(String name, int nr) {
100 Object gValue = null;
101 Object sValue = null;
102 Object ValueToSet = null;
103 int gInt = 0;
104 int sInt = 0;
106 if ( ! name.equals(props[nr].Name) ) {
107 log.println("Property '"+props[nr].Name+"' is tested");
108 log.println("But the status is for '"+name+"'");
112 try {
113 //waitForAllThreads();
114 gValue = props[nr].Value;
115 if ( name.equals("OutputPosition")) {
116 gInt = ((CellAddress) gValue).Row;
118 //waitForAllThreads();
119 ValueToSet = ValueChanger.changePValue(gValue);
120 //waitForAllThreads();
121 props[nr].Value=ValueToSet;
122 sValue = props[nr].Value;
123 if ( name.equals("OutputPosition")) {
124 sInt = ((CellAddress) sValue).Row;
125 gValue = new Integer(gInt);
126 sValue = new Integer(sInt);
129 //check get-set methods
130 if ( (gValue.equals(sValue)) || (sValue == null) ) {
131 log.println("Value for '"+name+"' hasn't changed");
132 tRes.tested(name, false);
134 else {
135 log.println("Property '"+name+"' OK");
136 tRes.tested(name, true);
138 } catch (Exception e) {
139 log.println("Exception occured while testing property '" +
140 name + "'");
141 e.printStackTrace(log);
142 tRes.tested(name, false);
146 }// end of changeProp
149 } // finish class _SheetSortDescriptor