summaryrefslogtreecommitdiff
path: root/sd
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.com>2020-05-22 17:58:22 +0200
committerMike Kaganski <mike.kaganski@collabora.com>2020-05-29 16:33:44 +0200
commit50d004fc8fe2c44516c52d22b40a221e8e3b587d (patch)
treee43d6afef727c87f0ec58cb830961798188ea791 /sd
parent03fe7a259e71d1c3f5190652649f9d4a6f75b4b7 (diff)
smartart import: handle multiple <a:schemeClr> in <dgm:fillClrLst>
The TODO in the ColorFragmentHandler ctor was right: we only handled the last <a:schemeClr> child, but there can be multiple one. Use them based on the index of a shape in a <dgm:forEach> loop. Move the TODO to the only place which still assumes a single color in the color list. (cherry picked from commit 12bea6c897822964ad4705418da54411cb15749e) Conflicts: oox/source/drawingml/colorchoicecontext.cxx oox/source/drawingml/diagram/diagram.cxx sd/qa/unit/import-tests-smartart.cxx Change-Id: I1c5c4f82e621f1110ef06b0490ff79f82f60f214 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/95015 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'sd')
-rw-r--r--sd/qa/unit/data/pptx/fill-color-list.pptxbin0 -> 41044 bytes
-rw-r--r--sd/qa/unit/import-tests-smartart.cxx19
2 files changed, 19 insertions, 0 deletions
diff --git a/sd/qa/unit/data/pptx/fill-color-list.pptx b/sd/qa/unit/data/pptx/fill-color-list.pptx
new file mode 100644
index 000000000000..341233ad5f78
--- /dev/null
+++ b/sd/qa/unit/data/pptx/fill-color-list.pptx
Binary files differ
diff --git a/sd/qa/unit/import-tests-smartart.cxx b/sd/qa/unit/import-tests-smartart.cxx
index d14c4bc6950a..273056c868d7 100644
--- a/sd/qa/unit/import-tests-smartart.cxx
+++ b/sd/qa/unit/import-tests-smartart.cxx
@@ -105,6 +105,7 @@ public:
void testRecursion();
void testDataFollow();
void testOrgChart2();
+ void testFillColorList();
CPPUNIT_TEST_SUITE(SdImportTestSmartArt);
@@ -149,6 +150,7 @@ public:
CPPUNIT_TEST(testRecursion);
CPPUNIT_TEST(testDataFollow);
CPPUNIT_TEST(testOrgChart2);
+ CPPUNIT_TEST(testFillColorList);
CPPUNIT_TEST_SUITE_END();
};
@@ -1454,6 +1456,23 @@ void SdImportTestSmartArt::testOrgChart2()
xDocShRef->DoClose();
}
+void SdImportTestSmartArt::testFillColorList()
+{
+ sd::DrawDocShellRef xDocShRef
+ = loadURL(m_directories.getURLFromSrc("/sd/qa/unit/data/pptx/fill-color-list.pptx"), PPTX);
+ uno::Reference<drawing::XShape> xGroup(getShapeFromPage(0, 0, xDocShRef), uno::UNO_QUERY);
+ uno::Reference<drawing::XShape> xShape = getChildShape(getChildShape(xGroup, 1), 0);
+ uno::Reference<beans::XPropertySet> xPropertySet(xShape, uno::UNO_QUERY_THROW);
+ sal_Int32 nFillColor = 0;
+ xPropertySet->getPropertyValue("FillColor") >>= nFillColor;
+ // Without the accompanying fix in place, this test would have failed with:
+ // - Expected: 12603469 (0xc0504d)
+ // - Actual : 16225862 (0xf79646)
+ // i.e. the background of the "A" shape was orange-ish, rather than red-ish.
+ CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(0xC0504D), nFillColor);
+ xDocShRef->DoClose();
+}
+
CPPUNIT_TEST_SUITE_REGISTRATION(SdImportTestSmartArt);
CPPUNIT_PLUGIN_IMPLEMENT();