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