#include #include #include #include #include #include START_TEST(test_start) { Display *dpy = XOpenDisplay(NULL); fail_if(dpy == NULL, "Unable to open X display"); Window wid = mame_start(dpy); fail_if(wid <= 0, "Unable to start and get mame XID"); XCloseDisplay(dpy); } END_TEST START_TEST(test_state_load) { Display *dpy = XOpenDisplay(NULL); fail_if(dpy == NULL, "Unable to open X display"); Window wid = mame_start(dpy); mame_state_load(dpy, wid, STATE_C); sleep(3); mame_pause_toggle(dpy, wid); XImage *xi = x_window_dump(dpy, wid); FILE *f = fopen("level3.dump", "wb"); x_imagedump_save(xi, f); fclose(f); XDestroyImage(xi); XCloseDisplay(dpy); } END_TEST /* Test suite for "Check" */ Suite *mame_suite() { Suite *s = suite_create("mame"); TCase *tc_core = tcase_create("Core"); /* Add tests here */ tcase_add_test(tc_core, test_start); //tcase_add_test(tc_core, test_state_load); tcase_set_timeout(tc_core, 10); suite_add_tcase(s, tc_core); } int main() { int number_failed; Suite *s = mame_suite (); SRunner *sr = srunner_create (s); srunner_run_all (sr, CK_NORMAL); number_failed = srunner_ntests_failed (sr); srunner_free (sr); return (number_failed == 0) ? EXIT_SUCCESS : EXIT_FAILURE; }