diff options
author | Miklos Vajna <vmiklos@collabora.com> | 2022-04-06 20:14:52 +0200 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.com> | 2022-04-07 08:15:48 +0200 |
commit | f5db3b12ae1cd3bfe6ee5d260aec9532cc65f2dc (patch) | |
tree | 60ca122103456e4b3f27eedb4c48f3fbc556f648 /sd/qa | |
parent | 6240902d996c31c1200fa523f89a419a934cde58 (diff) |
sd theme: add UI (sidebar) for shape fill color
This requires extending .uno:FillColor with a new parameter, and then
merging that parameter into the fill color item in sd/. The sidebar's
color picker already generated these parameters.
Change-Id: I83e3c4fc37b8d7bd34f0ef9c0cb96e164f7f0b99
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132646
Tested-by: Jenkins
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Diffstat (limited to 'sd/qa')
-rw-r--r-- | sd/qa/unit/uiimpress.cxx | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/sd/qa/unit/uiimpress.cxx b/sd/qa/unit/uiimpress.cxx index f56a0444c351..41664efb3497 100644 --- a/sd/qa/unit/uiimpress.cxx +++ b/sd/qa/unit/uiimpress.cxx @@ -959,6 +959,38 @@ CPPUNIT_TEST_FIXTURE(SdUiImpressTest, testCharColorTheme) CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int16>(8000), nCharColorLumOff); } +CPPUNIT_TEST_FIXTURE(SdUiImpressTest, testFillColorTheme) +{ + // Given an Impress document with a selected shape: + mxComponent = loadFromDesktop("private:factory/simpress", + "com.sun.star.presentation.PresentationDocument"); + uno::Reference<drawing::XDrawPagesSupplier> xPagesSupplier(mxComponent, uno::UNO_QUERY); + uno::Reference<drawing::XDrawPage> xPage(xPagesSupplier->getDrawPages()->getByIndex(0), + uno::UNO_QUERY); + uno::Reference<beans::XPropertySet> xShape(xPage->getByIndex(0), uno::UNO_QUERY); + uno::Reference<frame::XModel> xModel(mxComponent, uno::UNO_QUERY); + uno::Reference<view::XSelectionSupplier> xController(xModel->getCurrentController(), + uno::UNO_QUERY); + xController->select(uno::makeAny(xShape)); + + // When setting the fill color of that shape, with theme metadata: + uno::Sequence<beans::PropertyValue> aColorArgs = { + comphelper::makePropertyValue("FillColor", static_cast<sal_Int32>(0xed7d31)), // orange + comphelper::makePropertyValue("ColorThemeIndex", static_cast<sal_Int16>(4)), // accent 1 + }; + dispatchCommand(mxComponent, ".uno:FillColor", aColorArgs); + Scheduler::ProcessEventsToIdle(); + + // Then make sure the theme index is not lost when the sidebar sets it: + sal_Int16 nFillColorTheme{}; + xShape->getPropertyValue("FillColorTheme") >>= nFillColorTheme; + // Without the accompanying fix in place, this test would have failed with: + // - Expected: 4 + // - Actual : -1 + // i.e. the theme index was lost during the dispatch of the command. + CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int16>(4), nFillColorTheme); +} + CPPUNIT_TEST_FIXTURE(SdUiImpressTest, testTdf127696) { mxComponent = loadFromDesktop("private:factory/simpress", |