diff options
author | Bartosz Kosiorek <gang65@poczta.onet.pl> | 2022-07-15 22:46:03 +0200 |
---|---|---|
committer | Bartosz Kosiorek <gang65@poczta.onet.pl> | 2022-07-21 09:11:31 +0200 |
commit | a0bcd1d187a4e56a9fa600462842004545b6be9c (patch) | |
tree | 147169997a66bf755c5311fef5c489ea85b42306 /lotuswordpro/qa/cppunit | |
parent | d449da36086409e3cc440036193c4fc8a10a37a1 (diff) |
tdf33787 lotuswordpro: fix increments of ordered bullets
With previous implementation there was an bug which causing missing
incrementing ordered bullets. For example:
A. Lettered bullet uppercase 1 (A. )
A. Lettered bullet uppercase 2 (B. )
A. Lettered bullet uppercase 3 (C. )
This patch is fixing that, and increments is working 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) )
Change-Id: I1d1ad9ee549039077b418756efefb10bacfa1ddd
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137112
Tested-by: Jenkins
Reviewed-by: Bartosz Kosiorek <gang65@poczta.onet.pl>
Diffstat (limited to 'lotuswordpro/qa/cppunit')
-rw-r--r-- | lotuswordpro/qa/cppunit/data/tdf33787-ordered-bullets.lwp | bin | 0 -> 21316 bytes | |||
-rw-r--r-- | lotuswordpro/qa/cppunit/import_test.cxx | 102 |
2 files changed, 102 insertions, 0 deletions
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 000000000000..12febcd60d55 --- /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 index fe2128f72ab5..7411a16ab8bd 100644 --- a/lotuswordpro/qa/cppunit/import_test.cxx +++ b/lotuswordpro/qa/cppunit/import_test.cxx @@ -53,6 +53,108 @@ void LotusWordProTest::tearDown() constexpr OUStringLiteral DATA_DIRECTORY = u"/lotuswordpro/qa/cppunit/data/"; +CPPUNIT_TEST_FIXTURE(LotusWordProTest, testtdf33787OrderedBullets) +{ + // Test if ordered bullets are incrementing correclty: + // 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)) + OUString aURL = m_directories.getURLFromSrc(DATA_DIRECTORY) + "tdf33787-ordered-bullets.lwp"; + getComponent() = loadFromDesktop(aURL); + 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(); + + 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 indendation) 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) { OUString aURL = m_directories.getURLFromSrc(DATA_DIRECTORY) + "tdf129993.lwp"; |