From 60bf094db89ab098a7d56169c8657f7a26dd7590 Mon Sep 17 00:00:00 2001 From: "P. F. Chimento" Date: Thu, 18 Apr 2013 16:32:33 +0200 Subject: Test fixture for testing an application window Test harness improvement: ADD_APP_WINDOW_TEST(test_path, test_func) creates an EosApplication and connects test_func() to the "startup" handler of the application, then runs it. Commented out /application/two-windows test, because it's apparently not deterministic. --- test/run-tests.h | 28 ++++++++++++++++++++++++---- 1 file changed, 24 insertions(+), 4 deletions(-) (limited to 'test/run-tests.h') diff --git a/test/run-tests.h b/test/run-tests.h index 1d4c402..e60000f 100644 --- a/test/run-tests.h +++ b/test/run-tests.h @@ -3,9 +3,29 @@ #ifndef RUN_TESTS_H #define RUN_TESTS_H -void add_init_tests (void); -void add_hello_tests (void); -void add_application_tests (void); -void add_window_tests (void); +#define TEST_APPLICATION_ID "com.endlessm.example.test" + +#define ADD_APP_WINDOW_TEST(path, test_func) \ + g_test_add ((path), AppWindowTestFixture, (test_func), \ + app_window_test_fixture_setup, \ + app_window_test_fixture_test, \ + app_window_test_fixture_teardown); + +typedef struct +{ + EosApplication *app; +} AppWindowTestFixture; + +void app_window_test_fixture_setup (AppWindowTestFixture *fixture, + gconstpointer callback); +void app_window_test_fixture_test (AppWindowTestFixture *fixture, + gconstpointer unused); +void app_window_test_fixture_teardown (AppWindowTestFixture *fixture, + gconstpointer unused); + +void add_init_tests (void); +void add_hello_tests (void); +void add_application_tests (void); +void add_window_tests (void); #endif /* RUN_TESTS_H */ -- cgit v1.2.3