Avoid potential negative array index access to cached text.
[LibreOffice.git] / qadevOOo / tests / java / ifc / text / _XWordCursor.java
blob47474472af1e25b585fb7002e66a486d41133e3e
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.XWordCursor;
25 /**
26 * Testing <code>com.sun.star.text.XWordCursor</code>
27 * interface methods :
28 * <ul>
29 * <li><code> isStartOfWord()</code></li>
30 * <li><code> isEndOfWord()</code></li>
31 * <li><code> gotoNextWord()</code></li>
32 * <li><code> gotoPreviousWord()</code></li>
33 * <li><code> gotoEndOfWord()</code></li>
34 * <li><code> gotoStartOfWord()</code></li>
35 * </ul> <p>
36 * Test is <b> NOT </b> multithread compliant. <p>
37 * @see com.sun.star.text.XWordCursor
39 public class _XWordCursor extends MultiMethodTest {
41 public XWordCursor oObj = null; // oObj filled by MultiMethodTest
43 /**
44 * Moves the cursor to start of the text.
46 @Override
47 public void before() {
48 oObj.gotoStart(false);
51 /**
52 * First moves the cursor to the next word to be sure that
53 * at least one word is situated before. Then moves cursor
54 * to the previous word and checks the value returned. <p>
56 * Has <b>OK</b> status if method returns <code>true</code>.
58 public void _gotoPreviousWord(){
59 oObj.gotoNextWord(false);
60 tRes.tested("gotoPreviousWord()", oObj.gotoPreviousWord(false) );
63 /**
64 * First moves the cursor to the previous word to be sure that
65 * at least one word is situated after. Then moves cursor
66 * to the next word and checks the value returned. <p>
68 * Has <b>OK</b> status if method returns <code>true</code>.
70 public void _gotoNextWord(){
71 oObj.gotoPreviousWord(false) ;
72 tRes.tested("gotoNextWord()", oObj.gotoNextWord(false) );
75 /**
76 * First moves the cursor to the start of the current word,
77 * then to the end and checks the value returned. <p>
79 * Has <b>OK</b> status if method returns <code>true</code>.
81 public void _gotoEndOfWord(){
82 oObj.gotoStart(false);
83 tRes.tested("gotoEndOfWord()", oObj.gotoEndOfWord(false) );
86 /**
87 * Move cursor to the start, then to the end. After that the
88 * method is called and returned value is checked. <p>
89 * Has <b>OK</b> status if the method returns <code>true</code>.
91 public void _isEndOfWord(){
92 log.println("gotoStartOfWord() = " + oObj.gotoStartOfWord(false)) ;
93 log.println("gotoEndOfWord() = " + oObj.gotoEndOfWord(false));
95 tRes.tested("isEndOfWord()", oObj.isEndOfWord() );
98 /**
99 * Move cursor to the end, then to the start. After that the
100 * method is called and returned value is checked. <p>
101 * Has <b>OK</b> status if the method returns <code>true</code>.
103 public void _isStartOfWord(){
105 oObj.gotoEndOfWord(false);
106 oObj.gotoStartOfWord(false);
107 tRes.tested("isStartOfWord()", oObj.isStartOfWord() );
111 * First moves the cursor to the start of the current word,
112 * then shifts it 2 symbols to the right. After that the
113 * method is called and returned value is checked.<p>
115 * Has <b>OK</b> status if method returns <code>true</code>.
117 public void _gotoStartOfWord(){
118 oObj.gotoStartOfWord(false);
119 oObj.goRight((short) 2, false) ;
120 tRes.tested("gotoStartOfWord()", oObj.gotoStartOfWord(false) );
123 } // finish class _XWordCursor