mirror of
https://github.com/brl/mutter.git
synced 2024-11-28 11:00:54 -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
|
enum
|
||||||
{
|
{
|
||||||
BEFORE_TESTS,
|
BEFORE_TESTS,
|
||||||
|
RUN_TESTS,
|
||||||
AFTER_TESTS,
|
AFTER_TESTS,
|
||||||
N_SIGNALS
|
N_SIGNALS
|
||||||
};
|
};
|
||||||
@ -162,7 +163,15 @@ run_tests_idle (gpointer user_data)
|
|||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
g_signal_emit (context, signals[BEFORE_TESTS], 0);
|
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 ();
|
ret = g_test_run ();
|
||||||
|
}
|
||||||
g_signal_emit (context, signals[AFTER_TESTS], 0);
|
g_signal_emit (context, signals[AFTER_TESTS], 0);
|
||||||
|
|
||||||
if (ret != 0)
|
if (ret != 0)
|
||||||
@ -246,6 +255,14 @@ meta_context_test_class_init (MetaContextTestClass *klass)
|
|||||||
NULL, NULL, NULL,
|
NULL, NULL, NULL,
|
||||||
G_TYPE_NONE,
|
G_TYPE_NONE,
|
||||||
0);
|
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] =
|
signals[AFTER_TESTS] =
|
||||||
g_signal_new ("after-tests",
|
g_signal_new ("after-tests",
|
||||||
G_TYPE_FROM_CLASS (klass),
|
G_TYPE_FROM_CLASS (klass),
|
||||||
|
Loading…
Reference in New Issue
Block a user