1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2000, 2010 Oracle and/or its affiliates.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * This file is part of OpenOffice.org.
11 * OpenOffice.org is free software: you can redistribute it and/or modify
12 * it under the terms of the GNU Lesser General Public License version 3
13 * only, as published by the Free Software Foundation.
15 * OpenOffice.org is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU Lesser General Public License version 3 for more details
19 * (a copy is included in the LICENSE file that accompanied this code).
21 * You should have received a copy of the GNU Lesser General Public License
22 * version 3 along with OpenOffice.org. If not, see
23 * <http://www.openoffice.org/license.html>
24 * for a copy of the LGPLv3 License.
26 ************************************************************************/
30 import lib
.MultiMethodTest
;
32 import com
.sun
.star
.io
.XMarkableStream
;
35 * Testing <code>com.sun.star.io.XMarkableStream</code>
38 * <li><code>createMark()</code></li>
39 * <li><code>deleteMark()</code></li>
40 * <li><code>jumpToFurthest()</code></li>
41 * <li><code>jumpToMark()</code></li>
42 * <li><code>offsetToMark()</code></li>
44 * @see com.sun.star.io.XMarkableStream
46 public class _XMarkableStream
extends MultiMethodTest
{
48 public XMarkableStream oObj
= null;
49 private int mark
= -1 ;
52 * Test creates mark and stores it. <p>
53 * Has <b> OK </b> status if no exceptions were thrown
54 * and returned isn't less than zero. <p>
56 public void _createMark() {
59 mark
= oObj
.createMark() ;
61 } catch (com
.sun
.star
.io
.IOException e
) {
62 log
.println("Couldn't create mark");
63 e
.printStackTrace(log
);
67 tRes
.tested("createMark()", res
);
71 * Test deletes the mark that was created by method <code>createMark()
73 * Has <b> OK </b> status if the method successfully returns
74 * and no exceptions were thrown. <p>
75 * The following method tests are to be completed successfully before :
77 * <li> <code> createMark() </code> : to have mark </li>
79 * The following method tests are to be executed before :
81 * <li> <code> jumpToFurthest() </code></li>
82 * <li> <code> jumpToMark() </code></li>
83 * <li> <code> offsetToMark() </code></li>
86 public void _deleteMark() {
87 requiredMethod("createMark()") ;
89 executeMethod("jumpToFurthest()") ;
90 executeMethod("jumpToMark()") ;
91 executeMethod("offsetToMark()") ;
95 oObj
.deleteMark(mark
);
97 } catch(com
.sun
.star
.io
.IOException e
) {
98 log
.println("Couldn't delete mark");
99 e
.printStackTrace(log
);
101 } catch(com
.sun
.star
.lang
.IllegalArgumentException e
) {
102 log
.println("Couldn't delete mark");
103 e
.printStackTrace(log
);
107 tRes
.tested("deleteMark()", res
) ;
111 * Test calls the method. <p>
112 * Has <b> OK </b> status if the method successfully returns
113 * and no exceptions were thrown. <p>
114 * The following method tests are to be completed successfully before :
116 * <li> <code> createMark() </code></li>
119 public void _jumpToFurthest() {
120 requiredMethod("createMark()") ;
124 oObj
.jumpToFurthest() ;
126 } catch (com
.sun
.star
.io
.IOException e
) {
127 log
.println("Couldn't jump to furthest");
128 e
.printStackTrace(log
);
132 tRes
.tested("jumpToFurthest()", res
) ;
136 * Test jumps to mark that was created by method <code>createMark()</code>.
137 * <p>Has <b> OK </b> status if the method successfully returns
138 * and no exceptions were thrown. <p>
139 * The following method tests are to be completed successfully before :
141 * <li> <code> jumpToFurthest() </code> : for the right order of tests
145 public void _jumpToMark() {
146 requiredMethod("jumpToFurthest()") ;
150 oObj
.jumpToMark(mark
) ;
152 } catch(com
.sun
.star
.lang
.IllegalArgumentException e
) {
153 log
.println("Couldn't jump to mark");
154 e
.printStackTrace(log
);
156 } catch(com
.sun
.star
.io
.IOException e
) {
157 log
.println("Couldn't jump to mark");
158 e
.printStackTrace(log
);
162 tRes
.tested("jumpToMark()", res
) ;
166 * Test obtains offset to mark that was created by
167 * method <code>createMark()</code> and checks returned value.<p>
168 * Has <b> OK </b> status if returned value is equal to zero
169 * and no exceptions were thrown. <p>
170 * The following method tests are to be completed successfully before :
172 * <li> <code> jumpToMark() </code> : to have current position at
173 * the mark position </li>
176 public void _offsetToMark() {
178 requiredMethod("jumpToMark()") ;
182 int offset
= oObj
.offsetToMark(mark
);
184 } catch(com
.sun
.star
.lang
.IllegalArgumentException e
) {
185 log
.println("Couldn't get offser to mark");
186 e
.printStackTrace(log
);
188 } catch(com
.sun
.star
.io
.IOException e
) {
189 log
.println("Couldn't get offser to mark");
190 e
.printStackTrace(log
);
194 tRes
.tested("offsetToMark()", res
);