summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXisco Fauli <xiscofauli@libreoffice.org>2022-04-20 17:58:15 +0200
committerXisco Fauli <xiscofauli@libreoffice.org>2022-04-22 19:37:36 +0200
commit1c924efe1f80207a5e104d755615b1eb9a91d418 (patch)
treeb18ed685137b5a273be72c788eb80b99af44dc0f
parent0204c00f241313e1d292b4c3ea117d42af7dec69 (diff)
tdf#148685: Unset CharUnderlineColor and CharUnderlineHasColor properties
Change-Id: Iebf482434cd393f55ae3e4690580b573624d78b1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133219 Tested-by: Xisco Fauli <xiscofauli@libreoffice.org> Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
-rw-r--r--oox/source/drawingml/textcharacterproperties.cxx6
-rw-r--r--sd/qa/unit/data/pptx/tdf148685.pptxbin0 -> 23760 bytes
-rw-r--r--sd/qa/unit/import-tests2.cxx43
3 files changed, 49 insertions, 0 deletions
diff --git a/oox/source/drawingml/textcharacterproperties.cxx b/oox/source/drawingml/textcharacterproperties.cxx
index 9d568cd5cabb..fc8214db42fe 100644
--- a/oox/source/drawingml/textcharacterproperties.cxx
+++ b/oox/source/drawingml/textcharacterproperties.cxx
@@ -201,6 +201,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
--- /dev/null
+++ b/sd/qa/unit/data/pptx/tdf148685.pptx
Binary files differ
diff --git a/sd/qa/unit/import-tests2.cxx b/sd/qa/unit/import-tests2.cxx
index 0bb99100b9dd..b06a699b04bd 100644
--- a/sd/qa/unit/import-tests2.cxx
+++ b/sd/qa/unit/import-tests2.cxx
@@ -72,6 +72,7 @@ public:
void testAoo124143();
void testTdf103567();
void testTdf103792();
+ void testTdf148685();
void testTdf103876();
void testTdf79007();
void testTdf119649();
@@ -142,6 +143,7 @@ public:
CPPUNIT_TEST(testAoo124143);
CPPUNIT_TEST(testTdf103567);
CPPUNIT_TEST(testTdf103792);
+ CPPUNIT_TEST(testTdf148685);
CPPUNIT_TEST(testTdf103876);
CPPUNIT_TEST(testTdf79007);
CPPUNIT_TEST(testTdf119649);
@@ -436,6 +438,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