[gtk+/gtk-3-18] Add a test for gtk_style_context_list_classes
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/gtk-3-18] Add a test for gtk_style_context_list_classes
- Date: Sun, 4 Oct 2015 00:43:38 +0000 (UTC)
commit ee856fd30d66bf9ec214beba9ce54bad4028114c
Author: Matthias Clasen <mclasen redhat com>
Date: Sat Oct 3 17:38:36 2015 -0400
Add a test for gtk_style_context_list_classes
This test failed before the previous commit.
testsuite/gtk/stylecontext.c | 41 +++++++++++++++++++++++++++++++++++++++++
1 files changed, 41 insertions(+), 0 deletions(-)
---
diff --git a/testsuite/gtk/stylecontext.c b/testsuite/gtk/stylecontext.c
index 4d6438c..f0381bb 100644
--- a/testsuite/gtk/stylecontext.c
+++ b/testsuite/gtk/stylecontext.c
@@ -366,6 +366,46 @@ test_widget_path_parent (void)
g_object_unref (context);
}
+static void
+test_style_classes (void)
+{
+ GtkStyleContext *context;
+ GList *classes;
+
+ context = gtk_style_context_new ();
+
+ classes = gtk_style_context_list_classes (context);
+ g_assert_null (classes);
+
+ gtk_style_context_add_class (context, "A");
+
+ classes = gtk_style_context_list_classes (context);
+ g_assert (classes);
+ g_assert_null (classes->next);
+ g_assert_cmpstr (classes->data, ==, "A");
+ g_list_free (classes);
+
+ gtk_style_context_add_class (context, "B");
+
+ classes = gtk_style_context_list_classes (context);
+ g_assert (classes);
+ g_assert_cmpstr (classes->data, ==, "A");
+ g_assert (classes->next);
+ g_assert_cmpstr (classes->next->data, ==, "B");
+ g_assert_null (classes->next->next);
+ g_list_free (classes);
+
+ gtk_style_context_remove_class (context, "A");
+
+ classes = gtk_style_context_list_classes (context);
+ g_assert (classes);
+ g_assert_null (classes->next);
+ g_assert_cmpstr (classes->data, ==, "B");
+ g_list_free (classes);
+
+ g_object_unref (context);
+}
+
int
main (int argc, char *argv[])
{
@@ -379,6 +419,7 @@ main (int argc, char *argv[])
g_test_add_func ("/style/invalidate-saved", test_invalidate_saved);
g_test_add_func ("/style/set-widget-path-saved", test_set_widget_path_saved);
g_test_add_func ("/style/widget-path-parent", test_widget_path_parent);
+ g_test_add_func ("/style/classes", test_style_classes);
return g_test_run ();
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]