[gtk+] Add a test for matching with states
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] Add a test for matching with states
- Date: Tue, 22 Jul 2014 22:50:57 +0000 (UTC)
commit 52ec7bf54e15a7365225ff4630533dff2443c064
Author: Matthias Clasen <mclasen redhat com>
Date: Tue Jul 22 18:50:31 2014 -0400
Add a test for matching with states
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 89d395a..55bd2c7 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);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]