Mercurial > molko
comparison tests/test-action-script.c @ 458:02c1481b7dbb
tests: fix
author | David Demelier <markand@malikania.fr> |
---|---|
date | Fri, 24 Feb 2023 22:14:42 +0100 |
parents | 773a082f0b91 |
children | 39dd7c66ebfd |
comparison
equal
deleted
inserted
replaced
457:04797b35565c | 458:02c1481b7dbb |
---|---|
38 .end = my_end, \ | 38 .end = my_end, \ |
39 .finish = my_finish \ | 39 .finish = my_finish \ |
40 } | 40 } |
41 | 41 |
42 static void | 42 static void |
43 my_handle(struct mlk_action *act, const union event *ev) | 43 my_handle(struct mlk_action *act, const union mlk_event *ev) |
44 { | 44 { |
45 (void)ev; | 45 (void)ev; |
46 | 46 |
47 ((struct invokes *)act->data)->handle++; | 47 ((struct invokes *)act->data)->handle++; |
48 } | 48 } |
140 DT_ASSERT(script_append(&sc, &table[0].act) == 0); | 140 DT_ASSERT(script_append(&sc, &table[0].act) == 0); |
141 DT_ASSERT(script_append(&sc, &table[1].act) == 0); | 141 DT_ASSERT(script_append(&sc, &table[1].act) == 0); |
142 DT_ASSERT(script_append(&sc, &table[2].act) == 0); | 142 DT_ASSERT(script_append(&sc, &table[2].act) == 0); |
143 | 143 |
144 /* [0] */ | 144 /* [0] */ |
145 script_handle(&sc, &(union event){0}); | 145 script_handle(&sc, &(union mlk_event){0}); |
146 DT_EQ_INT(table[0].inv.handle, 1); | 146 DT_EQ_INT(table[0].inv.handle, 1); |
147 DT_EQ_INT(table[0].inv.update, 0); | 147 DT_EQ_INT(table[0].inv.update, 0); |
148 DT_EQ_INT(table[0].inv.draw, 0); | 148 DT_EQ_INT(table[0].inv.draw, 0); |
149 DT_EQ_INT(table[0].inv.end, 0); | 149 DT_EQ_INT(table[0].inv.end, 0); |
150 DT_EQ_INT(table[0].inv.finish, 0); | 150 DT_EQ_INT(table[0].inv.finish, 0); |
159 DT_EQ_INT(table[2].inv.end, 0); | 159 DT_EQ_INT(table[2].inv.end, 0); |
160 DT_EQ_INT(table[2].inv.finish, 0); | 160 DT_EQ_INT(table[2].inv.finish, 0); |
161 | 161 |
162 /* [0] -> [1] */ | 162 /* [0] -> [1] */ |
163 DT_ASSERT(!script_update(&sc, 0)); | 163 DT_ASSERT(!script_update(&sc, 0)); |
164 script_handle(&sc, &(union event){0}); | 164 script_handle(&sc, &(union mlk_event){0}); |
165 | 165 |
166 DT_EQ_INT(table[0].inv.handle, 1); | 166 DT_EQ_INT(table[0].inv.handle, 1); |
167 DT_EQ_INT(table[0].inv.update, 1); | 167 DT_EQ_INT(table[0].inv.update, 1); |
168 DT_EQ_INT(table[0].inv.draw, 0); | 168 DT_EQ_INT(table[0].inv.draw, 0); |
169 DT_EQ_INT(table[0].inv.end, 1); | 169 DT_EQ_INT(table[0].inv.end, 1); |
179 DT_EQ_INT(table[2].inv.end, 0); | 179 DT_EQ_INT(table[2].inv.end, 0); |
180 DT_EQ_INT(table[2].inv.finish, 0); | 180 DT_EQ_INT(table[2].inv.finish, 0); |
181 | 181 |
182 /* [2] */ | 182 /* [2] */ |
183 DT_ASSERT(!script_update(&sc, 0)); | 183 DT_ASSERT(!script_update(&sc, 0)); |
184 script_handle(&sc, &(union event){0}); | 184 script_handle(&sc, &(union mlk_event){0}); |
185 | 185 |
186 DT_EQ_INT(table[0].inv.handle, 1); | 186 DT_EQ_INT(table[0].inv.handle, 1); |
187 DT_EQ_INT(table[0].inv.update, 1); | 187 DT_EQ_INT(table[0].inv.update, 1); |
188 DT_EQ_INT(table[0].inv.draw, 0); | 188 DT_EQ_INT(table[0].inv.draw, 0); |
189 DT_EQ_INT(table[0].inv.end, 1); | 189 DT_EQ_INT(table[0].inv.end, 1); |
432 | 432 |
433 /* Now convert this script into an action itself. */ | 433 /* Now convert this script into an action itself. */ |
434 script_action(&sc, &act); | 434 script_action(&sc, &act); |
435 | 435 |
436 /* Draw and input before updating. */ | 436 /* Draw and input before updating. */ |
437 mlk_action_handle(&act, &(union event){0}); | 437 mlk_action_handle(&act, &(union mlk_event){0}); |
438 mlk_action_draw(&act); | 438 mlk_action_draw(&act); |
439 | 439 |
440 /* [0] -> [1] */ | 440 /* [0] -> [1] */ |
441 DT_ASSERT(!mlk_action_update(&act, 0)); | 441 DT_ASSERT(!mlk_action_update(&act, 0)); |
442 DT_EQ_INT(table[0].inv.handle, 1); | 442 DT_EQ_INT(table[0].inv.handle, 1); |
453 DT_EQ_INT(table[2].inv.update, 0); | 453 DT_EQ_INT(table[2].inv.update, 0); |
454 DT_EQ_INT(table[2].inv.draw, 0); | 454 DT_EQ_INT(table[2].inv.draw, 0); |
455 DT_EQ_INT(table[2].inv.end, 0); | 455 DT_EQ_INT(table[2].inv.end, 0); |
456 DT_EQ_INT(table[2].inv.finish, 0); | 456 DT_EQ_INT(table[2].inv.finish, 0); |
457 | 457 |
458 mlk_action_handle(&act, &(union event){0}); | 458 mlk_action_handle(&act, &(union mlk_event){0}); |
459 mlk_action_draw(&act); | 459 mlk_action_draw(&act); |
460 | 460 |
461 /* [1] -> [2] */ | 461 /* [1] -> [2] */ |
462 DT_ASSERT(!mlk_action_update(&act, 0)); | 462 DT_ASSERT(!mlk_action_update(&act, 0)); |
463 DT_EQ_INT(table[0].inv.handle, 1); | 463 DT_EQ_INT(table[0].inv.handle, 1); |
474 DT_EQ_INT(table[2].inv.update, 0); | 474 DT_EQ_INT(table[2].inv.update, 0); |
475 DT_EQ_INT(table[2].inv.draw, 0); | 475 DT_EQ_INT(table[2].inv.draw, 0); |
476 DT_EQ_INT(table[2].inv.end, 0); | 476 DT_EQ_INT(table[2].inv.end, 0); |
477 DT_EQ_INT(table[2].inv.finish, 0); | 477 DT_EQ_INT(table[2].inv.finish, 0); |
478 | 478 |
479 mlk_action_handle(&act, &(union event){0}); | 479 mlk_action_handle(&act, &(union mlk_event){0}); |
480 mlk_action_draw(&act); | 480 mlk_action_draw(&act); |
481 | 481 |
482 /* 2 stays, it never ends. */ | 482 /* 2 stays, it never ends. */ |
483 DT_ASSERT(!mlk_action_update(&act, 0)); | 483 DT_ASSERT(!mlk_action_update(&act, 0)); |
484 DT_ASSERT(!mlk_action_update(&act, 0)); | 484 DT_ASSERT(!mlk_action_update(&act, 0)); |