diff options
Diffstat (limited to 'lotuswordpro/qa/cppunit/import_test.cxx')
-rw-r--r-- | lotuswordpro/qa/cppunit/import_test.cxx | 102 |
1 files changed, 102 insertions, 0 deletions
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"; |