1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
3 * This file is part of the LibreOffice project.
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/.
10 #include <test/drawing/xshapegrouper.hxx>
11 #include <sal/types.h>
13 #include <com/sun/star/drawing/XShape.hpp>
14 #include <com/sun/star/drawing/XShapeGroup.hpp>
15 #include <com/sun/star/drawing/XShapeGrouper.hpp>
16 #include <com/sun/star/drawing/XShapes.hpp>
18 #include <com/sun/star/uno/Reference.hxx>
20 #include <cppunit/TestAssert.h>
26 void XShapeGrouper::testGroup()
28 uno::Reference
<drawing::XShapeGrouper
> xSG(init(), uno::UNO_QUERY_THROW
);
30 uno::Reference
<drawing::XShapes
> xShapes(m_xDrawPage
, uno::UNO_QUERY_THROW
);
31 const sal_Int32 nCountBeforeGroup
= xShapes
->getCount();
33 uno::Reference
<drawing::XShape
> xShape(xSG
->group(xShapes
), uno::UNO_QUERY_THROW
);
34 const sal_Int32 nCountAfterGroup
= xShapes
->getCount();
36 CPPUNIT_ASSERT(xShape
.is());
37 CPPUNIT_ASSERT(nCountAfterGroup
< nCountBeforeGroup
);
40 void XShapeGrouper::testUngroup()
42 uno::Reference
<drawing::XShapeGrouper
> xSG(init(), uno::UNO_QUERY_THROW
);
44 uno::Reference
<drawing::XShapes
> xShapes(m_xDrawPage
, uno::UNO_QUERY_THROW
);
45 uno::Reference
<drawing::XShape
> xShape(xSG
->group(xShapes
), uno::UNO_QUERY_THROW
);
46 uno::Reference
<drawing::XShapeGroup
> xShapeGroup(xShape
, uno::UNO_QUERY_THROW
);
48 const sal_Int32 nCountAfterGroup
= xShapes
->getCount();
50 xSG
->ungroup(xShapeGroup
);
51 const sal_Int32 nCountAfterUngroup
= xShapes
->getCount();
53 CPPUNIT_ASSERT(nCountAfterUngroup
!= nCountAfterGroup
);
55 } // namespace apitest
57 /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */