tests/monitor-unit-tests: Clear config history before each test

To not let different tests interfere with each other, clear the config
history before each run.
This commit is contained in:
Jonas Ådahl 2017-08-18 00:53:32 +08:00
parent 0d6e3fd675
commit 8b92ad1d4b

View File

@ -4792,12 +4792,25 @@ meta_test_monitor_migrated_rotated (void)
g_error ("Failed to remove test data output file: %s", error->message); g_error ("Failed to remove test data output file: %s", error->message);
} }
static void
test_case_setup (void **fixture,
const void *data)
{
MetaBackend *backend = meta_get_backend ();
MetaMonitorManager *monitor_manager =
meta_backend_get_monitor_manager (backend);
MetaMonitorConfigManager *config_manager = monitor_manager->config_manager;
meta_monitor_config_manager_set_current (config_manager, NULL);
meta_monitor_config_manager_clear_history (config_manager);
}
static void static void
add_monitor_test (const char *test_path, add_monitor_test (const char *test_path,
GTestFunc test_func) GTestFunc test_func)
{ {
g_test_add (test_path, gpointer, NULL, g_test_add (test_path, gpointer, NULL,
NULL, test_case_setup,
(void (* ) (void **, const void *)) test_func, (void (* ) (void **, const void *)) test_func,
NULL); NULL);
} }