[gimp] app: Add gimp_test_run_mainloop_until_idle()
- From: Martin Nordholts <martinn src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [gimp] app: Add gimp_test_run_mainloop_until_idle()
- Date: Thu, 24 Dec 2009 16:49:49 +0000 (UTC)
commit 049de90d812a7b5a33f52a5635ce0fa381e70f10
Author: Martin Nordholts <martinn src gnome org>
Date: Wed Dec 23 23:44:33 2009 +0100
app: Add gimp_test_run_mainloop_until_idle()
Add function that runs a main loop until it is idle. Useful for test
cases.
app/tests.c | 16 ++++++++++++++++
app/tests.h | 9 +++++----
2 files changed, 21 insertions(+), 4 deletions(-)
---
diff --git a/app/tests.c b/app/tests.c
index 6e0cd85..fdbfe7d 100644
--- a/app/tests.c
+++ b/app/tests.c
@@ -136,4 +136,20 @@ gimp_test_run_temp_mainloop (guint32 running_time)
g_main_loop_unref (loop);
}
+/**
+ * gimp_test_run_mainloop_until_idle:
+ *
+ * Creates and runs a main loop until it is idle, i.e. has no more
+ * work to do.
+ **/
+void
+gimp_test_run_mainloop_until_idle (void)
+{
+ GMainLoop *loop = g_main_loop_new (NULL, FALSE);
+ g_idle_add ((GSourceFunc) gimp_tests_quit_mainloop, loop);
+
+ g_main_loop_run (loop);
+
+ g_main_loop_unref (loop);
+}
diff --git a/app/tests.h b/app/tests.h
index d4e2fcd..7ec8608 100644
--- a/app/tests.h
+++ b/app/tests.h
@@ -19,10 +19,11 @@
#define __TESTS_H__
-Gimp * gimp_init_for_testing (gboolean use_cpu_accel);
-Gimp * gimp_init_for_gui_testing (gboolean use_cpu_accel,
- gboolean show_gui);
-void gimp_test_run_temp_mainloop (guint32 running_time);
+Gimp * gimp_init_for_testing (gboolean use_cpu_accel);
+Gimp * gimp_init_for_gui_testing (gboolean use_cpu_accel,
+ gboolean show_gui);
+void gimp_test_run_temp_mainloop (guint32 running_time);
+void gimp_test_run_mainloop_until_idle (void);
#endif /* __TESTS_H__ */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]