ocarina/include/tests/loop.h
Anna Schumaker d95c693db2 tests: Rename gui.h -> loop.h
I want to run a main loop during the audio tests, which aren't in gui/.
Let's rename this file to make me feel better about using it :)

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2017-09-05 14:12:13 -04:00

31 lines
557 B
C

/*
* Copyright 2016 (c) Anna Schumaker.
*/
#ifndef OCARINA_TESTS_LOOP_H
#define OCARINA_TESTS_LOOP_H
static GMainLoop *__test_main_loop;
static int __test_loop_on_idle(gpointer data)
{
g_main_loop_quit(__test_main_loop);
return G_SOURCE_CONTINUE;
}
static void test_loop_init()
{
__test_main_loop = g_main_loop_new(NULL, FALSE);
g_idle_add(__test_loop_on_idle, NULL);
}
static void test_loop_deinit()
{
g_main_loop_unref(__test_main_loop);
}
static void test_main_loop()
{
g_main_loop_run(__test_main_loop);
}
#endif /* OCARINA_TESTS_LOOP_H */