[gtksourceview/wip/chergert/gsv-gtk4: 148/189] testsuite: track gtk_main changes
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtksourceview/wip/chergert/gsv-gtk4: 148/189] testsuite: track gtk_main changes
- Date: Mon, 22 Jun 2020 21:58:26 +0000 (UTC)
commit 716e3505e45c42313e89ece9adab76d44052c714
Author: Christian Hergert <chergert redhat com>
Date: Mon Mar 16 16:25:25 2020 -0700
testsuite: track gtk_main changes
testsuite/test-file-loader.c | 8 ++++++--
testsuite/test-file-saver.c | 8 ++++++--
2 files changed, 12 insertions(+), 4 deletions(-)
---
diff --git a/testsuite/test-file-loader.c b/testsuite/test-file-loader.c
index 37918832..d3c1543c 100644
--- a/testsuite/test-file-loader.c
+++ b/testsuite/test-file-loader.c
@@ -28,6 +28,8 @@ typedef struct
gint newline_type;
} LoaderTestData;
+static GMainLoop *main_loop;
+
static void
delete_file (GFile *location)
{
@@ -75,7 +77,7 @@ load_file_cb (GtkSourceFileLoader *loader,
}
/* finished */
- gtk_main_quit ();
+ g_main_loop_quit (main_loop);
}
static void
@@ -92,6 +94,8 @@ test_loader (const gchar *filename,
LoaderTestData *data;
GError *error = NULL;
+ main_loop = g_main_loop_new (NULL, FALSE);
+
g_file_set_contents (filename, contents, -1, &error);
g_assert_no_error (error);
@@ -114,7 +118,7 @@ test_loader (const gchar *filename,
(GAsyncReadyCallback) load_file_cb,
data);
- gtk_main ();
+ g_main_loop_run (main_loop);
g_slice_free (LoaderTestData, data);
delete_file (location);
diff --git a/testsuite/test-file-saver.c b/testsuite/test-file-saver.c
index 77606831..ff298f06 100644
--- a/testsuite/test-file-saver.c
+++ b/testsuite/test-file-saver.c
@@ -57,6 +57,8 @@ struct _SaverTestData
guint file_existed : 1;
};
+static GMainLoop *main_loop;
+
static const gchar *
read_file (GFile *location)
{
@@ -105,7 +107,7 @@ save_file_cb (GtkSourceFileSaver *saver,
}
/* finished */
- gtk_main_quit ();
+ g_main_loop_quit (main_loop);
}
static void
@@ -178,6 +180,8 @@ test_saver (const gchar *filename_or_uri,
GtkSourceFileSaver *saver;
SaverTestData *data;
+ main_loop = g_main_loop_new (NULL, FALSE);
+
location = g_file_new_for_commandline_arg (filename_or_uri);
buffer = gtk_source_buffer_new (NULL);
@@ -197,7 +201,7 @@ test_saver (const gchar *filename_or_uri,
data->userdata = userdata;
check_mounted (data);
- gtk_main ();
+ g_main_loop_run (main_loop);
g_object_unref (location);
g_object_unref (buffer);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]