diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-15 05:54:39 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-15 05:54:39 +0000 |
commit | 267c6f2ac71f92999e969232431ba04678e7437e (patch) | |
tree | 358c9467650e1d0a1d7227a21dac2e3d08b622b2 /lotuswordpro/qa | |
parent | Initial commit. (diff) | |
download | libreoffice-267c6f2ac71f92999e969232431ba04678e7437e.tar.xz libreoffice-267c6f2ac71f92999e969232431ba04678e7437e.zip |
Adding upstream version 4:24.2.0.upstream/4%24.2.0
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'lotuswordpro/qa')
38 files changed, 375 insertions, 0 deletions
diff --git a/lotuswordpro/qa/cppunit/data/fail/A14.lwp b/lotuswordpro/qa/cppunit/data/fail/A14.lwp Binary files differnew file mode 100644 index 0000000000..9dd36f6264 --- /dev/null +++ b/lotuswordpro/qa/cppunit/data/fail/A14.lwp diff --git a/lotuswordpro/qa/cppunit/data/fail/CVE-2012-1770-1.lwp b/lotuswordpro/qa/cppunit/data/fail/CVE-2012-1770-1.lwp Binary files differnew file mode 100644 index 0000000000..fb4a7e80e9 --- /dev/null +++ b/lotuswordpro/qa/cppunit/data/fail/CVE-2012-1770-1.lwp diff --git a/lotuswordpro/qa/cppunit/data/fail/IntPres11-2004.lwp b/lotuswordpro/qa/cppunit/data/fail/IntPres11-2004.lwp Binary files differnew file mode 100644 index 0000000000..7672793e7d --- /dev/null +++ b/lotuswordpro/qa/cppunit/data/fail/IntPres11-2004.lwp diff --git a/lotuswordpro/qa/cppunit/data/fail/loop-1.lwp b/lotuswordpro/qa/cppunit/data/fail/loop-1.lwp Binary files differnew file mode 100644 index 0000000000..d610a3ed65 --- /dev/null +++ b/lotuswordpro/qa/cppunit/data/fail/loop-1.lwp diff --git a/lotuswordpro/qa/cppunit/data/fail/loop-2.lwp b/lotuswordpro/qa/cppunit/data/fail/loop-2.lwp Binary files differnew file mode 100644 index 0000000000..6342cc56ef --- /dev/null +++ b/lotuswordpro/qa/cppunit/data/fail/loop-2.lwp diff --git a/lotuswordpro/qa/cppunit/data/fail/null-1.lwp b/lotuswordpro/qa/cppunit/data/fail/null-1.lwp Binary files differnew file mode 100644 index 0000000000..06b8254431 --- /dev/null +++ b/lotuswordpro/qa/cppunit/data/fail/null-1.lwp diff --git a/lotuswordpro/qa/cppunit/data/fail/null-2.lwp b/lotuswordpro/qa/cppunit/data/fail/null-2.lwp Binary files differnew file mode 100644 index 0000000000..cd7e07278e --- /dev/null +++ b/lotuswordpro/qa/cppunit/data/fail/null-2.lwp diff --git a/lotuswordpro/qa/cppunit/data/fail/ofz20504-1.lwp b/lotuswordpro/qa/cppunit/data/fail/ofz20504-1.lwp Binary files differnew file mode 100644 index 0000000000..afbf578042 --- /dev/null +++ b/lotuswordpro/qa/cppunit/data/fail/ofz20504-1.lwp diff --git a/lotuswordpro/qa/cppunit/data/fail/ofz26357-1.lwp b/lotuswordpro/qa/cppunit/data/fail/ofz26357-1.lwp Binary files differnew file mode 100644 index 0000000000..4c087b6dfa --- /dev/null +++ b/lotuswordpro/qa/cppunit/data/fail/ofz26357-1.lwp diff --git a/lotuswordpro/qa/cppunit/data/fail/ofz35646-1.lwp b/lotuswordpro/qa/cppunit/data/fail/ofz35646-1.lwp Binary files differnew file mode 100644 index 0000000000..5db8cea8c5 --- /dev/null +++ b/lotuswordpro/qa/cppunit/data/fail/ofz35646-1.lwp diff --git a/lotuswordpro/qa/cppunit/data/fail/ofz35646-2.lwp b/lotuswordpro/qa/cppunit/data/fail/ofz35646-2.lwp Binary files differnew file mode 100644 index 0000000000..029b755f38 --- /dev/null +++ b/lotuswordpro/qa/cppunit/data/fail/ofz35646-2.lwp diff --git a/lotuswordpro/qa/cppunit/data/fail/ofz6208-1.lwp b/lotuswordpro/qa/cppunit/data/fail/ofz6208-1.lwp Binary files differnew file mode 100644 index 0000000000..5b068065a1 --- /dev/null +++ b/lotuswordpro/qa/cppunit/data/fail/ofz6208-1.lwp diff --git a/lotuswordpro/qa/cppunit/data/fail/recurse-1.lwp b/lotuswordpro/qa/cppunit/data/fail/recurse-1.lwp Binary files differnew file mode 100644 index 0000000000..ffc7a44e34 --- /dev/null +++ b/lotuswordpro/qa/cppunit/data/fail/recurse-1.lwp diff --git a/lotuswordpro/qa/cppunit/data/fail/recurse-2.lwp b/lotuswordpro/qa/cppunit/data/fail/recurse-2.lwp Binary files differnew file mode 100644 index 0000000000..f19b0d7f7d --- /dev/null +++ b/lotuswordpro/qa/cppunit/data/fail/recurse-2.lwp diff --git a/lotuswordpro/qa/cppunit/data/fail/recurse-3.lwp b/lotuswordpro/qa/cppunit/data/fail/recurse-3.lwp Binary files differnew file mode 100644 index 0000000000..acb8c93ced --- /dev/null +++ b/lotuswordpro/qa/cppunit/data/fail/recurse-3.lwp diff --git a/lotuswordpro/qa/cppunit/data/fail/recurse-4.lwp b/lotuswordpro/qa/cppunit/data/fail/recurse-4.lwp Binary files differnew file mode 100644 index 0000000000..f48c5bb718 --- /dev/null +++ b/lotuswordpro/qa/cppunit/data/fail/recurse-4.lwp diff --git a/lotuswordpro/qa/cppunit/data/fail/recurse-5.lwp b/lotuswordpro/qa/cppunit/data/fail/recurse-5.lwp Binary files differnew file mode 100644 index 0000000000..a81b42f61e --- /dev/null +++ b/lotuswordpro/qa/cppunit/data/fail/recurse-5.lwp diff --git a/lotuswordpro/qa/cppunit/data/fail/reference-1.lwp b/lotuswordpro/qa/cppunit/data/fail/reference-1.lwp Binary files differnew file mode 100644 index 0000000000..d8141ae6db --- /dev/null +++ b/lotuswordpro/qa/cppunit/data/fail/reference-1.lwp diff --git a/lotuswordpro/qa/cppunit/data/fail/reference-2.lwp b/lotuswordpro/qa/cppunit/data/fail/reference-2.lwp Binary files differnew file mode 100644 index 0000000000..d2101d8feb --- /dev/null +++ b/lotuswordpro/qa/cppunit/data/fail/reference-2.lwp diff --git a/lotuswordpro/qa/cppunit/data/fail/reference-3.lwp b/lotuswordpro/qa/cppunit/data/fail/reference-3.lwp Binary files differnew file mode 100644 index 0000000000..6076b43b75 --- /dev/null +++ b/lotuswordpro/qa/cppunit/data/fail/reference-3.lwp diff --git a/lotuswordpro/qa/cppunit/data/fail/registered-1.lwp b/lotuswordpro/qa/cppunit/data/fail/registered-1.lwp Binary files differnew file mode 100644 index 0000000000..f3419f45b3 --- /dev/null +++ b/lotuswordpro/qa/cppunit/data/fail/registered-1.lwp diff --git a/lotuswordpro/qa/cppunit/data/fail/stack-1.lwp b/lotuswordpro/qa/cppunit/data/fail/stack-1.lwp Binary files differnew file mode 100644 index 0000000000..60eb8e393e --- /dev/null +++ b/lotuswordpro/qa/cppunit/data/fail/stack-1.lwp diff --git a/lotuswordpro/qa/cppunit/data/fail/subtable-1.lwp b/lotuswordpro/qa/cppunit/data/fail/subtable-1.lwp Binary files differnew file mode 100644 index 0000000000..3d906ee684 --- /dev/null +++ b/lotuswordpro/qa/cppunit/data/fail/subtable-1.lwp diff --git a/lotuswordpro/qa/cppunit/data/indeterminate/.gitignore b/lotuswordpro/qa/cppunit/data/indeterminate/.gitignore new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/lotuswordpro/qa/cppunit/data/indeterminate/.gitignore diff --git a/lotuswordpro/qa/cppunit/data/paragraphProperties.lwp b/lotuswordpro/qa/cppunit/data/paragraphProperties.lwp Binary files differnew file mode 100644 index 0000000000..dc4048cb92 --- /dev/null +++ b/lotuswordpro/qa/cppunit/data/paragraphProperties.lwp diff --git a/lotuswordpro/qa/cppunit/data/pass/IntPres11-2004.lwp b/lotuswordpro/qa/cppunit/data/pass/IntPres11-2004.lwp Binary files differnew file mode 100644 index 0000000000..786164ea46 --- /dev/null +++ b/lotuswordpro/qa/cppunit/data/pass/IntPres11-2004.lwp diff --git a/lotuswordpro/qa/cppunit/data/pass/fdo36036-1.lwp b/lotuswordpro/qa/cppunit/data/pass/fdo36036-1.lwp Binary files differnew file mode 100644 index 0000000000..7cc05cebc0 --- /dev/null +++ b/lotuswordpro/qa/cppunit/data/pass/fdo36036-1.lwp diff --git a/lotuswordpro/qa/cppunit/data/pass/null-1.lwp b/lotuswordpro/qa/cppunit/data/pass/null-1.lwp Binary files differnew file mode 100644 index 0000000000..351d7e88ef --- /dev/null +++ b/lotuswordpro/qa/cppunit/data/pass/null-1.lwp diff --git a/lotuswordpro/qa/cppunit/data/pass/ofz20507-1.lwp b/lotuswordpro/qa/cppunit/data/pass/ofz20507-1.lwp Binary files differnew file mode 100644 index 0000000000..26fc903db6 --- /dev/null +++ b/lotuswordpro/qa/cppunit/data/pass/ofz20507-1.lwp diff --git a/lotuswordpro/qa/cppunit/data/pass/ofz20517-1.lwp b/lotuswordpro/qa/cppunit/data/pass/ofz20517-1.lwp Binary files differnew file mode 100644 index 0000000000..de6dcbf1c5 --- /dev/null +++ b/lotuswordpro/qa/cppunit/data/pass/ofz20517-1.lwp diff --git a/lotuswordpro/qa/cppunit/data/pass/ofz57800-1.lwp b/lotuswordpro/qa/cppunit/data/pass/ofz57800-1.lwp Binary files differnew file mode 100644 index 0000000000..3d9b4299f8 --- /dev/null +++ b/lotuswordpro/qa/cppunit/data/pass/ofz57800-1.lwp diff --git a/lotuswordpro/qa/cppunit/data/pass/tdf129993-2.lwp b/lotuswordpro/qa/cppunit/data/pass/tdf129993-2.lwp Binary files differnew file mode 100644 index 0000000000..0f0645e3ba --- /dev/null +++ b/lotuswordpro/qa/cppunit/data/pass/tdf129993-2.lwp diff --git a/lotuswordpro/qa/cppunit/data/pass/tdf71147-1.lwp b/lotuswordpro/qa/cppunit/data/pass/tdf71147-1.lwp Binary files differnew file mode 100644 index 0000000000..fc351f434d --- /dev/null +++ b/lotuswordpro/qa/cppunit/data/pass/tdf71147-1.lwp diff --git a/lotuswordpro/qa/cppunit/data/pass/wordpro.lwp b/lotuswordpro/qa/cppunit/data/pass/wordpro.lwp Binary files differnew file mode 100644 index 0000000000..dc4048cb92 --- /dev/null +++ b/lotuswordpro/qa/cppunit/data/pass/wordpro.lwp diff --git a/lotuswordpro/qa/cppunit/data/tdf129993.lwp b/lotuswordpro/qa/cppunit/data/tdf129993.lwp Binary files differnew file mode 100644 index 0000000000..54bc9ac998 --- /dev/null +++ b/lotuswordpro/qa/cppunit/data/tdf129993.lwp diff --git a/lotuswordpro/qa/cppunit/data/tdf33787-ordered-bullets.lwp b/lotuswordpro/qa/cppunit/data/tdf33787-ordered-bullets.lwp Binary files differnew file mode 100644 index 0000000000..12febcd60d --- /dev/null +++ b/lotuswordpro/qa/cppunit/data/tdf33787-ordered-bullets.lwp diff --git a/lotuswordpro/qa/cppunit/import_test.cxx b/lotuswordpro/qa/cppunit/import_test.cxx new file mode 100644 index 0000000000..08d4c1bd39 --- /dev/null +++ b/lotuswordpro/qa/cppunit/import_test.cxx @@ -0,0 +1,303 @@ +/* -*- 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/unoapi_test.hxx> + +#include <com/sun/star/awt/FontWeight.hpp> +#include <com/sun/star/awt/FontSlant.hpp> +#include <com/sun/star/awt/FontUnderline.hpp> +#include <com/sun/star/awt/FontStrikeout.hpp> +#include <com/sun/star/table/BorderLine2.hpp> +#include <com/sun/star/frame/Desktop.hpp> +#include <com/sun/star/style/ParagraphAdjust.hpp> +#include <com/sun/star/style/LineSpacing.hpp> +#include <com/sun/star/text/XTextDocument.hpp> +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/beans/XPropertySet.hpp> + +using namespace ::com::sun::star; + +class LotusWordProTest : public UnoApiTest +{ +public: + LotusWordProTest() + : UnoApiTest("/lotuswordpro/qa/cppunit/data/") + { + } +}; + +CPPUNIT_TEST_FIXTURE(LotusWordProTest, testtdf33787OrderedBullets) +{ + // Test if ordered bullets are incrementing correctly: + // A. Lettered bullet uppercase 1 (A.) + // B. Lettered bullet uppercase 2 (B.) + // C. Lettered bullet uppercase 3 (C.) + // It is also make sure that nested and skipped bullets are working correctly: + // 1) Numbered bullet w/ bracket one (1)) + // Skipped bullet + // 2) Numbered bullet w/ bracket two (2)) + // a) Lettered bullet w/ bracket lowercase 1 (a)) + // b) Lettered bullet w/ bracket lowercase 2 (b)) + loadFromFile(u"tdf33787-ordered-bullets.lwp"); + uno::Reference<text::XTextDocument> textDocument(mxComponent, uno::UNO_QUERY); + uno::Reference<container::XEnumerationAccess> xParaEnumAccess(textDocument->getText(), + uno::UNO_QUERY); + uno::Reference<container::XEnumeration> xParaEnum = xParaEnumAccess->createEnumeration(); + + uno::Reference<beans::XPropertySet> xPara(xParaEnum->nextElement(), uno::UNO_QUERY); + OUString aListLabelString; + xPara->getPropertyValue("ListLabelString") >>= aListLabelString; + // Make sure the list start from 1. + CPPUNIT_ASSERT_EQUAL(OUString("1."), aListLabelString); + xPara.set(xParaEnum->nextElement(), uno::UNO_QUERY); + xPara->getPropertyValue("ListLabelString") >>= aListLabelString; + // Without the accompanying fix in place, this test would have failed, the list label was "1.". + CPPUNIT_ASSERT_EQUAL(OUString("2."), aListLabelString); + + xPara.set(xParaEnum->nextElement(), uno::UNO_QUERY); + xPara->getPropertyValue("ListLabelString") >>= aListLabelString; + // Without the accompanying fix in place, this test would have failed, the list label was "1.". + CPPUNIT_ASSERT_EQUAL(OUString("3."), aListLabelString); + + xPara.set(xParaEnum->nextElement(), uno::UNO_QUERY); + xPara.set(xParaEnum->nextElement(), uno::UNO_QUERY); + xPara->getPropertyValue("ListLabelString") >>= aListLabelString; + // Make sure the list start from i. + CPPUNIT_ASSERT_EQUAL(OUString("i."), aListLabelString); + + xPara.set(xParaEnum->nextElement(), uno::UNO_QUERY); + xPara->getPropertyValue("ListLabelString") >>= aListLabelString; + // Without the accompanying fix in place, this test would have failed, the list label was "i.". + CPPUNIT_ASSERT_EQUAL(OUString("ii."), aListLabelString); + + xPara.set(xParaEnum->nextElement(), uno::UNO_QUERY); + xPara->getPropertyValue("ListLabelString") >>= aListLabelString; + // Without the accompanying fix in place, this test would have failed, the list label was "i.". + CPPUNIT_ASSERT_EQUAL(OUString("iii."), aListLabelString); + + xPara.set(xParaEnum->nextElement(), uno::UNO_QUERY); + xPara.set(xParaEnum->nextElement(), uno::UNO_QUERY); + xPara->getPropertyValue("ListLabelString") >>= aListLabelString; + // Make sure the list start from I. + CPPUNIT_ASSERT_EQUAL(OUString("I."), aListLabelString); + + xPara.set(xParaEnum->nextElement(), uno::UNO_QUERY); + xPara->getPropertyValue("ListLabelString") >>= aListLabelString; + // Without the accompanying fix in place, this test would have failed, the list label was "I.". + CPPUNIT_ASSERT_EQUAL(OUString("II."), aListLabelString); + + xPara.set(xParaEnum->nextElement(), uno::UNO_QUERY); + xPara->getPropertyValue("ListLabelString") >>= aListLabelString; + // Without the accompanying fix in place, this test would have failed, the list label was "I.". + CPPUNIT_ASSERT_EQUAL(OUString("III."), aListLabelString); + + for (int i = 0; i < 7; ++i) + xParaEnum->nextElement(); + + xPara.set(xParaEnum->nextElement(), uno::UNO_QUERY); + xPara->getPropertyValue("ListLabelString") >>= aListLabelString; + // Without the accompanying fix in place, this test would have failed, the list label was "A.". + CPPUNIT_ASSERT_EQUAL(OUString("C."), aListLabelString); + + xPara.set(xParaEnum->nextElement(), uno::UNO_QUERY); + xPara.set(xParaEnum->nextElement(), uno::UNO_QUERY); + xPara->getPropertyValue("ListLabelString") >>= aListLabelString; + // Make sure the nested list (with indentation) starts from 1). + CPPUNIT_ASSERT_EQUAL(OUString("1)"), aListLabelString); + + xPara.set(xParaEnum->nextElement(), uno::UNO_QUERY); + xPara->getPropertyValue("ListLabelString") >>= aListLabelString; + // Make sure skipped element has no prefix + CPPUNIT_ASSERT_EQUAL(OUString(""), aListLabelString); + + xPara.set(xParaEnum->nextElement(), uno::UNO_QUERY); + xPara->getPropertyValue("ListLabelString") >>= aListLabelString; + // Make sure the value after Skip is incremented properly + // Without the accompanying fix in place, this test would have failed, the list label was "1)". + CPPUNIT_ASSERT_EQUAL(OUString("2)"), aListLabelString); + + xPara.set(xParaEnum->nextElement(), uno::UNO_QUERY); + xPara->getPropertyValue("ListLabelString") >>= aListLabelString; + // Next nested list + CPPUNIT_ASSERT_EQUAL(OUString("a)"), aListLabelString); + + xPara.set(xParaEnum->nextElement(), uno::UNO_QUERY); + xPara->getPropertyValue("ListLabelString") >>= aListLabelString; + // Without the accompanying fix in place, this test would have failed, the list label was "a)". + CPPUNIT_ASSERT_EQUAL(OUString("b)"), aListLabelString); +} + +CPPUNIT_TEST_FIXTURE(LotusWordProTest, testTdf129993) +{ + loadFromFile(u"tdf129993.lwp"); + uno::Reference<text::XTextDocument> textDocument(mxComponent, 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_TEST_FIXTURE(LotusWordProTest, paragraphProperties) +{ + loadFromFile(u"paragraphProperties.lwp"); + uno::Reference<text::XTextDocument> textDocument(mxComponent, uno::UNO_QUERY); + uno::Reference<container::XEnumerationAccess> xParaEnumAccess(textDocument->getText(), + uno::UNO_QUERY); + uno::Reference<container::XEnumeration> xParaEnum = xParaEnumAccess->createEnumeration(); + + //Ignore the first paragraphs + for (int i = 0; i < 4; ++i) + xParaEnum->nextElement(); + + // bold + uno::Reference<text::XTextRange> const xParagraph(xParaEnum->nextElement(), + uno::UNO_QUERY_THROW); + uno::Reference<beans::XPropertySet> xPropertySet(xParagraph, uno::UNO_QUERY); + float fFontWeight; + xPropertySet->getPropertyValue("CharWeight") >>= fFontWeight; + CPPUNIT_ASSERT_EQUAL(awt::FontWeight::BOLD, fFontWeight); + + // italic + uno::Reference<text::XTextRange> const xParagraph2(xParaEnum->nextElement(), + uno::UNO_QUERY_THROW); + uno::Reference<beans::XPropertySet> xPropertySet2(xParagraph2, uno::UNO_QUERY); + awt::FontSlant fFontSlant; + xPropertySet2->getPropertyValue("CharPosture") >>= fFontSlant; + CPPUNIT_ASSERT_EQUAL(awt::FontSlant_ITALIC, fFontSlant); + + // underline + uno::Reference<text::XTextRange> const xParagraph3(xParaEnum->nextElement(), + uno::UNO_QUERY_THROW); + uno::Reference<beans::XPropertySet> xPropertySet3(xParagraph3, uno::UNO_QUERY); + sal_Int16 nCharUnderline; + xPropertySet3->getPropertyValue("CharUnderline") >>= nCharUnderline; + CPPUNIT_ASSERT_EQUAL(awt::FontUnderline::SINGLE, nCharUnderline); + + // striked through + uno::Reference<text::XTextRange> const xParagraph4(xParaEnum->nextElement(), + uno::UNO_QUERY_THROW); + uno::Reference<beans::XPropertySet> xPropertySet4(xParagraph4, uno::UNO_QUERY); + sal_Int16 nFontStrikeout; + xPropertySet4->getPropertyValue("CharStrikeout") >>= nFontStrikeout; + CPPUNIT_ASSERT_EQUAL(awt::FontStrikeout::SINGLE, nFontStrikeout); + + //superscript + uno::Reference<text::XTextRange> const xParagraph5(xParaEnum->nextElement(), + uno::UNO_QUERY_THROW); + uno::Reference<beans::XPropertySet> 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<text::XTextRange> const xParagraph6(xParaEnum->nextElement(), + uno::UNO_QUERY_THROW); + uno::Reference<beans::XPropertySet> 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<text::XTextRange> const xParagraph7(xParaEnum->nextElement(), + uno::UNO_QUERY_THROW); + uno::Reference<beans::XPropertySet> 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<text::XTextRange> const xParagraph8(xParaEnum->nextElement(), + uno::UNO_QUERY_THROW); + uno::Reference<beans::XPropertySet> xPropertySet8(xParagraph8, uno::UNO_QUERY); + sal_Int16 nParaAdjust = {}; // spurious -Werror=maybe-uninitialized + xPropertySet8->getPropertyValue("ParaAdjust") >>= nParaAdjust; + CPPUNIT_ASSERT_EQUAL(style::ParagraphAdjust_CENTER, + static_cast<style::ParagraphAdjust>(nParaAdjust)); + + // left margin + uno::Reference<text::XTextRange> const xParagraph9(xParaEnum->nextElement(), + uno::UNO_QUERY_THROW); + uno::Reference<beans::XPropertySet> xPropertySet9(xParagraph9, uno::UNO_QUERY); + sal_Int32 nParaLeftMargin; + xPropertySet9->getPropertyValue("ParaLeftMargin") >>= nParaLeftMargin; + CPPUNIT_ASSERT_EQUAL(sal_Int32(2000), nParaLeftMargin); + + // double line spacing + uno::Reference<text::XTextRange> const xParagraph10(xParaEnum->nextElement(), + uno::UNO_QUERY_THROW); + uno::Reference<beans::XPropertySet> 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<text::XTextRange> const xParagraph11(xParaEnum->nextElement(), + uno::UNO_QUERY_THROW); + uno::Reference<beans::XPropertySet> 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<text::XTextRange> const xParagraph12(xParaEnum->nextElement(), + uno::UNO_QUERY_THROW); + uno::Reference<beans::XPropertySet> 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<text::XTextRange> const xParagraph13(xParaEnum->nextElement(), + uno::UNO_QUERY_THROW); + uno::Reference<beans::XPropertySet> 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 0000000000..f4c1690305 --- /dev/null +++ b/lotuswordpro/qa/cppunit/test_lotuswordpro.cxx @@ -0,0 +1,72 @@ +/* -*- 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 <sal/config.h> + +#include <comphelper/propertyvalue.hxx> + +#include <unotest/filters-test.hxx> +#include <test/bootstrapfixture.hxx> +#include <com/sun/star/document/XFilter.hpp> + +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<document::XFilter> 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 aDescriptor{ comphelper::makePropertyValue("URL", rURL) }; + return m_xFilter->filter(aDescriptor); + } + + void LotusWordProTest::test() + { + testDir(OUString(), + m_directories.getURLFromSrc(u"/lotuswordpro/qa/cppunit/data/")); + } + + CPPUNIT_TEST_SUITE_REGISTRATION(LotusWordProTest); +} + +CPPUNIT_PLUGIN_IMPLEMENT(); + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |