bump product version to 4.2.0.1
[LibreOffice.git] / qadevOOo / tests / java / ifc / drawing / _XConnectorShape.java
blobbf0cf9ccf5e81dca87bc8538c6516fcdb64ec39f
1 /*
2 * This file is part of the LibreOffice project.
4 * This Source Code Form is subject to the terms of the Mozilla Public
5 * License, v. 2.0. If a copy of the MPL was not distributed with this
6 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 * This file incorporates work covered by the following license notice:
10 * Licensed to the Apache Software Foundation (ASF) under one or more
11 * contributor license agreements. See the NOTICE file distributed
12 * with this work for additional information regarding copyright
13 * ownership. The ASF licenses this file to you under the Apache
14 * License, Version 2.0 (the "License"); you may not use this file
15 * except in compliance with the License. You may obtain a copy of
16 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
19 package ifc.drawing;
21 import lib.MultiMethodTest;
22 import lib.Status;
23 import lib.StatusException;
25 import com.sun.star.drawing.ConnectionType;
26 import com.sun.star.drawing.XConnectableShape;
27 import com.sun.star.drawing.XConnectorShape;
28 import com.sun.star.drawing.XShape;
29 import com.sun.star.uno.UnoRuntime;
31 /**
32 * Testing <code>com.sun.star.drawing.XConnectorShape</code>
33 * interface methods :
34 * <ul>
35 * <li><code> connectStart()</code></li>
36 * <li><code> connectEnd()</code></li>
37 * <li><code> disconnectBegin()</code></li>
38 * <li><code> disconnectEnd()</code></li>
39 * </ul> <p>
40 * This test needs the following object relations :
41 * <ul>
42 * <li> <code>'XConnectorShape.Shapes'</code>
43 * (of type <code>com.sun.star.drawing.XShape[]</code>):
44 * an array of two shapes which <b>must</b> implement
45 * <code>com.sun.star.drawing.XConnectableShape</code>
46 * interface and are used for being connected by
47 * connector shape.</li>
48 * <ul> <p>
49 * Test is <b> NOT </b> multithread compilant. <p>
50 * @see com.sun.star.drawing.XConnectorShape
52 public class _XConnectorShape extends MultiMethodTest {
54 public XConnectorShape oObj = null; //oObj filled by MultiMethodTest
55 private XConnectableShape shape1 = null,
56 shape2 = null ;
58 /**
59 * Retrieves object relation.
60 * @throw StatusException If the relation is not found or shapes don't
61 * support <code>XConnectableShape</code> interface.
63 public void before() {
64 log.println("No shapes implementing XConnectableShape still found.");
65 XShape[] shapes = (XShape[])
66 tEnv.getObjRelation("XConnectorShape.Shapes") ;
67 if (shapes == null) throw new StatusException(Status.failed
68 ("Relation not found.")) ;
69 shape1 = UnoRuntime.queryInterface
70 (XConnectableShape.class, shapes[0]) ;
71 shape2 = UnoRuntime.queryInterface
72 (XConnectableShape.class, shapes[1]) ;
73 if (shape1 == null || shape2 == null) throw new StatusException
74 (Status.failed("Shapes don't implement XConnectableShape"+
75 " interface.")) ;
79 /**
80 * Test calls the method. <p>
81 * Has <b> OK </b> status if the method successfully returns
82 * and no exceptions were thrown. <p>
84 public void _connectStart() {
85 oObj.connectStart(shape1, ConnectionType.AUTO);
87 tRes.tested("connectStart()", true) ;
90 /**
91 * Test calls the method. <p>
92 * Has <b> OK </b> status if the method successfully returns
93 * and no exceptions were thrown. <p>
95 public void _connectEnd() {
96 oObj.connectEnd(shape2, ConnectionType.AUTO);
98 tRes.tested("connectEnd()", true) ;
102 * Test calls the method. <p>
103 * Has <b> OK </b> status if the method successfully returns
104 * and no exceptions were thrown. <p>
105 * The following method tests are to be completed successfully before :
106 * <ul>
107 * <li> <code> connectStart() </code> : first shape needs to be
108 * connected. </li>
109 * </ul>
111 public void _disconnectBegin() {
112 requiredMethod("connectStart()");
114 oObj.disconnectBegin(shape1);
116 tRes.tested("disconnectBegin()", true) ;
120 * Test calls the method. <p>
121 * Has <b> OK </b> status if the method successfully returns
122 * and no exceptions were thrown. <p>
123 * The following method tests are to be completed successfully before :
124 * <ul>
125 * <li> <code> connectEnd() </code> : first shape needs to be
126 * connected. </li>
127 * </ul>
129 public void _disconnectEnd() {
130 requiredMethod("connectEnd()");
132 oObj.disconnectEnd(shape2);
134 tRes.tested("disconnectEnd()", true) ;