1 /************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 23 24 package ifc.sheet; 25 26 import lib.MultiMethodTest; 27 import util.ValueChanger; 28 29 import com.sun.star.beans.PropertyValue; 30 import com.sun.star.beans.XPropertySet; 31 import com.sun.star.table.CellAddress; 32 import com.sun.star.util.XSortable; 33 34 /** 35 * Testing <code>com.sun.star.sheet.SheetSortDescriptor</code> 36 * service properties: <p> 37 * <ul> 38 * <li><code>BindFormatsToContent</code></li> 39 * <li><code>CopyOutputData</code></li> 40 * <li><code>IsCaseSensitive</code></li> 41 * <li><code>IsUserListEnabled</code></li> 42 * <li><code>OutputPosition</code></li> 43 * <li><code>SortAscending</code></li> 44 * <li><code>UserListIndex</code></li> 45 * </ul> <p> 46 * @see com.sun.star.sheet.SheetSortDescriptor 47 */ 48 public class _SheetSortDescriptor extends MultiMethodTest { 49 50 public XPropertySet oObj = null; 51 public XSortable xSORT = null; 52 public PropertyValue[] props = null; 53 _BindFormatsToContent()54 public void _BindFormatsToContent() { 55 xSORT = (XSortable) tEnv.getObjRelation("xSORT"); 56 props = xSORT.createSortDescriptor(); 57 changeProp("BindFormatsToContent",5); 58 } 59 _CopyOutputData()60 public void _CopyOutputData() { 61 changeProp("CopyOutputData",6); 62 } 63 _IsCaseSensitive()64 public void _IsCaseSensitive() { 65 changeProp("IsCaseSensitive",4); 66 } 67 _IsUserListEnabled()68 public void _IsUserListEnabled() { 69 changeProp("IsUserListEnabled",8); 70 } 71 _OutputPosition()72 public void _OutputPosition() { 73 changeProp("OutputPosition",7); 74 } 75 _SortAscending()76 public void _SortAscending() { 77 //changeProp("SortAscending",3); 78 log.println("Property 'SortAscending' is not part of the "+ 79 "property array"); 80 log.println("Available properties:"); 81 for (int i=0; i<props.length;i++) { 82 log.println("\t"+props[i].Name); 83 } 84 tRes.tested("SortAscending",false); 85 } 86 _UserListIndex()87 public void _UserListIndex() { 88 changeProp("UserListIndex",9); 89 } 90 changeProp(String name, int nr)91 public void changeProp(String name, int nr) { 92 93 Object gValue = null; 94 Object sValue = null; 95 Object ValueToSet = null; 96 int gInt = 0; 97 int sInt = 0; 98 99 if ( ! name.equals(props[nr].Name) ) { 100 log.println("Property '"+props[nr].Name+"' is tested"); 101 log.println("But the status is for '"+name+"'"); 102 } 103 104 105 try { 106 //waitForAllThreads(); 107 gValue = props[nr].Value; 108 if ( name.equals("OutputPosition")) { 109 gInt = ((CellAddress) gValue).Row; 110 } 111 //waitForAllThreads(); 112 ValueToSet = ValueChanger.changePValue(gValue); 113 //waitForAllThreads(); 114 props[nr].Value=ValueToSet; 115 sValue = props[nr].Value; 116 if ( name.equals("OutputPosition")) { 117 sInt = ((CellAddress) sValue).Row; 118 gValue = new Integer(gInt); 119 sValue = new Integer(sInt); 120 } 121 122 //check get-set methods 123 if ( (gValue.equals(sValue)) || (sValue == null) ) { 124 log.println("Value for '"+name+"' hasn't changed"); 125 tRes.tested(name, false); 126 } 127 else { 128 log.println("Property '"+name+"' OK"); 129 tRes.tested(name, true); 130 } 131 } catch (Exception e) { 132 log.println("Exception occurred while testing property '" + 133 name + "'"); 134 e.printStackTrace(log); 135 tRes.tested(name, false); 136 } 137 138 139 }// end of changeProp 140 141 142 } // finish class _SheetSortDescriptor 143 144 145