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
;
23 import com
.sun
.star
.io
.XMarkableStream
;
26 * Testing <code>com.sun.star.io.XMarkableStream</code>
29 * <li><code>createMark()</code></li>
30 * <li><code>deleteMark()</code></li>
31 * <li><code>jumpToFurthest()</code></li>
32 * <li><code>jumpToMark()</code></li>
33 * <li><code>offsetToMark()</code></li>
35 * @see com.sun.star.io.XMarkableStream
37 public class _XMarkableStream
extends MultiMethodTest
{
39 public XMarkableStream oObj
= null;
40 private int mark
= -1 ;
43 * Test creates mark and stores it. <p>
44 * Has <b> OK </b> status if no exceptions were thrown
45 * and returned isn't less than zero. <p>
47 public void _createMark() {
50 mark
= oObj
.createMark() ;
52 } catch (com
.sun
.star
.io
.IOException e
) {
53 log
.println("Couldn't create mark");
54 e
.printStackTrace(log
);
58 tRes
.tested("createMark()", res
);
62 * Test deletes the mark that was created by method <code>createMark()
64 * Has <b> OK </b> status if the method successfully returns
65 * and no exceptions were thrown. <p>
66 * The following method tests are to be completed successfully before :
68 * <li> <code> createMark() </code> : to have mark </li>
70 * The following method tests are to be executed before :
72 * <li> <code> jumpToFurthest() </code></li>
73 * <li> <code> jumpToMark() </code></li>
74 * <li> <code> offsetToMark() </code></li>
77 public void _deleteMark() {
78 requiredMethod("createMark()") ;
80 executeMethod("jumpToFurthest()") ;
81 executeMethod("jumpToMark()") ;
82 executeMethod("offsetToMark()") ;
86 oObj
.deleteMark(mark
);
88 } catch(com
.sun
.star
.io
.IOException e
) {
89 log
.println("Couldn't delete mark");
90 e
.printStackTrace(log
);
92 } catch(com
.sun
.star
.lang
.IllegalArgumentException e
) {
93 log
.println("Couldn't delete mark");
94 e
.printStackTrace(log
);
98 tRes
.tested("deleteMark()", res
) ;
102 * Test calls the method. <p>
103 * Has <b> OK </b> status if the method successfully returns
104 * and no exceptions were thrown. <p>
105 * The following method tests are to be completed successfully before :
107 * <li> <code> createMark() </code></li>
110 public void _jumpToFurthest() {
111 requiredMethod("createMark()") ;
115 oObj
.jumpToFurthest() ;
117 } catch (com
.sun
.star
.io
.IOException e
) {
118 log
.println("Couldn't jump to furthest");
119 e
.printStackTrace(log
);
123 tRes
.tested("jumpToFurthest()", res
) ;
127 * Test jumps to mark that was created by method <code>createMark()</code>.
128 * <p>Has <b> OK </b> status if the method successfully returns
129 * and no exceptions were thrown. <p>
130 * The following method tests are to be completed successfully before :
132 * <li> <code> jumpToFurthest() </code> : for the right order of tests
136 public void _jumpToMark() {
137 requiredMethod("jumpToFurthest()") ;
141 oObj
.jumpToMark(mark
) ;
143 } catch(com
.sun
.star
.lang
.IllegalArgumentException e
) {
144 log
.println("Couldn't jump to mark");
145 e
.printStackTrace(log
);
147 } catch(com
.sun
.star
.io
.IOException e
) {
148 log
.println("Couldn't jump to mark");
149 e
.printStackTrace(log
);
153 tRes
.tested("jumpToMark()", res
) ;
157 * Test obtains offset to mark that was created by
158 * method <code>createMark()</code> and checks returned value.<p>
159 * Has <b> OK </b> status if returned value is equal to zero
160 * and no exceptions were thrown. <p>
161 * The following method tests are to be completed successfully before :
163 * <li> <code> jumpToMark() </code> : to have current position at
164 * the mark position </li>
167 public void _offsetToMark() {
169 requiredMethod("jumpToMark()") ;
173 int offset
= oObj
.offsetToMark(mark
);
175 } catch(com
.sun
.star
.lang
.IllegalArgumentException e
) {
176 log
.println("Couldn't get offset to mark");
177 e
.printStackTrace(log
);
179 } catch(com
.sun
.star
.io
.IOException e
) {
180 log
.println("Couldn't get offset to mark");
181 e
.printStackTrace(log
);
185 tRes
.tested("offsetToMark()", res
);