summaryrefslogtreecommitdiff
path: root/tests/testadjustsize.c
diff options
context:
space:
mode:
authorTristan Van Berkom <tristan.van.berkom@gmail.com>2010-09-27 21:15:16 +0900
committerTristan Van Berkom <tristan.van.berkom@gmail.com>2010-09-27 21:15:16 +0900
commit7047502d846713fee8f271354c86afa5dd63ffdd (patch)
treebd7bc34ba083dffd353f3188898f18da3c708754 /tests/testadjustsize.c
parentde0428fe520ea0be3c3c612054927d0b78faaa1b (diff)
downloadgtk+-7047502d846713fee8f271354c86afa5dd63ffdd.tar.gz
Fix erroneous usage of height-for-width apis in gtk_widget_real_adjust_size_allocation().
When fitting a widget into its allocation, the second dimension is always dependent on the first, so gtk_widget_get_preferred_size() cannot be used directly (because we want the natural height for the allocated width, not the natural height for the natural width, which is generally a smaller height than the height-for-minimum-width or height-for-allocated-width). Added test to testadjustsize to ensure proper behaviour.
Diffstat (limited to 'tests/testadjustsize.c')
-rw-r--r--tests/testadjustsize.c35
1 files changed, 35 insertions, 0 deletions
diff --git a/tests/testadjustsize.c b/tests/testadjustsize.c
index 5e9795c824..889ea52c72 100644
--- a/tests/testadjustsize.c
+++ b/tests/testadjustsize.c
@@ -394,6 +394,40 @@ open_margin_window (void)
gtk_widget_show_all (test_window);
}
+static void
+open_valigned_label_window (void)
+{
+ GtkWidget *window, *box, *label, *frame;
+
+ window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
+
+ g_signal_connect (test_window, "delete-event",
+ G_CALLBACK (gtk_main_quit), test_window);
+
+ box = gtk_vbox_new (FALSE, 0);
+ gtk_widget_show (box);
+ gtk_container_add (GTK_CONTAINER (window), box);
+
+
+ label = gtk_label_new ("Some wrapping text with width-chars = 15 and max-width-chars = 35");
+ gtk_label_set_line_wrap (GTK_LABEL (label), TRUE);
+ gtk_label_set_width_chars (GTK_LABEL (label), 15);
+ gtk_label_set_max_width_chars (GTK_LABEL (label), 35);
+
+ gtk_widget_show (label);
+
+ frame = gtk_frame_new (NULL);
+ gtk_widget_show (frame);
+ gtk_container_add (GTK_CONTAINER (frame), label);
+
+ gtk_widget_set_valign (frame, GTK_ALIGN_CENTER);
+ gtk_widget_set_halign (frame, GTK_ALIGN_FILL);
+
+ gtk_box_pack_start (GTK_BOX (box), frame, TRUE, TRUE, 0);
+
+ gtk_window_present (GTK_WINDOW (window));
+}
+
int
main (int argc, char *argv[])
{
@@ -403,6 +437,7 @@ main (int argc, char *argv[])
open_control_window ();
open_alignment_window ();
open_margin_window ();
+ open_valigned_label_window ();
gtk_main ();