oox/source/drawingml/textcharacterproperties.cxx | 2 + sd/qa/unit/data/pptx/tdf96061.pptx |binary sd/qa/unit/export-tests-ooxml2.cxx | 36 +++++++++++++++++++++++ 3 files changed, 38 insertions(+)
New commits: commit 1cd26a9ab64482daf4de08f5bb7730d0a991bbce Author: Gülşah Köse <gulsah.k...@collabora.com> AuthorDate: Wed May 19 14:37:36 2021 +0300 Commit: Gülşah Köse <gulsah.k...@collabora.com> CommitDate: Wed May 26 10:14:57 2021 +0200 tdf#96061 Unset the highlight property When we have highlight property on specific part of the text the following texts were highligthing. To prevent this we unset the highlight property when we have not highlight property anymore. Change-Id: I802cde1c784afe47201a9ba4f41827dd0c705035 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115800 Tested-by: Jenkins Reviewed-by: Gülşah Köse <gulsah.k...@collabora.com> diff --git a/oox/source/drawingml/textcharacterproperties.cxx b/oox/source/drawingml/textcharacterproperties.cxx index 20965e33abb1..4eb5acaffb56 100644 --- a/oox/source/drawingml/textcharacterproperties.cxx +++ b/oox/source/drawingml/textcharacterproperties.cxx @@ -177,6 +177,8 @@ void TextCharacterProperties::pushToPropMap( PropertyMap& rPropMap, const XmlFil if( maHighlightColor.isUsed() ) rPropMap.setProperty( PROP_CharBackColor, maHighlightColor.getColor( rFilter.getGraphicHelper() )); + else + rPropMap.setProperty( PROP_CharBackColor, sal_Int32(-1)); } static void pushToGrabBag( PropertySet& rPropSet, const std::vector<PropertyValue>& aVectorOfPropertyValues ) diff --git a/sd/qa/unit/data/pptx/tdf96061.pptx b/sd/qa/unit/data/pptx/tdf96061.pptx new file mode 100644 index 000000000000..c6e6aa5ae16f Binary files /dev/null and b/sd/qa/unit/data/pptx/tdf96061.pptx differ diff --git a/sd/qa/unit/export-tests-ooxml2.cxx b/sd/qa/unit/export-tests-ooxml2.cxx index 6c12ac08928c..973503cc3b80 100644 --- a/sd/qa/unit/export-tests-ooxml2.cxx +++ b/sd/qa/unit/export-tests-ooxml2.cxx @@ -212,6 +212,7 @@ public: void testTdf128213ShapeRot(); void testTdf125560_textDeflate(); void testTdf125560_textInflateTop(); + void testTdf96061_textHighlight(); CPPUNIT_TEST_SUITE(SdOOXMLExportTest2); @@ -338,6 +339,7 @@ public: CPPUNIT_TEST(testTdf128213ShapeRot); CPPUNIT_TEST(testTdf125560_textDeflate); CPPUNIT_TEST(testTdf125560_textInflateTop); + CPPUNIT_TEST(testTdf96061_textHighlight); CPPUNIT_TEST_SUITE_END(); @@ -3191,6 +3193,40 @@ void SdOOXMLExportTest2::testTdf125560_textInflateTop() assertXPath(pXmlDocRels, "/office:document-content/office:body/office:presentation/draw:page/draw:custom-shape/draw:enhanced-geometry", "type", "mso-spt164"); } +void SdOOXMLExportTest2::testTdf96061_textHighlight() +{ + ::sd::DrawDocShellRef xDocShRef = loadURL( m_directories.getURLFromSrc(u"/sd/qa/unit/data/pptx/tdf96061.pptx"), PPTX); + + uno::Reference<beans::XPropertySet> xShape(getShapeFromPage(0, 0, xDocShRef)); + uno::Reference<text::XTextRange> const xParagraph1(getParagraphFromShape(0, xShape)); + uno::Reference<text::XTextRange> xRun1(getRunFromParagraph(0, xParagraph1)); + uno::Reference< beans::XPropertySet> xPropSet1(xRun1, uno::UNO_QUERY_THROW); + sal_Int32 aColor; + xPropSet1->getPropertyValue("CharBackColor") >>= aColor; + CPPUNIT_ASSERT_EQUAL(sal_Int32(16776960), aColor); + + uno::Reference<text::XTextRange> const xParagraph2(getParagraphFromShape(1, xShape)); + uno::Reference<text::XTextRange> xRun2(getRunFromParagraph(0, xParagraph2)); + uno::Reference< beans::XPropertySet> xPropSet2(xRun2, uno::UNO_QUERY_THROW); + xPropSet2->getPropertyValue("CharBackColor") >>= aColor; + CPPUNIT_ASSERT_EQUAL(sal_Int32(-1), aColor); + + xDocShRef = saveAndReload( xDocShRef.get(), PPTX ); + + uno::Reference<beans::XPropertySet> xShape2(getShapeFromPage(0, 0, xDocShRef)); + uno::Reference<text::XTextRange> const xParagraph3(getParagraphFromShape(0, xShape2)); + uno::Reference<text::XTextRange> xRun3(getRunFromParagraph(0, xParagraph3)); + uno::Reference< beans::XPropertySet> xPropSet3(xRun3, uno::UNO_QUERY_THROW); + xPropSet3->getPropertyValue("CharBackColor") >>= aColor; + CPPUNIT_ASSERT_EQUAL(sal_Int32(16776960), aColor); + + uno::Reference<text::XTextRange> const xParagraph4(getParagraphFromShape(1, xShape2)); + uno::Reference<text::XTextRange> xRun4(getRunFromParagraph(0, xParagraph4)); + uno::Reference< beans::XPropertySet> xPropSet4(xRun4, uno::UNO_QUERY_THROW); + xPropSet4->getPropertyValue("CharBackColor") >>= aColor; + CPPUNIT_ASSERT_EQUAL(sal_Int32(-1), aColor); +} + CPPUNIT_TEST_SUITE_REGISTRATION(SdOOXMLExportTest2); CPPUNIT_PLUGIN_IMPLEMENT(); _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits