sw/qa/extras/tiledrendering/tiledrendering.cxx |   39 +++++++++++++++++++++++++
 1 file changed, 39 insertions(+)

New commits:
commit a76ac5400e60d8b8019b598491e5e3900f7b2f56
Author:     Skyler Grey <skyler.g...@collabora.com>
AuthorDate: Wed Jun 26 10:13:36 2024 +0000
Commit:     Miklos Vajna <vmik...@collabora.com>
CommitDate: Thu Jun 27 15:14:47 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/+/169580
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com>
    Reviewed-by: Miklos Vajna <vmik...@collabora.com>

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.

Reply via email to