diff options
author | Tamás Zolnai <tamas.zolnai@collabora.com> | 2016-12-09 12:33:52 +0000 |
---|---|---|
committer | Tamás Zolnai <tamas.zolnai@collabora.com> | 2016-12-09 12:33:52 +0000 |
commit | ea30958bd28bf5cb020fe36cf1b4748659544be2 (patch) | |
tree | e4f53851a05f5c28130d9768bc36abc4d24becd8 /sd | |
parent | c1ae11db4a56dea9369d379a83c8a2a7afc2b99b (diff) |
tdf#104445: PPTX import: Extra bullets are added to placeholder text
Reviewed-on: https://gerrit.libreoffice.org/31771
Reviewed-by: Tamás Zolnai <tamas.zolnai@collabora.com>
Tested-by: Tamás Zolnai <tamas.zolnai@collabora.com>
(cherry picked from commit cb598029835477326b190bc99abd31a487cc5a91)
Change-Id: I25ce98ed391f70292bed6238645b121b9cf50d5e
Diffstat (limited to 'sd')
-rwxr-xr-x | sd/qa/unit/data/pptx/tdf104445.pptx | bin | 0 -> 14291 bytes | |||
-rw-r--r-- | sd/qa/unit/import-tests.cxx | 53 |
2 files changed, 53 insertions, 0 deletions
diff --git a/sd/qa/unit/data/pptx/tdf104445.pptx b/sd/qa/unit/data/pptx/tdf104445.pptx Binary files differnew file mode 100755 index 000000000000..bee32dc0022f --- /dev/null +++ b/sd/qa/unit/data/pptx/tdf104445.pptx diff --git a/sd/qa/unit/import-tests.cxx b/sd/qa/unit/import-tests.cxx index 72654ab543bf..6e89764d972b 100644 --- a/sd/qa/unit/import-tests.cxx +++ b/sd/qa/unit/import-tests.cxx @@ -60,6 +60,7 @@ #include <com/sun/star/style/ParagraphAdjust.hpp> #include <com/sun/star/style/XStyleFamiliesSupplier.hpp> #include <com/sun/star/table/XTableRows.hpp> +#include <com/sun/star/style/NumberingType.hpp> #include <stlpool.hxx> #include <comphelper/processfactory.hxx> @@ -117,6 +118,7 @@ public: void testTdf103876(); void testTdf104015(); void testTdf104201(); + void testTdf104445(); CPPUNIT_TEST_SUITE(SdImportTest); @@ -165,6 +167,7 @@ public: CPPUNIT_TEST(testTdf103876); CPPUNIT_TEST(testTdf104015); CPPUNIT_TEST(testTdf104201); + CPPUNIT_TEST(testTdf104445); CPPUNIT_TEST_SUITE_END(); }; @@ -1350,6 +1353,56 @@ void SdImportTest::testTdf104201() xDocShRef->DoClose(); } +void SdImportTest::testTdf104445() +{ + // Extra bullets were added to the first shape + sd::DrawDocShellRef xDocShRef = loadURL(getURLFromSrc("sd/qa/unit/data/pptx/tdf104445.pptx"), PPTX); + + // First shape should not have bullet + { + uno::Reference< beans::XPropertySet > xShape(getShapeFromPage(0, 0, xDocShRef)); + uno::Reference< text::XText > xText = uno::Reference< text::XTextRange>(xShape, uno::UNO_QUERY)->getText(); + CPPUNIT_ASSERT_MESSAGE("Not a text shape", xText.is()); + uno::Reference< beans::XPropertySet > xPropSet(xText, uno::UNO_QUERY_THROW); + + uno::Reference< container::XIndexAccess > xNumRule; + xPropSet->getPropertyValue("NumberingRules") >>= xNumRule; + uno::Sequence<beans::PropertyValue> aBulletProps; + xNumRule->getByIndex(0) >>= aBulletProps; + + for (int i = 0; i < aBulletProps.getLength(); ++i) + { + const beans::PropertyValue& rProp = aBulletProps[i]; + if(rProp.Name == "NumberingType") + CPPUNIT_ASSERT_EQUAL(sal_Int16(style::NumberingType::NUMBER_NONE), rProp.Value.get<sal_Int16>()); + if(rProp.Name == "LeftMargin") + CPPUNIT_ASSERT_EQUAL(sal_Int32(0), rProp.Value.get<sal_Int32>()); + } + } + // Second shape should have bullet set + { + uno::Reference< beans::XPropertySet > xShape(getShapeFromPage(1, 0, xDocShRef)); + uno::Reference< text::XText > xText = uno::Reference< text::XTextRange>(xShape, uno::UNO_QUERY)->getText(); + CPPUNIT_ASSERT_MESSAGE("Not a text shape", xText.is()); + uno::Reference< beans::XPropertySet > xPropSet(xText, uno::UNO_QUERY_THROW); + + uno::Reference< container::XIndexAccess > xNumRule; + xPropSet->getPropertyValue("NumberingRules") >>= xNumRule; + uno::Sequence<beans::PropertyValue> aBulletProps; + xNumRule->getByIndex(0) >>= aBulletProps; + + for(int i = 0; i < aBulletProps.getLength(); ++i) + { + const beans::PropertyValue& rProp = aBulletProps[i]; + if(rProp.Name == "NumberingType") + CPPUNIT_ASSERT_EQUAL(sal_Int16(style::NumberingType::CHAR_SPECIAL), rProp.Value.get<sal_Int16>()); + if(rProp.Name == "LeftMargin") + CPPUNIT_ASSERT_EQUAL(sal_Int32(635), rProp.Value.get<sal_Int32>()); + } + } + xDocShRef->DoClose(); +} + CPPUNIT_TEST_SUITE_REGISTRATION(SdImportTest); CPPUNIT_PLUGIN_IMPLEMENT(); |