[Libreoffice-commits] core.git: Branch 'libreoffice-7-1' - oox/source sd/qa

Gülşah Köse (via logerrit) logerrit at kemper.freedesktop.org
Wed May 26 13:21:30 UTC 2021


 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 2ff2a77990a09637321417bfda23206a5a8306e8
Author:     Gülşah Köse <gulsah.kose at collabora.com>
AuthorDate: Wed May 19 14:37:36 2021 +0300
Commit:     Andras Timar <andras.timar at collabora.com>
CommitDate: Wed May 26 15:20:47 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.kose at collabora.com>
    Signed-off-by: Xisco Fauli <xiscofauli at libreoffice.org>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/116176
    Reviewed-by: Andras Timar <andras.timar at 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 ce8280e54f24..bf701ac3ecc1 100644
--- a/sd/qa/unit/export-tests-ooxml2.cxx
+++ b/sd/qa/unit/export-tests-ooxml2.cxx
@@ -206,6 +206,7 @@ public:
     void testShapeSoftEdgeEffect();
     void testShapeShadowBlurEffect();
     void testTdf119223();
+    void testTdf96061_textHighlight();
 
     CPPUNIT_TEST_SUITE(SdOOXMLExportTest2);
 
@@ -327,6 +328,7 @@ public:
     CPPUNIT_TEST(testShapeSoftEdgeEffect);
     CPPUNIT_TEST(testShapeShadowBlurEffect);
     CPPUNIT_TEST(testTdf119223);
+    CPPUNIT_TEST(testTdf96061_textHighlight);
 
     CPPUNIT_TEST_SUITE_END();
 
@@ -3074,6 +3076,40 @@ void SdOOXMLExportTest2::testTdf119223()
                 "//p:cNvPr[@name='SomeGroup']");
 }
 
+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();


More information about the Libreoffice-commits mailing list