Update ooo320-m1
[ooovba.git] / qadevOOo / tests / java / ifc / text / _XParagraphCursor.java
blob33af5dcb627202cedf120bf3f36411a57fc3e29f
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: _XParagraphCursor.java,v $
10 * $Revision: 1.4 $
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 ************************************************************************/
31 package ifc.text;
33 import lib.MultiMethodTest;
34 import util.XInstCreator;
36 import com.sun.star.text.XParagraphCursor;
38 /**
39 * Testing <code>com.sun.star.text.XParagraphCursor</code>
40 * interface methods :
41 * <ul>
42 * <li><code> isStartOfParagraph()</code></li>
43 * <li><code> isEndOfParagraph()</code></li>
44 * <li><code> gotoStartOfParagraph()</code></li>
45 * <li><code> gotoEndOfParagraph()</code></li>
46 * <li><code> gotoNextParagraph()</code></li>
47 * <li><code> gotoPreviousParagraph()</code></li>
48 * </ul> <p>
50 * <b>Prerequisites :</b> the text must have at least
51 * two paragraphs. <p>
53 * Test is <b> NOT </b> multithread compilant. <p>
54 * @see com.sun.star.text.XParagraphCursor
56 public class _XParagraphCursor extends MultiMethodTest {
58 public XParagraphCursor oObj = null; // oObj filled by MultiMethodTest
59 XInstCreator info = null; // instance creator
61 /**
62 * Test calls the method. <p>
63 * Has <b> OK </b> status if the method returns
64 * <code>true</code> value.
66 public void _gotoEndOfParagraph(){
67 log.println( "test for gotoEndOfParagraph()" );
68 if (oObj.isEndOfParagraph()) log.println("This is the end of the paragraph");
69 else log.println("This isn't the end of the paragraph");
70 log.println("gotoEndOfParagraph()");
71 boolean result = oObj.gotoEndOfParagraph(false);
72 tRes.tested("gotoEndOfParagraph()", result );
73 if (oObj.isEndOfParagraph()) log.println("This is the end of the paragraph");
74 else log.println("This isn't the end of the paragraph");
75 if (!result) log.println("But 'gotoEndOfParagraph()' returns false");
78 /**
79 * Test calls the method. <p>
80 * Has <b> OK </b> status if the method returns
81 * <code>true</code> value. <p>
83 * The following method tests are to be completed successfully before :
84 * <ul>
85 * <li> <code>gotoPreviousParagraph()</code> : to be sure next paragraph
86 * exists. </li>
87 * </ul>
89 public void _gotoNextParagraph(){
90 requiredMethod( "gotoPreviousParagraph()" );
91 log.println( "test for gotoNextParagraph()" );
92 tRes.tested("gotoNextParagraph()", oObj.gotoNextParagraph(false) );
95 /**
96 * First moves the cursor to the next paragraph to be sure
97 * that previous paragraph exists and then calls the method. <p>
98 * Has <b> OK </b> status if the method returns
99 * <code>true</code> value.
101 public void _gotoPreviousParagraph(){
102 //requiredMethod( "gotoNextParagraph()" );
103 oObj.gotoNextParagraph(false);
104 log.println( "test for gotoPreviousParagraph()" );
105 tRes.tested("gotoPreviousParagraph()", oObj.gotoPreviousParagraph(false) );
109 * Test calls the method. <p>
110 * Has <b> OK </b> status if the method returns
111 * <code>true</code> value.
113 public void _gotoStartOfParagraph(){
114 log.println( "test for gotoStartOfParagraph()" );
115 tRes.tested("gotoStartOfParagraph()", oObj.gotoStartOfParagraph(false) );
119 * Moves the cursor to the end of paragraph then check if it is
120 * at the end. <p>
121 * Has <b> OK </b> status if the method returns
122 * <code>true</code> value.
124 public void _isEndOfParagraph(){
125 oObj.gotoEndOfParagraph(false);
126 log.println( "test for isEndOfParagraph()" );
127 tRes.tested("isEndOfParagraph()", oObj.isEndOfParagraph() );
131 * Moves the cursor to the start of paragraph then check if it is
132 * at the start. <p>
133 * Has <b> OK </b> status if the method returns
134 * <code>true</code> value.
136 public void _isStartOfParagraph(){
137 oObj.gotoStartOfParagraph(false);
138 log.println( "test for isStartOfParagraph()" );
139 tRes.tested("isStartOfParagraph()", oObj.isStartOfParagraph() );
142 } // finish class _XParagraphCursor