summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorOwen Taylor <otaylor@redhat.com>2002-02-02 00:44:52 +0000
committerOwen Taylor <otaylor@src.gnome.org>2002-02-02 00:44:52 +0000
commit5288e079317b2882b1da06f9050a7881c2ddbd68 (patch)
tree9998eebc158139d1c81b964a0936672594ec1cbe /tests
parentcfaea03b104664f5ca774734b43e9a57fc74e3ac (diff)
downloadgdk-pixbuf-5288e079317b2882b1da06f9050a7881c2ddbd68.tar.gz
Fix ordering of priorities so that priorities take precendence over the
Fri Feb 1 17:48:51 2002 Owen Taylor <otaylor@redhat.com> * gtk/gtkrc.c (gtk_rc_get_style): Fix ordering of priorities so that priorities take precendence over the ordering by type. (#70205) * test/testgtkrc tests/testgtk.c (create_rc_file): Add some labels to test priorities in testgtkrc.
Diffstat (limited to 'tests')
-rw-r--r--tests/testgtk.c27
-rw-r--r--tests/testgtkrc23
2 files changed, 45 insertions, 5 deletions
diff --git a/tests/testgtk.c b/tests/testgtk.c
index f60fd6fa5..fbd4af4c6 100644
--- a/tests/testgtk.c
+++ b/tests/testgtk.c
@@ -10573,6 +10573,9 @@ create_rc_file (void)
{
static GtkWidget *window = NULL;
GtkWidget *button;
+ GtkWidget *frame;
+ GtkWidget *vbox;
+ GtkWidget *label;
if (!window)
{
@@ -10582,6 +10585,24 @@ create_rc_file (void)
GTK_SIGNAL_FUNC(destroy_idle_test),
&window);
+ frame = gtk_aspect_frame_new ("Testing RC file prioritization", 0.5, 0.5, 0.0, TRUE);
+ gtk_box_pack_start (GTK_BOX (GTK_DIALOG (window)->vbox), frame, FALSE, FALSE, 0);
+
+ vbox = gtk_vbox_new (FALSE, 0);
+ gtk_container_add (GTK_CONTAINER (frame), vbox);
+
+ label = gtk_label_new ("This label should be red");
+ gtk_widget_set_name (label, "testgtk-red-label");
+ gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0);
+
+ label = gtk_label_new ("This label should be green");
+ gtk_widget_set_name (label, "testgtk-green-label");
+ gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0);
+
+ label = gtk_label_new ("This label should be blue");
+ gtk_widget_set_name (label, "testgtk-blue-label");
+ gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0);
+
gtk_window_set_title (GTK_WINDOW (window), "Reload Rc file");
gtk_container_set_border_width (GTK_CONTAINER (window), 0);
@@ -10592,7 +10613,6 @@ create_rc_file (void)
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (window)->action_area),
button, TRUE, TRUE, 0);
gtk_widget_grab_default (button);
- gtk_widget_show (button);
button = gtk_button_new_with_label ("Reload All");
gtk_signal_connect (GTK_OBJECT (button), "clicked",
@@ -10600,7 +10620,6 @@ create_rc_file (void)
GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (window)->action_area),
button, TRUE, TRUE, 0);
- gtk_widget_show (button);
button = gtk_button_new_with_label ("Close");
gtk_signal_connect_object (GTK_OBJECT (button), "clicked",
@@ -10609,12 +10628,10 @@ create_rc_file (void)
GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (window)->action_area),
button, TRUE, TRUE, 0);
- gtk_widget_show (button);
-
}
if (!GTK_WIDGET_VISIBLE (window))
- gtk_widget_show (window);
+ gtk_widget_show_all (window);
else
gtk_widget_destroy (window);
}
diff --git a/tests/testgtkrc b/tests/testgtkrc
index 4b4cc5741..87c3c66a2 100644
--- a/tests/testgtkrc
+++ b/tests/testgtkrc
@@ -188,3 +188,26 @@ style "testthickness" {
}
#class "GtkFrame" style "testthickness"
+
+# Test ordering of RC file priorities
+
+style "testgtk-red-style" {
+ fg[NORMAL] = "red"
+}
+
+style "testgtk-green-style" {
+ fg[NORMAL] = "green"
+}
+
+style "testgtk-blue-style" {
+ fg[NORMAL] = "blue"
+}
+
+widget_class "*.GtkAspectFrame.*.GtkLabel" style "testgtk-green-style"
+widget_class "*.GtkAspectFrame.*.GtkLabel" style "testgtk-blue-style" # override because it's later
+
+widget "*.testgtk-red-label" style "testgtk-red-style" # override because it's widget, not widget_class
+
+widget "*.testgtk-green-label" style : highest "testgtk-green-style"
+# overrides the following, because it is higher priority
+widget "*.testgtk-green-label" style "testgtk-red-style"