From b9c880f58de87fe0e1ad40fd99262e3ec81917ed Mon Sep 17 00:00:00 2001 From: Benjamin Otte Date: Wed, 5 Feb 2020 02:59:11 +0100 Subject: [PATCH] testsuite: Remove the stylecontext test Stylecontexts are on their way out and I'm removing API that the testsuite was relying on, so remove the tests. Put the useful parts of the tests elsewhere. --- testsuite/css/parser/meson.build | 2 + testsuite/css/parser/selector-original.css | 39 ++++++ .../css/parser/selector-original.ref.css | 0 testsuite/gtk/meson.build | 1 - testsuite/gtk/stylecontext.c | 132 ------------------ 5 files changed, 41 insertions(+), 133 deletions(-) create mode 100644 testsuite/css/parser/selector-original.css create mode 100644 testsuite/css/parser/selector-original.ref.css delete mode 100644 testsuite/gtk/stylecontext.c diff --git a/testsuite/css/parser/meson.build b/testsuite/css/parser/meson.build index 607faab0bb..b378a5e9f3 100644 --- a/testsuite/css/parser/meson.build +++ b/testsuite/css/parser/meson.build @@ -406,6 +406,8 @@ test_data = [ 'radial.ref.css', 'selector.css', 'selector.ref.css', + 'selector-original.css', + 'selector-original.ref.css', 'shadow.css', 'shadow.ref.css', 'shadow-ordering.css', diff --git a/testsuite/css/parser/selector-original.css b/testsuite/css/parser/selector-original.css new file mode 100644 index 0000000000..a3569e268c --- /dev/null +++ b/testsuite/css/parser/selector-original.css @@ -0,0 +1,39 @@ +* {} +E {} +E F {} +E > F {} +E + F {} +E#id {} +#id {} +tab:first-child {} +tab:last-child {} +tab:first-child {} +tab:last-child {} +tab:nth-child(even) {} +tab:nth-child(odd) {} +.some-class {} +.some-class.another-class {} +.some-class .another-class {} +E * {} +E .class {} +E > .foo {} +E > #id {} +E:active {} +E:hover {} +E:selected {} +E:disabled {} +E:indeterminate {} +E:focus {} +E:active:hover {} +* > .notebook tab:first-child .label:focus {} +E, F {} +E, F /* comment here */ {} +E,/* comment here */ F {} +E1.e1_2 #T3_4 {} +E:first-child {} +E:last-child {} +E:first-child {} +E:last-child {} +E:nth-child(even) {} +E:nth-child(odd) {} +E:focus tab {} diff --git a/testsuite/css/parser/selector-original.ref.css b/testsuite/css/parser/selector-original.ref.css new file mode 100644 index 0000000000..e69de29bb2 diff --git a/testsuite/gtk/meson.build b/testsuite/gtk/meson.build index e721ceaf49..e232522841 100644 --- a/testsuite/gtk/meson.build +++ b/testsuite/gtk/meson.build @@ -54,7 +54,6 @@ tests = [ ['slicelistmodel'], ['sortlistmodel'], ['spinbutton'], - ['stylecontext'], ['templates'], ['textbuffer'], ['textiter'], diff --git a/testsuite/gtk/stylecontext.c b/testsuite/gtk/stylecontext.c deleted file mode 100644 index a4d4d44435..0000000000 --- a/testsuite/gtk/stylecontext.c +++ /dev/null @@ -1,132 +0,0 @@ -#include - -typedef struct { - GtkStyleContext *context; - GtkCssProvider *blue_provider; - GtkCssProvider *red_provider; - GtkCssProvider *green_provider; -} PrioritiesFixture; - -static void -test_parse_selectors (void) -{ - GtkCssProvider *provider; - gint i; - const gchar *valid[] = { - "* {}", - "E {}", - "E F {}", - "E > F {}", - "E + F {}", - "E#id {}", - "#id {}", - "tab:first-child {}", - "tab:last-child {}", - "tab:first-child {}", - "tab:last-child {}", - "tab:nth-child(even) {}", - "tab:nth-child(odd) {}", - ".some-class {}", - ".some-class.another-class {}", - ".some-class .another-class {}", - "E * {}", - "E .class {}", - "E > .foo {}", - "E > #id {}", - "E:active {}", - "E:hover {}", - "E:selected {}", - "E:disabled {}", - "E:indeterminate {}", - "E:focus {}", - "E:active:hover {}", - "* > .notebook tab:first-child .label:focus {}", - "E, F {}", - "E, F /* comment here */ {}", - "E,/* comment here */ F {}", - "E1.e1_2 #T3_4 {}", - "E:first-child {}", - "E:last-child {}", - "E:first-child {}", - "E:last-child {}", - "E:nth-child(even) {}", - "E:nth-child(odd) {}", - "E:focus tab {}", - NULL - }; - - for (i = 0; valid[i]; i++) - { - provider = gtk_css_provider_new (); - gtk_css_provider_load_from_data (provider, valid[i], -1); - - g_object_unref (provider); - } -} - -void -test_widget_path_parent (void) -{ - GtkStyleContext *parent, *context; - - parent = gtk_style_context_new (); - context = gtk_style_context_new (); - - gtk_style_context_set_parent (context, parent); - - g_object_unref (parent); - 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[]) -{ - gtk_init (); - g_test_init (&argc, &argv, NULL); - - g_test_add_func ("/style/parse/selectors", test_parse_selectors); - 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 (); -}