Avoid potential negative array index access to cached text.
[LibreOffice.git] / qadevOOo / tests / java / ifc / text / _TextColumns.java
blob93ef30505f727c23097e182bfc41f71e703e0e37
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 import com.sun.star.text.XTextColumns;
24 import com.sun.star.uno.UnoRuntime;
26 /**
27 * Testing <code>com.sun.star.text.TextColumns</code>
28 * service properties :
29 * <ul>
30 * <li><code> IsAutomatic</code></li>
31 * <li><code> AutomaticDistance</code></li>
32 * <li><code> SeparatorLineWidth</code></li>
33 * <li><code> SeparatorLineColor</code></li>
34 * <li><code> SeparatorLineRelativeHeight</code></li>
35 * <li><code> SeparatorLineVerticalAlignment</code></li>
36 * <li><code> SeparatorLineIsOn</code></li>
37 * </ul> <p>
38 * Properties testing is automated by <code>lib.MultiPropertyTest</code>.
39 * @see com.sun.star.text.TextColumns
41 public class _TextColumns extends MultiPropertyTest {
44 /**
45 * Redefined method returns specific value, that differs from property
46 * value. ( (oldValue + referenceValue) / 2 ).
48 public void _AutomaticDistance() {
49 log.println("Testing with custom Property tester") ;
50 testProperty("AutomaticDistance", new PropertyTester() {
51 @Override
52 protected Object getNewValue(String propName, Object oldValue) {
53 XTextColumns xTC = UnoRuntime.queryInterface
54 (XTextColumns.class,tEnv.getTestObject());
55 int ref = xTC.getReferenceValue();
56 int setting = ( ( (Integer) oldValue).intValue() + ref) / 2;
57 return Integer.valueOf(setting);
59 });
63 } //finish class _TextColumns