summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorParis Oplopoios <paris.oplopoios@collabora.com>2023-04-26 12:17:33 +0300
committerMiklos Vajna <vmiklos@collabora.com>2023-04-27 08:23:40 +0200
commit292f422c421336c43bafe5ee048832137d617436 (patch)
tree48f25ee534d5bb9e3c5e5f577a5131b59c44c2b4
parentCppunitTest_sw_htmlexport: avoid reqif magic in testReqIfOleImg (diff)
downloadcore-292f422c421336c43bafe5ee048832137d617436.tar.gz
core-292f422c421336c43bafe5ee048832137d617436.zip
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/+/151046 Tested-by: Jenkins Reviewed-by: Paris Oplopoios <parisoplop@gmail.com> Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
-rw-r--r--sw/qa/extras/tiledrendering/tiledrendering.cxx25
-rw-r--r--sw/source/uibase/config/viewopt.cxx1
-rw-r--r--sw/source/uibase/uno/unotxdoc.cxx4
3 files changed, 27 insertions, 3 deletions
diff --git a/sw/qa/extras/tiledrendering/tiledrendering.cxx b/sw/qa/extras/tiledrendering/tiledrendering.cxx
index 19bd70fa78e4..06b9ee25a64c 100644
--- a/sw/qa/extras/tiledrendering/tiledrendering.cxx
+++ b/sw/qa/extras/tiledrendering/tiledrendering.cxx
@@ -1639,10 +1639,11 @@ 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();
+ int nSecondViewId = SfxLokHelper::getView();
ViewCallback aView2;
{
// Give the second view different options
@@ -1651,11 +1652,29 @@ 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);
+ {
+ 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(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;Default"), pXTextDocument->getViewRenderState());
}
CPPUNIT_TEST_FIXTURE(SwTiledRenderingTest, testSetViewGraphicSelection)
diff --git a/sw/source/uibase/config/viewopt.cxx b/sw/source/uibase/config/viewopt.cxx
index 6b9ca4967c36..2f456a317e92 100644
--- a/sw/source/uibase/config/viewopt.cxx
+++ b/sw/source/uibase/config/viewopt.cxx
@@ -237,6 +237,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 e7eb52e81a21..f107586c1a29 100644
--- a/sw/source/uibase/uno/unotxdoc.cxx
+++ b/sw/source/uibase/uno/unotxdoc.cxx
@@ -3414,6 +3414,10 @@ OString SwXTextDocument::getViewRenderState()
aState.append('P');
if (pVOpt->IsOnlineSpell())
aState.append('S');
+ aState.append(';');
+
+ OString aThemeName = OUStringToOString(pVOpt->GetThemeName(), RTL_TEXTENCODING_UTF8);
+ aState.append(aThemeName);
}
}
return aState.makeStringAndClear();