tdf#129686: Revert "tdf#118776: pptx import: draw char noFill as transparent"
Revert it for now towards LibreOffice 7.0 and add unittest
This reverts commit e01df3488abe6d319c6874ca870afb82a3ad9b1e.
Change-Id: Ic6aba5948f9c6e55199def0476918fbd496321bf
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/94704
Tested-by: Xisco Faulí <xiscofauli@libreoffice.org>
Reviewed-by: Xisco Faulí <xiscofauli@libreoffice.org>
diff --git a/oox/source/drawingml/textcharacterproperties.cxx b/oox/source/drawingml/textcharacterproperties.cxx
index 19c5579..20965e3 100644
--- a/oox/source/drawingml/textcharacterproperties.cxx
+++ b/oox/source/drawingml/textcharacterproperties.cxx
@@ -112,12 +112,7 @@ void TextCharacterProperties::pushToPropMap( PropertyMap& rPropMap, const XmlFil
Color aColor = maFillProperties.getBestSolidColor();
rPropMap.setProperty(PROP_CharColor, aColor.getColor(rFilter.getGraphicHelper()));
if( maFillProperties.moFillType.get() == XML_noFill )
{
// noFill doesn't exist for characters. Map noFill to 99% transparency
rPropMap.setProperty(PROP_CharTransparence, sal_Int16((MAX_PERCENT - 1) / PER_PERCENT) );
}
else if (aColor.hasTransparency())
if (aColor.hasTransparency())
{
rPropMap.setProperty(PROP_CharTransparence, aColor.getTransparency());
}
diff --git a/sd/qa/unit/data/pptx/tdf118776.pptx b/sd/qa/unit/data/pptx/tdf118776.pptx
deleted file mode 100644
index 8df9452..0000000
--- a/sd/qa/unit/data/pptx/tdf118776.pptx
+++ /dev/null
Binary files differ
diff --git a/sd/qa/unit/data/pptx/tdf129686.pptx b/sd/qa/unit/data/pptx/tdf129686.pptx
new file mode 100644
index 0000000..9aeb396
--- /dev/null
+++ b/sd/qa/unit/data/pptx/tdf129686.pptx
Binary files differ
diff --git a/sd/qa/unit/import-tests.cxx b/sd/qa/unit/import-tests.cxx
index 6d8ff3e..32e0d68 100644
--- a/sd/qa/unit/import-tests.cxx
+++ b/sd/qa/unit/import-tests.cxx
@@ -179,9 +179,9 @@ public:
void testAoo124143();
void testTdf103567();
void testTdf103792();
void testTdf118776();
void testTdf103876();
void testTdf79007();
void testTdf129686();
void testTdf104015();
void testTdf104201();
void testTdf103477();
@@ -286,9 +286,9 @@ public:
CPPUNIT_TEST(testAoo124143);
CPPUNIT_TEST(testTdf103567);
CPPUNIT_TEST(testTdf103792);
CPPUNIT_TEST(testTdf118776);
CPPUNIT_TEST(testTdf103876);
CPPUNIT_TEST(testTdf79007);
CPPUNIT_TEST(testTdf129686);
CPPUNIT_TEST(testTdf104015);
CPPUNIT_TEST(testTdf104201);
CPPUNIT_TEST(testTdf103477);
@@ -1840,26 +1840,6 @@ void SdImportTest::testTdf103792()
xDocShRef->DoClose();
}
void SdImportTest::testTdf118776()
{
sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("/sd/qa/unit/data/pptx/tdf118776.pptx"), PPTX);
uno::Reference< beans::XPropertySet > xShape( getShapeFromPage( 0, 0, xDocShRef ) );
// Get first paragraph of the text
uno::Reference<text::XTextRange> const xParagraph( getParagraphFromShape( 0, xShape ) );
// Get first run of the paragraph
uno::Reference<text::XTextRange> xRun( getRunFromParagraph (0, xParagraph ) );
uno::Reference< beans::XPropertySet > xPropSet( xRun, uno::UNO_QUERY_THROW );
sal_Int16 nTransparency = 0;
xPropSet->getPropertyValue("CharTransparence") >>= nTransparency;
// Import noFill color as 99% transparency
CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int16>(99), nTransparency);
xDocShRef->DoClose();
}
void SdImportTest::testTdf103876()
{
// Title text shape's placeholder text did not inherit the corresponding text properties
@@ -1934,6 +1914,26 @@ void SdImportTest::testTdf79007()
xDocShRef->DoClose();
}
void SdImportTest::testTdf129686()
{
sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("sd/qa/unit/data/pptx/tdf129686.pptx"), PPTX);
uno::Reference< beans::XPropertySet > xShape( getShapeFromPage( 0, 0, xDocShRef ) );
// Get first paragraph of the text
uno::Reference<text::XTextRange> const xParagraph( getParagraphFromShape( 0, xShape ) );
// Get first run of the paragraph
uno::Reference<text::XTextRange> xRun( getRunFromParagraph (0, xParagraph ) );
uno::Reference< beans::XPropertySet > xPropSet( xRun, uno::UNO_QUERY_THROW );
sal_Int16 nTransparency = 0;
xPropSet->getPropertyValue("CharTransparence") >>= nTransparency;
// 100 = no transparency
CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int16>(100), nTransparency);
xDocShRef->DoClose();
}
void SdImportTest::testTdf104015()
{
// Shape fill, line and effect properties were not inherited from master slide shape