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
.drawing
.XDrawPage
;
24 import com
.sun
.star
.drawing
.XDrawPages
;
27 * Testing <code>com.sun.star.drawing.XDrawPages</code>
30 * <li><code> insertNewByIndex()</code></li>
31 * <li><code> remove()</code></li>
33 * Test is <b> NOT </b> multithread compliant. <p>
34 * @see com.sun.star.drawing.XDrawPages
36 public class _XDrawPages
extends MultiMethodTest
{
37 public XDrawPages oObj
= null;
38 public XDrawPage DrawPage
;
41 * Inserts a draw page at index 0. Number of pages is obtained
42 * before and after insertion.<p>
43 * Has <b> OK </b> status if the value returned is not null and
44 * number of pages increases by one after insertion. <p>
46 public void _insertNewByIndex(){
47 boolean result
= true;
48 log
.println("testing insertNewByIndex() ... ");
50 int cntBefore
= oObj
.getCount();
51 DrawPage
= oObj
.insertNewByIndex(0);
52 int cntAfter
= oObj
.getCount();
53 result
= DrawPage
!= null &&
54 cntAfter
== cntBefore
+ 1 ;
56 tRes
.tested("insertNewByIndex()", result
);
57 } // end InsertNewByIndex
60 * Removes the draw page inserted before. Number of pages is obtained
61 * before and after removing.<p>
62 * Has <b> OK </b> status if the number of pages decreases by one
64 * The following method tests are to be completed successfully before :
66 * <li> <code> insertByIndex() </code> : the page to be removed must
67 * be inserted first.</li>
70 public void _remove(){
71 requiredMethod("insertNewByIndex()") ;
73 boolean result
= true;
74 log
.println("removing DrawPage...");
76 int cntBefore
= oObj
.getCount();
77 oObj
.remove(DrawPage
);
78 int cntAfter
= oObj
.getCount();
79 result
= cntAfter
+ 1 == cntBefore
;
81 tRes
.tested("remove()", result
);