diff options
author | Benjamin Otte <otte@redhat.com> | 2014-10-12 05:08:54 +0200 |
---|---|---|
committer | Benjamin Otte <otte@redhat.com> | 2014-10-12 05:11:13 +0200 |
commit | 81fe943472d2fb0b6670af2d3b4a62fa5aee3906 (patch) | |
tree | 82c5f8b76ab906581034bffc7d2b58b5af546b0e /tests | |
parent | 0a6443ebafb4fd0a1644434ce13b3c24db0c4c4f (diff) | |
download | gtk+-81fe943472d2fb0b6670af2d3b4a62fa5aee3906.tar.gz |
tests: Update testoverlaystyleclass test
Make it not use deprecations anymore and use CSS to show things work by
changing border-radius when a style class exists.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/testoverlaystyleclass.c | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/tests/testoverlaystyleclass.c b/tests/testoverlaystyleclass.c index 161fd6c235..28a10bd531 100644 --- a/tests/testoverlaystyleclass.c +++ b/tests/testoverlaystyleclass.c @@ -42,18 +42,28 @@ int main (int argc, char *argv[]) { GtkWidget *win, *overlay, *grid, *main_child, *child, *label, *sw; - GdkRGBA color; + GtkCssProvider *provider; gchar *str; gtk_init (&argc, &argv); + provider = gtk_css_provider_new (); + gtk_css_provider_load_from_data (provider, + "GtkLabel { border: 3px solid black; border-radius: 5px; padding: 2px; }" + ".top { border-top-style: none; right-radius: 0px; border-top-left-radius: 0px; }" + ".bottom { border-bottom-style: none; border-bottom-right-radius: 0px; border-bottom-left-radius: 0px; }" + ".left { border-left-style: none; border-top-left-radius: 0px; border-bottom-left-radius: 0px; }" + ".right { border-right-style: none; border-top-right-radius: 0px; border-bottom-right-radius: 0px; }", + -1, NULL); + gtk_style_context_add_provider_for_screen (gdk_screen_get_default (), + GTK_STYLE_PROVIDER (provider), + GTK_STYLE_PROVIDER_PRIORITY_APPLICATION); + win = gtk_window_new (GTK_WINDOW_TOPLEVEL); gtk_window_set_default_size (GTK_WINDOW (win), 600, 600); grid = gtk_grid_new (); child = gtk_event_box_new (); - gdk_rgba_parse (&color, "red"); - gtk_widget_override_background_color (child, 0, &color); gtk_widget_set_hexpand (child, TRUE); gtk_widget_set_vexpand (child, TRUE); gtk_container_add (GTK_CONTAINER (grid), child); @@ -69,11 +79,11 @@ main (int argc, char *argv[]) main_child = gtk_event_box_new (); gtk_container_add (GTK_CONTAINER (sw), main_child); - gdk_rgba_parse (&color, "green"); - gtk_widget_override_background_color (main_child, 0, &color); gtk_widget_set_hexpand (main_child, TRUE); gtk_widget_set_vexpand (main_child, TRUE); label = gtk_label_new ("Main child"); + gtk_widget_set_halign (label, GTK_ALIGN_CENTER); + gtk_widget_set_valign (label, GTK_ALIGN_CENTER); gtk_container_add (GTK_CONTAINER (main_child), label); child = gtk_label_new (NULL); |