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