test: fix two race conditions waiting for proximity events

This test does a prox in/out and immediately drains events.
Where we are slow enough we may drain only one (or none) of the
proximity events which causes a failure later in the test.

Similar issue with the second test where we may get a delayed tip event.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1074>
This commit is contained in:
Peter Hutterer 2024-10-31 15:10:11 +10:00
parent 2b2959fc8b
commit 2ac4227843

View file

@ -3775,6 +3775,7 @@ START_TEST(tablet_calibration_set_matrix_delta)
dy = libinput_event_tablet_tool_get_y(tablet_event) - y;
libinput_event_destroy(event);
litest_tablet_proximity_out(dev);
litest_wait_for_event_of_type(li, LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY);
litest_drain_events(li);
status = libinput_device_config_calibration_set_matrix(d,
@ -3857,6 +3858,8 @@ START_TEST(tablet_calibration_set_matrix)
litest_dispatch(li);
litest_tablet_proximity_in(dev, 50, 50, axes);
litest_tablet_proximity_out(dev);
litest_wait_for_event_of_type(li, LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY);
litest_wait_for_event_of_type(li, LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY);
litest_drain_events(li);
calibration[0] = 1;