Avoid potential negative array index access to cached text.
[LibreOffice.git] / qadevOOo / tests / java / ifc / text / _XSentenceCursor.java
blob7729f42a61ae1e8baac1c7ddd973011f106b721d
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.XSentenceCursor;
25 /**
26 * Testing <code>com.sun.star.text.XSentenceCursor</code>
27 * interface methods :
28 * <ul>
29 * <li><code> isStartOfSentence()</code></li>
30 * <li><code> isEndOfSentence()</code></li>
31 * <li><code> gotoNextSentence()</code></li>
32 * <li><code> gotoPreviousSentence()</code></li>
33 * <li><code> gotoStartOfSentence()</code></li>
34 * <li><code> gotoEndOfSentence()</code></li>
35 * </ul> <p>
36 * Test is <b> NOT </b> multithread compliant. <p>
37 * @see com.sun.star.text.XSentenceCursor
39 public class _XSentenceCursor extends MultiMethodTest {
41 public XSentenceCursor oObj = null; // oObj filled by MultiMethodTest
43 /**
44 * First goes to next sentence (to be sure that previous exists),
45 * then calls the method. <p>
47 * Has <b>OK</b> status if the method returns <code>true</code>.
49 public void _gotoPreviousSentence(){
50 oObj.gotoNextSentence(false);
51 oObj.gotoNextSentence(false);
52 tRes.tested("gotoPreviousSentence()", oObj.gotoPreviousSentence(false) );
55 /**
56 * First goes to previous sentence (to be sure that next exists),
57 * then calls the method. <p>
59 * Has <b>OK</b> status if the method returns <code>true</code>.
61 public void _gotoNextSentence(){
62 oObj.gotoPreviousSentence(false) ;
63 oObj.gotoPreviousSentence(false) ;
64 tRes.tested("gotoNextSentence()", oObj.gotoNextSentence(false) );
67 /**
68 * Test calls the method. <p>
69 * Has <b> OK </b> status if the method returns <code>true</code>. <p>
70 * The following method tests are to be completed successfully before :
71 * <ul>
72 * <li> <code> gotoPreviousSentence() </code> : to be sure the
73 * cursor is in range of some sentence. </li>
74 * </ul>
76 public void _gotoEndOfSentence(){
77 requiredMethod( "gotoPreviousSentence()" );
78 tRes.tested("gotoEndOfSentence()", oObj.gotoEndOfSentence(false) );
81 /**
82 * Test calls the method. <p>
83 * Has <b> OK </b> status if the method returns <code>true</code>. <p>
84 * The following method tests are to be completed successfully before :
85 * <ul>
86 * <li> <code> gotoPreviousSentence() </code> : to be sure the
87 * cursor is in range of some sentence. </li>
88 * </ul>
90 public void _gotoStartOfSentence(){
91 requiredMethod( "gotoPreviousSentence()" );
92 tRes.tested("gotoStartOfSentence()", oObj.gotoStartOfSentence(false) );
95 /**
96 * First moves the cursor to the start of sentence and then calls
97 * the method. <p>
99 * Has <b>OK</b> status if the method returns <code>true</code>.
101 public void _isStartOfSentence(){
102 oObj.gotoStartOfSentence(false) ;
103 tRes.tested("isStartOfSentence()", oObj.isStartOfSentence() );
107 * First moves the cursor to the end of sentence and then calls
108 * the method. <p>
110 * Has <b>OK</b> status if the method returns <code>true</code>.
112 public void _isEndOfSentence(){
113 oObj.gotoEndOfSentence(false) ;
114 tRes.tested("isEndOfSentence()", oObj.isEndOfSentence() );
117 } // finish class _XSentenceCursor