sw/qa/extras/tiledrendering/tiledrendering.cxx | 39 +++++++++++++++++++++++++ 1 file changed, 39 insertions(+)
New commits: commit 07dec064c2a05d13812cd85c1047743468843f7f Author: Skyler Grey <skyler.g...@collabora.com> AuthorDate: Wed Jun 26 10:13:36 2024 +0000 Commit: Miklos Vajna <vmik...@collabora.com> CommitDate: Fri Aug 2 16:07:07 2024 +0200 test: send document bg color on new theme In I27c8409a6fcb771d741b07d77c5598c87e178f3b we fixed this feature, here's a test to make sure we're doing the right thing Change-Id: I32f3c410da6bc607f2e0cc3e48a440a09d92d6eb Reviewed-on: https://gerrit.libreoffice.org/c/core/+/171398 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmik...@collabora.com> diff --git a/sw/qa/extras/tiledrendering/tiledrendering.cxx b/sw/qa/extras/tiledrendering/tiledrendering.cxx index d43170885c57..163dd4751ace 100644 --- a/sw/qa/extras/tiledrendering/tiledrendering.cxx +++ b/sw/qa/extras/tiledrendering/tiledrendering.cxx @@ -769,6 +769,7 @@ namespace { bool m_bGraphicViewSelection; bool m_bGraphicSelection; bool m_bViewLock; + OString m_aDocColor; /// Set if any callback was invoked. bool m_bCalled; /// Redline table size changed payload @@ -940,6 +941,11 @@ namespace { m_aComment = m_aComment.get_child("comment"); } break; + case LOK_CALLBACK_DOCUMENT_BACKGROUND_COLOR: + { + m_aDocColor = aPayload; + break; + } } } }; @@ -1854,6 +1860,39 @@ CPPUNIT_TEST_FIXTURE(SwTiledRenderingTest, testThemeViewSeparation) assertTilePixelColor(pXTextDocument, 255, 255, COL_WHITE); } +// Test that changing the theme sends the document background color as LOK_CALLBACK_DOCUMENT_BACKGROUND_COLOR +CPPUNIT_TEST_FIXTURE(SwTiledRenderingTest, testThemeChangeBackgroundCallback) +{ + Color aDarkColor(0x1c, 0x1c, 0x1c); + addDarkLightThemes(aDarkColor, COL_WHITE); + SwXTextDocument* pXTextDocument = createDoc(); + ViewCallback aView; + + SwDoc* pDoc = pXTextDocument->GetDocShell()->GetDoc(); + SwView* pView = pDoc->GetDocShell()->GetView(); + uno::Reference<frame::XFrame> xFrame = pView->GetViewFrame().GetFrame().GetFrameInterface(); + + { + uno::Sequence<beans::PropertyValue> aPropertyValues = comphelper::InitPropertySequence( + { + { "NewTheme", uno::Any(OUString("Dark")) }, + } + ); + comphelper::dispatchCommand(".uno:ChangeTheme", xFrame, aPropertyValues); + } + CPPUNIT_ASSERT_EQUAL("1c1c1c"_ostr, aView.m_aDocColor); + + { + uno::Sequence<beans::PropertyValue> aPropertyValues = comphelper::InitPropertySequence( + { + { "NewTheme", uno::Any(OUString("Light")) }, + } + ); + comphelper::dispatchCommand(".uno:ChangeTheme", xFrame, aPropertyValues); + } + CPPUNIT_ASSERT_EQUAL("ffffff"_ostr, aView.m_aDocColor); +} + CPPUNIT_TEST_FIXTURE(SwTiledRenderingTest, testSetViewGraphicSelection) { // Load a document.