From 940b4d1848e8c70ab7642901a68594e8016caffc Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sat, 27 Apr 2024 18:51:28 +0200 Subject: Adding upstream version 1:7.0.4. Signed-off-by: Daniel Baumann --- lotuswordpro/qa/cppunit/data/fail/A14.lwp | Bin 0 -> 82280 bytes .../qa/cppunit/data/fail/CVE-2012-1770-1.lwp | Bin 0 -> 32456 bytes .../qa/cppunit/data/fail/IntPres11-2004.lwp | Bin 0 -> 5417924 bytes lotuswordpro/qa/cppunit/data/fail/loop-1.lwp | Bin 0 -> 24085 bytes lotuswordpro/qa/cppunit/data/fail/loop-2.lwp | Bin 0 -> 79446 bytes lotuswordpro/qa/cppunit/data/fail/null-1.lwp | Bin 0 -> 15952 bytes lotuswordpro/qa/cppunit/data/fail/null-2.lwp | Bin 0 -> 22368 bytes lotuswordpro/qa/cppunit/data/fail/ofz20504-1.lwp | Bin 0 -> 21427 bytes lotuswordpro/qa/cppunit/data/fail/ofz6208-1.lwp | Bin 0 -> 21428 bytes lotuswordpro/qa/cppunit/data/fail/recurse-1.lwp | Bin 0 -> 15975 bytes lotuswordpro/qa/cppunit/data/fail/recurse-2.lwp | Bin 0 -> 15952 bytes lotuswordpro/qa/cppunit/data/fail/recurse-3.lwp | Bin 0 -> 56354 bytes lotuswordpro/qa/cppunit/data/fail/recurse-4.lwp | Bin 0 -> 15012 bytes lotuswordpro/qa/cppunit/data/fail/recurse-5.lwp | Bin 0 -> 21428 bytes lotuswordpro/qa/cppunit/data/fail/reference-1.lwp | Bin 0 -> 17632 bytes lotuswordpro/qa/cppunit/data/fail/reference-2.lwp | Bin 0 -> 82326 bytes lotuswordpro/qa/cppunit/data/fail/reference-3.lwp | Bin 0 -> 62632 bytes lotuswordpro/qa/cppunit/data/fail/registered-1.lwp | Bin 0 -> 15012 bytes lotuswordpro/qa/cppunit/data/fail/stack-1.lwp | Bin 0 -> 6074 bytes lotuswordpro/qa/cppunit/data/fail/subtable-1.lwp | Bin 0 -> 83439 bytes .../qa/cppunit/data/indeterminate/.gitignore | 0 .../qa/cppunit/data/paragraphProperties.lwp | Bin 0 -> 23172 bytes .../qa/cppunit/data/pass/IntPres11-2004.lwp | Bin 0 -> 5417924 bytes lotuswordpro/qa/cppunit/data/pass/fdo36036-1.lwp | Bin 0 -> 82280 bytes lotuswordpro/qa/cppunit/data/pass/null-1.lwp | Bin 0 -> 17632 bytes lotuswordpro/qa/cppunit/data/pass/ofz20507-1.lwp | Bin 0 -> 21432 bytes lotuswordpro/qa/cppunit/data/pass/ofz20517-1.lwp | Bin 0 -> 21429 bytes lotuswordpro/qa/cppunit/data/pass/tdf129993-2.lwp | Bin 0 -> 29964 bytes lotuswordpro/qa/cppunit/data/pass/tdf71147-1.lwp | Bin 0 -> 1173532 bytes lotuswordpro/qa/cppunit/data/pass/wordpro.lwp | Bin 0 -> 23172 bytes lotuswordpro/qa/cppunit/data/tdf129993.lwp | Bin 0 -> 26152 bytes lotuswordpro/qa/cppunit/import_test.cxx | 233 +++++++++++++++++++++ lotuswordpro/qa/cppunit/test_lotuswordpro.cxx | 73 +++++++ 33 files changed, 306 insertions(+) create mode 100644 lotuswordpro/qa/cppunit/data/fail/A14.lwp create mode 100644 lotuswordpro/qa/cppunit/data/fail/CVE-2012-1770-1.lwp create mode 100644 lotuswordpro/qa/cppunit/data/fail/IntPres11-2004.lwp create mode 100644 lotuswordpro/qa/cppunit/data/fail/loop-1.lwp create mode 100644 lotuswordpro/qa/cppunit/data/fail/loop-2.lwp create mode 100644 lotuswordpro/qa/cppunit/data/fail/null-1.lwp create mode 100644 lotuswordpro/qa/cppunit/data/fail/null-2.lwp create mode 100644 lotuswordpro/qa/cppunit/data/fail/ofz20504-1.lwp create mode 100644 lotuswordpro/qa/cppunit/data/fail/ofz6208-1.lwp create mode 100644 lotuswordpro/qa/cppunit/data/fail/recurse-1.lwp create mode 100644 lotuswordpro/qa/cppunit/data/fail/recurse-2.lwp create mode 100644 lotuswordpro/qa/cppunit/data/fail/recurse-3.lwp create mode 100644 lotuswordpro/qa/cppunit/data/fail/recurse-4.lwp create mode 100644 lotuswordpro/qa/cppunit/data/fail/recurse-5.lwp create mode 100644 lotuswordpro/qa/cppunit/data/fail/reference-1.lwp create mode 100644 lotuswordpro/qa/cppunit/data/fail/reference-2.lwp create mode 100644 lotuswordpro/qa/cppunit/data/fail/reference-3.lwp create mode 100644 lotuswordpro/qa/cppunit/data/fail/registered-1.lwp create mode 100644 lotuswordpro/qa/cppunit/data/fail/stack-1.lwp create mode 100644 lotuswordpro/qa/cppunit/data/fail/subtable-1.lwp create mode 100644 lotuswordpro/qa/cppunit/data/indeterminate/.gitignore create mode 100644 lotuswordpro/qa/cppunit/data/paragraphProperties.lwp create mode 100644 lotuswordpro/qa/cppunit/data/pass/IntPres11-2004.lwp create mode 100644 lotuswordpro/qa/cppunit/data/pass/fdo36036-1.lwp create mode 100644 lotuswordpro/qa/cppunit/data/pass/null-1.lwp create mode 100644 lotuswordpro/qa/cppunit/data/pass/ofz20507-1.lwp create mode 100644 lotuswordpro/qa/cppunit/data/pass/ofz20517-1.lwp create mode 100644 lotuswordpro/qa/cppunit/data/pass/tdf129993-2.lwp create mode 100644 lotuswordpro/qa/cppunit/data/pass/tdf71147-1.lwp create mode 100644 lotuswordpro/qa/cppunit/data/pass/wordpro.lwp create mode 100644 lotuswordpro/qa/cppunit/data/tdf129993.lwp create mode 100644 lotuswordpro/qa/cppunit/import_test.cxx create mode 100644 lotuswordpro/qa/cppunit/test_lotuswordpro.cxx (limited to 'lotuswordpro/qa') diff --git a/lotuswordpro/qa/cppunit/data/fail/A14.lwp b/lotuswordpro/qa/cppunit/data/fail/A14.lwp new file mode 100644 index 000000000..9dd36f626 Binary files /dev/null and b/lotuswordpro/qa/cppunit/data/fail/A14.lwp differ diff --git a/lotuswordpro/qa/cppunit/data/fail/CVE-2012-1770-1.lwp b/lotuswordpro/qa/cppunit/data/fail/CVE-2012-1770-1.lwp new file mode 100644 index 000000000..fb4a7e80e Binary files /dev/null and b/lotuswordpro/qa/cppunit/data/fail/CVE-2012-1770-1.lwp differ diff --git a/lotuswordpro/qa/cppunit/data/fail/IntPres11-2004.lwp b/lotuswordpro/qa/cppunit/data/fail/IntPres11-2004.lwp new file mode 100644 index 000000000..7672793e7 Binary files /dev/null and b/lotuswordpro/qa/cppunit/data/fail/IntPres11-2004.lwp differ diff --git a/lotuswordpro/qa/cppunit/data/fail/loop-1.lwp b/lotuswordpro/qa/cppunit/data/fail/loop-1.lwp new file mode 100644 index 000000000..d610a3ed6 Binary files /dev/null and b/lotuswordpro/qa/cppunit/data/fail/loop-1.lwp differ diff --git a/lotuswordpro/qa/cppunit/data/fail/loop-2.lwp b/lotuswordpro/qa/cppunit/data/fail/loop-2.lwp new file mode 100644 index 000000000..6342cc56e Binary files /dev/null and b/lotuswordpro/qa/cppunit/data/fail/loop-2.lwp differ diff --git a/lotuswordpro/qa/cppunit/data/fail/null-1.lwp b/lotuswordpro/qa/cppunit/data/fail/null-1.lwp new file mode 100644 index 000000000..06b825443 Binary files /dev/null and b/lotuswordpro/qa/cppunit/data/fail/null-1.lwp differ diff --git a/lotuswordpro/qa/cppunit/data/fail/null-2.lwp b/lotuswordpro/qa/cppunit/data/fail/null-2.lwp new file mode 100644 index 000000000..cd7e07278 Binary files /dev/null and b/lotuswordpro/qa/cppunit/data/fail/null-2.lwp differ diff --git a/lotuswordpro/qa/cppunit/data/fail/ofz20504-1.lwp b/lotuswordpro/qa/cppunit/data/fail/ofz20504-1.lwp new file mode 100644 index 000000000..afbf57804 Binary files /dev/null and b/lotuswordpro/qa/cppunit/data/fail/ofz20504-1.lwp differ diff --git a/lotuswordpro/qa/cppunit/data/fail/ofz6208-1.lwp b/lotuswordpro/qa/cppunit/data/fail/ofz6208-1.lwp new file mode 100644 index 000000000..5b068065a Binary files /dev/null and b/lotuswordpro/qa/cppunit/data/fail/ofz6208-1.lwp differ diff --git a/lotuswordpro/qa/cppunit/data/fail/recurse-1.lwp b/lotuswordpro/qa/cppunit/data/fail/recurse-1.lwp new file mode 100644 index 000000000..ffc7a44e3 Binary files /dev/null and b/lotuswordpro/qa/cppunit/data/fail/recurse-1.lwp differ diff --git a/lotuswordpro/qa/cppunit/data/fail/recurse-2.lwp b/lotuswordpro/qa/cppunit/data/fail/recurse-2.lwp new file mode 100644 index 000000000..f19b0d7f7 Binary files /dev/null and b/lotuswordpro/qa/cppunit/data/fail/recurse-2.lwp differ diff --git a/lotuswordpro/qa/cppunit/data/fail/recurse-3.lwp b/lotuswordpro/qa/cppunit/data/fail/recurse-3.lwp new file mode 100644 index 000000000..acb8c93ce Binary files /dev/null and b/lotuswordpro/qa/cppunit/data/fail/recurse-3.lwp differ diff --git a/lotuswordpro/qa/cppunit/data/fail/recurse-4.lwp b/lotuswordpro/qa/cppunit/data/fail/recurse-4.lwp new file mode 100644 index 000000000..f48c5bb71 Binary files /dev/null and b/lotuswordpro/qa/cppunit/data/fail/recurse-4.lwp differ diff --git a/lotuswordpro/qa/cppunit/data/fail/recurse-5.lwp b/lotuswordpro/qa/cppunit/data/fail/recurse-5.lwp new file mode 100644 index 000000000..a81b42f61 Binary files /dev/null and b/lotuswordpro/qa/cppunit/data/fail/recurse-5.lwp differ diff --git a/lotuswordpro/qa/cppunit/data/fail/reference-1.lwp b/lotuswordpro/qa/cppunit/data/fail/reference-1.lwp new file mode 100644 index 000000000..d8141ae6d Binary files /dev/null and b/lotuswordpro/qa/cppunit/data/fail/reference-1.lwp differ diff --git a/lotuswordpro/qa/cppunit/data/fail/reference-2.lwp b/lotuswordpro/qa/cppunit/data/fail/reference-2.lwp new file mode 100644 index 000000000..d2101d8fe Binary files /dev/null and b/lotuswordpro/qa/cppunit/data/fail/reference-2.lwp differ diff --git a/lotuswordpro/qa/cppunit/data/fail/reference-3.lwp b/lotuswordpro/qa/cppunit/data/fail/reference-3.lwp new file mode 100644 index 000000000..6076b43b7 Binary files /dev/null and b/lotuswordpro/qa/cppunit/data/fail/reference-3.lwp differ diff --git a/lotuswordpro/qa/cppunit/data/fail/registered-1.lwp b/lotuswordpro/qa/cppunit/data/fail/registered-1.lwp new file mode 100644 index 000000000..f3419f45b Binary files /dev/null and b/lotuswordpro/qa/cppunit/data/fail/registered-1.lwp differ diff --git a/lotuswordpro/qa/cppunit/data/fail/stack-1.lwp b/lotuswordpro/qa/cppunit/data/fail/stack-1.lwp new file mode 100644 index 000000000..60eb8e393 Binary files /dev/null and b/lotuswordpro/qa/cppunit/data/fail/stack-1.lwp differ diff --git a/lotuswordpro/qa/cppunit/data/fail/subtable-1.lwp b/lotuswordpro/qa/cppunit/data/fail/subtable-1.lwp new file mode 100644 index 000000000..3d906ee68 Binary files /dev/null and b/lotuswordpro/qa/cppunit/data/fail/subtable-1.lwp differ diff --git a/lotuswordpro/qa/cppunit/data/indeterminate/.gitignore b/lotuswordpro/qa/cppunit/data/indeterminate/.gitignore new file mode 100644 index 000000000..e69de29bb diff --git a/lotuswordpro/qa/cppunit/data/paragraphProperties.lwp b/lotuswordpro/qa/cppunit/data/paragraphProperties.lwp new file mode 100644 index 000000000..dc4048cb9 Binary files /dev/null and b/lotuswordpro/qa/cppunit/data/paragraphProperties.lwp differ diff --git a/lotuswordpro/qa/cppunit/data/pass/IntPres11-2004.lwp b/lotuswordpro/qa/cppunit/data/pass/IntPres11-2004.lwp new file mode 100644 index 000000000..786164ea4 Binary files /dev/null and b/lotuswordpro/qa/cppunit/data/pass/IntPres11-2004.lwp differ diff --git a/lotuswordpro/qa/cppunit/data/pass/fdo36036-1.lwp b/lotuswordpro/qa/cppunit/data/pass/fdo36036-1.lwp new file mode 100644 index 000000000..7cc05cebc Binary files /dev/null and b/lotuswordpro/qa/cppunit/data/pass/fdo36036-1.lwp differ diff --git a/lotuswordpro/qa/cppunit/data/pass/null-1.lwp b/lotuswordpro/qa/cppunit/data/pass/null-1.lwp new file mode 100644 index 000000000..351d7e88e Binary files /dev/null and b/lotuswordpro/qa/cppunit/data/pass/null-1.lwp differ diff --git a/lotuswordpro/qa/cppunit/data/pass/ofz20507-1.lwp b/lotuswordpro/qa/cppunit/data/pass/ofz20507-1.lwp new file mode 100644 index 000000000..26fc903db Binary files /dev/null and b/lotuswordpro/qa/cppunit/data/pass/ofz20507-1.lwp differ diff --git a/lotuswordpro/qa/cppunit/data/pass/ofz20517-1.lwp b/lotuswordpro/qa/cppunit/data/pass/ofz20517-1.lwp new file mode 100644 index 000000000..de6dcbf1c Binary files /dev/null and b/lotuswordpro/qa/cppunit/data/pass/ofz20517-1.lwp differ diff --git a/lotuswordpro/qa/cppunit/data/pass/tdf129993-2.lwp b/lotuswordpro/qa/cppunit/data/pass/tdf129993-2.lwp new file mode 100644 index 000000000..0f0645e3b Binary files /dev/null and b/lotuswordpro/qa/cppunit/data/pass/tdf129993-2.lwp differ diff --git a/lotuswordpro/qa/cppunit/data/pass/tdf71147-1.lwp b/lotuswordpro/qa/cppunit/data/pass/tdf71147-1.lwp new file mode 100644 index 000000000..fc351f434 Binary files /dev/null and b/lotuswordpro/qa/cppunit/data/pass/tdf71147-1.lwp differ diff --git a/lotuswordpro/qa/cppunit/data/pass/wordpro.lwp b/lotuswordpro/qa/cppunit/data/pass/wordpro.lwp new file mode 100644 index 000000000..dc4048cb9 Binary files /dev/null and b/lotuswordpro/qa/cppunit/data/pass/wordpro.lwp differ diff --git a/lotuswordpro/qa/cppunit/data/tdf129993.lwp b/lotuswordpro/qa/cppunit/data/tdf129993.lwp new file mode 100644 index 000000000..54bc9ac99 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 000000000..8ffddc215 --- /dev/null +++ b/lotuswordpro/qa/cppunit/import_test.cxx @@ -0,0 +1,233 @@ +/* -*- 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 +#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 mxComponent; +}; + +void LotusWordProTest::setUp() +{ + test::BootstrapFixture::setUp(); + + 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_TEST_FIXTURE(LotusWordProTest, paragraphProperties) +{ + OUString aURL = m_directories.getURLFromSrc(DATA_DIRECTORY) + "paragraphProperties.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(); + + //Ignore the first paragraphs + for (int i = 0; i < 4; ++i) + xParaEnum->nextElement(); + + // bold + uno::Reference const xParagraph(xParaEnum->nextElement(), + uno::UNO_QUERY_THROW); + uno::Reference xPropertySet(xParagraph, uno::UNO_QUERY); + float fFontWeight; + xPropertySet->getPropertyValue("CharWeight") >>= fFontWeight; + CPPUNIT_ASSERT_EQUAL(awt::FontWeight::BOLD, fFontWeight); + + // italic + uno::Reference const xParagraph2(xParaEnum->nextElement(), + uno::UNO_QUERY_THROW); + uno::Reference xPropertySet2(xParagraph2, uno::UNO_QUERY); + awt::FontSlant fFontSlant; + xPropertySet2->getPropertyValue("CharPosture") >>= fFontSlant; + CPPUNIT_ASSERT_EQUAL(awt::FontSlant_ITALIC, fFontSlant); + + // underline + uno::Reference const xParagraph3(xParaEnum->nextElement(), + uno::UNO_QUERY_THROW); + uno::Reference xPropertySet3(xParagraph3, uno::UNO_QUERY); + sal_Int16 nCharUnderline; + xPropertySet3->getPropertyValue("CharUnderline") >>= nCharUnderline; + CPPUNIT_ASSERT_EQUAL(awt::FontUnderline::SINGLE, nCharUnderline); + + // striked through + uno::Reference const xParagraph4(xParaEnum->nextElement(), + uno::UNO_QUERY_THROW); + uno::Reference xPropertySet4(xParagraph4, uno::UNO_QUERY); + sal_Int16 nFontStrikeout; + xPropertySet4->getPropertyValue("CharStrikeout") >>= nFontStrikeout; + CPPUNIT_ASSERT_EQUAL(awt::FontStrikeout::SINGLE, nFontStrikeout); + + //superscript + uno::Reference const xParagraph5(xParaEnum->nextElement(), + uno::UNO_QUERY_THROW); + uno::Reference xPropertySet5(xParagraph5, uno::UNO_QUERY); + sal_Int32 nCharEscapement; + xPropertySet5->getPropertyValue("CharEscapement") >>= nCharEscapement; + CPPUNIT_ASSERT_EQUAL(sal_Int32(33), nCharEscapement); + + sal_Int32 nCharEscapementHeight; + xPropertySet5->getPropertyValue("CharEscapementHeight") >>= nCharEscapementHeight; + CPPUNIT_ASSERT_EQUAL(sal_Int32(58), nCharEscapementHeight); + + //subscript + uno::Reference const xParagraph6(xParaEnum->nextElement(), + uno::UNO_QUERY_THROW); + uno::Reference xPropertySet6(xParagraph6, uno::UNO_QUERY); + sal_Int32 nCharEscapement2; + xPropertySet6->getPropertyValue("CharEscapement") >>= nCharEscapement2; + CPPUNIT_ASSERT_EQUAL(sal_Int32(-33), nCharEscapement2); + + sal_Int32 nCharEscapementHeight2; + xPropertySet6->getPropertyValue("CharEscapementHeight") >>= nCharEscapementHeight2; + CPPUNIT_ASSERT_EQUAL(sal_Int32(58), nCharEscapementHeight2); + + // red background and borders + uno::Reference const xParagraph7(xParaEnum->nextElement(), + uno::UNO_QUERY_THROW); + uno::Reference xPropertySet7(xParagraph7, uno::UNO_QUERY); + Color nParaBackColor; + xPropertySet7->getPropertyValue("ParaBackColor") >>= nParaBackColor; + CPPUNIT_ASSERT_EQUAL(Color(0xff0000), nParaBackColor); + + table::BorderLine2 aTopBorder; + xPropertySet7->getPropertyValue("TopBorder") >>= aTopBorder; + CPPUNIT_ASSERT_EQUAL(sal_Int16(35), aTopBorder.OuterLineWidth); + + table::BorderLine2 aBottomBorder; + xPropertySet7->getPropertyValue("BottomBorder") >>= aBottomBorder; + CPPUNIT_ASSERT_EQUAL(sal_Int16(35), aBottomBorder.OuterLineWidth); + + table::BorderLine2 aLeftBorder; + xPropertySet7->getPropertyValue("LeftBorder") >>= aLeftBorder; + CPPUNIT_ASSERT_EQUAL(sal_Int16(35), aLeftBorder.OuterLineWidth); + + table::BorderLine2 aRightBorder; + xPropertySet7->getPropertyValue("RightBorder") >>= aRightBorder; + CPPUNIT_ASSERT_EQUAL(sal_Int16(35), aRightBorder.OuterLineWidth); + + // centered + uno::Reference const xParagraph8(xParaEnum->nextElement(), + uno::UNO_QUERY_THROW); + uno::Reference xPropertySet8(xParagraph8, uno::UNO_QUERY); + sal_Int16 nParaAdjust = {}; // spurious -Werror=maybe-uninitialized + xPropertySet8->getPropertyValue("ParaAdjust") >>= nParaAdjust; + CPPUNIT_ASSERT_EQUAL(style::ParagraphAdjust_CENTER, + static_cast(nParaAdjust)); + + // left margin + uno::Reference const xParagraph9(xParaEnum->nextElement(), + uno::UNO_QUERY_THROW); + uno::Reference xPropertySet9(xParagraph9, uno::UNO_QUERY); + sal_Int32 nParaLeftMargin; + xPropertySet9->getPropertyValue("ParaLeftMargin") >>= nParaLeftMargin; + CPPUNIT_ASSERT_EQUAL(sal_Int32(2000), nParaLeftMargin); + + // double line spacing + uno::Reference const xParagraph10(xParaEnum->nextElement(), + uno::UNO_QUERY_THROW); + uno::Reference xPropertySet10(xParagraph10, uno::UNO_QUERY); + style::LineSpacing nParaLineSpacing; + xPropertySet10->getPropertyValue("ParaLineSpacing") >>= nParaLineSpacing; + CPPUNIT_ASSERT_EQUAL(sal_Int16(200), nParaLineSpacing.Height); + + // time new roman 12 + uno::Reference const xParagraph11(xParaEnum->nextElement(), + uno::UNO_QUERY_THROW); + uno::Reference xPropertySet11(xParagraph11, uno::UNO_QUERY); + OUString sCharFontName; + xPropertySet11->getPropertyValue("CharFontName") >>= sCharFontName; + CPPUNIT_ASSERT_EQUAL(OUString("Times New Roman"), sCharFontName); + float fCharFontHeight; + xPropertySet11->getPropertyValue("CharHeight") >>= fCharFontHeight; + CPPUNIT_ASSERT_EQUAL(float(12.), fCharFontHeight); + + // time new roman 16 + uno::Reference const xParagraph12(xParaEnum->nextElement(), + uno::UNO_QUERY_THROW); + uno::Reference xPropertySet12(xParagraph12, uno::UNO_QUERY); + OUString sCharFontName2; + xPropertySet12->getPropertyValue("CharFontName") >>= sCharFontName2; + CPPUNIT_ASSERT_EQUAL(OUString("Times New Roman"), sCharFontName2); + float fCharFontHeight2; + xPropertySet12->getPropertyValue("CharHeight") >>= fCharFontHeight2; + CPPUNIT_ASSERT_EQUAL(float(16.), fCharFontHeight2); + + //ignore this paragraph + xParaEnum->nextElement(); + + //text color + uno::Reference const xParagraph13(xParaEnum->nextElement(), + uno::UNO_QUERY_THROW); + uno::Reference xPropertySet13(xParagraph13, uno::UNO_QUERY); + Color nCharColor; + xPropertySet13->getPropertyValue("CharColor") >>= nCharColor; + CPPUNIT_ASSERT_EQUAL(Color(0x00ff00), nCharColor); +} + +CPPUNIT_PLUGIN_IMPLEMENT(); + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/lotuswordpro/qa/cppunit/test_lotuswordpro.cxx b/lotuswordpro/qa/cppunit/test_lotuswordpro.cxx new file mode 100644 index 000000000..961faa668 --- /dev/null +++ b/lotuswordpro/qa/cppunit/test_lotuswordpro.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 + +using namespace ::com::sun::star; + +namespace +{ + class LotusWordProTest + : public test::FiltersTest + , public test::BootstrapFixture + { + public: + LotusWordProTest() : BootstrapFixture(true, false) {} + + virtual void setUp() override; + + virtual bool load(const OUString &, + const OUString &rURL, const OUString &, + SfxFilterFlags, SotClipboardFormatId, unsigned int) override; + + void test(); + + CPPUNIT_TEST_SUITE(LotusWordProTest); + CPPUNIT_TEST(test); + CPPUNIT_TEST_SUITE_END(); + private: + uno::Reference m_xFilter; + }; + + void LotusWordProTest::setUp() + { + test::BootstrapFixture::setUp(); + + m_xFilter.set(m_xSFactory->createInstance( + "com.sun.star.comp.Writer.LotusWordProImportFilter"), + uno::UNO_QUERY_THROW); + } + + bool LotusWordProTest::load(const OUString &, + const OUString &rURL, const OUString &, + SfxFilterFlags, SotClipboardFormatId, unsigned int) + { + uno::Sequence< beans::PropertyValue > aDescriptor(1); + aDescriptor[0].Name = "URL"; + aDescriptor[0].Value <<= rURL; + return m_xFilter->filter(aDescriptor); + } + + void LotusWordProTest::test() + { + testDir(OUString(), + m_directories.getURLFromSrc("/lotuswordpro/qa/cppunit/data/")); + } + + CPPUNIT_TEST_SUITE_REGISTRATION(LotusWordProTest); +} + +CPPUNIT_PLUGIN_IMPLEMENT(); + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ -- cgit v1.2.3