mirror of
https://gitlab.gnome.org/GNOME/nautilus
synced 2024-06-30 23:46:35 +00:00
test/interactive: Drop obsolete test
Originally introduced by 469047a2a5
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.
This commit is contained in:
parent
26e9da3ed6
commit
83c2c6fdda
|
@ -1,8 +0,0 @@
|
|||
test_copy = executable(
|
||||
'test-copy', [
|
||||
'test-copy.c',
|
||||
'test.c',
|
||||
'test.h'
|
||||
],
|
||||
dependencies: libnautilus_dep
|
||||
)
|
|
@ -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;
|
||||
}
|
|
@ -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);
|
||||
}
|
|
@ -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);
|
|
@ -19,4 +19,3 @@ test_env = [
|
|||
]
|
||||
|
||||
subdir('automated')
|
||||
#subdir('interactive')
|
||||
|
|
Loading…
Reference in New Issue
Block a user