1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: _XWordCursor.java,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
33 import lib
.MultiMethodTest
;
35 import com
.sun
.star
.text
.XWordCursor
;
38 * Testing <code>com.sun.star.text.XWordCursor</code>
41 * <li><code> isStartOfWord()</code></li>
42 * <li><code> isEndOfWord()</code></li>
43 * <li><code> gotoNextWord()</code></li>
44 * <li><code> gotoPreviousWord()</code></li>
45 * <li><code> gotoEndOfWord()</code></li>
46 * <li><code> gotoStartOfWord()</code></li>
48 * Test is <b> NOT </b> multithread compilant. <p>
49 * @see com.sun.star.text.XWordCursor
51 public class _XWordCursor
extends MultiMethodTest
{
53 public XWordCursor oObj
= null; // oObj filled by MultiMethodTest
56 * Moves the cursor to start of the text.
58 public void before() {
59 oObj
.gotoStart(false);
63 * First moves the cursor to the next word to be sure that
64 * at least one word is situated before. Then moves cursor
65 * to the previous word and checks the value returned. <p>
67 * Has <b>OK</b> status if method returns <code>true</code>.
69 public void _gotoPreviousWord(){
70 oObj
.gotoNextWord(false);
71 tRes
.tested("gotoPreviousWord()", oObj
.gotoPreviousWord(false) );
75 * First moves the cursor to the previous word to be sure that
76 * at least one word is situated after. Then moves cursor
77 * to the next word and checks the value returned. <p>
79 * Has <b>OK</b> status if method returns <code>true</code>.
81 public void _gotoNextWord(){
82 oObj
.gotoPreviousWord(false) ;
83 tRes
.tested("gotoNextWord()", oObj
.gotoNextWord(false) );
87 * First moves the cursor to the start of the current word,
88 * then to the end and checks the value returned. <p>
90 * Has <b>OK</b> status if method returns <code>true</code>.
92 public void _gotoEndOfWord(){
93 oObj
.gotoStart(false);
94 tRes
.tested("gotoEndOfWord()", oObj
.gotoEndOfWord(false) );
98 * Move cursor to the start, then to the end. After that the
99 * method is called and returned value is checked. <p>
100 * Has <b>OK</b> status if the method returns <code>true</code>.
102 public void _isEndOfWord(){
103 log
.println("gotoStartOfWord() = " + oObj
.gotoStartOfWord(false)) ;
104 log
.println("gotoEndOfWord() = " + oObj
.gotoEndOfWord(false));
106 tRes
.tested("isEndOfWord()", oObj
.isEndOfWord() );
110 * Move cursor to the end, then to the start. After that the
111 * method is called and returned value is checked. <p>
112 * Has <b>OK</b> status if the method returns <code>true</code>.
114 public void _isStartOfWord(){
116 oObj
.gotoEndOfWord(false);
117 oObj
.gotoStartOfWord(false);
118 tRes
.tested("isStartOfWord()", oObj
.isStartOfWord() );
122 * First moves the cursor to the start of the current word,
123 * then shifts it 2 symbols to the right. After that the
124 * method is called and returned value is checked.<p>
126 * Has <b>OK</b> status if method returns <code>true</code>.
128 public void _gotoStartOfWord(){
129 oObj
.gotoStartOfWord(false);
130 oObj
.goRight((short) 2, false) ;
131 tRes
.tested("gotoStartOfWord()", oObj
.gotoStartOfWord(false) );
134 } // finish class _XWordCursor