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
10*ef39d40dSAndrew Rist  *
11*ef39d40dSAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*ef39d40dSAndrew Rist  *
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.
19*ef39d40dSAndrew Rist  *
20*ef39d40dSAndrew Rist  *************************************************************/
21*ef39d40dSAndrew Rist 
22*ef39d40dSAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir package ifc.text;
25cdf0e10cSrcweir 
26cdf0e10cSrcweir import lib.MultiMethodTest;
27cdf0e10cSrcweir import util.XInstCreator;
28cdf0e10cSrcweir 
29cdf0e10cSrcweir import com.sun.star.text.XParagraphCursor;
30cdf0e10cSrcweir 
31cdf0e10cSrcweir /**
32cdf0e10cSrcweir  * Testing <code>com.sun.star.text.XParagraphCursor</code>
33cdf0e10cSrcweir  * interface methods :
34cdf0e10cSrcweir  * <ul>
35cdf0e10cSrcweir  *  <li><code> isStartOfParagraph()</code></li>
36cdf0e10cSrcweir  *  <li><code> isEndOfParagraph()</code></li>
37cdf0e10cSrcweir  *  <li><code> gotoStartOfParagraph()</code></li>
38cdf0e10cSrcweir  *  <li><code> gotoEndOfParagraph()</code></li>
39cdf0e10cSrcweir  *  <li><code> gotoNextParagraph()</code></li>
40cdf0e10cSrcweir  *  <li><code> gotoPreviousParagraph()</code></li>
41cdf0e10cSrcweir  * </ul> <p>
42cdf0e10cSrcweir  *
43cdf0e10cSrcweir  * <b>Prerequisites :</b> the text must have at least
44cdf0e10cSrcweir  * two paragraphs. <p>
45cdf0e10cSrcweir  *
46cdf0e10cSrcweir  * Test is <b> NOT </b> multithread compilant. <p>
47cdf0e10cSrcweir  * @see com.sun.star.text.XParagraphCursor
48cdf0e10cSrcweir  */
49cdf0e10cSrcweir public class _XParagraphCursor extends MultiMethodTest {
50cdf0e10cSrcweir 
51cdf0e10cSrcweir     public XParagraphCursor oObj = null;     // oObj filled by MultiMethodTest
52cdf0e10cSrcweir     XInstCreator info = null;               // instance creator
53cdf0e10cSrcweir 
54cdf0e10cSrcweir     /**
55cdf0e10cSrcweir      * Test calls the method. <p>
56cdf0e10cSrcweir      * Has <b> OK </b> status if the method returns
57cdf0e10cSrcweir      * <code>true</code> value.
58cdf0e10cSrcweir      */
_gotoEndOfParagraph()59cdf0e10cSrcweir     public void _gotoEndOfParagraph(){
60cdf0e10cSrcweir         log.println( "test for gotoEndOfParagraph()" );
61cdf0e10cSrcweir         if (oObj.isEndOfParagraph()) log.println("This is the end of the paragraph");
62cdf0e10cSrcweir                                     else log.println("This isn't the end of the paragraph");
63cdf0e10cSrcweir         log.println("gotoEndOfParagraph()");
64cdf0e10cSrcweir         boolean result = oObj.gotoEndOfParagraph(false);
65cdf0e10cSrcweir         tRes.tested("gotoEndOfParagraph()", result );
66cdf0e10cSrcweir         if (oObj.isEndOfParagraph()) log.println("This is the end of the paragraph");
67cdf0e10cSrcweir                                     else log.println("This isn't the end of the paragraph");
68cdf0e10cSrcweir         if (!result) log.println("But 'gotoEndOfParagraph()' returns false");
69cdf0e10cSrcweir     }
70cdf0e10cSrcweir 
71cdf0e10cSrcweir     /**
72cdf0e10cSrcweir      * Test calls the method. <p>
73cdf0e10cSrcweir      * Has <b> OK </b> status if the method returns
74cdf0e10cSrcweir      * <code>true</code> value. <p>
75cdf0e10cSrcweir      *
76cdf0e10cSrcweir      * The following method tests are to be completed successfully before :
77cdf0e10cSrcweir      * <ul>
78cdf0e10cSrcweir      *  <li> <code>gotoPreviousParagraph()</code> : to be sure next paragraph
79cdf0e10cSrcweir      *   exists. </li>
80cdf0e10cSrcweir      * </ul>
81cdf0e10cSrcweir      */
_gotoNextParagraph()82cdf0e10cSrcweir     public void _gotoNextParagraph(){
83cdf0e10cSrcweir         requiredMethod( "gotoPreviousParagraph()" );
84cdf0e10cSrcweir         log.println( "test for gotoNextParagraph()" );
85cdf0e10cSrcweir         tRes.tested("gotoNextParagraph()", oObj.gotoNextParagraph(false) );
86cdf0e10cSrcweir     }
87cdf0e10cSrcweir 
88cdf0e10cSrcweir     /**
89cdf0e10cSrcweir      * First moves the cursor to the next paragraph to be sure
90cdf0e10cSrcweir      * that previous paragraph exists and then calls the method. <p>
91cdf0e10cSrcweir      * Has <b> OK </b> status if the method returns
92cdf0e10cSrcweir      * <code>true</code> value.
93cdf0e10cSrcweir      */
_gotoPreviousParagraph()94cdf0e10cSrcweir     public void _gotoPreviousParagraph(){
95cdf0e10cSrcweir         //requiredMethod( "gotoNextParagraph()" );
96cdf0e10cSrcweir         oObj.gotoNextParagraph(false);
97cdf0e10cSrcweir         log.println( "test for gotoPreviousParagraph()" );
98cdf0e10cSrcweir         tRes.tested("gotoPreviousParagraph()", oObj.gotoPreviousParagraph(false) );
99cdf0e10cSrcweir     }
100cdf0e10cSrcweir 
101cdf0e10cSrcweir     /**
102cdf0e10cSrcweir      * Test calls the method. <p>
103cdf0e10cSrcweir      * Has <b> OK </b> status if the method returns
104cdf0e10cSrcweir      * <code>true</code> value.
105cdf0e10cSrcweir      */
_gotoStartOfParagraph()106cdf0e10cSrcweir     public void _gotoStartOfParagraph(){
107cdf0e10cSrcweir         log.println( "test for gotoStartOfParagraph()" );
108cdf0e10cSrcweir         tRes.tested("gotoStartOfParagraph()", oObj.gotoStartOfParagraph(false) );
109cdf0e10cSrcweir     }
110cdf0e10cSrcweir 
111cdf0e10cSrcweir     /**
112cdf0e10cSrcweir      * Moves the cursor to the end of paragraph then check if it is
113cdf0e10cSrcweir      * at the end. <p>
114cdf0e10cSrcweir      * Has <b> OK </b> status if the method returns
115cdf0e10cSrcweir      * <code>true</code> value.
116cdf0e10cSrcweir      */
_isEndOfParagraph()117cdf0e10cSrcweir     public void _isEndOfParagraph(){
118cdf0e10cSrcweir         oObj.gotoEndOfParagraph(false);
119cdf0e10cSrcweir         log.println( "test for isEndOfParagraph()" );
120cdf0e10cSrcweir         tRes.tested("isEndOfParagraph()", oObj.isEndOfParagraph() );
121cdf0e10cSrcweir     }
122cdf0e10cSrcweir 
123cdf0e10cSrcweir     /**
124cdf0e10cSrcweir      * Moves the cursor to the start of paragraph then check if it is
125cdf0e10cSrcweir      * at the start. <p>
126cdf0e10cSrcweir      * Has <b> OK </b> status if the method returns
127cdf0e10cSrcweir      * <code>true</code> value.
128cdf0e10cSrcweir      */
_isStartOfParagraph()129cdf0e10cSrcweir     public void _isStartOfParagraph(){
130cdf0e10cSrcweir         oObj.gotoStartOfParagraph(false);
131cdf0e10cSrcweir         log.println( "test for isStartOfParagraph()" );
132cdf0e10cSrcweir         tRes.tested("isStartOfParagraph()", oObj.isStartOfParagraph() );
133cdf0e10cSrcweir     }
134cdf0e10cSrcweir 
135cdf0e10cSrcweir  }  // finish class _XParagraphCursor
136cdf0e10cSrcweir 
137