summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorSkyler Grey <skyler.grey@collabora.com>2024-06-26 10:13:36 +0000
committerMiklos Vajna <vmiklos@collabora.com>2024-06-27 15:14:47 +0200
commita76ac5400e60d8b8019b598491e5e3900f7b2f56 (patch)
treeb16308a5e6e1f2118c8443e70b4b65434f5b14fd /sw
parent0da6c82a50116111239125fe847355a42af59531 (diff)
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/+/169580 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Diffstat (limited to 'sw')
-rw-r--r--sw/qa/extras/tiledrendering/tiledrendering.cxx39
1 files changed, 39 insertions, 0 deletions
diff --git a/sw/qa/extras/tiledrendering/tiledrendering.cxx b/sw/qa/extras/tiledrendering/tiledrendering.cxx
index dddf4f9503b5..b8c46fe404b4 100644
--- a/sw/qa/extras/tiledrendering/tiledrendering.cxx
+++ b/sw/qa/extras/tiledrendering/tiledrendering.cxx
@@ -772,6 +772,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
@@ -949,6 +950,11 @@ namespace {
m_aStateChanges.push_back(pPayload);
break;
}
+ case LOK_CALLBACK_DOCUMENT_BACKGROUND_COLOR:
+ {
+ m_aDocColor = aPayload;
+ break;
+ }
}
}
};
@@ -1863,6 +1869,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.