sw/qa/extras/tiledrendering/tiledrendering.cxx |   13 ++++++-------
 sw/source/uibase/config/viewopt.cxx            |    1 +
 sw/source/uibase/uno/unotxdoc.cxx              |    6 ++++--
 3 files changed, 11 insertions(+), 9 deletions(-)

New commits:
commit 1cd8599ca911133a5dcecb517127ce6e6d29b0dc
Author:     Paris Oplopoios <paris.oplopo...@collabora.com>
AuthorDate: Wed Apr 26 12:17:33 2023 +0300
Commit:     Paris Oplopoios <parisop...@gmail.com>
CommitDate: Thu May 4 23:17:16 2023 +0200

    Extend tiled rendering test to account for dark mode
    
    Made testGetViewRenderState test for change from light mode to dark mode
    
    Change-Id: Ia02e7a462e595671492405733f25c0bbb3c24080
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151018
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com>
    Reviewed-by: Paris Oplopoios <parisop...@gmail.com>

diff --git a/sw/qa/extras/tiledrendering/tiledrendering.cxx 
b/sw/qa/extras/tiledrendering/tiledrendering.cxx
index 8c205e9ea167..8e4ff3ea4077 100644
--- a/sw/qa/extras/tiledrendering/tiledrendering.cxx
+++ b/sw/qa/extras/tiledrendering/tiledrendering.cxx
@@ -1684,7 +1684,7 @@ CPPUNIT_TEST_FIXTURE(SwTiledRenderingTest, 
testGetViewRenderState)
         aViewOptions.SetOnlineSpell(true);
         
pXTextDocument->GetDocShell()->GetWrtShell()->ApplyViewOptions(aViewOptions);
     }
-    CPPUNIT_ASSERT_EQUAL(OString("PS"), pXTextDocument->getViewRenderState());
+    CPPUNIT_ASSERT_EQUAL(OString("PS;Default"), 
pXTextDocument->getViewRenderState());
 
     // Create a second view
     SfxLokHelper::createView();
@@ -1697,11 +1697,11 @@ CPPUNIT_TEST_FIXTURE(SwTiledRenderingTest, 
testGetViewRenderState)
         aViewOptions.SetOnlineSpell(true);
         
pXTextDocument->GetDocShell()->GetWrtShell()->ApplyViewOptions(aViewOptions);
     }
-    CPPUNIT_ASSERT_EQUAL(OString("S"), pXTextDocument->getViewRenderState());
+    CPPUNIT_ASSERT_EQUAL(OString("S;Default"), 
pXTextDocument->getViewRenderState());
 
     // Switch back to the first view, and check that the options string is the 
same
     SfxLokHelper::setView(nFirstViewId);
-    CPPUNIT_ASSERT_EQUAL(OString("PS"), pXTextDocument->getViewRenderState());
+    CPPUNIT_ASSERT_EQUAL(OString("PS;Default"), 
pXTextDocument->getViewRenderState());
 
     // Switch back to the second view, and change to dark mode
     SfxLokHelper::setView(nSecondViewId);
@@ -1711,16 +1711,15 @@ CPPUNIT_TEST_FIXTURE(SwTiledRenderingTest, 
testGetViewRenderState)
         uno::Reference<frame::XFrame> xFrame = 
pView->GetViewFrame()->GetFrame().GetFrameInterface();
         uno::Sequence<beans::PropertyValue> aPropertyValues = 
comphelper::InitPropertySequence(
             {
-                { "NewTheme", 
uno::Any(OUString("COLOR_SCHEME_LIBREOFFICE_DARK")) },
+                { "NewTheme", uno::Any(OUString("Dark")) },
             }
         );
         comphelper::dispatchCommand(".uno:ChangeTheme", xFrame, 
aPropertyValues);
     }
-    CPPUNIT_ASSERT_EQUAL(OString("SD"), pXTextDocument->getViewRenderState());
-
+    CPPUNIT_ASSERT_EQUAL(OString("S;Dark"), 
pXTextDocument->getViewRenderState());
     // Switch back to the first view, and check that the options string is the 
same
     SfxLokHelper::setView(nFirstViewId);
-    CPPUNIT_ASSERT_EQUAL(OString("PS"), pXTextDocument->getViewRenderState());
+    CPPUNIT_ASSERT_EQUAL(OString("PS;Default"), 
pXTextDocument->getViewRenderState());
 }
 
 // Helper function to get a tile to a bitmap and check the pixel color
diff --git a/sw/source/uibase/config/viewopt.cxx 
b/sw/source/uibase/config/viewopt.cxx
index 668256fb5c42..fb9f9abbac12 100644
--- a/sw/source/uibase/config/viewopt.cxx
+++ b/sw/source/uibase/config/viewopt.cxx
@@ -236,6 +236,7 @@ void SwViewOption::PaintPostIts( OutputDevice *pOut, const 
SwRect &rRect, bool b
 }
 
 SwViewOption::SwViewOption() :
+    m_sThemeName( "Default" ),
     m_sSymbolFont( "symbol" ),
     m_aRetouchColor( COL_TRANSPARENT ),
     mnViewLayoutColumns( 0 ),
diff --git a/sw/source/uibase/uno/unotxdoc.cxx 
b/sw/source/uibase/uno/unotxdoc.cxx
index 74326311f193..29bede97f15b 100644
--- a/sw/source/uibase/uno/unotxdoc.cxx
+++ b/sw/source/uibase/uno/unotxdoc.cxx
@@ -3417,8 +3417,10 @@ OString SwXTextDocument::getViewRenderState()
                 aState.append('P');
             if (pVOpt->IsOnlineSpell())
                 aState.append('S');
-            if (pVOpt->GetThemeName() == u"COLOR_SCHEME_LIBREOFFICE_DARK")
-                aState.append('D');
+            aState.append(';');
+
+            OString aThemeName = OUStringToOString(pVOpt->GetThemeName(), 
RTL_TEXTENCODING_UTF8);
+            aState.append(aThemeName);
         }
     }
     return aState.makeStringAndClear();

Reply via email to