/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* This file incorporates work covered by the following license notice:
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
package ifc.drawing;
import lib.MultiMethodTest;
import lib.Status;
import lib.StatusException;
import com.sun.star.drawing.ConnectionType;
import com.sun.star.drawing.XConnectableShape;
import com.sun.star.drawing.XConnectorShape;
import com.sun.star.drawing.XShape;
import com.sun.star.uno.UnoRuntime;
/**
* Testing com.sun.star.drawing.XConnectorShape
* interface methods :
*
connectStart()
connectEnd()
disconnectBegin()
disconnectEnd()
* This test needs the following object relations : *
'XConnectorShape.Shapes'
* (of type com.sun.star.drawing.XShape[]
):
* an array of two shapes which must implement
* com.sun.star.drawing.XConnectableShape
* interface and are used for being connected by
* connector shape.* Test is NOT multithread compliant.
* @see com.sun.star.drawing.XConnectorShape
*/
public class _XConnectorShape extends MultiMethodTest {
public XConnectorShape oObj = null; //oObj filled by MultiMethodTest
private XConnectableShape shape1 = null,
shape2 = null ;
/**
* Retrieves object relation.
* @throw StatusException If the relation is not found or shapes don't
* support XConnectableShape
interface.
*/
@Override
public void before() {
log.println("No shapes implementing XConnectableShape still found.");
XShape[] shapes = (XShape[])
tEnv.getObjRelation("XConnectorShape.Shapes") ;
if (shapes == null) throw new StatusException(Status.failed
("Relation not found.")) ;
shape1 = UnoRuntime.queryInterface
(XConnectableShape.class, shapes[0]) ;
shape2 = UnoRuntime.queryInterface
(XConnectableShape.class, shapes[1]) ;
if (shape1 == null || shape2 == null) throw new StatusException
(Status.failed("Shapes don't implement XConnectableShape"+
" interface.")) ;
}
/**
* Test calls the method.
* Has OK status if the method successfully returns * and no exceptions were thrown.
*/ public void _connectStart() { oObj.connectStart(shape1, ConnectionType.AUTO); tRes.tested("connectStart()", true) ; } /** * Test calls the method.
* Has OK status if the method successfully returns * and no exceptions were thrown.
*/ public void _connectEnd() { oObj.connectEnd(shape2, ConnectionType.AUTO); tRes.tested("connectEnd()", true) ; } /** * Test calls the method.
* Has OK status if the method successfully returns * and no exceptions were thrown.
* The following method tests are to be completed successfully before : *
connectStart()
: first shape needs to be
* connected. * Has OK status if the method successfully returns * and no exceptions were thrown.
* The following method tests are to be completed successfully before : *
connectEnd()
: first shape needs to be
* connected.