summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorTimm Bäder <mail@baedert.org>2016-01-02 15:40:50 +0100
committerTimm Bäder <mail@baedert.org>2016-01-02 15:52:20 +0100
commit2b2a5386293cee011e29408fedae3f9dc5129ecb (patch)
tree5a564e4633b683b9aea50148b4cb858cb12c89dd /tests
parent3758762119827a62c93bd071dd6a7e63723d5e10 (diff)
downloadgtk+-2b2a5386293cee011e29408fedae3f9dc5129ecb.tar.gz
testframe: Pass correct state to GtkStyleContext API
Diffstat (limited to 'tests')
-rw-r--r--tests/testframe.c21
1 files changed, 16 insertions, 5 deletions
diff --git a/tests/testframe.c b/tests/testframe.c
index 4eda506cc0..0ab8a7a73e 100644
--- a/tests/testframe.c
+++ b/tests/testframe.c
@@ -38,9 +38,13 @@ spin_ythickness_cb (GtkSpinButton *spin, gpointer user_data)
GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
}
- gtk_style_context_get_padding (context, GTK_STATE_FLAG_NORMAL, &pad);
+ gtk_style_context_save (context);
+ gtk_style_context_set_state (context, GTK_STATE_FLAG_NORMAL);
+ gtk_style_context_get_padding (context, gtk_style_context_get_state (context), &pad);
+ gtk_style_context_restore (context);
- data = g_strdup_printf ("GtkFrame { padding: %d %d }",
+
+ data = g_strdup_printf ("GtkFrame { padding: %dpx %dpx }",
pad.top,
(gint)gtk_spin_button_get_value (spin));
@@ -70,9 +74,13 @@ spin_xthickness_cb (GtkSpinButton *spin, gpointer user_data)
GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
}
- gtk_style_context_get_padding (context, GTK_STATE_FLAG_NORMAL, &pad);
+ gtk_style_context_save (context);
+ gtk_style_context_set_state (context, GTK_STATE_FLAG_NORMAL);
+ gtk_style_context_get_padding (context, gtk_style_context_get_state (context), &pad);
+ gtk_style_context_restore (context);
+
- data = g_strdup_printf ("GtkFrame { padding: %d %d }",
+ data = g_strdup_printf ("GtkFrame { padding: %dpx %dpx }",
(gint)gtk_spin_button_get_value (spin),
pad.left);
@@ -149,7 +157,10 @@ int main (int argc, char **argv)
gtk_box_pack_start (GTK_BOX (vbox), grid, FALSE, FALSE, 0);
context = gtk_widget_get_style_context (frame);
- gtk_style_context_get_padding (context, GTK_STATE_FLAG_NORMAL, &pad);
+ gtk_style_context_save (context);
+ gtk_style_context_set_state (context, GTK_STATE_FLAG_NORMAL);
+ gtk_style_context_get_padding (context, gtk_style_context_get_state (context), &pad);
+ gtk_style_context_restore (context);
/* Spin to control xthickness */
label = gtk_label_new ("xthickness: ");