merge the formfield patch from ooo-build
[ooovba.git] / qadevOOo / tests / basic / ifc / text / XParagraphCursor / text_XParagraphCursor.xba
blob4fdfd745d4227e6bad6d29168db8a8491f798a5d
1 <?xml version="1.0" encoding="UTF-8"?>
2 <!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd">
3 <script:module xmlns:script="http://openoffice.org/2000/script" script:name="text_XParagraphCursor" script:language="StarBasic">
6 '*************************************************************************
8 ' DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
9 '
10 ' Copyright 2008 by Sun Microsystems, Inc.
12 ' OpenOffice.org - a multi-platform office productivity suite
14 ' $RCSfile: text_XParagraphCursor.xba,v $
16 ' $Revision: 1.3 $
18 ' This file is part of OpenOffice.org.
20 ' OpenOffice.org is free software: you can redistribute it and/or modify
21 ' it under the terms of the GNU Lesser General Public License version 3
22 ' only, as published by the Free Software Foundation.
24 ' OpenOffice.org is distributed in the hope that it will be useful,
25 ' but WITHOUT ANY WARRANTY; without even the implied warranty of
26 ' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
27 ' GNU Lesser General Public License version 3 for more details
28 ' (a copy is included in the LICENSE file that accompanied this code).
30 ' You should have received a copy of the GNU Lesser General Public License
31 ' version 3 along with OpenOffice.org. If not, see
32 ' <http://www.openoffice.org/license.html>
33 ' for a copy of the LGPLv3 License.
35 '*************************************************************************
36 '*************************************************************************
40 ' Be sure that all variables are dimensioned:
41 option explicit
43 '*************************************************************************
44 ' This Interface/Service test depends on the following GLOBAL variables,
45 ' which must be specified in the object creation:
47 ' - Global oText As Object
49 '*************************************************************************
55 Sub RunTest()
57 '*************************************************************************
58 ' INTERFACE:
59 ' com.sun.star.text.XParagraphCursor
60 '*************************************************************************
61 On Error Goto ErrHndl
62 Dim bOK As Boolean
63 Dim i As Integer
65 for i = 0 to 2
66 oText.insertString(oObj, "" + i +"Start of paragraph.", false)
67 oText.insertString(oObj, Chr(10) + cObjectName + " " + cIfcShortName + Chr(10), false)
68 oText.insertString(oObj, "Paragraph's end." + i, false)
69 oText.insertControlCharacter(oObj, com.sun.star.text.ControlCharacter.PARAGRAPH_BREAK, false)
70 next i
72 oObj.gotoStart(false)
74 Test.StartMethod("gotoStartOfParagraph()")
75 bOK = true
76 oObj.gotoStartOfParagraph(false)
77 oText.insertString(oObj, "1", false)
78 bOK = bOK AND inStr(1, oText.String, "10Start") &lt;&gt; 0
79 Test.MethodTested("gotoStartOfParagraph()", bOK)
81 Test.StartMethod("gotoEndOfParagraph()")
82 bOK = true
83 oObj.gotoEndOfParagraph(false)
84 oText.insertString(oObj, "2", false)
85 bOK = bOK AND inStr(1, oText.String, "end.02") &lt;&gt; 0
86 Test.MethodTested("gotoEndOfParagraph()", bOK)
88 Test.StartMethod("gotoNextParagraph()")
89 bOK = true
90 oObj.gotoNextParagraph(false)
91 oObj.gotoNextParagraph(false)
92 oObj.gotoEndOfParagraph(false)
93 oText.insertString(oObj, "3", false)
94 bOK = bOK AND inStr(1, oText.String, "end.23") &lt;&gt; 0
95 Test.MethodTested("gotoNextParagraph()", bOK)
97 Test.StartMethod("gotoPreviousParagraph()")
98 bOK = true
99 oObj.gotoPreviousParagraph(false)
100 oObj.gotoEndOfParagraph(false)
101 oText.insertString(oObj, "4", false)
102 bOK = bOK AND inStr(1, oText.String, "end.14") &lt;&gt; 0
103 Test.MethodTested("gotoPreviousParagraph()", bOK)
105 Test.StartMethod("isStartOfParagraph()")
106 bOK = true
107 oObj.gotoStartOfParagraph(false)
108 bOK = bOK AND oObj.isStartOfParagraph()
109 bOK = bOK AND NOT oObj.isEndOfParagraph()
110 Test.MethodTested("isStartOfParagraph()", bOK)
112 Test.StartMethod("isEndOfParagraph()")
113 bOK = true
114 oObj.gotoEndOfParagraph(false)
115 bOK = bOK AND oObj.isEndOfParagraph()
116 bOK = bOK AND NOT oObj.isStartOfParagraph()
117 Test.MethodTested("isEndOfParagraph()", bOK)
119 Exit Sub
120 ErrHndl:
121 Test.Exception()
122 bOK = false
123 resume next
124 End Sub
125 </script:module>