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