mirror of
https://github.com/brl/mutter.git
synced 2024-11-24 17:10:40 -05:00
context/test: Add 'run-tests' signal that can replace g_test_run()
For tests that doesn't use g_test_run(). Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1861>
This commit is contained in:
parent
03242a4e2a
commit
f61c1a1be1
@ -37,6 +37,7 @@
|
||||
enum
|
||||
{
|
||||
BEFORE_TESTS,
|
||||
RUN_TESTS,
|
||||
AFTER_TESTS,
|
||||
N_SIGNALS
|
||||
};
|
||||
@ -162,7 +163,15 @@ run_tests_idle (gpointer user_data)
|
||||
int ret;
|
||||
|
||||
g_signal_emit (context, signals[BEFORE_TESTS], 0);
|
||||
if (g_signal_has_handler_pending (context, signals[RUN_TESTS], 0, TRUE))
|
||||
{
|
||||
g_signal_emit (context, signals[RUN_TESTS], 0, &ret);
|
||||
g_assert (ret == 1 || ret == 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
ret = g_test_run ();
|
||||
}
|
||||
g_signal_emit (context, signals[AFTER_TESTS], 0);
|
||||
|
||||
if (ret != 0)
|
||||
@ -246,6 +255,14 @@ meta_context_test_class_init (MetaContextTestClass *klass)
|
||||
NULL, NULL, NULL,
|
||||
G_TYPE_NONE,
|
||||
0);
|
||||
signals[RUN_TESTS] =
|
||||
g_signal_new ("run-tests",
|
||||
G_TYPE_FROM_CLASS (klass),
|
||||
G_SIGNAL_RUN_LAST,
|
||||
0,
|
||||
NULL, NULL, NULL,
|
||||
G_TYPE_INT,
|
||||
0);
|
||||
signals[AFTER_TESTS] =
|
||||
g_signal_new ("after-tests",
|
||||
G_TYPE_FROM_CLASS (klass),
|
||||
|
Loading…
Reference in New Issue
Block a user