oox/source/drawingml/textcharacterproperties.cxx |    6 +++
 sd/qa/unit/data/pptx/tdf148685.pptx              |binary
 sd/qa/unit/import-tests2.cxx                     |   43 +++++++++++++++++++++++
 3 files changed, 49 insertions(+)

New commits:
commit 696677a36182062dfa3d157130904a6cf9fc73b1
Author:     Xisco Fauli <[email protected]>
AuthorDate: Wed Apr 20 17:58:15 2022 +0200
Commit:     Adolfo Jayme Barrientos <[email protected]>
CommitDate: Sat Apr 23 13:02:35 2022 +0200

    tdf#148685: Unset CharUnderlineColor and CharUnderlineHasColor properties
    
    Change-Id: Iebf482434cd393f55ae3e4690580b573624d78b1
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133219
    Tested-by: Xisco Fauli <[email protected]>
    Reviewed-by: Xisco Fauli <[email protected]>
    (cherry picked from commit 1c924efe1f80207a5e104d755615b1eb9a91d418)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133282
    Tested-by: Jenkins
    Reviewed-by: Adolfo Jayme Barrientos <[email protected]>

diff --git a/oox/source/drawingml/textcharacterproperties.cxx 
b/oox/source/drawingml/textcharacterproperties.cxx
index 7ffeaeba8da2..be2409f5795c 100644
--- a/oox/source/drawingml/textcharacterproperties.cxx
+++ b/oox/source/drawingml/textcharacterproperties.cxx
@@ -195,6 +195,12 @@ void TextCharacterProperties::pushToPropMap( PropertyMap& 
rPropMap, const XmlFil
         rPropMap.setProperty( PROP_CharUnderlineHasColor, true);
         rPropMap.setProperty( PROP_CharUnderlineColor, 
maUnderlineColor.getColor( rFilter.getGraphicHelper() ));
     }
+    else
+    {
+        rPropMap.setProperty( PROP_CharUnderlineHasColor, false);
+        rPropMap.setProperty( PROP_CharUnderlineColor, sal_Int32(-1));
+    }
+
     // TODO If bUnderlineFillFollowText uFillTx 
(CT_TextUnderlineFillFollowText) is set, fill color of the underline should be 
the same color as the text
 
     if (maHighlightColor.isUsed() && maHighlightColor.getTransparency() != 100)
diff --git a/sd/qa/unit/data/pptx/tdf148685.pptx 
b/sd/qa/unit/data/pptx/tdf148685.pptx
new file mode 100644
index 000000000000..80af5a9bbf46
Binary files /dev/null and b/sd/qa/unit/data/pptx/tdf148685.pptx differ
diff --git a/sd/qa/unit/import-tests2.cxx b/sd/qa/unit/import-tests2.cxx
index 3ecbec200c6e..ee0d110df24d 100644
--- a/sd/qa/unit/import-tests2.cxx
+++ b/sd/qa/unit/import-tests2.cxx
@@ -116,6 +116,7 @@ public:
     void testAoo124143();
     void testTdf103567();
     void testTdf103792();
+    void testTdf148685();
     void testTdf103876();
     void testTdf79007();
     void testTdf118776();
@@ -184,6 +185,7 @@ public:
     CPPUNIT_TEST(testAoo124143);
     CPPUNIT_TEST(testTdf103567);
     CPPUNIT_TEST(testTdf103792);
+    CPPUNIT_TEST(testTdf148685);
     CPPUNIT_TEST(testTdf103876);
     CPPUNIT_TEST(testTdf79007);
     CPPUNIT_TEST(testTdf118776);
@@ -476,6 +478,47 @@ void SdImportTest2::testTdf103792()
     xDocShRef->DoClose();
 }
 
+void SdImportTest2::testTdf148685()
+{
+    sd::DrawDocShellRef xDocShRef
+        = 
loadURL(m_directories.getURLFromSrc(u"/sd/qa/unit/data/pptx/tdf148685.pptx"), 
PPTX);
+    uno::Reference<beans::XPropertySet> xShape(getShapeFromPage(1, 0, 
xDocShRef));
+
+    uno::Reference<text::XTextRange> const xParagraph(getParagraphFromShape(0, 
xShape));
+
+    uno::Reference<text::XTextRange> xRun(getRunFromParagraph(0, xParagraph));
+    CPPUNIT_ASSERT_EQUAL(OUString("TEXT "), xRun->getString());
+
+    uno::Reference<beans::XPropertySet> xPropSet(xRun, uno::UNO_QUERY_THROW);
+
+    Color nCharUnderlineColor;
+    xPropSet->getPropertyValue("CharUnderlineColor") >>= nCharUnderlineColor;
+    CPPUNIT_ASSERT_EQUAL(Color(0xA1467E), nCharUnderlineColor);
+
+    xRun.set(getRunFromParagraph(1, xParagraph));
+
+    CPPUNIT_ASSERT_EQUAL(OUString("TE"), xRun->getString());
+
+    xPropSet.set(xRun, uno::UNO_QUERY_THROW);
+
+    xPropSet->getPropertyValue("CharUnderlineColor") >>= nCharUnderlineColor;
+
+    // Without the fix in place, this test would have failed with
+    // - Expected: Color: R:255 G:255 B:255 A:255
+    // - Actual  : Color: R:161 G:70 B:126 A:0
+    CPPUNIT_ASSERT_EQUAL(COL_AUTO, nCharUnderlineColor);
+
+    xRun.set(getRunFromParagraph(2, xParagraph));
+    CPPUNIT_ASSERT_EQUAL(OUString("XT"), xRun->getString());
+
+    xPropSet.set(xRun, uno::UNO_QUERY_THROW);
+
+    xPropSet->getPropertyValue("CharUnderlineColor") >>= nCharUnderlineColor;
+    CPPUNIT_ASSERT_EQUAL(COL_AUTO, nCharUnderlineColor);
+
+    xDocShRef->DoClose();
+}
+
 void SdImportTest2::testTdf103876()
 {
     // Title text shape's placeholder text did not inherit the corresponding 
text properties

Reply via email to