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.text; 25 26 import lib.MultiPropertyTest; 27 28 /** 29 * Testing <code>com.sun.star.text.CellRange</code> 30 * service properties : 31 * <ul> 32 * <li><code> BackColor</code></li> 33 * <li><code> BackGraphicURL</code></li> 34 * <li><code> BackGraphicFilter</code></li> 35 * <li><code> BackGraphicLocation</code></li> 36 * <li><code> BackTransparent</code></li> 37 * <li><code> ChartColumnAsLabel</code></li> 38 * <li><code> ChartRowAsLabel</code></li> 39 * <li><code> NumberFormat</code></li> 40 * <li><code> TopMargin</code></li> 41 * <li><code> BottomMargin</code></li> 42 * 43 * The following predefined files needed to complete the test: 44 * <ul> 45 * <li> <code> crazy-blue.jpg </code> : jpeg image used to test 46 * BackGraphicURL()</li> 47 * <li> <code> space-metal.jpg </code> : jpeg image used to test 48 * BackGraphicURL()</li> 49 * </ul> <p> 50 * Properties testing is automated by <code>lib.MultiPropertyTest</code>. 51 * @see com.sun.star.text.CellProperties 52 */ 53 public class _CellRange extends MultiPropertyTest { 54 55 /** 56 * Redefined method returns value, that differs from property value. 57 */ _BackColor()58 public void _BackColor() { 59 final Short val1 = new Short( (short) 4 ); 60 final Short val2 = new Short( (short) 6 ); 61 log.println("Testing with custom Property tester") ; 62 testProperty("BackColor", new PropertyTester() { 63 protected Object getNewValue(String propName, Object oldValue) { 64 if ( oldValue.equals(val1) ) 65 return val2; 66 else 67 return val1; 68 } 69 }); 70 } 71 72 /** 73 * This property could be changed only when graphic 74 * URL is set. 75 */ _BackGraphicFilter()76 public void _BackGraphicFilter() { 77 executeMethod("BackGraphicURL"); 78 testProperty("BackGraphicFilter"); 79 } 80 81 /** 82 * Redefined method returns value, that differs from property value. 83 */ _BackGraphicURL()84 public void _BackGraphicURL() { 85 log.println("Testing with custom Property tester") ; 86 testProperty("BackGraphicURL", new PropertyTester() { 87 protected Object getNewValue(String propName, Object oldValue) { 88 if (oldValue.equals(util.utils.getFullTestURL 89 ("space-metal.jpg"))) 90 return util.utils.getFullTestURL("crazy-blue.jpg"); 91 else 92 return util.utils.getFullTestURL("space-metal.jpg"); 93 } 94 }); 95 } 96 } 97 98