merge the formfield patch from ooo-build
[ooovba.git] / qadevOOo / tests / java / ifc / drawing / _XShapeCombiner.java
blobad16e1a980100b5f07fba79709e2bc9389703b60
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: _XShapeCombiner.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.XShape;
37 import com.sun.star.drawing.XShapeCombiner;
38 import com.sun.star.drawing.XShapes;
39 import com.sun.star.uno.UnoRuntime;
41 /**
42 * Testing <code>com.sun.star.drawing.XShapeCombiner</code>
43 * interface methods :
44 * <ul>
45 * <li><code> combine()</code></li>
46 * <li><code> split()</code></li>
47 * </ul> <p>
48 * This test needs the following object relations :
49 * <ul>
50 * <li> <code>'DrawPage'</code> (must implement <code>XShapes</code>):
51 * the collection of shapes in a document which used to create a group.</li>
52 * <ul> <p>
53 * Test is <b> NOT </b> multithread compilant. <p>
54 * @see com.sun.star.drawing.XShapeCombiner
56 public class _XShapeCombiner extends MultiMethodTest {
58 public XShapeCombiner oObj = null; //filled by MultiMethodTest
59 protected XShape oGroup = null;
60 int countBeforeComb = 0;
61 XShapes oShapes = null;
63 /**
64 * Retrieves draw page collection from relation and combines them. <p>
65 * Has <b> OK </b> status if the shape group returned is not null nd
66 * number of shapes in collection is 1 (shapes are combined into a single
67 * shape). <p>
69 public void _combine () {
70 XDrawPage dp = (XDrawPage) tEnv.getObjRelation("DrawPage");
71 oShapes = (XShapes)UnoRuntime.queryInterface( XShapes.class, dp );
73 boolean result = false;
75 log.println("testing combine() ... ");
76 countBeforeComb = oShapes.getCount();
77 log.println("Count before combining:" + countBeforeComb);
78 oGroup = oObj.combine(oShapes);
79 int countAfterComb = oShapes.getCount();
80 log.println("Count after combining:" + countAfterComb);
81 result = oGroup != null && countAfterComb == 1;
83 tRes.tested("combine()", result);
86 /**
87 * Splits the group created before. <p>
89 * Has <b> OK </b> status if number of shapes in collection after
90 * <code>split</code> is the same as before <code>combine</code>. <p>
92 * The following method tests are to be completed successfully before :
93 * <ul>
94 * <li> <code> combine() </code> : to create a shape group </li>
95 * </ul>
97 public void _split() {
98 requiredMethod("combine()");
100 boolean result = false;
102 log.println("spiltting the shape...");
104 oObj.split(oGroup);
105 int countAfterSplit = oShapes.getCount();
106 log.println("Count after split:" + countAfterSplit);
107 result = countAfterSplit == countBeforeComb;
109 tRes.tested("split()", result);
110 } // end of split
112 } // end of XShapeCombiner