From a432d7e05bed9697ecb4ceca9052cd374a8f72fc Mon Sep 17 00:00:00 2001 From: Rohitth Date: Sat, 12 Jun 2021 20:53:17 +0530 Subject: [PATCH] theme: Add missing styles to REQUIRED_STYLES and check completeness. * 3 missing styles: 'muted', 'current_user', 'table_head' were added to REQUIRED_STYLES. * `complete_and_incomplete_themes` was amended to check for equality instead of the superset criteria * The completeness test for builtin themes was amended to check for equality with REQUIRED_STYLES and existance of Colors. --- tests/config/test_themes.py | 12 ++++++++---- zulipterminal/config/themes.py | 2 +- zulipterminal/themes/_template.py | 3 +++ 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/tests/config/test_themes.py b/tests/config/test_themes.py index 44239048b1..8cef24c6cb 100644 --- a/tests/config/test_themes.py +++ b/tests/config/test_themes.py @@ -6,6 +6,7 @@ complete_and_incomplete_themes, generate_theme, ) +from zulipterminal.themes import gruvbox, zt_blue, zt_dark, zt_light from zulipterminal.themes._template import REQUIRED_STYLES @@ -14,7 +15,6 @@ "gruvbox_dark", "zt_light", "zt_blue", - "gruvbox_dark24", } @@ -34,10 +34,14 @@ def test_all_themes(): ) def test_builtin_theme_completeness(theme_name): theme = THEMES[theme_name] - styles_in_theme = {style[0] for style in theme} + theme_styles = theme.STYLES + theme_colors = theme.Color - assert len(styles_in_theme) >= len(REQUIRED_STYLES) - assert all(required_style in styles_in_theme for required_style in REQUIRED_STYLES) + assert len(theme_styles) == len(REQUIRED_STYLES) + assert all(required_style in theme_styles for required_style in REQUIRED_STYLES) + for style_name, style_conf in theme_styles.items(): + fg, bg = style_conf + assert fg in theme_colors and bg in theme_colors def test_complete_and_incomplete_themes(): diff --git a/zulipterminal/config/themes.py b/zulipterminal/config/themes.py index ccffff0b84..17a547c1a4 100644 --- a/zulipterminal/config/themes.py +++ b/zulipterminal/config/themes.py @@ -36,7 +36,7 @@ def complete_and_incomplete_themes() -> Tuple[List[str], List[str]]: complete = { name for name, theme in THEMES.items() - if {s for s in theme.STYLES}.issuperset(REQUIRED_STYLES) + if theme.STYLES.keys() == REQUIRED_STYLES.keys() } incomplete = list(set(THEMES) - complete) return sorted(list(complete)), sorted(incomplete) diff --git a/zulipterminal/themes/_template.py b/zulipterminal/themes/_template.py index 5265406fb5..f140028ae9 100644 --- a/zulipterminal/themes/_template.py +++ b/zulipterminal/themes/_template.py @@ -103,11 +103,14 @@ class Color(Enum): 'popup_category' : 'bold', 'unread_count' : 'bold', 'starred_count' : '', + 'table_head' : 'bold', 'filter_results' : 'bold', 'edit_topic' : 'standout', 'edit_tag' : 'standout', 'edit_author' : 'bold', 'edit_time' : 'bold', + 'current_user' : '', + 'muted' : 'bold', 'popup_border' : 'bold', 'area:help' : 'standout', 'area:msg' : 'standout',