diff options
author | Miklos Vajna <vmiklos@collabora.com> | 2022-03-02 20:27:09 +0100 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.com> | 2022-06-30 16:49:41 +0200 |
commit | 5100b5cc187aaeace7b7d9e556a1b19aefed3b72 (patch) | |
tree | fe398240fd34c6d774782780c7e3282d030f0d76 /svx/qa | |
parent | ba896488b49f5bb9982ac704a0a0697d88435731 (diff) |
sd theme: add rendering for shape fill color
I.e. update the shape fill color when the theme of the master page
changes if the color is a theme color.
(cherry picked from commit 6f50fe6f524d922c27ec1313ebef49352a2f9128)
Change-Id: Ia1ed566230a8547334aa4a7d69627882aa690546
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136671
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Diffstat (limited to 'svx/qa')
-rw-r--r-- | svx/qa/unit/data/theme.pptx | bin | 28788 -> 29572 bytes | |||
-rw-r--r-- | svx/qa/unit/styles.cxx | 19 |
2 files changed, 19 insertions, 0 deletions
diff --git a/svx/qa/unit/data/theme.pptx b/svx/qa/unit/data/theme.pptx Binary files differindex 74397b3ea67a..ebed899cd42c 100644 --- a/svx/qa/unit/data/theme.pptx +++ b/svx/qa/unit/data/theme.pptx diff --git a/svx/qa/unit/styles.cxx b/svx/qa/unit/styles.cxx index 565d981e6e2e..3881fe1d1006 100644 --- a/svx/qa/unit/styles.cxx +++ b/svx/qa/unit/styles.cxx @@ -62,6 +62,14 @@ sal_Int32 GetShapeTextColor(const uno::Reference<text::XTextRange>& xShape) return nColor; } +/// Get the solid fill color of xShape. +sal_Int32 GetShapeFillColor(const uno::Reference<beans::XPropertySet>& xShape) +{ + sal_Int32 nColor{}; + xShape->getPropertyValue("FillColor") >>= nColor; + return nColor; +} + CPPUNIT_TEST_FIXTURE(Test, testThemeChange) { // Given a document, with a first slide and blue shape text from theme: @@ -81,6 +89,12 @@ CPPUNIT_TEST_FIXTURE(Test, testThemeChange) uno::Reference<text::XTextRange> xShape3(xDrawPageShapes->getByIndex(2), uno::UNO_QUERY); // Blue, darker. CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(0x2f5597), GetShapeTextColor(xShape3)); + // Shape fill: + uno::Reference<beans::XPropertySet> xShape4(xDrawPageShapes->getByIndex(4), uno::UNO_QUERY); + // Blue. + CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(0x4472c4), GetShapeFillColor(xShape4)); + // Set theme index to accent 1 till PPTX import is missing. + xShape4->setPropertyValue("FillColorTheme", uno::makeAny(static_cast<sal_Int16>(4))); // When changing the master slide of slide 1 to use the theme of the second master slide: uno::Reference<drawing::XMasterPageTarget> xDrawPage2( @@ -104,6 +118,11 @@ CPPUNIT_TEST_FIXTURE(Test, testThemeChange) CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(0xd5eda2), GetShapeTextColor(xShape2)); // Green, darker. CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(0x6c911d), GetShapeTextColor(xShape3)); + // Shape fill: + // Without the accompanying fix in place, this test would have failed with: + // - Expected: 9486886 (#90c226, green) + // - Actual : 4485828 (#4472c4, blue) + CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(0x90c226), GetShapeFillColor(xShape4)); } } |