diff --git a/sw/qa/api/SwXNumberingRules.cxx b/sw/qa/api/SwXNumberingRules.cxx index 983341953efb..0cef4f4312bf 100644 --- a/sw/qa/api/SwXNumberingRules.cxx +++ b/sw/qa/api/SwXNumberingRules.cxx @@ -16,7 +16,7 @@ #include #include - +#include #include #include #include @@ -26,6 +26,7 @@ #include #include #include +#include using namespace css; using namespace css::uno; @@ -110,6 +111,53 @@ public: return Reference(xNumRules, UNO_QUERY_THROW); } + //tdf#135335 + void testBulletFontName() + { + loadFromURL(u"private:factory/swriter"_ustr); + Reference xTextDoc(mxComponent, UNO_QUERY_THROW); + Reference xText = xTextDoc->getText(); + Reference xCursor = xText->createTextCursor(); + + xText->insertString(xCursor, u"Test List Item"_ustr, false); + xText->insertControlCharacter(xCursor, text::ControlCharacter::PARAGRAPH_BREAK, false); + + Reference xParaProps(xCursor, UNO_QUERY_THROW); + Reference xFactory(mxComponent, UNO_QUERY_THROW); + + Reference xNumRules( + xFactory->createInstance(u"com.sun.star.text.NumberingRules"_ustr), UNO_QUERY_THROW); + + beans::PropertyValue props[4] + = { { u"NumberingType"_ustr, 0, Any(style::NumberingType::CHAR_SPECIAL), + beans::PropertyState_DIRECT_VALUE }, + { u"BulletChar"_ustr, 0, Any(OUString(OUStringChar(u'\u2022'))), + beans::PropertyState_DIRECT_VALUE }, + { u"Prefix"_ustr, 0, Any(OUString()), beans::PropertyState_DIRECT_VALUE }, + { u"BulletFontName"_ustr, 0, Any(u"OpenSymbol"_ustr), + beans::PropertyState_DIRECT_VALUE } }; + Sequence levelProps(props, 4); + xNumRules->replaceByIndex(0, Any(levelProps)); + + xParaProps->setPropertyValue(u"NumberingRules"_ustr, Any(xNumRules)); + + Reference xAppliedRules; + xParaProps->getPropertyValue(u"NumberingRules"_ustr) >>= xAppliedRules; + Sequence appliedLevelProps; + xAppliedRules->getByIndex(0) >>= appliedLevelProps; + OUString bulletFontName; + for (const auto& prop : appliedLevelProps) + { + if (prop.Name == "BulletFontName") + { + prop.Value >>= bulletFontName; + break; + } + } + CPPUNIT_ASSERT_MESSAGE("Bullet font name must not be empty", !bulletFontName.isEmpty()); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Bullet font should be OpenSymbol", u"OpenSymbol"_ustr, + bulletFontName); + } CPPUNIT_TEST_SUITE(SwXNumberingRules); CPPUNIT_TEST(testGetElementType); @@ -122,6 +170,7 @@ public: CPPUNIT_TEST(testPropertyChangeListener); CPPUNIT_TEST(testVetoableChangeListener); CPPUNIT_TEST(testNumberingRulesProperties); + CPPUNIT_TEST(testBulletFontName); CPPUNIT_TEST_SUITE_END(); };