Kaydet (Commit) fd8a724d authored tarafından Jens Carl's avatar Jens Carl

tdf#45904 Move XDrawPages Java tests to C++

Move XDrawPages Java tests to C++ for ScDrawPagesObj.

Change-Id: I0e48aae9caadf0d9834c4f973095ba9d10435fdc
Reviewed-on: https://gerrit.libreoffice.org/66712
Tested-by: Jenkins
Reviewed-by: 's avatarJens Carl <j.carl43@gmx.de>
üst 2d8253c5
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
/*
* 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/.
*/
#ifndef INCLUDED_TEST_DRAWING_XDRAWPAGES_HXX
#define INCLUDED_TEST_DRAWING_XDRAWPAGES_HXX
#include <com/sun/star/uno/XInterface.hpp>
#include <com/sun/star/uno/Reference.hxx>
#include <test/testdllapi.hxx>
namespace apitest
{
class OOO_DLLPUBLIC_TEST XDrawPages
{
public:
virtual css::uno::Reference<css::uno::XInterface> init() = 0;
virtual void testInsertNewByIndex();
virtual void testRemove();
protected:
~XDrawPages() {}
};
} // namespace apitest
#endif // INCLUDED_TEST_DRAWING_XDRAWPAGES_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
"ScDrawPagesObj";"com::sun::star::drawing::XDrawPages";"insertNewByIndex()"
"ScDrawPagesObj";"com::sun::star::drawing::XDrawPages";"remove()"
"ScDrawPagesObj";"com::sun::star::drawing::XDrawPageExpander#optional";"expand()"
"ScDrawPagesObj";"com::sun::star::drawing::XDrawPageSummarizer#optional";"summarize()"
......@@ -10,6 +10,7 @@
#include <test/calc_unoapi_test.hxx>
#include <test/container/xelementaccess.hxx>
#include <test/container/xindexaccess.hxx>
#include <test/drawing/xdrawpages.hxx>
#include <com/sun/star/drawing/XDrawPage.hpp>
#include <com/sun/star/drawing/XDrawPages.hpp>
......@@ -28,6 +29,7 @@ using namespace css::uno;
namespace sc_apitest
{
class ScDrawPagesObj : public CalcUnoApiTest,
public apitest::XDrawPages,
public apitest::XElementAccess,
public apitest::XIndexAccess
{
......@@ -40,6 +42,10 @@ public:
CPPUNIT_TEST_SUITE(ScDrawPagesObj);
// XDrawPages
CPPUNIT_TEST(testInsertNewByIndex);
CPPUNIT_TEST(testRemove);
// XElementAccess
CPPUNIT_TEST(testGetElementType);
CPPUNIT_TEST(testHasElements);
......
......@@ -51,8 +51,9 @@ $(eval $(call gb_Library_add_exception_objects,subsequenttest,\
test/source/container/xnamecontainer \
test/source/container/xnamed \
test/source/container/xnamereplace \
test/source/drawing/captionshape \
test/source/document/xlinktargetsupplier \
test/source/drawing/captionshape \
test/source/drawing/xdrawpages \
test/source/lang/xserviceinfo \
test/source/sheet/cellarealink \
test/source/sheet/cellproperties \
......
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
/*
* 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/.
*/
#include <test/drawing/xdrawpages.hxx>
#include <com/sun/star/drawing/XDrawPage.hpp>
#include <com/sun/star/drawing/XDrawPages.hpp>
#include <com/sun/star/uno/XInterface.hpp>
#include <com/sun/star/uno/Reference.hxx>
#include <cppunit/extensions/HelperMacros.h>
using namespace css;
using namespace css::uno;
namespace apitest
{
void XDrawPages::testInsertNewByIndex()
{
uno::Reference<drawing::XDrawPages> xDrawPages(init(), uno::UNO_QUERY_THROW);
const sal_Int32 nCount = xDrawPages->getCount();
uno::Reference<drawing::XDrawPage> xDP(xDrawPages->insertNewByIndex(0), uno::UNO_QUERY_THROW);
CPPUNIT_ASSERT(xDP.is());
CPPUNIT_ASSERT_EQUAL(nCount + 1, xDrawPages->getCount());
}
void XDrawPages::testRemove()
{
uno::Reference<drawing::XDrawPages> xDrawPages(init(), uno::UNO_QUERY_THROW);
const sal_Int32 nCount = xDrawPages->getCount();
uno::Reference<drawing::XDrawPage> xDP(xDrawPages->insertNewByIndex(0), uno::UNO_QUERY_THROW);
CPPUNIT_ASSERT(xDP.is());
xDrawPages->remove(xDP);
CPPUNIT_ASSERT_EQUAL(nCount, xDrawPages->getCount());
}
} // namespace apitest
/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment