merge the formfield patch from ooo-build
[ooovba.git] / qadevOOo / tests / java / ifc / drawing / _XMasterPageTarget.java
blob50ba7b6e48b09ff3d21570470b54708b1c62cf79
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: _XMasterPageTarget.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;
37 import com.sun.star.drawing.XMasterPageTarget;
39 /**
40 * Testing <code>com.sun.star.drawing.XMasterPageTarget</code>
41 * interface methods :
42 * <ul>
43 * <li><code> getMasterPage()</code></li>
44 * <li><code> setMasterPage()</code></li>
45 * </ul> <p>
46 * This test needs the following object relations :
47 * <ul>
48 * <li> <code>'MasterPageSupplier'</code>
49 * (of type <code>XDrawPages</code>):
50 * the relation is used to create a new draw page. </li>
51 * <ul> <p>
52 * Test is <b> NOT </b> multithread compilant. <p>
53 * @see com.sun.star.drawing.XMasterPageTarget
55 public class _XMasterPageTarget extends MultiMethodTest{
57 public XMasterPageTarget oObj = null;
58 public XDrawPage DrawPage = null;
60 /**
61 * Gets the master page and stores. <p>
62 * Has <b> OK </b> status if the value returned is not null. <p>
64 public void _getMasterPage(){
65 boolean result = false;
66 log.println("get the MasterPage");
68 DrawPage = oObj.getMasterPage();
69 result = DrawPage != null ;
71 tRes.tested("getMasterPage()",result);
74 /**
75 * Gets the pages supplier from relation. Then a new page is created,
76 * inserted and set as master page.<p>
77 * Has <b> OK </b> status if the master page get is equal to page
78 * which was set. <p>
79 * The following method tests are to be completed successfully before :
80 * <ul>
81 * <li> <code> getMasterPage() </code> : to get old master page.</li>
82 * </ul>
84 public void _setMasterPage() {
85 requiredMethod("getMasterPage()") ;
87 boolean result = true;
88 XDrawPage oNewPage = null;
90 XDrawPages oPages = (XDrawPages) tEnv.getObjRelation("MasterPageSupplier");
91 log.println("inserting new MasterPage");
92 oNewPage = oPages.insertNewByIndex(oPages.getCount());
94 // save the old MasterPage
95 XDrawPage oOldPage = DrawPage;
97 // set the new Page as MasterPage
98 log.println("set the new MasterPage");
99 oObj.setMasterPage(oNewPage);
101 // get the new MasterPage
102 DrawPage = oObj.getMasterPage();
104 // test the diffrent MasterPages
105 if (DrawPage.equals(oOldPage)) result = false;
107 tRes.tested("setMasterPage()",result);
110 } // end of XMasterPageTarget