bump product version to 4.2.0.1
[LibreOffice.git] / qadevOOo / tests / java / ifc / sheet / _SheetSortDescriptor.java
blob1bc0eaab69bb3cf928d718d2ead19f31c43f3364
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 lib.MultiMethodTest;
22 import util.ValueChanger;
24 import com.sun.star.beans.PropertyValue;
25 import com.sun.star.beans.XPropertySet;
26 import com.sun.star.table.CellAddress;
27 import com.sun.star.util.XSortable;
29 /**
30 * Testing <code>com.sun.star.sheet.SheetSortDescriptor</code>
31 * service properties: <p>
32 * <ul>
33 * <li><code>BindFormatsToContent</code></li>
34 * <li><code>CopyOutputData</code></li>
35 * <li><code>IsCaseSensitive</code></li>
36 * <li><code>IsUserListEnabled</code></li>
37 * <li><code>OutputPosition</code></li>
38 * <li><code>SortAscending</code></li>
39 * <li><code>UserListIndex</code></li>
40 * </ul> <p>
41 * @see com.sun.star.sheet.SheetSortDescriptor
43 public class _SheetSortDescriptor extends MultiMethodTest {
45 public XPropertySet oObj = null;
46 public XSortable xSORT = null;
47 public PropertyValue[] props = null;
49 public void _BindFormatsToContent() {
50 xSORT = (XSortable) tEnv.getObjRelation("xSORT");
51 props = xSORT.createSortDescriptor();
52 changeProp("BindFormatsToContent",5);
55 public void _CopyOutputData() {
56 changeProp("CopyOutputData",6);
59 public void _IsCaseSensitive() {
60 changeProp("IsCaseSensitive",4);
63 public void _IsUserListEnabled() {
64 changeProp("IsUserListEnabled",8);
67 public void _OutputPosition() {
68 changeProp("OutputPosition",7);
71 public void _SortAscending() {
72 //changeProp("SortAscending",3);
73 log.println("Property 'SortAscending' is not part of the "+
74 "property array");
75 log.println("Available properties:");
76 for (int i=0; i<props.length;i++) {
77 log.println("\t"+props[i].Name);
79 tRes.tested("SortAscending",false);
82 public void _UserListIndex() {
83 changeProp("UserListIndex",9);
86 public void changeProp(String name, int nr) {
88 Object gValue = null;
89 Object sValue = null;
90 Object ValueToSet = null;
91 int gInt = 0;
92 int sInt = 0;
94 if ( ! name.equals(props[nr].Name) ) {
95 log.println("Property '"+props[nr].Name+"' is tested");
96 log.println("But the status is for '"+name+"'");
100 try {
101 //waitForAllThreads();
102 gValue = props[nr].Value;
103 if ( name.equals("OutputPosition")) {
104 gInt = ((CellAddress) gValue).Row;
106 //waitForAllThreads();
107 ValueToSet = ValueChanger.changePValue(gValue);
108 //waitForAllThreads();
109 props[nr].Value=ValueToSet;
110 sValue = props[nr].Value;
111 if ( name.equals("OutputPosition")) {
112 sInt = ((CellAddress) sValue).Row;
113 gValue = new Integer(gInt);
114 sValue = new Integer(sInt);
117 //check get-set methods
118 if ( (gValue.equals(sValue)) || (sValue == null) ) {
119 log.println("Value for '"+name+"' hasn't changed");
120 tRes.tested(name, false);
122 else {
123 log.println("Property '"+name+"' OK");
124 tRes.tested(name, true);
126 } catch (Exception e) {
127 log.println("Exception occurred while testing property '" +
128 name + "'");
129 e.printStackTrace(log);
130 tRes.tested(name, false);
134 }// end of changeProp
137 } // finish class _SheetSortDescriptor