[gnome-shell] st: Test for :insensitive styling



commit f19c75d9c3effde50287aea5d7a87c71c2707fc2
Author: Florian Müllner <fmuellner gnome org>
Date:   Sun Feb 7 23:21:55 2021 +0100

    st: Test for :insensitive styling
    
    Commit 473e77e2c5a fixed applying the :insensitive pseudo class to
    initially unreactive widgets, and adjusted the style test to work
    with that.
    
    In hindsight, we can do better than just making the test work, and
    include a test case for the :insensitive styling as well (namely
    the issue the previous commit was fixing).
    
    Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1649>

 src/st/test-theme.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
---
diff --git a/src/st/test-theme.c b/src/st/test-theme.c
index 6aff82b0dd..1d7bf517db 100644
--- a/src/st/test-theme.c
+++ b/src/st/test-theme.c
@@ -465,8 +465,6 @@ test_pseudo_class (void)
 
   /* Test the StWidget add/remove pseudo_class interfaces */
   label = st_label_new ("foo");
-  /* Make reactive, so we don't get the automatic :insensitive style */
-  clutter_actor_set_reactive (CLUTTER_ACTOR (label), TRUE);
   clutter_actor_add_child (stage, CLUTTER_ACTOR (label));
 
   labelNode = st_widget_get_theme_node (label);
@@ -515,12 +513,16 @@ test_pseudo_class (void)
                  st_theme_node_get_border_width (labelNode, ST_SIDE_TOP));
 
   st_widget_remove_style_pseudo_class (label, "boxed");
-  g_assert (st_widget_get_style_pseudo_class (label) == NULL);
+  g_assert (!st_widget_has_style_pseudo_class (label, "boxed"));
+  g_assert (st_widget_has_style_pseudo_class (label, "insensitive"));
   labelNode = st_widget_get_theme_node (label);
   assert_foreground_color (labelNode, "label", 0x000000ff);
   assert_text_decoration  (labelNode, "label", 0);
   assert_length ("label", "border-width", 0.,
                  st_theme_node_get_border_width (labelNode, ST_SIDE_TOP));
+
+  clutter_actor_set_reactive (CLUTTER_ACTOR (label), TRUE);
+  g_assert (st_widget_get_style_pseudo_class (label) == NULL);
 }
 
 static void


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]