2 * This file is part of the LibreOffice project.
4 * This Source Code Form is subject to the terms of the Mozilla Public
5 * License, v. 2.0. If a copy of the MPL was not distributed with this
6 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 * This file incorporates work covered by the following license notice:
10 * Licensed to the Apache Software Foundation (ASF) under one or more
11 * contributor license agreements. See the NOTICE file distributed
12 * with this work for additional information regarding copyright
13 * ownership. The ASF licenses this file to you under the Apache
14 * License, Version 2.0 (the "License"); you may not use this file
15 * except in compliance with the License. You may obtain a copy of
16 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
21 import lib
.MultiMethodTest
;
22 import util
.XInstCreator
;
24 import com
.sun
.star
.text
.XParagraphCursor
;
27 * Testing <code>com.sun.star.text.XParagraphCursor</code>
30 * <li><code> isStartOfParagraph()</code></li>
31 * <li><code> isEndOfParagraph()</code></li>
32 * <li><code> gotoStartOfParagraph()</code></li>
33 * <li><code> gotoEndOfParagraph()</code></li>
34 * <li><code> gotoNextParagraph()</code></li>
35 * <li><code> gotoPreviousParagraph()</code></li>
38 * <b>Prerequisites :</b> the text must have at least
41 * Test is <b> NOT </b> multithread compliant. <p>
42 * @see com.sun.star.text.XParagraphCursor
44 public class _XParagraphCursor
extends MultiMethodTest
{
46 public XParagraphCursor oObj
= null; // oObj filled by MultiMethodTest
47 XInstCreator info
= null; // instance creator
50 * Test calls the method. <p>
51 * Has <b> OK </b> status if the method returns
52 * <code>true</code> value.
54 public void _gotoEndOfParagraph(){
55 log
.println( "test for gotoEndOfParagraph()" );
56 if (oObj
.isEndOfParagraph()) log
.println("This is the end of the paragraph");
57 else log
.println("This isn't the end of the paragraph");
58 log
.println("gotoEndOfParagraph()");
59 boolean result
= oObj
.gotoEndOfParagraph(false);
60 tRes
.tested("gotoEndOfParagraph()", result
);
61 if (oObj
.isEndOfParagraph()) log
.println("This is the end of the paragraph");
62 else log
.println("This isn't the end of the paragraph");
63 if (!result
) log
.println("But 'gotoEndOfParagraph()' returns false");
67 * Test calls the method. <p>
68 * Has <b> OK </b> status if the method returns
69 * <code>true</code> value. <p>
71 * The following method tests are to be completed successfully before :
73 * <li> <code>gotoPreviousParagraph()</code> : to be sure next paragraph
77 public void _gotoNextParagraph(){
78 requiredMethod( "gotoPreviousParagraph()" );
79 log
.println( "test for gotoNextParagraph()" );
80 tRes
.tested("gotoNextParagraph()", oObj
.gotoNextParagraph(false) );
84 * First moves the cursor to the next paragraph to be sure
85 * that previous paragraph exists and then calls the method. <p>
86 * Has <b> OK </b> status if the method returns
87 * <code>true</code> value.
89 public void _gotoPreviousParagraph(){
90 //requiredMethod( "gotoNextParagraph()" );
91 oObj
.gotoNextParagraph(false);
92 log
.println( "test for gotoPreviousParagraph()" );
93 tRes
.tested("gotoPreviousParagraph()", oObj
.gotoPreviousParagraph(false) );
97 * Test calls the method. <p>
98 * Has <b> OK </b> status if the method returns
99 * <code>true</code> value.
101 public void _gotoStartOfParagraph(){
102 log
.println( "test for gotoStartOfParagraph()" );
103 tRes
.tested("gotoStartOfParagraph()", oObj
.gotoStartOfParagraph(false) );
107 * Moves the cursor to the end of paragraph then check if it is
109 * Has <b> OK </b> status if the method returns
110 * <code>true</code> value.
112 public void _isEndOfParagraph(){
113 oObj
.gotoEndOfParagraph(false);
114 log
.println( "test for isEndOfParagraph()" );
115 tRes
.tested("isEndOfParagraph()", oObj
.isEndOfParagraph() );
119 * Moves the cursor to the start of paragraph then check if it is
121 * Has <b> OK </b> status if the method returns
122 * <code>true</code> value.
124 public void _isStartOfParagraph(){
125 oObj
.gotoStartOfParagraph(false);
126 log
.println( "test for isStartOfParagraph()" );
127 tRes
.tested("isStartOfParagraph()", oObj
.isStartOfParagraph() );
130 } // finish class _XParagraphCursor