[gtk+/gtk-2-90] Remove obsolete GtkText test from testgtk
- From: Christian Dywan <cdywan src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/gtk-2-90] Remove obsolete GtkText test from testgtk
- Date: Wed, 31 Mar 2010 13:31:06 +0000 (UTC)
commit 1d76f58b50faa7add9cb409de072f4bd86c5a6bb
Author: Christian Dywan <christian twotoasts de>
Date: Wed Mar 31 15:32:03 2010 +0200
Remove obsolete GtkText test from testgtk
tests/testgtk.c | 178 -------------------------------------------------------
1 files changed, 0 insertions(+), 178 deletions(-)
---
diff --git a/tests/testgtk.c b/tests/testgtk.c
index 51b422f..18b0f08 100644
--- a/tests/testgtk.c
+++ b/tests/testgtk.c
@@ -6851,183 +6851,6 @@ struct {
int ntext_colors = sizeof(text_colors) / sizeof(text_colors[0]);
/*
- * GtkText
- */
-void
-text_insert_random (GtkWidget *w, GtkText *text)
-{
- int i;
- char c;
- for (i=0; i<10; i++)
- {
- c = 'A' + rand() % ('Z' - 'A');
- gtk_text_set_point (text, rand() % gtk_text_get_length (text));
- gtk_text_insert (text, NULL, NULL, NULL, &c, 1);
- }
-}
-
-void
-create_text (GtkWidget *widget)
-{
- int i, j;
-
- static GtkWidget *window = NULL;
- GtkWidget *box1;
- GtkWidget *box2;
- GtkWidget *hbox;
- GtkWidget *button;
- GtkWidget *check;
- GtkWidget *separator;
- GtkWidget *scrolled_window;
- GtkWidget *text;
-
- FILE *infile;
-
- if (!window)
- {
- window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
- gtk_window_set_screen (GTK_WINDOW (window),
- gtk_widget_get_screen (widget));
-
- gtk_widget_set_name (window, "text window");
- g_object_set (window, "allow_shrink", TRUE, "allow_grow", TRUE, NULL);
- gtk_widget_set_size_request (window, 500, 500);
-
- g_signal_connect (window, "destroy",
- G_CALLBACK (gtk_widget_destroyed),
- &window);
-
- gtk_window_set_title (GTK_WINDOW (window), "test");
- gtk_container_set_border_width (GTK_CONTAINER (window), 0);
-
-
- box1 = gtk_vbox_new (FALSE, 0);
- gtk_container_add (GTK_CONTAINER (window), box1);
- gtk_widget_show (box1);
-
-
- box2 = gtk_vbox_new (FALSE, 10);
- gtk_container_set_border_width (GTK_CONTAINER (box2), 10);
- gtk_box_pack_start (GTK_BOX (box1), box2, TRUE, TRUE, 0);
- gtk_widget_show (box2);
-
-
- scrolled_window = gtk_scrolled_window_new (NULL, NULL);
- gtk_box_pack_start (GTK_BOX (box2), scrolled_window, TRUE, TRUE, 0);
- gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_window),
- GTK_POLICY_NEVER,
- GTK_POLICY_ALWAYS);
- gtk_widget_show (scrolled_window);
-
- text = gtk_text_new (NULL, NULL);
- gtk_text_set_editable (GTK_TEXT (text), TRUE);
- gtk_container_add (GTK_CONTAINER (scrolled_window), text);
- gtk_widget_grab_focus (text);
- gtk_widget_show (text);
-
-
- gtk_text_freeze (GTK_TEXT (text));
-
- for (i=0; i<ntext_colors; i++)
- {
- gtk_text_insert (GTK_TEXT (text), NULL, NULL, NULL,
- text_colors[i].name, -1);
- gtk_text_insert (GTK_TEXT (text), NULL, NULL, NULL, "\t", -1);
-
- for (j=0; j<ntext_colors; j++)
- {
- gtk_text_insert (GTK_TEXT (text), NULL,
- &text_colors[j].color, &text_colors[i].color,
- "XYZ", -1);
- }
- gtk_text_insert (GTK_TEXT (text), NULL, NULL, NULL, "\n", -1);
- }
-
- infile = fopen("testgtk.c", "r");
-
- if (infile)
- {
- char *buffer;
- int nbytes_read, nbytes_alloc;
-
- nbytes_read = 0;
- nbytes_alloc = 1024;
- buffer = g_new (char, nbytes_alloc);
- while (1)
- {
- int len;
- if (nbytes_alloc < nbytes_read + 1024)
- {
- nbytes_alloc *= 2;
- buffer = g_realloc (buffer, nbytes_alloc);
- }
- len = fread (buffer + nbytes_read, 1, 1024, infile);
- nbytes_read += len;
- if (len < 1024)
- break;
- }
-
- gtk_text_insert (GTK_TEXT (text), NULL, NULL,
- NULL, buffer, nbytes_read);
- g_free(buffer);
- fclose (infile);
- }
-
- gtk_text_thaw (GTK_TEXT (text));
-
- hbox = gtk_hbutton_box_new ();
- gtk_box_pack_start (GTK_BOX (box2), hbox, FALSE, FALSE, 0);
- gtk_widget_show (hbox);
-
- check = gtk_check_button_new_with_label("Editable");
- gtk_box_pack_start (GTK_BOX (hbox), check, FALSE, FALSE, 0);
- g_signal_connect (check, "toggled",
- G_CALLBACK (text_toggle_editable), text);
- gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(check), TRUE);
- gtk_widget_show (check);
-
- check = gtk_check_button_new_with_label("Wrap Words");
- gtk_box_pack_start (GTK_BOX (hbox), check, FALSE, TRUE, 0);
- g_signal_connect (check, "toggled",
- G_CALLBACK (text_toggle_word_wrap), text);
- gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(check), FALSE);
- gtk_widget_show (check);
-
- separator = gtk_hseparator_new ();
- gtk_box_pack_start (GTK_BOX (box1), separator, FALSE, TRUE, 0);
- gtk_widget_show (separator);
-
-
- box2 = gtk_vbox_new (FALSE, 10);
- gtk_container_set_border_width (GTK_CONTAINER (box2), 10);
- gtk_box_pack_start (GTK_BOX (box1), box2, FALSE, TRUE, 0);
- gtk_widget_show (box2);
-
-
- button = gtk_button_new_with_label ("insert random");
- g_signal_connect (button, "clicked",
- G_CALLBACK (text_insert_random),
- text);
- gtk_box_pack_start (GTK_BOX (box2), button, TRUE, TRUE, 0);
- gtk_widget_show (button);
-
- button = gtk_button_new_with_label ("close");
- g_signal_connect_swapped (button, "clicked",
- G_CALLBACK (gtk_widget_destroy),
- window);
- gtk_box_pack_start (GTK_BOX (box2), button, TRUE, TRUE, 0);
- gtk_widget_set_can_default (button, TRUE);
- gtk_widget_grab_default (button);
- gtk_widget_show (button);
- }
-
- if (!gtk_widget_get_visible (window))
- gtk_widget_show (window);
- else
- gtk_widget_destroy (window);
-}
-
-/*
* GtkNotebook
*/
@@ -11070,7 +10893,6 @@ struct {
{ "test scrolling", create_scroll_test },
{ "test selection", create_selection_test },
{ "test timeout", create_timeout_test },
- { "text", create_text },
{ "toggle buttons", create_toggle_buttons },
{ "toolbar", create_toolbar },
{ "tooltips", create_tooltips },
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]