diff options
author | António Fernandes <antoniof@gnome.org> | 2022-09-01 16:26:47 +0100 |
---|---|---|
committer | António Fernandes <antoniof@gnome.org> | 2022-09-01 22:20:55 +0000 |
commit | 83c2c6fdda4e6652cbbcf87a14f23a6bf355baf4 (patch) | |
tree | 3376caf3c5806d4a376b708a1714e01ea83726e0 /test | |
parent | 26e9da3ed6525ae5330e4028daa85c3c5245c336 (diff) | |
download | nautilus-83c2c6fdda4e6652cbbcf87a14f23a6bf355baf4.tar.gz |
test/interactive: Drop obsolete test
Originally introduced by 469047a2a58430026d68a3b99b223b922b18b8d1
It's been disabled because it relied on gtk_main* API, which is gone
in GTK4, but even after porting to GMainLoop API, it fails to work
because operations invoke GApplication inhibition.
In other words: I'm confident this test program has been broken for
years without anyone realizing it.
We already have automatic tests for copy operations. Manual testing
can be done with the nautilus application itself with debug messages
enabled.
So, let's just drop the broken obsolete test code.
Diffstat (limited to 'test')
-rw-r--r-- | test/file-torture.py (renamed from test/interactive/file-torture.py) | 0 | ||||
-rw-r--r-- | test/interactive/meson.build | 8 | ||||
-rw-r--r-- | test/interactive/test-copy.c | 102 | ||||
-rw-r--r-- | test/interactive/test.c | 122 | ||||
-rw-r--r-- | test/interactive/test.h | 34 | ||||
-rw-r--r-- | test/meson.build | 1 |
6 files changed, 0 insertions, 267 deletions
diff --git a/test/interactive/file-torture.py b/test/file-torture.py index 865795ff1..865795ff1 100644 --- a/test/interactive/file-torture.py +++ b/test/file-torture.py diff --git a/test/interactive/meson.build b/test/interactive/meson.build deleted file mode 100644 index eb8cf8ae6..000000000 --- a/test/interactive/meson.build +++ /dev/null @@ -1,8 +0,0 @@ -test_copy = executable( - 'test-copy', [ - 'test-copy.c', - 'test.c', - 'test.h' - ], - dependencies: libnautilus_dep -) diff --git a/test/interactive/test-copy.c b/test/interactive/test-copy.c deleted file mode 100644 index d48182ebd..000000000 --- a/test/interactive/test-copy.c +++ /dev/null @@ -1,102 +0,0 @@ -#include "test.h" - -#include <src/nautilus-file-operations.h> -#include <src/nautilus-progress-info.h> -#include <src/nautilus-progress-info-manager.h> - -static void -copy_done (GHashTable *debuting_uris, - gboolean success, - gpointer data) -{ - g_print ("Copy done\n"); -} - -static void -changed_cb (NautilusProgressInfo *info, - gpointer data) -{ - g_print ("Changed: %s -- %s\n", - nautilus_progress_info_get_status (info), - nautilus_progress_info_get_details (info)); -} - -static void -progress_changed_cb (NautilusProgressInfo *info, - gpointer data) -{ - g_print ("Progress changed: %f\n", - nautilus_progress_info_get_progress (info)); -} - -static void -finished_cb (NautilusProgressInfo *info, - gpointer data) -{ - g_print ("Finished\n"); - gtk_main_quit (); -} - -int -main (int argc, - char *argv[]) -{ - GtkWidget *window; - GList *sources; - GFile *dest; - GFile *source; - int i; - GList *infos; - NautilusProgressInfoManager *manager; - NautilusProgressInfo *progress_info; - - test_init (&argc, &argv); - - if (argc < 3) - { - g_print ("Usage test-copy <sources...> <dest dir>\n"); - return 1; - } - - sources = NULL; - for (i = 1; i < argc - 1; i++) - { - source = g_file_new_for_commandline_arg (argv[i]); - sources = g_list_prepend (sources, source); - } - sources = g_list_reverse (sources); - - dest = g_file_new_for_commandline_arg (argv[i]); - - window = test_window_new ("copy test"); - - gtk_widget_show (window); - - manager = nautilus_progress_info_manager_dup_singleton (); - - nautilus_file_operations_copy_async (sources, - dest, - GTK_WINDOW (window), - NULL, - copy_done, NULL); - - infos = nautilus_progress_info_manager_get_all_infos (manager); - - if (infos == NULL) - { - g_object_unref (manager); - return 0; - } - - progress_info = NAUTILUS_PROGRESS_INFO (infos->data); - - g_signal_connect (progress_info, "changed", (GCallback) changed_cb, NULL); - g_signal_connect (progress_info, "progress-changed", (GCallback) progress_changed_cb, NULL); - g_signal_connect (progress_info, "finished", (GCallback) finished_cb, NULL); - - gtk_main (); - - g_object_unref (manager); - - return 0; -} diff --git a/test/interactive/test.c b/test/interactive/test.c deleted file mode 100644 index 0f1662e02..000000000 --- a/test/interactive/test.c +++ /dev/null @@ -1,122 +0,0 @@ -#include "test.h" -#include <sys/types.h> -#include <unistd.h> - -void -test_init (int *argc, - char ***argv) -{ - gtk_init (); - - eel_make_warnings_and_criticals_stop_in_debugger (); -} - -int -test_quit (int exit_code) -{ - if (gtk_main_level () > 0) - { - gtk_main_quit (); - } - - return exit_code; -} - -void -test_delete_event (GtkWidget *widget, - GdkEvent *event, - gpointer callback_data) -{ - test_quit (0); -} - -GtkWidget * -test_window_new (const char *title) -{ - GtkWidget *window; - - window = gtk_window_new (GTK_WINDOW_TOPLEVEL); - - if (title != NULL) - { - gtk_window_set_title (GTK_WINDOW (window), title); - } - - g_signal_connect (window, "delete_event", - G_CALLBACK (test_delete_event), NULL); - - return window; -} - -GdkPixbuf * -test_pixbuf_new_named (const char *name, - float scale) -{ - GdkPixbuf *pixbuf; - char *path; - - g_return_val_if_fail (name != NULL, NULL); - g_return_val_if_fail (scale >= 0.0, NULL); - - if (name[0] == '/') - { - path = g_strdup (name); - } - else - { - path = g_strdup_printf ("%s/%s", NAUTILUS_DATADIR, name); - } - - pixbuf = gdk_pixbuf_new_from_file (path, NULL); - - g_free (path); - - g_return_val_if_fail (pixbuf != NULL, NULL); - - if (scale != 1.0) - { - GdkPixbuf *scaled; - float width = gdk_pixbuf_get_width (pixbuf) * scale; - float height = gdk_pixbuf_get_width (pixbuf) * scale; - - scaled = gdk_pixbuf_scale_simple (pixbuf, width, height, GDK_INTERP_BILINEAR); - - g_object_unref (pixbuf); - - g_return_val_if_fail (scaled != NULL, NULL); - - pixbuf = scaled; - } - - return pixbuf; -} - -GtkWidget * -test_label_new (const char *text, - gboolean with_background, - int num_sizes_larger) -{ - GtkWidget *label; - - if (text == NULL) - { - text = "Foo"; - } - - label = gtk_label_new (text); - - return label; -} - -void -test_window_set_title_with_pid (GtkWindow *window, - const char *title) -{ - char *tmp; - - g_return_if_fail (GTK_IS_WINDOW (window)); - - tmp = g_strdup_printf ("%lu: %s", (gulong) getpid (), title); - gtk_window_set_title (GTK_WINDOW (window), tmp); - g_free (tmp); -} diff --git a/test/interactive/test.h b/test/interactive/test.h deleted file mode 100644 index b8ce09a23..000000000 --- a/test/interactive/test.h +++ /dev/null @@ -1,34 +0,0 @@ -#pragma once - -#include <config.h> -#include <gtk/gtk.h> - -#include <eel/eel-debug.h> -#include <eel/eel.h> -#include <src/nautilus-file-utilities.h> - -void test_init (int *argc, - char ***argv); -int test_quit (int exit_code); -void test_delete_event (GtkWidget *widget, - GdkEvent *event, - gpointer callback_data); -GtkWidget *test_window_new (const char *title); -void test_gtk_widget_set_background_image (GtkWidget *widget, - const char *image_name); -void test_gtk_widget_set_background_color (GtkWidget *widget, - const char *color_spec); -GdkPixbuf *test_pixbuf_new_named (const char *name, - float scale); -GtkWidget *test_label_new (const char *text, - gboolean with_background, - int num_sizes_larger); -void test_pixbuf_draw_rectangle_tiled (GdkPixbuf *pixbuf, - const char *tile_name, - int x0, - int y0, - int x1, - int y1, - int opacity); -void test_window_set_title_with_pid (GtkWindow *window, - const char *title);
\ No newline at end of file diff --git a/test/meson.build b/test/meson.build index 07532fd2a..f8bcdac0e 100644 --- a/test/meson.build +++ b/test/meson.build @@ -19,4 +19,3 @@ test_env = [ ] subdir('automated') -#subdir('interactive') |