LibreOffice Module test (master) 1
xshape.cxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 */
9
12
13#include <com/sun/star/awt/Point.hpp>
14#include <com/sun/star/awt/Size.hpp>
15#include <com/sun/star/drawing/XShape.hpp>
16
17#include <com/sun/star/uno/Reference.hxx>
18
19#include <cppunit/TestAssert.h>
20
21using namespace css;
22
23namespace apitest
24{
26{
27 uno::Reference<drawing::XShape> xShape(init(), uno::UNO_QUERY_THROW);
29 {
30 awt::Point aOldPoint = xShape->getPosition();
31 CPPUNIT_ASSERT_NO_THROW(
32 xShape->setPosition(awt::Point(aOldPoint.X + 100, aOldPoint.Y + 100)));
33
34 awt::Point aNewPoint = xShape->getPosition();
35 CPPUNIT_ASSERT_EQUAL(awt::Point(aOldPoint.X + 100, aOldPoint.Y + 100), aNewPoint);
36 }
37 CPPUNIT_ASSERT(true);
38}
39
41{
42 uno::Reference<drawing::XShape> xShape(init(), uno::UNO_QUERY_THROW);
43
44 awt::Size aOldSize = xShape->getSize();
45
46 CPPUNIT_ASSERT_NO_THROW(xShape->setSize(awt::Size(aOldSize.Width + 10, aOldSize.Height + 10)));
47
48 awt::Size aNewSize = xShape->getSize();
49 const sal_Int16 aAcceptableLimit = 2;
50 CPPUNIT_ASSERT(aOldSize.Height - aNewSize.Height <= aAcceptableLimit);
51 CPPUNIT_ASSERT(aOldSize.Height - aNewSize.Height <= aAcceptableLimit);
52}
53
54} // namespace apitest
55
56/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
bool const m_bObjSupportsPosition
Definition: xshape.hxx:37
void testGetSetSize()
Definition: xshape.cxx:40
void testGetSetPosition()
Definition: xshape.cxx:25
virtual css::uno::Reference< css::uno::XInterface > init()=0