1
0
Fork 0

tests/clutter/event-delivery: Queue update before waiting

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2727>
This commit is contained in:
Jonas Ådahl 2022-12-01 22:45:11 +01:00 committed by Marge Bot
parent 2d7e5e7671
commit bd72b671fc

View file

@ -21,9 +21,11 @@ on_event_return_stop (ClutterActor *actor,
} }
static void static void
wait_stage_updated (gboolean *was_updated) wait_stage_updated (ClutterStage *stage,
gboolean *was_updated)
{ {
*was_updated = FALSE; *was_updated = FALSE;
clutter_stage_schedule_update (stage);
while (!*was_updated) while (!*was_updated)
g_main_context_iteration (NULL, TRUE); g_main_context_iteration (NULL, TRUE);
} }
@ -53,11 +55,11 @@ event_delivery_consecutive_touch_begin_end (void)
clutter_virtual_input_device_notify_touch_up (virtual_pointer, now_us, 0); clutter_virtual_input_device_notify_touch_up (virtual_pointer, now_us, 0);
clutter_virtual_input_device_notify_touch_down (virtual_pointer, now_us, 0, 5, 5); clutter_virtual_input_device_notify_touch_down (virtual_pointer, now_us, 0, 5, 5);
g_assert_true (!was_updated); g_assert_true (!was_updated);
wait_stage_updated (&was_updated); wait_stage_updated (CLUTTER_STAGE (stage), &was_updated);
g_assert_cmpint (n_captured_touch_events, ==, 3); g_assert_cmpint (n_captured_touch_events, ==, 3);
clutter_virtual_input_device_notify_touch_up (virtual_pointer, now_us, 0); clutter_virtual_input_device_notify_touch_up (virtual_pointer, now_us, 0);
wait_stage_updated (&was_updated); wait_stage_updated (CLUTTER_STAGE (stage), &was_updated);
g_assert_cmpint (n_captured_touch_events, ==, 4); g_assert_cmpint (n_captured_touch_events, ==, 4);
g_signal_handlers_disconnect_by_func (stage, on_event_return_stop, &n_captured_touch_events); g_signal_handlers_disconnect_by_func (stage, on_event_return_stop, &n_captured_touch_events);