Avoid potential negative array index access to cached text.
[LibreOffice.git] / qadevOOo / tests / java / ifc / text / _XTextColumns.java
blobeaf10367454dc3ad8a448711ab57b5b03582bf36
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.MultiMethodTest;
23 import com.sun.star.text.TextColumn;
24 import com.sun.star.text.XTextColumns;
26 /**
27 * Testing <code>com.sun.star.text.XTextColumns</code>
28 * interface methods :
29 * <ul>
30 * <li><code> getReferenceValue()</code></li>
31 * <li><code> getColumnCount()</code></li>
32 * <li><code> setColumnCount()</code></li>
33 * <li><code> getColumns()</code></li>
34 * <li><code> setColumns()</code></li>
35 * </ul> <p>
36 * Test is <b> NOT </b> multithread compliant. <p>
37 * @see com.sun.star.text.XTextColumns
39 public class _XTextColumns extends MultiMethodTest {
41 public XTextColumns oObj = null;
43 /**
44 * Test calls the method. <p>
45 * Has <b> OK </b> status if the method returns
46 * positive value.
48 public void _getColumnCount(){
50 short howmuch = oObj.getColumnCount();
51 tRes.tested("getColumnCount()",howmuch >=0);
54 /**
55 * Test calls the method. <p>
56 * Has <b> OK </b> status if the method returns not
57 * <code>null</code> value.
59 public void _getColumns(){
60 TextColumn[] cols = oObj.getColumns();
61 tRes.tested("getColumns()",cols != null);
64 /**
65 * Test calls the method. <p>
66 * Has <b> OK </b> status if the method returns
67 * positive value.
69 public void _getReferenceValue(){
71 int ref = oObj.getReferenceValue();
72 tRes.tested("getReferenceValue()",ref >0);
75 /**
76 * Sets the column count property to some value
77 * then checks it by <code>getColumnCount</code> method. <p>
79 * Has <b>OK</b> status if set and get values are equal.
81 public void _setColumnCount(){
83 oObj.setColumnCount((short) 3);
84 short howmuch = oObj.getColumnCount();
85 tRes.tested("setColumnCount()",howmuch == 3);
88 /**
89 * Sets columns to some array
90 * then checks it by <code>getColumns</code> method. <p>
92 * Has <b>OK</b> status if set and get arrays are equal.
94 public void _setColumns(){
96 TextColumn newCol = new TextColumn(5,1,1);
97 TextColumn[] cols = {newCol};
98 oObj.setColumns(cols);
99 TextColumn[] gCols = oObj.getColumns();
100 tRes.tested("setColumns()",util.ValueComparer.equalValue(cols, gCols));
103 } // finish class _XTextColumns