summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuillaume Seguin <guillaume@segu.in>2008-08-22 17:39:07 +0200
committerGuillaume Seguin <guillaume@segu.in>2008-08-22 17:39:07 +0200
commit1e85295300eeef90494fd56567829fea18de5ca6 (patch)
treedc2b97483cf4b16a4fe3ac642f02156810aad19c
parentc51574db489d073573bf5e468413fa82740a9e0b (diff)
downloadgmathlib-1e85295300eeef90494fd56567829fea18de5ca6.tar.gz
gmathlib-1e85295300eeef90494fd56567829fea18de5ca6.tar.bz2
* Add test for GMathWrapBox
-rw-r--r--test/test_gmathwrapbox.c87
1 files changed, 87 insertions, 0 deletions
diff --git a/test/test_gmathwrapbox.c b/test/test_gmathwrapbox.c
new file mode 100644
index 0000000..ee7d164
--- /dev/null
+++ b/test/test_gmathwrapbox.c
@@ -0,0 +1,87 @@
+/*
+ * gMathWrapBox, horizontal wrapping box
+ *
+ * # Widget test
+ *
+ * Author : Guillaume Seguin
+ * Email : guillaume@segu.in
+ *
+ * Copyright (c) 2008 Guillaume Seguin <guillaume@segu.in>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include <gtk/gtk.h>
+
+#include <gmathwrapbox.h>
+
+int
+main (int argc, char **argv)
+{
+ GtkWidget *window;
+ GtkWidget *simplewrapbox;
+ GtkWidget *homogeneouswrapbox;
+ GtkWidget *hbox, *vbox;
+ GtkWidget *button;
+ gint i;
+
+ gtk_init (&argc, &argv);
+
+ window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
+ gtk_window_set_title (GTK_WINDOW (window), "gMathWrapBox Test");
+ gtk_window_set_default_size (GTK_WINDOW (window), 400, -1);
+
+ gtk_widget_show (window);
+
+ hbox = gtk_hbox_new (TRUE, 0);
+
+ gtk_container_add (GTK_CONTAINER (window), hbox);
+
+ simplewrapbox = g_math_wrapbox_new (FALSE, FALSE, TRUE);
+ homogeneouswrapbox = g_math_wrapbox_new (TRUE, TRUE, FALSE);
+
+ vbox = gtk_vbox_new (FALSE, 0);
+ gtk_box_pack_start (GTK_BOX (hbox), vbox, TRUE, TRUE, 0);
+ gtk_box_pack_start (GTK_BOX (vbox), gtk_label_new ("Simple"),
+ FALSE, FALSE, 0);
+ gtk_box_pack_start (GTK_BOX (vbox), simplewrapbox,
+ FALSE, FALSE, 0);
+
+ vbox = gtk_vbox_new (FALSE, 0);
+ gtk_box_pack_start (GTK_BOX (hbox), vbox, TRUE, TRUE, 0);
+ gtk_box_pack_start (GTK_BOX (vbox), gtk_label_new ("Homogeneous"),
+ FALSE, FALSE, 0);
+ gtk_box_pack_start (GTK_BOX (vbox), homogeneouswrapbox,
+ FALSE, FALSE, 0);
+
+ /* I know this is a huge memleak, but all we want is to test the widget */
+ for (i = 0; i < 96; i++)
+ {
+ button = gtk_button_new_with_label (g_strdup_printf ("%d", i));
+ g_math_wrapbox_add (GTK_CONTAINER (simplewrapbox),
+ GTK_WIDGET (button));
+ button = gtk_button_new_with_label (g_strdup_printf ("%d", i));
+ g_math_wrapbox_add (GTK_CONTAINER (homogeneouswrapbox),
+ GTK_WIDGET (button));
+ }
+
+ g_signal_connect (window, "delete-event",
+ G_CALLBACK (gtk_main_quit), NULL);
+
+ gtk_widget_show_all (window);
+
+ gtk_main ();
+}