xref: /AOO41X/main/qadevOOo/tests/java/ifc/text/_XWordCursor.java (revision ef39d40d3f5e66cf3f035b3e93783012b340500d)
1*ef39d40dSAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*ef39d40dSAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*ef39d40dSAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*ef39d40dSAndrew Rist  * distributed with this work for additional information
6*ef39d40dSAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*ef39d40dSAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*ef39d40dSAndrew Rist  * "License"); you may not use this file except in compliance
9*ef39d40dSAndrew Rist  * with the License.  You may obtain a copy of the License at
10cdf0e10cSrcweir  *
11*ef39d40dSAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12cdf0e10cSrcweir  *
13*ef39d40dSAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*ef39d40dSAndrew Rist  * software distributed under the License is distributed on an
15*ef39d40dSAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*ef39d40dSAndrew Rist  * KIND, either express or implied.  See the License for the
17*ef39d40dSAndrew Rist  * specific language governing permissions and limitations
18*ef39d40dSAndrew Rist  * under the License.
19cdf0e10cSrcweir  *
20*ef39d40dSAndrew Rist  *************************************************************/
21*ef39d40dSAndrew Rist 
22*ef39d40dSAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir package ifc.text;
25cdf0e10cSrcweir 
26cdf0e10cSrcweir import lib.MultiMethodTest;
27cdf0e10cSrcweir 
28cdf0e10cSrcweir import com.sun.star.text.XWordCursor;
29cdf0e10cSrcweir 
30cdf0e10cSrcweir /**
31cdf0e10cSrcweir  * Testing <code>com.sun.star.text.XWordCursor</code>
32cdf0e10cSrcweir  * interface methods :
33cdf0e10cSrcweir  * <ul>
34cdf0e10cSrcweir  *  <li><code> isStartOfWord()</code></li>
35cdf0e10cSrcweir  *  <li><code> isEndOfWord()</code></li>
36cdf0e10cSrcweir  *  <li><code> gotoNextWord()</code></li>
37cdf0e10cSrcweir  *  <li><code> gotoPreviousWord()</code></li>
38cdf0e10cSrcweir  *  <li><code> gotoEndOfWord()</code></li>
39cdf0e10cSrcweir  *  <li><code> gotoStartOfWord()</code></li>
40cdf0e10cSrcweir  * </ul> <p>
41cdf0e10cSrcweir  * Test is <b> NOT </b> multithread compilant. <p>
42cdf0e10cSrcweir  * @see com.sun.star.text.XWordCursor
43cdf0e10cSrcweir  */
44cdf0e10cSrcweir public class _XWordCursor extends MultiMethodTest {
45cdf0e10cSrcweir 
46cdf0e10cSrcweir     public XWordCursor oObj = null;     // oObj filled by MultiMethodTest
47cdf0e10cSrcweir 
48cdf0e10cSrcweir     /**
49cdf0e10cSrcweir      * Moves the cursor to start of the text.
50cdf0e10cSrcweir      */
before()51cdf0e10cSrcweir     public void before() {
52cdf0e10cSrcweir         oObj.gotoStart(false);
53cdf0e10cSrcweir     }
54cdf0e10cSrcweir 
55cdf0e10cSrcweir     /**
56cdf0e10cSrcweir      * First moves the cursor to the next word to be sure that
57cdf0e10cSrcweir      * at least one word is situated before. Then moves cursor
58cdf0e10cSrcweir      * to the previous word and checks the value returned. <p>
59cdf0e10cSrcweir      *
60cdf0e10cSrcweir      * Has <b>OK</b> status if method returns <code>true</code>.
61cdf0e10cSrcweir      */
_gotoPreviousWord()62cdf0e10cSrcweir     public void _gotoPreviousWord(){
63cdf0e10cSrcweir         oObj.gotoNextWord(false);
64cdf0e10cSrcweir         tRes.tested("gotoPreviousWord()", oObj.gotoPreviousWord(false) );
65cdf0e10cSrcweir     }
66cdf0e10cSrcweir 
67cdf0e10cSrcweir     /**
68cdf0e10cSrcweir      * First moves the cursor to the previous word to be sure that
69cdf0e10cSrcweir      * at least one word is situated after. Then moves cursor
70cdf0e10cSrcweir      * to the next word and checks the value returned. <p>
71cdf0e10cSrcweir      *
72cdf0e10cSrcweir      * Has <b>OK</b> status if method returns <code>true</code>.
73cdf0e10cSrcweir      */
_gotoNextWord()74cdf0e10cSrcweir     public void _gotoNextWord(){
75cdf0e10cSrcweir         oObj.gotoPreviousWord(false) ;
76cdf0e10cSrcweir         tRes.tested("gotoNextWord()", oObj.gotoNextWord(false) );
77cdf0e10cSrcweir     }
78cdf0e10cSrcweir 
79cdf0e10cSrcweir     /**
80cdf0e10cSrcweir      * First moves the cursor to the start of the current word,
81cdf0e10cSrcweir      * then to the end and checks the value returned. <p>
82cdf0e10cSrcweir      *
83cdf0e10cSrcweir      * Has <b>OK</b> status if method returns <code>true</code>.
84cdf0e10cSrcweir      */
_gotoEndOfWord()85cdf0e10cSrcweir     public void _gotoEndOfWord(){
86cdf0e10cSrcweir         oObj.gotoStart(false);
87cdf0e10cSrcweir         tRes.tested("gotoEndOfWord()", oObj.gotoEndOfWord(false) );
88cdf0e10cSrcweir     }
89cdf0e10cSrcweir 
90cdf0e10cSrcweir     /**
91cdf0e10cSrcweir      * Move cursor to the start, then to the end. After that the
92cdf0e10cSrcweir      * method is called and returned value is checked. <p>
93cdf0e10cSrcweir      * Has <b>OK</b> status if the method returns <code>true</code>.
94cdf0e10cSrcweir      */
_isEndOfWord()95cdf0e10cSrcweir     public void _isEndOfWord(){
96cdf0e10cSrcweir         log.println("gotoStartOfWord() = " + oObj.gotoStartOfWord(false)) ;
97cdf0e10cSrcweir         log.println("gotoEndOfWord() = " + oObj.gotoEndOfWord(false));
98cdf0e10cSrcweir 
99cdf0e10cSrcweir         tRes.tested("isEndOfWord()", oObj.isEndOfWord() );
100cdf0e10cSrcweir     }
101cdf0e10cSrcweir 
102cdf0e10cSrcweir     /**
103cdf0e10cSrcweir      * Move cursor to the end, then to the start. After that the
104cdf0e10cSrcweir      * method is called and returned value is checked. <p>
105cdf0e10cSrcweir      * Has <b>OK</b> status if the method returns <code>true</code>.
106cdf0e10cSrcweir      */
_isStartOfWord()107cdf0e10cSrcweir     public void _isStartOfWord(){
108cdf0e10cSrcweir 
109cdf0e10cSrcweir         oObj.gotoEndOfWord(false);
110cdf0e10cSrcweir         oObj.gotoStartOfWord(false);
111cdf0e10cSrcweir         tRes.tested("isStartOfWord()", oObj.isStartOfWord() );
112cdf0e10cSrcweir     }
113cdf0e10cSrcweir 
114cdf0e10cSrcweir     /**
115cdf0e10cSrcweir      * First moves the cursor to the start of the current word,
116cdf0e10cSrcweir      * then shifts it 2 symbols to the right. After that the
117cdf0e10cSrcweir      * method is called and returned value is checked.<p>
118cdf0e10cSrcweir      *
119cdf0e10cSrcweir      * Has <b>OK</b> status if method returns <code>true</code>.
120cdf0e10cSrcweir      */
_gotoStartOfWord()121cdf0e10cSrcweir     public void _gotoStartOfWord(){
122cdf0e10cSrcweir         oObj.gotoStartOfWord(false);
123cdf0e10cSrcweir         oObj.goRight((short) 2, false) ;
124cdf0e10cSrcweir         tRes.tested("gotoStartOfWord()", oObj.gotoStartOfWord(false) );
125cdf0e10cSrcweir     }
126cdf0e10cSrcweir 
127cdf0e10cSrcweir  }  // finish class _XWordCursor
128cdf0e10cSrcweir 
129