|
23 | 23 | // * * * * * * * * * * * * * * * * * * * * * * * *
|
24 | 24 |
|
25 | 25 | // Define the test suite and add test cases
|
26 |
| -FOSSIL_TEST_SUITE(c_keyboard_suite); |
| 26 | +FOSSIL_TEST_SUITE(c_device_suite); |
27 | 27 |
|
28 |
| -// Setup function for the test suite |
29 |
| -FOSSIL_SETUP(c_keyboard_suite) { |
30 |
| - // Setup code here |
| 28 | +FOSSIL_SETUP(c_device_suite) { |
| 29 | + fossil_io_mouse_init(); |
| 30 | + fossil_io_touch_init(); |
31 | 31 | }
|
32 | 32 |
|
33 |
| -// Teardown function for the test suite |
34 |
| -FOSSIL_TEARDOWN(c_keyboard_suite) { |
35 |
| - // Teardown code here |
| 33 | +FOSSIL_TEARDOWN(c_device_suite) { |
| 34 | + fossil_io_mouse_shutdown(); |
| 35 | + fossil_io_touch_shutdown(); |
36 | 36 | }
|
37 | 37 |
|
38 | 38 | // * * * * * * * * * * * * * * * * * * * * * * * *
|
@@ -73,15 +73,62 @@ FOSSIL_TEST_CASE(c_test_keyboard_poll_events) {
|
73 | 73 | fossil_io_keyboard_unregister_binding(event);
|
74 | 74 | }
|
75 | 75 |
|
| 76 | +FOSSIL_TEST_CASE(c_test_mouse_register_unregister_binding) { |
| 77 | + fossil_io_mouse_event_t event = { .x = 10, .y = 20, .button = 0, .shift = 0, .ctrl = 0, .alt = 0 }; |
| 78 | + fossil_io_mouse_callback_t callback = (fossil_io_mouse_callback_t)1; |
| 79 | + |
| 80 | + fossil_io_mouse_register_binding(event, callback); |
| 81 | + ASSUME_NOT_CNULL(callback); |
| 82 | + |
| 83 | + fossil_io_mouse_unregister_binding(event); |
| 84 | + ASSUME_NOT_CNULL(callback); |
| 85 | +} |
| 86 | + |
| 87 | +FOSSIL_TEST_CASE(c_test_mouse_clear_bindings) { |
| 88 | + fossil_io_mouse_event_t event = { .x = 10, .y = 20, .button = 0, .shift = 0, .ctrl = 0, .alt = 0 }; |
| 89 | + fossil_io_mouse_callback_t callback = (fossil_io_mouse_callback_t)1; |
| 90 | + |
| 91 | + fossil_io_mouse_register_binding(event, callback); |
| 92 | + fossil_io_mouse_clear_bindings(); |
| 93 | + ASSUME_NOT_CNULL(callback); |
| 94 | +} |
| 95 | + |
| 96 | +FOSSIL_TEST_CASE(c_test_touch_register_unregister_binding) { |
| 97 | + fossil_io_touch_event_t event = { .x = 100, .y = 200, .touch_id = 1, .action = 0, .shift = 0, .ctrl = 0, .alt = 0 }; |
| 98 | + fossil_io_touch_callback_t callback = (fossil_io_touch_callback_t)1; |
| 99 | + |
| 100 | + fossil_io_touch_register_binding(event, callback); |
| 101 | + ASSUME_NOT_CNULL(callback); |
| 102 | + |
| 103 | + fossil_io_touch_unregister_binding(event); |
| 104 | + ASSUME_NOT_CNULL(callback); |
| 105 | +} |
| 106 | + |
| 107 | +FOSSIL_TEST_CASE(c_test_touch_clear_bindings) { |
| 108 | + fossil_io_touch_event_t event = { .x = 100, .y = 200, .touch_id = 1, .action = 0, .shift = 0, .ctrl = 0, .alt = 0 }; |
| 109 | + fossil_io_touch_callback_t callback = (fossil_io_touch_callback_t)1; |
| 110 | + |
| 111 | + fossil_io_touch_register_binding(event, callback); |
| 112 | + fossil_io_touch_clear_bindings(); |
| 113 | + ASSUME_NOT_CNULL(callback); |
| 114 | +} |
76 | 115 |
|
77 | 116 | // * * * * * * * * * * * * * * * * * * * * * * * *
|
78 | 117 | // * Fossil Logic Test Pool
|
79 | 118 | // * * * * * * * * * * * * * * * * * * * * * * * *
|
80 | 119 |
|
81 | 120 | FOSSIL_TEST_GROUP(c_keyboard_tests) {
|
82 |
| - FOSSIL_TEST_ADD(c_keyboard_suite, c_test_keyboard_register_unregister_binding); |
83 |
| - FOSSIL_TEST_ADD(c_keyboard_suite, c_test_keyboard_clear_bindings); |
84 |
| - FOSSIL_TEST_ADD(c_keyboard_suite, c_test_keyboard_poll_events); |
| 121 | + FOSSIL_TEST_ADD(c_device_suite, c_test_keyboard_register_unregister_binding); |
| 122 | + FOSSIL_TEST_ADD(c_device_suite, c_test_keyboard_clear_bindings); |
| 123 | + FOSSIL_TEST_ADD(c_device_suite, c_test_keyboard_poll_events); |
| 124 | + |
| 125 | + // Mouse tests |
| 126 | + FOSSIL_TEST_ADD(c_device_suite, c_test_mouse_register_unregister_binding); |
| 127 | + FOSSIL_TEST_ADD(c_device_suite, c_test_mouse_clear_bindings); |
| 128 | + |
| 129 | + // Touch tests |
| 130 | + FOSSIL_TEST_ADD(c_device_suite, c_test_touch_register_unregister_binding); |
| 131 | + FOSSIL_TEST_ADD(c_device_suite, c_test_touch_clear_bindings); |
85 | 132 |
|
86 |
| - FOSSIL_TEST_REGISTER(c_keyboard_suite); |
| 133 | + FOSSIL_TEST_REGISTER(c_device_suite); |
87 | 134 | }
|
0 commit comments