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_XWordCursor" script:language="StarBasic">
4
5
6'*************************************************************************
7'
8'  Licensed to the Apache Software Foundation (ASF) under one
9'  or more contributor license agreements.  See the NOTICE file
10'  distributed with this work for additional information
11'  regarding copyright ownership.  The ASF licenses this file
12'  to you under the Apache License, Version 2.0 (the
13'  "License"); you may not use this file except in compliance
14'  with the License.  You may obtain a copy of the License at
15'
16'    http://www.apache.org/licenses/LICENSE-2.0
17'
18'  Unless required by applicable law or agreed to in writing,
19'  software distributed under the License is distributed on an
20'  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
21'  KIND, either express or implied.  See the License for the
22'  specific language governing permissions and limitations
23'  under the License.
24'
25'*************************************************************************
26
27
28
29
30
31
32
33Sub RunTest()
34
35'*************************************************************************
36' INTERFACE:
37' com.sun.star.text.XWordCursor
38'*************************************************************************
39On Error Goto ErrHndl
40    Dim bOK As Boolean
41
42    oObj.Text.string = "1Word1: 2Word2, 3Word3."
43    oObj.gotoStart(false)
44
45    Test.StartMethod("gotoStartOfWord()")
46    bOK = true
47    oObj.gotoStartOfWord(false)
48    oObj.String = "1"
49    bOK = bOK AND inStr(1, oObj.Text.String, "11W") &lt;&gt; 0
50    Test.MethodTested("gotoStartOfWord()", bOK)
51
52    Test.StartMethod("gotoEndOfWord()")
53    bOK = true
54    oObj.gotoEndOfWord(false)
55    oObj.String = "2"
56    bOK = bOK AND inStr(1, oObj.Text.String, "d12") &lt;&gt; 0
57    Test.MethodTested("gotoEndOfWord()", bOK)
58
59    Test.StartMethod("gotoNextWord()")
60    bOK = true
61    oObj.gotoNextWord(false)
62    oObj.gotoNextWord(false)
63    oObj.gotoEndOfWord(false)
64    oObj.String = "3"
65    bOK = bOK AND inStr(1, oObj.Text.String, "d33") &lt;&gt; 0
66    Test.MethodTested("gotoNextWord()", bOK)
67
68    Test.StartMethod("gotoPreviousWord()")
69    bOK = true
70    oObj.gotoPreviousWord(false)
71    oObj.gotoStartOfWord(false)
72    oObj.String = "4"
73    bOK = bOK AND inStr(1, oObj.Text.String, "42W") &lt;&gt; 0
74    Test.MethodTested("gotoPreviousWord()", bOK)
75
76    Test.StartMethod("isStartOfWord()")
77    bOK = true
78    oObj.gotoStartOfWord(false)
79    bOK = bOK AND oObj.isStartOfWord()
80    Test.MethodTested("isStartOfWord()", bOK)
81
82    Test.StartMethod("isEndOfWord()")
83    bOK = true
84    oObj.gotoEndOfWord(false)
85    bOK = bOK AND oObj.isEndOfWord()
86    Test.MethodTested("isEndOfWord()", bOK)
87
88Exit Sub
89ErrHndl:
90    Test.Exception()
91    bOK = false
92    resume next
93End Sub
94</script:module>
95