mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-11-10 03:16:17 +01:00
gio/tests/appmonitor: Delete file before checking for changed event
In 4e7d22e268
, deleting the file was moved
after the assertion which checks for the changed event that results from
it being deleted. This is the wrong way around and makes the assertion
fail.
Move the deletion back up before we check the condition. delete_app is
no longer an idle callback so it can be made void. The change
notification might come in when the loop isn't running now, so don't try
to quit if it isn't running. In this case we'll wait for the three
second timeout and the test will still pass.
https://bugzilla.gnome.org/show_bug.cgi?id=751737
This commit is contained in:
parent
475445e6e0
commit
f2c1cfe8c7
@ -24,7 +24,7 @@ create_app (gpointer data)
|
||||
return G_SOURCE_REMOVE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
static void
|
||||
delete_app (gpointer data)
|
||||
{
|
||||
const gchar *path = data;
|
||||
@ -35,8 +35,6 @@ delete_app (gpointer data)
|
||||
g_remove (file);
|
||||
|
||||
g_free (file);
|
||||
|
||||
return G_SOURCE_REMOVE;
|
||||
}
|
||||
|
||||
static gboolean changed_fired;
|
||||
@ -53,7 +51,8 @@ quit_loop (gpointer data)
|
||||
{
|
||||
GMainLoop *loop = data;
|
||||
|
||||
g_main_loop_quit (loop);
|
||||
if (g_main_loop_is_running (loop))
|
||||
g_main_loop_quit (loop);
|
||||
|
||||
return G_SOURCE_REMOVE;
|
||||
}
|
||||
@ -88,15 +87,16 @@ test_app_monitor (void)
|
||||
|
||||
g_timeout_add_seconds (3, quit_loop, loop);
|
||||
|
||||
delete_app (path);
|
||||
|
||||
g_main_loop_run (loop);
|
||||
|
||||
g_assert (changed_fired);
|
||||
|
||||
g_main_loop_unref (loop);
|
||||
|
||||
g_object_unref (monitor);
|
||||
|
||||
delete_app (path);
|
||||
|
||||
g_free (path);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user