diff options
author | Matthias Clasen <mclasen@redhat.com> | 2014-07-22 18:50:31 -0400 |
---|---|---|
committer | Matthias Clasen <mclasen@redhat.com> | 2014-07-22 18:50:31 -0400 |
commit | 52ec7bf54e15a7365225ff4630533dff2443c064 (patch) | |
tree | 1a227e09a1a94afa841dcd29b79752ec659d9f6c | |
parent | c3bfaaa5d11004837c0935872448f35a330feb0f (diff) | |
download | gtk+-52ec7bf54e15a7365225ff4630533dff2443c064.tar.gz |
Add a test for matching with states
-rw-r--r-- | testsuite/gtk/stylecontext.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/testsuite/gtk/stylecontext.c b/testsuite/gtk/stylecontext.c index 89d395ab27..55bd2c754f 100644 --- a/testsuite/gtk/stylecontext.c +++ b/testsuite/gtk/stylecontext.c @@ -162,6 +162,7 @@ test_match (void) gtk_widget_path_append_type (path, GTK_TYPE_BUTTON); gtk_widget_path_iter_set_name (path, 0, "mywindow"); gtk_widget_path_iter_add_class (path, 2, "button"); + gtk_widget_path_iter_set_state (path, 0, GTK_STATE_FLAG_ACTIVE); gtk_style_context_set_path (context, path); gtk_widget_path_free (path); @@ -245,6 +246,15 @@ test_match (void) gtk_style_context_get_color (context, GTK_STATE_FLAG_NORMAL, &color); g_assert (gdk_rgba_equal (&color, &expected)); + data = "* { color: #f00 }\n" + "GtkWindow:backdrop .button { color: #000 }\n" + "GtkWindow .button { color: #111 }\n" + "GtkWindow:active .button { color: #fff }"; + gtk_css_provider_load_from_data (provider, data, -1, &error); + g_assert_no_error (error); + gtk_style_context_get_color (context, GTK_STATE_FLAG_NORMAL, &color); + g_assert (gdk_rgba_equal (&color, &expected)); + g_object_unref (provider); g_object_unref (context); } |