summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2022-10-07 20:00:23 +0100
committerMichael Stahl <michael.stahl@allotropia.de>2022-10-11 11:12:01 +0200
commita8b7a725c62671599245733e55f311795f49b6e4 (patch)
tree4cfef4b25c6d7cb6f8ec600181e20293aa646624
parentUse correct color in cuicharmap.cxx (diff)
downloadcore-a8b7a725c62671599245733e55f311795f49b6e4.tar.gz
core-a8b7a725c62671599245733e55f311795f49b6e4.zip
tdf#124672 for hicontrast white/black bg select either Sifr vs Sifr Dark
Change-Id: I63d789d90bfad9fe57ceee2011797f611a2ac8cc Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141064 Reviewed-by: Michael Stahl <michael.stahl@allotropia.de> Tested-by: Jenkins
-rw-r--r--include/vcl/IconThemeInfo.hxx3
-rw-r--r--vcl/CppunitTest_vcl_app_test.mk12
-rw-r--r--vcl/qa/cppunit/app/test_IconThemeSelector.cxx4
-rw-r--r--vcl/source/app/IconThemeSelector.cxx10
4 files changed, 24 insertions, 5 deletions
diff --git a/include/vcl/IconThemeInfo.hxx b/include/vcl/IconThemeInfo.hxx
index f061821ceaa1..0ac2b7dc2857 100644
--- a/include/vcl/IconThemeInfo.hxx
+++ b/include/vcl/IconThemeInfo.hxx
@@ -29,7 +29,8 @@ class VCL_DLLPUBLIC IconThemeInfo
{
public:
/** The name of the icon theme to use for high contrast mode */
- static constexpr OUStringLiteral HIGH_CONTRAST_ID = u"sifr";
+ static constexpr OUStringLiteral HIGH_CONTRAST_ID_BRIGHT = u"sifr";
+ static constexpr OUStringLiteral HIGH_CONTRAST_ID_DARK = u"sifr_dark";
/** Construct an IconThemeInfo from the URL to a file.
* This method will throw a std::runtime_error if the URL cannot be properly parsed.
diff --git a/vcl/CppunitTest_vcl_app_test.mk b/vcl/CppunitTest_vcl_app_test.mk
index 9ee43d5a3b09..3749a7f29ca5 100644
--- a/vcl/CppunitTest_vcl_app_test.mk
+++ b/vcl/CppunitTest_vcl_app_test.mk
@@ -29,4 +29,16 @@ $(eval $(call gb_CppunitTest_use_externals,vcl_app_test, \
boost_headers \
))
+$(eval $(call gb_CppunitTest_use_sdk_api,vcl_app_test))
+
+$(eval $(call gb_CppunitTest_use_ure,vcl_app_test))
+$(eval $(call gb_CppunitTest_use_vcl,vcl_app_test))
+
+$(eval $(call gb_CppunitTest_use_components,vcl_app_test,\
+ configmgr/source/configmgr \
+ i18npool/util/i18npool \
+))
+
+$(eval $(call gb_CppunitTest_use_configuration,vcl_app_test))
+
# vim: set noet sw=4 ts=4:
diff --git a/vcl/qa/cppunit/app/test_IconThemeSelector.cxx b/vcl/qa/cppunit/app/test_IconThemeSelector.cxx
index 69f61c79e381..94d53b43d309 100644
--- a/vcl/qa/cppunit/app/test_IconThemeSelector.cxx
+++ b/vcl/qa/cppunit/app/test_IconThemeSelector.cxx
@@ -106,8 +106,8 @@ IconThemeSelectorTest::ThemeIsOverriddenByHighContrastMode()
s.SetUseHighContrastTheme(true);
std::vector<vcl::IconThemeInfo> themes = GetFakeInstalledThemes();
OUString selected = s.SelectIconTheme(themes, "breeze");
- CPPUNIT_ASSERT_EQUAL_MESSAGE("'breeze' theme is overridden by high contrast mode",
- OUString("sifr"), selected);
+ bool sifr = selected.startsWith("sifr");
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("'breeze' theme is overridden by high contrast mode", true, sifr);
s.SetUseHighContrastTheme(false);
selected = s.SelectIconTheme(themes, "breeze");
CPPUNIT_ASSERT_EQUAL_MESSAGE("'breeze' theme is no longer overridden by high contrast mode",
diff --git a/vcl/source/app/IconThemeSelector.cxx b/vcl/source/app/IconThemeSelector.cxx
index 5abb7b29d5df..fd32008d9414 100644
--- a/vcl/source/app/IconThemeSelector.cxx
+++ b/vcl/source/app/IconThemeSelector.cxx
@@ -11,7 +11,10 @@
#include <IconThemeSelector.hxx>
+#include <tools/color.hxx>
#include <vcl/IconThemeInfo.hxx>
+#include <vcl/settings.hxx>
+#include <vcl/svapp.hxx>
#include <config_mpl.h>
#include <algorithm>
@@ -106,8 +109,11 @@ IconThemeSelector::SelectIconTheme(
const OUString& theme) const
{
if (mUseHighContrastTheme) {
- if (icon_theme_is_in_installed_themes(IconThemeInfo::HIGH_CONTRAST_ID, installedThemes)) {
- return IconThemeInfo::HIGH_CONTRAST_ID;
+ const Color aCol(Application::GetSettings().GetStyleSettings().GetWindowColor());
+ const OUString name(aCol.IsDark() ? OUString(IconThemeInfo::HIGH_CONTRAST_ID_DARK)
+ : OUString(IconThemeInfo::HIGH_CONTRAST_ID_BRIGHT));
+ if (icon_theme_is_in_installed_themes(name, installedThemes)) {
+ return name;
}
}