From deef018c68b54c1e7c5a0452c92232845f04ff63 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Wed, 13 May 2020 15:37:21 -0400 Subject: [PATCH 1/9] tests: Drop testtoolbar2 This is just a tool bar styling test; we have the same in the widget factory. See: #2738 --- tests/meson.build | 1 - tests/testtoolbar2.c | 45 -------------------------------------------- 2 files changed, 46 deletions(-) delete mode 100644 tests/testtoolbar2.c diff --git a/tests/meson.build b/tests/meson.build index 3bcda9440c..6ffb10378f 100644 --- a/tests/meson.build +++ b/tests/meson.build @@ -73,7 +73,6 @@ gtk_tests = [ ['testselectionmode'], ['testsounds'], ['testspinbutton'], - ['testtoolbar2'], ['testtreechanging'], ['testtreednd'], ['testtreeedit'], diff --git a/tests/testtoolbar2.c b/tests/testtoolbar2.c deleted file mode 100644 index 82343293f9..0000000000 --- a/tests/testtoolbar2.c +++ /dev/null @@ -1,45 +0,0 @@ -#include - -int main (int argc, char *argv[]) -{ - GtkWidget *window; - GtkWidget *box; - GtkWidget *frame; - GtkWidget *box3; - GtkWidget *view; - GtkWidget *button; - - gtk_init (); - - window = gtk_window_new (); - gtk_window_set_default_size (GTK_WINDOW (window), 600, 400); - box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0); - gtk_window_set_child (GTK_WINDOW (window), box); - frame = gtk_frame_new (NULL); - gtk_box_append (GTK_BOX (box), frame); - view = gtk_text_view_new (); - gtk_widget_set_vexpand (view, TRUE); - gtk_box_append (GTK_BOX (box), view); - box3 = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0); - gtk_widget_set_margin_start (box3, 10); - gtk_widget_set_margin_end (box3, 10); - gtk_widget_set_margin_top (box3, 10); - gtk_widget_set_margin_bottom (box3, 10); - - gtk_widget_add_css_class (box3, GTK_STYLE_CLASS_LINKED); - button = gtk_button_new_from_icon_name ("document-new-symbolic"); - gtk_box_append (GTK_BOX (box3), button); - button = gtk_button_new_from_icon_name ("document-open-symbolic"); - gtk_box_append (GTK_BOX (box3), button); - button = gtk_button_new_from_icon_name ("document-save-symbolic"); - gtk_box_append (GTK_BOX (box3), button); - - gtk_frame_set_child (GTK_FRAME (frame), box3); - - gtk_widget_show (GTK_WIDGET (window)); - - while (TRUE) - g_main_context_iteration (NULL, TRUE); - - return 0; -} From c3aeac19bcc16d1f146cc424e632f1bbb26d862d Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Wed, 13 May 2020 15:40:39 -0400 Subject: [PATCH 2/9] tests: Drop testpixbuf-scale This looks like a GdkPixbuf utility, and we are moving away from GdkPixbuf anyway. See: #2738 --- tests/meson.build | 1 - tests/testpixbuf-scale.c | 160 --------------------------------------- 2 files changed, 161 deletions(-) delete mode 100644 tests/testpixbuf-scale.c diff --git a/tests/meson.build b/tests/meson.build index 6ffb10378f..c97a8ba4d0 100644 --- a/tests/meson.build +++ b/tests/meson.build @@ -100,7 +100,6 @@ gtk_tests = [ ['testsensitive'], ['testtextview'], ['testtextview2'], - ['testpixbuf-scale'], ['testgmenu'], ['testlogout'], ['teststack'], diff --git a/tests/testpixbuf-scale.c b/tests/testpixbuf-scale.c deleted file mode 100644 index 2a67078858..0000000000 --- a/tests/testpixbuf-scale.c +++ /dev/null @@ -1,160 +0,0 @@ -#include "config.h" -#include - -#include -#include - -GdkInterpType interp_type = GDK_INTERP_BILINEAR; -int overall_alpha = 255; -GdkPixbuf *pixbuf; -GtkWidget *darea; - -static void -set_interp_type (GtkWidget *widget, gpointer data) -{ - guint types[] = { GDK_INTERP_NEAREST, - GDK_INTERP_BILINEAR, - GDK_INTERP_TILES, - GDK_INTERP_HYPER }; - - interp_type = types[gtk_combo_box_get_active (GTK_COMBO_BOX (widget))]; - gtk_widget_queue_draw (darea); -} - -static void -overall_changed_cb (GtkAdjustment *adjustment, gpointer data) -{ - if (gtk_adjustment_get_value (adjustment) != overall_alpha) - { - overall_alpha = gtk_adjustment_get_value (adjustment); - gtk_widget_queue_draw (darea); - } -} - -static void -draw_func (GtkDrawingArea *area, - cairo_t *cr, - int width, - int height, - gpointer data) -{ - GdkPixbuf *dest; - - dest = gdk_pixbuf_new (GDK_COLORSPACE_RGB, FALSE, 8, width, height); - - gdk_pixbuf_composite_color (pixbuf, dest, - 0, 0, width, height, - 0, 0, - (double) width / gdk_pixbuf_get_width (pixbuf), - (double) height / gdk_pixbuf_get_height (pixbuf), - interp_type, overall_alpha, - 0, 0, 16, 0xaaaaaa, 0x555555); - - gdk_cairo_set_source_pixbuf (cr, dest, 0, 0); - cairo_paint (cr); - - g_object_unref (dest); -} - -static void -quit_cb (GtkWidget *widget, - gpointer data) -{ - gboolean *done = data; - - *done = TRUE; - - g_main_context_wakeup (NULL); -} - -int -main(int argc, char **argv) -{ - GtkWidget *window, *vbox; - GtkWidget *combo_box; - GtkWidget *hbox, *label, *hscale; - GtkAdjustment *adjustment; - GtkRequisition scratch_requisition; - const gchar *creator; - GError *error; - gboolean done = FALSE; - - gtk_init (); - - if (argc != 2) { - fprintf (stderr, "Usage: testpixbuf-scale FILE\n"); - exit (1); - } - - error = NULL; - pixbuf = gdk_pixbuf_new_from_file (argv[1], &error); - if (!pixbuf) { - fprintf (stderr, "Cannot load image: %s\n", - error->message); - g_error_free (error); - exit(1); - } - - creator = gdk_pixbuf_get_option (pixbuf, "tEXt::Software"); - if (creator) - g_print ("%s was created by '%s'\n", argv[1], creator); - - window = gtk_window_new (); - g_signal_connect (window, "destroy", - G_CALLBACK (quit_cb), &done); - - vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0); - gtk_window_set_child (GTK_WINDOW (window), vbox); - - combo_box = gtk_combo_box_text_new (); - - gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combo_box), "NEAREST"); - gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combo_box), "BILINEAR"); - gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combo_box), "TILES"); - gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combo_box), "HYPER"); - - gtk_combo_box_set_active (GTK_COMBO_BOX (combo_box), 1); - - g_signal_connect (combo_box, "changed", - G_CALLBACK (set_interp_type), - NULL); - - gtk_widget_set_halign (combo_box, GTK_ALIGN_START); - gtk_box_append (GTK_BOX (vbox), combo_box); - - hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 4); - gtk_box_append (GTK_BOX (vbox), hbox); - - label = gtk_label_new ("Overall Alpha:"); - gtk_box_append (GTK_BOX (hbox), label); - - adjustment = gtk_adjustment_new (overall_alpha, 0, 255, 1, 10, 0); - g_signal_connect (adjustment, "value_changed", - G_CALLBACK (overall_changed_cb), NULL); - - hscale = gtk_scale_new (GTK_ORIENTATION_HORIZONTAL, adjustment); - gtk_scale_set_digits (GTK_SCALE (hscale), 0); - gtk_widget_set_hexpand (hscale, TRUE); - gtk_box_append (GTK_BOX (hbox), hscale); - - /* Compute the size without the drawing area, so we know how big to make the default size */ - gtk_widget_get_preferred_size ( (vbox), - &scratch_requisition, NULL); - - darea = gtk_drawing_area_new (); - gtk_widget_set_hexpand (darea, TRUE); - gtk_box_append (GTK_BOX (vbox), darea); - - gtk_drawing_area_set_draw_func (GTK_DRAWING_AREA (darea), draw_func, NULL, NULL); - - gtk_window_set_default_size (GTK_WINDOW (window), - gdk_pixbuf_get_width (pixbuf), - scratch_requisition.height + gdk_pixbuf_get_height (pixbuf)); - - gtk_widget_show (window); - - while (!done) - g_main_context_iteration (NULL, TRUE); - - return 0; -} From 1420e846b5b59f2cd34750038bb0a6e16f1d95d8 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Wed, 13 May 2020 15:42:25 -0400 Subject: [PATCH 3/9] tests: Drop testicontheme This is a command line utility for GtkIconTheme that is probably not as useful as gtk4-icon-browser. See: #2738 --- tests/meson.build | 1 - tests/testicontheme.c | 163 ------------------------------------------ 2 files changed, 164 deletions(-) delete mode 100644 tests/testicontheme.c diff --git a/tests/meson.build b/tests/meson.build index c97a8ba4d0..c5aeb78cc7 100644 --- a/tests/meson.build +++ b/tests/meson.build @@ -52,7 +52,6 @@ gtk_tests = [ ['testhover'], ['testiconview'], ['testiconview-keynav'], - ['testicontheme'], ['testinfobar'], ['testkineticscrolling'], ['testlist'], diff --git a/tests/testicontheme.c b/tests/testicontheme.c deleted file mode 100644 index ae88684b97..0000000000 --- a/tests/testicontheme.c +++ /dev/null @@ -1,163 +0,0 @@ -/* testicontheme.c - * Copyright (C) 2002, 2003 Red Hat, Inc. - * Authors: Alexander Larsson, Owen Taylor - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library 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 - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library. If not, see . - */ - -#include -#include -#include -#include - -static void -usage (void) -{ - g_print ("usage: test-icon-theme lookup [size] [scale]\n" - " or\n" - "usage: test-icon-theme list [context]\n" - " or\n" - "usage: test-icon-theme display [size] [scale]\n" - ); -} - -static void -quit_cb (GtkWidget *widget, - gpointer data) -{ - gboolean *done = data; - - *done = TRUE; - - g_main_context_wakeup (NULL); -} - -int -main (int argc, char *argv[]) -{ - GtkIconTheme *icon_theme; - char *themename; - int size = 48; - int scale = 1; - GtkIconLookupFlags flags; - GtkTextDirection direction; - - gtk_init (); - - if (argc < 3) - { - usage (); - return 1; - } - - flags = 0; - - if (g_getenv ("RTL")) - direction = GTK_TEXT_DIR_RTL; - else if (g_getenv ("LTR")) - direction = GTK_TEXT_DIR_LTR; - else - direction = GTK_TEXT_DIR_NONE; - - themename = argv[2]; - - icon_theme = gtk_icon_theme_new (); - - gtk_icon_theme_set_theme_name (icon_theme, themename); - - if (strcmp (argv[1], "display") == 0) - { - GtkIconPaintable *icon; - GtkWidget *window, *image; - gboolean done = FALSE; - - if (argc < 4) - { - g_object_unref (icon_theme); - usage (); - return 1; - } - - if (argc >= 5) - size = atoi (argv[4]); - - if (argc >= 6) - scale = atoi (argv[5]); - - icon = gtk_icon_theme_lookup_icon (icon_theme, argv[3], NULL, size, scale, direction, flags); - if (!icon) - { - g_print ("Icon '%s' not found\n", argv[3]); - return 1; - } - - window = gtk_window_new (); - image = gtk_image_new (); - gtk_image_set_from_paintable (GTK_IMAGE (image), GDK_PAINTABLE (icon)); - g_object_unref (icon); - gtk_window_set_child (GTK_WINDOW (window), image); - g_signal_connect (window, "destroy", G_CALLBACK (quit_cb), &done); - gtk_widget_show (window); - - while (!done) - g_main_context_iteration (NULL, TRUE); - } - else if (strcmp (argv[1], "list") == 0) - { - char **icons; - int i; - - icons = gtk_icon_theme_get_icon_names (icon_theme); - for (i = 0; icons[i]; i++) - g_print ("%s\n", icons[i]); - g_strfreev (icons); - } - else if (strcmp (argv[1], "lookup") == 0) - { - GFile *file; - GtkIconPaintable *icon; - - if (argc < 4) - { - g_object_unref (icon_theme); - usage (); - return 1; - } - - if (argc >= 5) - size = atoi (argv[4]); - - if (argc >= 6) - scale = atoi (argv[5]); - - icon = gtk_icon_theme_lookup_icon (icon_theme, argv[3], NULL, size, scale, direction, flags); - file = gtk_icon_paintable_get_file (icon); - g_print ("icon for %s at %dx%d@%dx is %s\n", argv[3], size, size, scale, - file ? g_file_get_uri (file) : ""); - - g_print ("texture size: %dx%d\n", gdk_paintable_get_intrinsic_width (GDK_PAINTABLE (icon)), gdk_paintable_get_intrinsic_height (GDK_PAINTABLE (icon))); - g_object_unref (icon); - } - else - { - g_object_unref (icon_theme); - usage (); - return 1; - } - - - g_object_unref (icon_theme); - - return 0; -} From 604f4cf8bf143efa8223e21981933ae62314edc1 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Wed, 13 May 2020 15:52:00 -0400 Subject: [PATCH 4/9] tests: Drop testcolorchooser2 This tests an embedded colorchooser. Just like we have in widget-factory. And it doesn't work in !srcdir builds, so it can go. See: #2738 --- tests/meson.build | 1 - tests/testcolorchooser2.c | 60 -------------------------------------- tests/testcolorchooser2.ui | 29 ------------------ 3 files changed, 90 deletions(-) delete mode 100644 tests/testcolorchooser2.c delete mode 100644 tests/testcolorchooser2.ui diff --git a/tests/meson.build b/tests/meson.build index c5aeb78cc7..356540184a 100644 --- a/tests/meson.build +++ b/tests/meson.build @@ -22,7 +22,6 @@ gtk_tests = [ ['testcalendar'], ['testclipboard2'], ['testcolorchooser'], - ['testcolorchooser2'], ['testcombo'], ['testcombochange'], ['testcellrenderertext'], diff --git a/tests/testcolorchooser2.c b/tests/testcolorchooser2.c deleted file mode 100644 index 4309d9c754..0000000000 --- a/tests/testcolorchooser2.c +++ /dev/null @@ -1,60 +0,0 @@ -#include - -static void rgba_changed (GtkColorChooser *chooser, GParamSpec *pspec, gpointer data); - -static void -text_activated (GtkEntry *entry, gpointer data) -{ - GtkColorChooser *chooser = data; - GdkRGBA rgba; - const char *text; - - text = gtk_editable_get_text (GTK_EDITABLE (entry)); - - g_signal_handlers_block_by_func (entry, rgba_changed, entry); - if (gdk_rgba_parse (&rgba, text)) - gtk_color_chooser_set_rgba (chooser, &rgba); - g_signal_handlers_unblock_by_func (entry, rgba_changed, entry); -} - -static void -rgba_changed (GtkColorChooser *chooser, GParamSpec *pspec, gpointer data) -{ - GtkWidget *entry = data; - GdkRGBA color; - char *s; - - gtk_color_chooser_get_rgba (chooser, &color); - s = gdk_rgba_to_string (&color); - - g_signal_handlers_block_by_func (entry, text_activated, chooser); - gtk_editable_set_text (GTK_EDITABLE (entry), s); - g_signal_handlers_unblock_by_func (entry, text_activated, chooser); - - g_free (s); -} - -int main (int argc, char *argv[]) -{ - GtkWidget *window; - GtkWidget *chooser; - GtkWidget *entry; - GtkBuilder *builder; - - gtk_init (); - - builder = gtk_builder_new_from_file ("testcolorchooser2.ui"); - window = GTK_WIDGET (gtk_builder_get_object (builder, "window1")); - chooser = GTK_WIDGET (gtk_builder_get_object (builder, "chooser")); - entry = GTK_WIDGET (gtk_builder_get_object (builder, "entry")); - - g_signal_connect (chooser, "notify::rgba", G_CALLBACK (rgba_changed), entry); - g_signal_connect (entry, "activate", G_CALLBACK (text_activated), chooser); - - gtk_widget_show (window); - - while (TRUE) - g_main_context_iteration (NULL, TRUE); - - return 0; -} diff --git a/tests/testcolorchooser2.ui b/tests/testcolorchooser2.ui deleted file mode 100644 index 398dc4e25c..0000000000 --- a/tests/testcolorchooser2.ui +++ /dev/null @@ -1,29 +0,0 @@ - - - - - - 1 - horizontal - center - center - 10 - - - 1 - start - unknown - 25 - 25 - - - - - 1 - 1 - - - - - - From b0fcf645449cc5a30b828618a465da35d7d29842 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Wed, 13 May 2020 15:57:03 -0400 Subject: [PATCH 5/9] tests: Drop testbox Not useful enough to keep. See #2738 --- tests/meson.build | 1 - tests/testbox.c | 139 ---------------------------------------------- 2 files changed, 140 deletions(-) delete mode 100644 tests/testbox.c diff --git a/tests/meson.build b/tests/meson.build index 356540184a..f24d147fc5 100644 --- a/tests/meson.build +++ b/tests/meson.build @@ -17,7 +17,6 @@ gtk_tests = [ ['testappchooserbutton'], ['testassistant'], ['testbaseline'], - ['testbox'], ['testbuttons'], ['testcalendar'], ['testclipboard2'], diff --git a/tests/testbox.c b/tests/testbox.c deleted file mode 100644 index 3b551079d4..0000000000 --- a/tests/testbox.c +++ /dev/null @@ -1,139 +0,0 @@ -#include - -static void -edit_widget (GtkWidget *button) -{ - GtkWidget *dialog; - GtkWidget *grid; - GtkWidget *label; - GtkWidget *entry; - GtkWidget *check; - - dialog = GTK_WIDGET (g_object_get_data (G_OBJECT (button), "dialog")); - - if (!dialog) - { - dialog = gtk_dialog_new_with_buttons ("", - GTK_WINDOW (gtk_widget_get_root (button)), - GTK_DIALOG_DESTROY_WITH_PARENT | GTK_DIALOG_USE_HEADER_BAR, - NULL, NULL); - - grid = gtk_grid_new (); - g_object_set (grid, - "margin-start", 20, - "margin-end", 20, - "margin-top", 20, - "margin-bottom", 20, - "row-spacing", 10, - "column-spacing", 10, - NULL); - gtk_box_append (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dialog))), grid); - - label = gtk_label_new ("Label:"); - gtk_widget_set_halign (label, GTK_ALIGN_END); - entry = gtk_entry_new (); - g_object_bind_property (button, "label", - entry, "text", - G_BINDING_BIDIRECTIONAL|G_BINDING_SYNC_CREATE); - gtk_grid_attach (GTK_GRID (grid), label, 0, 0, 1, 1); - gtk_grid_attach (GTK_GRID (grid), entry, 1, 0, 1, 1); - - label = gtk_label_new ("Visible:"); - gtk_widget_set_halign (label, GTK_ALIGN_END); - check = gtk_check_button_new (); - g_object_bind_property (button, "visible", - check, "active", - G_BINDING_BIDIRECTIONAL|G_BINDING_SYNC_CREATE); - gtk_grid_attach (GTK_GRID (grid), label, 0, 1, 1, 1); - gtk_grid_attach (GTK_GRID (grid), check, 1, 1, 1, 1); - - g_object_set_data (G_OBJECT (button), "dialog", dialog); - } - - gtk_window_present (GTK_WINDOW (dialog)); -} - -static GtkWidget * -test_widget (const gchar *label) -{ - GtkWidget *w; - - w = gtk_button_new_with_label (label); - g_signal_connect (w, "clicked", G_CALLBACK (edit_widget), NULL); - - return w; -} - -static void -spacing_changed (GtkSpinButton *spin, GtkBox *box) -{ - gint spacing; - - spacing = gtk_spin_button_get_value_as_int (spin); - gtk_box_set_spacing (box, spacing); -} - -int -main (int argc, char *argv[]) -{ - GtkWidget *window; - GtkWidget *vbox; - GtkWidget *box; - GtkWidget *check; - GtkWidget *b; - GtkWidget *label; - GtkWidget *spin; - - gtk_init (); - - window = gtk_window_new (); - - vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0); - gtk_window_set_child (GTK_WINDOW (window), vbox); - - box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0); - gtk_box_append (GTK_BOX (box), test_widget ("1")); - gtk_box_append (GTK_BOX (box), test_widget ("2")); - gtk_box_append (GTK_BOX (box), test_widget ("3")); - gtk_box_append (GTK_BOX (box), test_widget ("4")); - gtk_box_append (GTK_BOX (box), test_widget ("5")); - gtk_box_append (GTK_BOX (box), test_widget ("6")); - - gtk_box_append (GTK_BOX (vbox), box); - - check = gtk_check_button_new_with_label ("Homogeneous"); - g_object_bind_property (box, "homogeneous", - check, "active", - G_BINDING_BIDIRECTIONAL|G_BINDING_SYNC_CREATE); - gtk_widget_set_margin_start (check, 10); - gtk_widget_set_margin_end (check, 10); - gtk_widget_set_margin_top (check, 10); - gtk_widget_set_margin_bottom (check, 10); - gtk_widget_set_halign (check, GTK_ALIGN_CENTER); - gtk_box_append (GTK_BOX (vbox), check); - - b = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 10); - gtk_widget_set_margin_start (b, 10); - gtk_widget_set_margin_end (b, 10); - gtk_widget_set_margin_top (b, 10); - gtk_widget_set_margin_bottom (b, 10); - gtk_widget_set_halign (b, GTK_ALIGN_CENTER); - label = gtk_label_new ("Spacing:"); - gtk_widget_set_halign (label, GTK_ALIGN_END); - gtk_box_append (GTK_BOX (b), label); - - spin = gtk_spin_button_new_with_range (0, 10, 1); - gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (spin), TRUE); - gtk_widget_set_halign (spin, GTK_ALIGN_START); - g_signal_connect (spin, "value-changed", - G_CALLBACK (spacing_changed), box); - gtk_box_append (GTK_BOX (b), spin); - gtk_box_append (GTK_BOX (vbox), b); - - gtk_widget_show (window); - - while (TRUE) - g_main_context_iteration (NULL, TRUE); - - return 0; -} From b8e905eae70d31834831bd790154d2ed853e6cae Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Wed, 13 May 2020 16:15:09 -0400 Subject: [PATCH 6/9] tests: Drop testcolorchooser We have plenty of color choosers in demos. This test doesn't add anything. See #2738 --- tests/meson.build | 1 - tests/testcolorchooser.c | 108 --------------------------------------- 2 files changed, 109 deletions(-) delete mode 100644 tests/testcolorchooser.c diff --git a/tests/meson.build b/tests/meson.build index f24d147fc5..28e3cf2f46 100644 --- a/tests/meson.build +++ b/tests/meson.build @@ -20,7 +20,6 @@ gtk_tests = [ ['testbuttons'], ['testcalendar'], ['testclipboard2'], - ['testcolorchooser'], ['testcombo'], ['testcombochange'], ['testcellrenderertext'], diff --git a/tests/testcolorchooser.c b/tests/testcolorchooser.c deleted file mode 100644 index b438547877..0000000000 --- a/tests/testcolorchooser.c +++ /dev/null @@ -1,108 +0,0 @@ -#include - -static void -color_changed (GObject *o, GParamSpec *pspect, gpointer data) -{ - GdkRGBA color; - - gtk_color_chooser_get_rgba (GTK_COLOR_CHOOSER (o), &color); - g_print ("color changed: %g %g %g %g\n", - color.red, color.green, color.blue, color.alpha); -} - -static gboolean done = FALSE; - -static void -dialog_response (GtkDialog *dialog, gint response) -{ - GdkRGBA color; - - switch (response) - { - case GTK_RESPONSE_OK: - gtk_color_chooser_get_rgba (GTK_COLOR_CHOOSER (dialog), &color); - g_print ("color accepted: %g %g %g %g\n", - color.red, color.green, color.blue, color.alpha); - break; - default: - g_print ("canceled\n"); - break; - } - - done = TRUE; - - g_main_context_wakeup (NULL); -} - -int -main (int argc, char *argv[]) -{ - GtkWidget *dialog; - gint i; - - gtk_init (); - - dialog = gtk_color_chooser_dialog_new ("Select a color", NULL); - - for (i = 1; i < argc; i++) - { - if (g_strcmp0 (argv[i], "--no-alpha") == 0) - { - g_print ("turning alpha off\n"); - gtk_color_chooser_set_use_alpha (GTK_COLOR_CHOOSER (dialog), FALSE); - } - else if (g_strcmp0 (argv[i], "--edit") == 0) - { - g_print ("starting in edit mode\n"); - g_object_set (dialog, "show-editor", TRUE, NULL); - } - else if (g_strcmp0 (argv[i], "--palette") == 0) - { - const gchar *c[9] = { "red", "maroon", "yellow", "green", "blue", "magenta", "DarkOliveGreen4", "khaki2", "thistle1" }; - GdkRGBA color; - GdkRGBA colors[9*9]; - gint k,j; - gdouble f[5] = { 0.2, 0.35, 0.5, 0.65, 0.8 }; - - g_print ("setting custom palette\n"); - for (k = 0; k < 9; k++) - { - gdk_rgba_parse (&color, c[k]); - for (j = 0; j < 5; j++) - { - colors[i*9 + j].red = f[j]*color.red; - colors[i*9 + j].green = f[j]*color.green; - colors[i*9 + j].blue = f[j]*color.blue; - colors[i*9 + j].alpha = 1; - } - for (j = 5; j < 9; j++) - { - colors[i*9 + j].red = f[9-j]*color.red + (1-f[9-j]); - colors[i*9 + j].green = f[9-j]*color.green + (1-f[9-j]); - colors[i*9 + j].blue = f[9-j]*color.blue + (1-f[9-j]); - colors[i*9 + j].alpha = 1; - } - } - gtk_color_chooser_add_palette (GTK_COLOR_CHOOSER (dialog), - GTK_ORIENTATION_VERTICAL, - 9, 9*9, - colors); - } - else if (g_strcmp0 (argv[i], "--no-palette") == 0) - { - gtk_color_chooser_add_palette (GTK_COLOR_CHOOSER (dialog), - GTK_ORIENTATION_VERTICAL, 0, 0, NULL); - } - } - - g_signal_connect (dialog, "notify::color", G_CALLBACK (color_changed), NULL); - g_signal_connect (dialog, "response", G_CALLBACK (dialog_response), NULL); - - gtk_widget_show (dialog); - - while (!done) - g_main_context_iteration (NULL, TRUE); - - return 0; -} - From a375c415107266891d02833a84cdae6881f821cd Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Wed, 13 May 2020 16:18:50 -0400 Subject: [PATCH 7/9] tests: Drop testfontchooser This test adds nothing over the font choosers in our various demos. See #2738 --- tests/meson.build | 1 - tests/testfontchooser.c | 101 ---------------------------------------- 2 files changed, 102 deletions(-) delete mode 100644 tests/testfontchooser.c diff --git a/tests/meson.build b/tests/meson.build index 28e3cf2f46..0f90065898 100644 --- a/tests/meson.build +++ b/tests/meson.build @@ -34,7 +34,6 @@ gtk_tests = [ ['testfilechooser'], ['testfilechooserbutton'], ['testflowbox'], - ['testfontchooser'], ['testfontoptions'], ['testframe'], ['testfullscreen'], diff --git a/tests/testfontchooser.c b/tests/testfontchooser.c deleted file mode 100644 index b13acbc21a..0000000000 --- a/tests/testfontchooser.c +++ /dev/null @@ -1,101 +0,0 @@ -/* testfontchooser.c - * Copyright (C) 2011 Alberto Ruiz - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library 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 - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library. If not, see . - */ - -#include - -static void -notify_font_cb (GtkFontChooser *fontchooser, GParamSpec *pspec, gpointer data) -{ - PangoFontFamily *family; - PangoFontFace *face; - - g_debug ("Changed font name %s", gtk_font_chooser_get_font (fontchooser)); - - family = gtk_font_chooser_get_font_family (fontchooser); - face = gtk_font_chooser_get_font_face (fontchooser); - if (family) - { - g_debug (" Family: %s is-monospace:%s", - pango_font_family_get_name (family), - pango_font_family_is_monospace (family) ? "true" : "false"); - } - else - g_debug (" No font family!"); - - if (face) - g_debug (" Face description: %s", pango_font_face_get_face_name (face)); - else - g_debug (" No font face!"); -} - -static void -notify_preview_text_cb (GObject *fontchooser, GParamSpec *pspec, gpointer data) -{ - g_debug ("Changed preview text %s", gtk_font_chooser_get_preview_text (GTK_FONT_CHOOSER (fontchooser))); -} - -static void -font_activated_cb (GtkFontChooser *chooser, const gchar *font_name, gpointer data) -{ - g_debug ("font-activated: %s", font_name); -} - -static void -quit_cb (GtkWidget *widget, - gpointer data) -{ - gboolean *done = data; - - *done = TRUE; - - g_main_context_wakeup (NULL); -} - -int -main (int argc, char *argv[]) -{ - GtkWidget *window; - GtkWidget *fontchooser; - gboolean done = FALSE; - - gtk_init (); - - fontchooser = gtk_font_chooser_widget_new (); - - window = gtk_window_new (); - gtk_widget_set_size_request (window, 600, 600); - gtk_window_set_child (GTK_WINDOW (window), fontchooser); - - gtk_widget_show (window); - - g_signal_connect (window, "destroy", G_CALLBACK (quit_cb), &done); - g_signal_connect (fontchooser, "notify::font", - G_CALLBACK (notify_font_cb), NULL); - g_signal_connect (fontchooser, "notify::preview-text", - G_CALLBACK (notify_preview_text_cb), NULL); - g_signal_connect (fontchooser, "font-activated", - G_CALLBACK (font_activated_cb), NULL); - - gtk_font_chooser_set_font (GTK_FONT_CHOOSER (fontchooser), "Sans 45"); - gtk_font_chooser_set_preview_text (GTK_FONT_CHOOSER (fontchooser), "[user@host ~]$ &>>"); - gtk_font_chooser_set_show_preview_entry (GTK_FONT_CHOOSER (fontchooser), FALSE); - - while (!done) - g_main_context_iteration (NULL, TRUE); - - return 0; -} From dc8c37120e9bbd151d1123671542fa6783e03c4b Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Wed, 13 May 2020 16:23:48 -0400 Subject: [PATCH 8/9] tests: Drop testexpander This was copied into gtk4-demo at some point. See #2738 --- tests/meson.build | 1 - tests/testexpander.c | 81 -------------------------------------------- 2 files changed, 82 deletions(-) delete mode 100644 tests/testexpander.c diff --git a/tests/meson.build b/tests/meson.build index 0f90065898..218a72677f 100644 --- a/tests/meson.build +++ b/tests/meson.build @@ -83,7 +83,6 @@ gtk_tests = [ ['testgrouping'], ['testtooltips'], ['testexpand'], - ['testexpander'], ['testvolumebutton'], ['testscrolledwindow'], ['testscrolledge'], diff --git a/tests/testexpander.c b/tests/testexpander.c deleted file mode 100644 index d76619b912..0000000000 --- a/tests/testexpander.c +++ /dev/null @@ -1,81 +0,0 @@ -#include - -static void -expander_cb (GtkExpander *expander, GParamSpec *pspec, GtkWindow *dialog) -{ - gtk_window_set_resizable (dialog, gtk_expander_get_expanded (expander)); -} - -static void -response_cb (GtkDialog *dialog, gint response_id, gpointer data) -{ - gboolean *done = data; - - *done = TRUE; - - g_main_context_wakeup (NULL); -} - -int -main (int argc, char *argv[]) -{ - GtkWidget *dialog; - GtkWidget *area; - GtkWidget *expander; - GtkWidget *sw; - GtkWidget *tv; - GtkTextBuffer *buffer; - gboolean done = FALSE; - - gtk_init (); - - dialog = gtk_message_dialog_new_with_markup (NULL, - 0, - GTK_MESSAGE_ERROR, - GTK_BUTTONS_CLOSE, - "%s", - "Something went wrong"); - gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog), - "Here are some more details " - "but not the full story."); - - area = gtk_message_dialog_get_message_area (GTK_MESSAGE_DIALOG (dialog)); - - expander = gtk_expander_new ("Details:"); - sw = gtk_scrolled_window_new (NULL, NULL); - gtk_scrolled_window_set_has_frame (GTK_SCROLLED_WINDOW (sw), TRUE); - gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw), - GTK_POLICY_NEVER, - GTK_POLICY_AUTOMATIC); - - tv = gtk_text_view_new (); - buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (tv)); - gtk_text_view_set_editable (GTK_TEXT_VIEW (tv), FALSE); - gtk_text_view_set_wrap_mode (GTK_TEXT_VIEW (tv), GTK_WRAP_WORD); - gtk_text_buffer_set_text (GTK_TEXT_BUFFER (buffer), - "Finally, the full story with all details. " - "And all the inside information, including " - "error codes, etc etc. Pages of information, " - "you might have to scroll down to read it all, " - "or even resize the window - it works !\n" - "A second paragraph will contain even more " - "innuendo, just to make you scroll down or " - "resize the window. Do it already !", -1); - gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (sw), tv); - gtk_expander_set_child (GTK_EXPANDER (expander), sw); - gtk_widget_set_hexpand (expander, TRUE); - gtk_widget_set_vexpand (expander, TRUE); - gtk_box_append (GTK_BOX (area), expander); - g_signal_connect (expander, "notify::expanded", - G_CALLBACK (expander_cb), dialog); - - g_signal_connect (dialog, "response", G_CALLBACK (response_cb), &done); - - gtk_window_present (GTK_WINDOW (dialog)); - - while (!done) - g_main_context_iteration (NULL, TRUE); - - return 0; -} - From 25577e4fbf5746f589597dd1b78ee1a2097db4a5 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Wed, 13 May 2020 16:35:28 -0400 Subject: [PATCH 9/9] tests: Drop testnoscreen It tests something that no longer works, and that we probably don't want to guarantee anyway. See #2738 --- tests/meson.build | 1 - tests/testnoscreen.c | 50 -------------------------------------------- 2 files changed, 51 deletions(-) delete mode 100644 tests/testnoscreen.c diff --git a/tests/meson.build b/tests/meson.build index 218a72677f..ad8b6838cb 100644 --- a/tests/meson.build +++ b/tests/meson.build @@ -89,7 +89,6 @@ gtk_tests = [ ['testscrolltofocus'], ['testcellarea'], ['testswitch'], - ['testnoscreen'], ['testtreepos'], ['testsensitive'], ['testtextview'], diff --git a/tests/testnoscreen.c b/tests/testnoscreen.c deleted file mode 100644 index 72b0c8daaf..0000000000 --- a/tests/testnoscreen.c +++ /dev/null @@ -1,50 +0,0 @@ -/* testnoscreen.c - * Copyright (C) 2011 Red Hat, Inc. - * Authors: Matthias Clasen - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library 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 - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library. If not, see . - */ - -#include - -/* Very limited test to ensure that creating widgets works - * before opening a display connection - */ -int main (int argc, char *argv[]) -{ - GtkWidget *window; - GtkWidget *button; - GdkDisplay *display; - gboolean has_display; - - gdk_set_allowed_backends ("x11"); - g_unsetenv ("DISPLAY"); - has_display = gtk_init_check (); - g_assert (!has_display); - - window = gtk_window_new (); - button = gtk_button_new (); - gtk_window_set_child (GTK_WINDOW (window), button); - - display = gdk_display_open (NULL); - - gtk_window_set_display (GTK_WINDOW (window), display); - - gtk_widget_show (window); - - while (TRUE) - g_main_context_iteration (NULL, TRUE); - - return 0; -}