summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorMatthias Clasen <maclas@gmx.de>2004-07-22 05:06:39 +0000
committerMatthias Clasen <matthiasc@src.gnome.org>2004-07-22 05:06:39 +0000
commitccb1f08ef8dcc75777709ac53f95df0f58612675 (patch)
tree1712baa6b1417bd1c83b46aa140bd39ae8a583e7 /tests
parentb23415ee8b836f58755a86897285fe7dd6086606 (diff)
downloadgdk-pixbuf-ccb1f08ef8dcc75777709ac53f95df0f58612675.tar.gz
Require Pango 1.5.1 (for ellipsisation).
Thu Jul 22 01:05:16 2004 Matthias Clasen <maclas@gmx.de> * configure.in: Require Pango 1.5.1 (for ellipsisation). * gtk/gtklabel.h: * gtk/gtklabel.c (gtk_label_class_init): Add a new :ellipsise property which controls ellipsisation of the label. (#125250, Tim Van Wassenhove, patch by James M. Cape) * tests/testellipsise.c: Simple test for ellipsisation.
Diffstat (limited to 'tests')
-rw-r--r--tests/Makefile.am3
-rw-r--r--tests/testellipsise.c68
2 files changed, 71 insertions, 0 deletions
diff --git a/tests/Makefile.am b/tests/Makefile.am
index c57d9f45f..8dc718c83 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -32,6 +32,7 @@ noinst_PROGRAMS = \
testcombo \
testcombochange \
testdnd \
+ testellipsise \
testentrycompletion \
testfilechooser \
testgtk \
@@ -69,6 +70,7 @@ testcalendar_DEPENDENCIES = $(TEST_DEPS)
testcombo_DEPENDENCIES = $(TEST_DEPS)
testcombochange_DEPENDENCIES = $(TEST_DEPS)
testdnd_DEPENDENCIES = $(TEST_DEPS)
+testellipsise_DEPENDENCIES = $(TEST_DEPS)
testentrycompletion_DEPENDENCIES = $(TEST_DEPS)
testfilechooser_DEPENDENCIES = $(TEST_DEPS)
testgtk_DEPENDENCIES = $(TEST_DEPS)
@@ -99,6 +101,7 @@ testcalendar_LDADD = $(LDADDS)
testcombo_LDADD = $(LDADDS)
testcombochange_LDADD = $(LDADDS)
testdnd_LDADD = $(LDADDS)
+testellipsise_LDADD = $(LDADDS)
testentrycompletion_LDADD = $(LDADDS)
testfilechooser_LDADD = $(LDADDS)
testgtk_LDADD = $(LDADDS)
diff --git a/tests/testellipsise.c b/tests/testellipsise.c
new file mode 100644
index 000000000..5e5d5a039
--- /dev/null
+++ b/tests/testellipsise.c
@@ -0,0 +1,68 @@
+/* GTK - The GIMP Toolkit
+ * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free
+ * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+/*
+ * Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
+ * file for a list of people on the GTK+ Team. See the ChangeLog
+ * files for a list of changes. These files are distributed with
+ * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
+ */
+
+#include <gtk/gtk.h>
+
+static void
+combo_changed_cb (GtkWidget *combo,
+ gpointer data)
+{
+ GtkWidget *label = GTK_WIDGET (data);
+ gint active;
+
+ active = gtk_combo_box_get_active (GTK_COMBO_BOX (combo));
+
+ gtk_label_set_ellipsize (GTK_LABEL (label), (PangoEllipsizeMode)active);
+}
+
+int
+main (int argc, char *argv[])
+{
+ GtkWidget *window, *vbox, *hbox, *label, *combo;
+
+ gtk_init (&argc, &argv);
+
+ window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
+ vbox = gtk_vbox_new (0, FALSE);
+ gtk_container_add (GTK_CONTAINER (window), vbox);
+ hbox = gtk_hbox_new (0, FALSE);
+ gtk_box_pack_start (GTK_BOX (vbox), hbox, TRUE, TRUE, 0);
+ label = gtk_label_new ("This label may be ellipsized\nto make it fit.");
+ gtk_box_pack_start (GTK_BOX (hbox), label, TRUE, TRUE, 0);
+ combo = gtk_combo_box_new_text ();
+ gtk_combo_box_append_text (GTK_COMBO_BOX (combo), "NONE");
+ gtk_combo_box_append_text (GTK_COMBO_BOX (combo), "START");
+ gtk_combo_box_append_text (GTK_COMBO_BOX (combo), "MIDDLE");
+ gtk_combo_box_append_text (GTK_COMBO_BOX (combo), "END");
+ gtk_combo_box_set_active (GTK_COMBO_BOX (combo), 0);
+ gtk_box_pack_start (GTK_BOX (hbox), combo, TRUE, TRUE, 0);
+ g_signal_connect (combo, "changed", G_CALLBACK (combo_changed_cb), label);
+
+ gtk_widget_show_all (window);
+
+ gtk_main ();
+
+ return 0;
+}