xref: /AOO41X/main/qadevOOo/tests/java/ifc/text/_XWordCursor.java (revision cdf0e10c4e3984b49a9502b011690b615761d4a3)
1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 package ifc.text;
29 
30 import lib.MultiMethodTest;
31 
32 import com.sun.star.text.XWordCursor;
33 
34 /**
35  * Testing <code>com.sun.star.text.XWordCursor</code>
36  * interface methods :
37  * <ul>
38  *  <li><code> isStartOfWord()</code></li>
39  *  <li><code> isEndOfWord()</code></li>
40  *  <li><code> gotoNextWord()</code></li>
41  *  <li><code> gotoPreviousWord()</code></li>
42  *  <li><code> gotoEndOfWord()</code></li>
43  *  <li><code> gotoStartOfWord()</code></li>
44  * </ul> <p>
45  * Test is <b> NOT </b> multithread compilant. <p>
46  * @see com.sun.star.text.XWordCursor
47  */
48 public class _XWordCursor extends MultiMethodTest {
49 
50     public XWordCursor oObj = null;     // oObj filled by MultiMethodTest
51 
52     /**
53      * Moves the cursor to start of the text.
54      */
55     public void before() {
56         oObj.gotoStart(false);
57     }
58 
59     /**
60      * First moves the cursor to the next word to be sure that
61      * at least one word is situated before. Then moves cursor
62      * to the previous word and checks the value returned. <p>
63      *
64      * Has <b>OK</b> status if method returns <code>true</code>.
65      */
66     public void _gotoPreviousWord(){
67         oObj.gotoNextWord(false);
68         tRes.tested("gotoPreviousWord()", oObj.gotoPreviousWord(false) );
69     }
70 
71     /**
72      * First moves the cursor to the previous word to be sure that
73      * at least one word is situated after. Then moves cursor
74      * to the next word and checks the value returned. <p>
75      *
76      * Has <b>OK</b> status if method returns <code>true</code>.
77      */
78     public void _gotoNextWord(){
79         oObj.gotoPreviousWord(false) ;
80         tRes.tested("gotoNextWord()", oObj.gotoNextWord(false) );
81     }
82 
83     /**
84      * First moves the cursor to the start of the current word,
85      * then to the end and checks the value returned. <p>
86      *
87      * Has <b>OK</b> status if method returns <code>true</code>.
88      */
89     public void _gotoEndOfWord(){
90         oObj.gotoStart(false);
91         tRes.tested("gotoEndOfWord()", oObj.gotoEndOfWord(false) );
92     }
93 
94     /**
95      * Move cursor to the start, then to the end. After that the
96      * method is called and returned value is checked. <p>
97      * Has <b>OK</b> status if the method returns <code>true</code>.
98      */
99     public void _isEndOfWord(){
100         log.println("gotoStartOfWord() = " + oObj.gotoStartOfWord(false)) ;
101         log.println("gotoEndOfWord() = " + oObj.gotoEndOfWord(false));
102 
103         tRes.tested("isEndOfWord()", oObj.isEndOfWord() );
104     }
105 
106     /**
107      * Move cursor to the end, then to the start. After that the
108      * method is called and returned value is checked. <p>
109      * Has <b>OK</b> status if the method returns <code>true</code>.
110      */
111     public void _isStartOfWord(){
112 
113         oObj.gotoEndOfWord(false);
114         oObj.gotoStartOfWord(false);
115         tRes.tested("isStartOfWord()", oObj.isStartOfWord() );
116     }
117 
118     /**
119      * First moves the cursor to the start of the current word,
120      * then shifts it 2 symbols to the right. After that the
121      * method is called and returned value is checked.<p>
122      *
123      * Has <b>OK</b> status if method returns <code>true</code>.
124      */
125     public void _gotoStartOfWord(){
126         oObj.gotoStartOfWord(false);
127         oObj.goRight((short) 2, false) ;
128         tRes.tested("gotoStartOfWord()", oObj.gotoStartOfWord(false) );
129     }
130 
131  }  // finish class _XWordCursor
132 
133