summaryrefslogtreecommitdiffstats
path: root/sd
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.com>2019-10-14 21:49:32 +0200
committerXisco FaulĂ­ <xiscofauli@libreoffice.org>2019-10-15 10:52:30 +0200
commit6f9407c0d872675dbcbd0dc52fd7a0fdb098804b (patch)
treed6ec828b5063ae427af3a89063ac4a51f3ba999c /sd
parenttdf#128111: "adsrc" doesn't exist from Postgresql 12 (diff)
downloadcore-6f9407c0d872675dbcbd0dc52fd7a0fdb098804b.tar.gz
core-6f9407c0d872675dbcbd0dc52fd7a0fdb098804b.zip
tdf#127964 PPTX import: fix shape fill handling: style vs slide background
Regression from commit 943a534ac7cb3df513583e226c986dafd8ba246b (tdf#123684 PPTX import: fix wrong background color for <p:sp useBgFill="1">, 2019-04-23), the problem was that we didn't handle the case when a shape had an XML fragment like this: <p:sp useBgFill="1"> <p:style> <a:fillRef idx="1"> <a:schemeClr val="accent1"/> </a:fillRef> </p:style> </p:sp> i.e. the shape both wants to use background fill and it has a style declaring how to fill it as well. We gave the style a priority, while PowerPoint gives the background fill a priority. Fix the problem by not setting the fill from the style in case the background fill is already set. Change-Id: Ie1b56e5615219138a5b7ddd7a2b25295b991bc05 Reviewed-on: https://gerrit.libreoffice.org/80804 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com> (cherry picked from commit 46d630f98f1c07ec2048da35d1a4804181148ac5) Reviewed-on: https://gerrit.libreoffice.org/80807 Reviewed-by: Xisco FaulĂ­ <xiscofauli@libreoffice.org>
Diffstat (limited to 'sd')
-rw-r--r--sd/qa/unit/data/pptx/tdf127964.pptxbin0 -> 34018 bytes
-rw-r--r--sd/qa/unit/import-tests.cxx23
2 files changed, 23 insertions, 0 deletions
diff --git a/sd/qa/unit/data/pptx/tdf127964.pptx b/sd/qa/unit/data/pptx/tdf127964.pptx
new file mode 100644
index 000000000000..89482a4ce99c
--- /dev/null
+++ b/sd/qa/unit/data/pptx/tdf127964.pptx
Binary files differ
diff --git a/sd/qa/unit/import-tests.cxx b/sd/qa/unit/import-tests.cxx
index 6252ca27161f..28a908197fdc 100644
--- a/sd/qa/unit/import-tests.cxx
+++ b/sd/qa/unit/import-tests.cxx
@@ -207,6 +207,7 @@ public:
void testTdf122899();
void testOOXTheme();
void testCropToShape();
+ void testTdf127964();
CPPUNIT_TEST_SUITE(SdImportTest);
@@ -299,6 +300,7 @@ public:
CPPUNIT_TEST(testTdf122899);
CPPUNIT_TEST(testOOXTheme);
CPPUNIT_TEST(testCropToShape);
+ CPPUNIT_TEST(testTdf127964);
CPPUNIT_TEST_SUITE_END();
};
@@ -2823,6 +2825,27 @@ void SdImportTest::testCropToShape()
CPPUNIT_ASSERT_EQUAL(css::drawing::BitmapMode_STRETCH, bitmapmode);
}
+void SdImportTest::testTdf127964()
+{
+ sd::DrawDocShellRef xDocShRef
+ = loadURL(m_directories.getURLFromSrc("sd/qa/unit/data/pptx/tdf127964.pptx"), PPTX);
+ const SdrPage* pPage = GetPage(1, xDocShRef);
+ const SdrObject* pObj = pPage->GetObj(0);
+ auto& rFillStyleItem
+ = dynamic_cast<const XFillStyleItem&>(pObj->GetMergedItem(XATTR_FILLSTYLE));
+ CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_SOLID, rFillStyleItem.GetValue());
+
+ auto& rFillColorItem
+ = dynamic_cast<const XFillColorItem&>(pObj->GetMergedItem(XATTR_FILLCOLOR));
+ // Without the accompanying fix in place, this test would have failed with:
+ // - Expected: 4294967295
+ // - Actual : 5210557
+ // i.e. instead of transparent (which then got rendered as white), the shape fill color was
+ // blue.
+ CPPUNIT_ASSERT_EQUAL(COL_TRANSPARENT, rFillColorItem.GetColorValue());
+ xDocShRef->DoClose();
+}
+
CPPUNIT_TEST_SUITE_REGISTRATION(SdImportTest);
CPPUNIT_PLUGIN_IMPLEMENT();