/*
* 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 com.sun.star.awt.Point;
import com.sun.star.awt.Size;
import com.sun.star.drawing.XShape;
/**
* Testing com.sun.star.drawing.XShape
* interface methods :
*
getPosition()
setPosition()
getSize()
setSize()
* This test needs the following object relations : *
'NoPos'
optional
* (of type Object
):
* if this relation exists then position setting is
* not supported by the object.* Test is NOT multithread compliant.
* @see com.sun.star.drawing.XShape */ public class _XShape extends MultiMethodTest { public XShape oObj = null; //oObj filled by MultiMethodTest Size sOld = new Size(); Point pOld = new Point(); Size sNew = new Size(); Point pNew = new Point(); /** * Gets the size and stores it.
* Has OK status if the method successfully returns * and no exceptions were thrown.
*/ public void _getSize(){ boolean result = false; log.println("get the size"); sOld = oObj.getSize(); result = true; tRes.tested("getSize()", result); } /** * Gets the current position and stores it if the object * supports position setting.
* Has OK status if the method successfully returns * and no exceptions were thrown or object doesn't * support position setting.
*/ public void _getPosition(){ boolean result = false; String obj = (String) tEnv.getObjRelation("NoPos"); if (obj != null) { log.println("Can't be used with "+obj); result = true; tRes.tested("getPosition()", result); return; } log.println("get the position"); pOld = oObj.getPosition(); result = true; tRes.tested("getPosition()", result); } /** * Sets a new size different from the size get before.
* Has OK status if the size returned by getSize()
* is equal to the size which was set.
* The following method tests are to be completed successfully before : *
getSize()
: to set the original size changed.* Has OK status if get position is equal to set position or * if the position setting isn't supported.
* The following method tests are to be completed successfully before : *
getPosition()
: to change old position.