/* -*- 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/.
*/
class LotusWordProTest : public UnoApiTest
{ public:
LotusWordProTest()
: UnoApiTest(u"/lotuswordpro/qa/cppunit/data/"_ustr)
{
}
};
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(u"ListLabelString"_ustr) >>= aListLabelString; // Make sure the list start from 1.
CPPUNIT_ASSERT_EQUAL(u"1."_ustr, aListLabelString);
xPara.set(xParaEnum->nextElement(), uno::UNO_QUERY);
xPara->getPropertyValue(u"ListLabelString"_ustr) >>= aListLabelString; // Without the accompanying fix in place, this test would have failed, the list label was "1.".
CPPUNIT_ASSERT_EQUAL(u"2."_ustr, aListLabelString);
xPara.set(xParaEnum->nextElement(), uno::UNO_QUERY);
xPara->getPropertyValue(u"ListLabelString"_ustr) >>= aListLabelString; // Without the accompanying fix in place, this test would have failed, the list label was "1.".
CPPUNIT_ASSERT_EQUAL(u"3."_ustr, aListLabelString);
xPara.set(xParaEnum->nextElement(), uno::UNO_QUERY);
xPara.set(xParaEnum->nextElement(), uno::UNO_QUERY);
xPara->getPropertyValue(u"ListLabelString"_ustr) >>= aListLabelString; // Make sure the list start from i.
CPPUNIT_ASSERT_EQUAL(u"i."_ustr, aListLabelString);
xPara.set(xParaEnum->nextElement(), uno::UNO_QUERY);
xPara->getPropertyValue(u"ListLabelString"_ustr) >>= aListLabelString; // Without the accompanying fix in place, this test would have failed, the list label was "i.".
CPPUNIT_ASSERT_EQUAL(u"ii."_ustr, aListLabelString);
xPara.set(xParaEnum->nextElement(), uno::UNO_QUERY);
xPara->getPropertyValue(u"ListLabelString"_ustr) >>= aListLabelString; // Without the accompanying fix in place, this test would have failed, the list label was "i.".
CPPUNIT_ASSERT_EQUAL(u"iii."_ustr, aListLabelString);
xPara.set(xParaEnum->nextElement(), uno::UNO_QUERY);
xPara.set(xParaEnum->nextElement(), uno::UNO_QUERY);
xPara->getPropertyValue(u"ListLabelString"_ustr) >>= aListLabelString; // Make sure the list start from I.
CPPUNIT_ASSERT_EQUAL(u"I."_ustr, aListLabelString);
xPara.set(xParaEnum->nextElement(), uno::UNO_QUERY);
xPara->getPropertyValue(u"ListLabelString"_ustr) >>= aListLabelString; // Without the accompanying fix in place, this test would have failed, the list label was "I.".
CPPUNIT_ASSERT_EQUAL(u"II."_ustr, aListLabelString);
xPara.set(xParaEnum->nextElement(), uno::UNO_QUERY);
xPara->getPropertyValue(u"ListLabelString"_ustr) >>= aListLabelString; // Without the accompanying fix in place, this test would have failed, the list label was "I.".
CPPUNIT_ASSERT_EQUAL(u"III."_ustr, aListLabelString);
for (int i = 0; i < 7; ++i)
xParaEnum->nextElement();
xPara.set(xParaEnum->nextElement(), uno::UNO_QUERY);
xPara->getPropertyValue(u"ListLabelString"_ustr) >>= aListLabelString; // Without the accompanying fix in place, this test would have failed, the list label was "A.".
CPPUNIT_ASSERT_EQUAL(u"C."_ustr, aListLabelString);
xPara.set(xParaEnum->nextElement(), uno::UNO_QUERY);
xPara.set(xParaEnum->nextElement(), uno::UNO_QUERY);
xPara->getPropertyValue(u"ListLabelString"_ustr) >>= aListLabelString; // Make sure the nested list (with indentation) starts from 1).
CPPUNIT_ASSERT_EQUAL(u"1)"_ustr, aListLabelString);
xPara.set(xParaEnum->nextElement(), uno::UNO_QUERY);
xPara->getPropertyValue(u"ListLabelString"_ustr) >>= aListLabelString; // Make sure skipped element has no prefix
CPPUNIT_ASSERT_EQUAL(u""_ustr, aListLabelString);
xPara.set(xParaEnum->nextElement(), uno::UNO_QUERY);
xPara->getPropertyValue(u"ListLabelString"_ustr) >>= 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(u"2)"_ustr, aListLabelString);
xPara.set(xParaEnum->nextElement(), uno::UNO_QUERY);
xPara->getPropertyValue(u"ListLabelString"_ustr) >>= aListLabelString; // Next nested list
CPPUNIT_ASSERT_EQUAL(u"a)"_ustr, aListLabelString);
xPara.set(xParaEnum->nextElement(), uno::UNO_QUERY);
xPara->getPropertyValue(u"ListLabelString"_ustr) >>= aListLabelString; // Without the accompanying fix in place, this test would have failed, the list label was "a)".
CPPUNIT_ASSERT_EQUAL(u"b)"_ustr, 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);
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.