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