tdf#129993: Add unittest
Change-Id: I30b0583a3e38f0f8a06a7711c9413101dc87cc21 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/87861 Tested-by: Jenkins Reviewed-by: Xisco Faulí <xiscofauli@libreoffice.org> Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
This commit is contained in:
parent
af731ab96f
commit
5a989074cd
4 changed files with 111 additions and 0 deletions
37
lotuswordpro/CppunitTest_lotuswordpro_import_test.mk
Normal file
37
lotuswordpro/CppunitTest_lotuswordpro_import_test.mk
Normal file
|
@ -0,0 +1,37 @@
|
|||
# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
|
||||
#
|
||||
# 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/.
|
||||
#
|
||||
|
||||
$(eval $(call gb_CppunitTest_CppunitTest,lotuswordpro_import_test))
|
||||
|
||||
$(eval $(call gb_CppunitTest_use_external,lotuswordpro_import_test,boost_headers))
|
||||
|
||||
$(eval $(call gb_CppunitTest_add_exception_objects,lotuswordpro_import_test, \
|
||||
lotuswordpro/qa/cppunit/import_test \
|
||||
))
|
||||
|
||||
$(eval $(call gb_CppunitTest_use_libraries,lotuswordpro_import_test, \
|
||||
comphelper \
|
||||
cppu \
|
||||
cppuhelper \
|
||||
sal \
|
||||
test \
|
||||
unotest \
|
||||
vcl \
|
||||
))
|
||||
|
||||
$(eval $(call gb_CppunitTest_use_sdk_api,lotuswordpro_import_test))
|
||||
|
||||
$(eval $(call gb_CppunitTest_use_ure,lotuswordpro_import_test))
|
||||
$(eval $(call gb_CppunitTest_use_vcl,lotuswordpro_import_test))
|
||||
|
||||
$(eval $(call gb_CppunitTest_use_rdb,lotuswordpro_import_test,services))
|
||||
|
||||
$(eval $(call gb_CppunitTest_use_configuration,lotuswordpro_import_test))
|
||||
|
||||
# vim: set noet sw=4 ts=4:
|
|
@ -17,6 +17,7 @@ $(eval $(call gb_Module_add_targets,lotuswordpro,\
|
|||
|
||||
$(eval $(call gb_Module_add_check_targets,lotuswordpro,\
|
||||
CppunitTest_lotuswordpro_test_lotuswordpro \
|
||||
CppunitTest_lotuswordpro_import_test \
|
||||
))
|
||||
|
||||
endif
|
||||
|
|
BIN
lotuswordpro/qa/cppunit/data/tdf129993.lwp
Normal file
BIN
lotuswordpro/qa/cppunit/data/tdf129993.lwp
Normal file
Binary file not shown.
73
lotuswordpro/qa/cppunit/import_test.cxx
Normal file
73
lotuswordpro/qa/cppunit/import_test.cxx
Normal file
|
@ -0,0 +1,73 @@
|
|||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/*
|
||||
* 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/bootstrapfixture.hxx>
|
||||
#include <unotest/macros_test.hxx>
|
||||
|
||||
#include <com/sun/star/drawing/XDrawPagesSupplier.hpp>
|
||||
#include <com/sun/star/frame/Desktop.hpp>
|
||||
#include <com/sun/star/text/XTextDocument.hpp>
|
||||
#include <com/sun/star/text/XTextTable.hpp>
|
||||
#include <com/sun/star/lang/XServiceInfo.hpp>
|
||||
|
||||
#include <comphelper/processfactory.hxx>
|
||||
|
||||
using namespace ::com::sun::star;
|
||||
|
||||
class LotusWordProTest : public test::BootstrapFixture, public unotest::MacrosTest
|
||||
{
|
||||
public:
|
||||
virtual void setUp() override;
|
||||
|
||||
virtual void tearDown() override;
|
||||
uno::Reference<lang::XComponent>& getComponent() { return mxComponent; }
|
||||
|
||||
private:
|
||||
uno::Reference<uno::XComponentContext> mxComponentContext;
|
||||
uno::Reference<lang::XComponent> mxComponent;
|
||||
};
|
||||
|
||||
void LotusWordProTest::setUp()
|
||||
{
|
||||
test::BootstrapFixture::setUp();
|
||||
|
||||
mxComponentContext.set(comphelper::getComponentContext(getMultiServiceFactory()));
|
||||
mxDesktop.set(frame::Desktop::create(mxComponentContext));
|
||||
}
|
||||
|
||||
void LotusWordProTest::tearDown()
|
||||
{
|
||||
if (mxComponent.is())
|
||||
mxComponent->dispose();
|
||||
|
||||
test::BootstrapFixture::tearDown();
|
||||
}
|
||||
|
||||
char const DATA_DIRECTORY[] = "/lotuswordpro/qa/cppunit/data/";
|
||||
|
||||
CPPUNIT_TEST_FIXTURE(LotusWordProTest, testTdf129993)
|
||||
{
|
||||
OUString aURL = m_directories.getURLFromSrc(DATA_DIRECTORY) + "tdf129993.lwp";
|
||||
getComponent() = loadFromDesktop(aURL);
|
||||
CPPUNIT_ASSERT(getComponent().is());
|
||||
|
||||
uno::Reference<text::XTextDocument> textDocument(getComponent(), uno::UNO_QUERY);
|
||||
uno::Reference<container::XEnumerationAccess> xParaEnumAccess(textDocument->getText(),
|
||||
uno::UNO_QUERY);
|
||||
uno::Reference<container::XEnumeration> xParaEnum = xParaEnumAccess->createEnumeration();
|
||||
for (int i = 0; i < 15; ++i)
|
||||
xParaEnum->nextElement();
|
||||
uno::Reference<lang::XServiceInfo> xServiceInfo(xParaEnum->nextElement(), uno::UNO_QUERY);
|
||||
|
||||
CPPUNIT_ASSERT_EQUAL(sal_True, xServiceInfo->supportsService("com.sun.star.text.TextTable"));
|
||||
}
|
||||
|
||||
CPPUNIT_PLUGIN_IMPLEMENT();
|
||||
|
||||
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
Loading…
Reference in a new issue