diff --git a/lotuswordpro/CppunitTest_lotuswordpro_import_test.mk b/lotuswordpro/CppunitTest_lotuswordpro_import_test.mk new file mode 100644 index 000000000000..325b1db2b921 --- /dev/null +++ b/lotuswordpro/CppunitTest_lotuswordpro_import_test.mk @@ -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: diff --git a/lotuswordpro/Module_lotuswordpro.mk b/lotuswordpro/Module_lotuswordpro.mk index 538702e72bef..d7be4232161a 100644 --- a/lotuswordpro/Module_lotuswordpro.mk +++ b/lotuswordpro/Module_lotuswordpro.mk @@ -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 diff --git a/lotuswordpro/qa/cppunit/data/tdf129993.lwp b/lotuswordpro/qa/cppunit/data/tdf129993.lwp new file mode 100644 index 000000000000..54bc9ac99891 Binary files /dev/null and b/lotuswordpro/qa/cppunit/data/tdf129993.lwp differ diff --git a/lotuswordpro/qa/cppunit/import_test.cxx b/lotuswordpro/qa/cppunit/import_test.cxx new file mode 100644 index 000000000000..5f3770b69e3e --- /dev/null +++ b/lotuswordpro/qa/cppunit/import_test.cxx @@ -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 +#include + +#include +#include +#include +#include +#include + +#include + +using namespace ::com::sun::star; + +class LotusWordProTest : public test::BootstrapFixture, public unotest::MacrosTest +{ +public: + virtual void setUp() override; + + virtual void tearDown() override; + uno::Reference& getComponent() { return mxComponent; } + +private: + uno::Reference mxComponentContext; + uno::Reference 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 textDocument(getComponent(), uno::UNO_QUERY); + uno::Reference xParaEnumAccess(textDocument->getText(), + uno::UNO_QUERY); + uno::Reference xParaEnum = xParaEnumAccess->createEnumeration(); + for (int i = 0; i < 15; ++i) + xParaEnum->nextElement(); + uno::Reference 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: */