Update ooo320-m1
[ooovba.git] / qadevOOo / tests / java / ifc / drawing / _XDrawPages.java
blob9f38d6d9767424cfcfab809841c65b2cdff8f5b4
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: _XDrawPages.java,v $
10 * $Revision: 1.4 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 package ifc.drawing;
33 import lib.MultiMethodTest;
35 import com.sun.star.drawing.XDrawPage;
36 import com.sun.star.drawing.XDrawPages;
38 /**
39 * Testing <code>com.sun.star.drawing.XDrawPages</code>
40 * interface methods :
41 * <ul>
42 * <li><code> insertNewByIndex()</code></li>
43 * <li><code> remove()</code></li>
44 * </ul> <p>
45 * Test is <b> NOT </b> multithread compilant. <p>
46 * @see com.sun.star.drawing.XDrawPages
48 public class _XDrawPages extends MultiMethodTest {
49 public XDrawPages oObj = null;
50 public XDrawPage DrawPage;
52 /**
53 * Inserts a draw page at index 0. Number of pages is obtained
54 * before and after insertion.<p>
55 * Has <b> OK </b> status if the value returned is not null and
56 * number of pages increases by one after insertion. <p>
58 public void _insertNewByIndex(){
59 boolean result = true;
60 log.println("testing insertNewByIndex() ... ");
62 int cntBefore = oObj.getCount();
63 DrawPage = oObj.insertNewByIndex(0);
64 int cntAfter = oObj.getCount();
65 result = DrawPage != null &&
66 cntAfter == cntBefore + 1 ;
68 tRes.tested("insertNewByIndex()", result);
69 } // end InsertNewByIndex
71 /**
72 * Removes the draw page inserted before. Number of pages is obtained
73 * before and after removing.<p>
74 * Has <b> OK </b> status if the number of pages decreases by one
75 * after removing. <p>
76 * The following method tests are to be completed successfully before :
77 * <ul>
78 * <li> <code> insertByIndex() </code> : the page to be removed must
79 * be inserted first.</li>
80 * </ul>
82 public void _remove(){
83 requiredMethod("insertNewByIndex()") ;
85 boolean result = true;
86 log.println("removing DrawPage...");
88 int cntBefore = oObj.getCount();
89 oObj.remove(DrawPage);
90 int cntAfter = oObj.getCount();
91 result = cntAfter + 1 == cntBefore ;
93 tRes.tested("remove()", result);
94 } // end remove()
96 } // end XDrawPages