diff options
author | Xisco Fauli <xiscofauli@libreoffice.org> | 2020-02-03 13:09:06 +0100 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.com> | 2020-02-04 17:11:49 +0100 |
commit | 5a989074cd1f8afdc03d0ee4f2dc12b174f9aa19 (patch) | |
tree | 32a8e8c672224a741e2edc68dc427982f41a9963 /lotuswordpro/qa | |
parent | af731ab96f4f4f9d1f87d438c9ebf576b2e09a72 (diff) |
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>
Diffstat (limited to 'lotuswordpro/qa')
-rw-r--r-- | lotuswordpro/qa/cppunit/data/tdf129993.lwp | bin | 0 -> 26152 bytes | |||
-rw-r--r-- | lotuswordpro/qa/cppunit/import_test.cxx | 73 |
2 files changed, 73 insertions, 0 deletions
diff --git a/lotuswordpro/qa/cppunit/data/tdf129993.lwp b/lotuswordpro/qa/cppunit/data/tdf129993.lwp Binary files differnew file mode 100644 index 000000000000..54bc9ac99891 --- /dev/null +++ b/lotuswordpro/qa/cppunit/data/tdf129993.lwp 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 <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: */ |