mirror of
https://gitlab.freedesktop.org/libinput/libei.git
synced 2026-02-05 04:10:25 +01:00
test: fix the device add test
Check that we're actually adding the device and getting the message back Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
parent
55246512f0
commit
ce51392241
1 changed files with 27 additions and 7 deletions
|
|
@ -142,17 +142,37 @@ static MunitResult
|
|||
test_ei_device_add(const MunitParameter params[], void *user_data)
|
||||
{
|
||||
_cleanup_peck_ struct peck *peck = peck_new();
|
||||
struct ei *ei = peck_get_ei(peck);
|
||||
|
||||
peck_enable_eis_behavior(peck, PECK_EIS_BEHAVIOR_ACCEPT_ALL);
|
||||
with_server(peck) {
|
||||
peck_enable_eis_behavior(peck, PECK_EIS_BEHAVIOR_ACCEPT_ALL);
|
||||
peck_dispatch_eis(peck);
|
||||
}
|
||||
|
||||
with_client(peck) {
|
||||
peck_drain_ei(ei);
|
||||
}
|
||||
|
||||
_cleanup_ei_device_ struct ei_device *device = NULL;
|
||||
|
||||
with_client(peck) {
|
||||
device = ei_device_new(ei);
|
||||
ei_device_configure_name(device, __func__);
|
||||
ei_device_configure_capability(device, EI_DEVICE_CAP_POINTER);
|
||||
ei_device_add(device);
|
||||
}
|
||||
|
||||
peck_dispatch_eis(peck);
|
||||
peck_dispatch_ei(peck);
|
||||
|
||||
peck_drain_ei(ei);
|
||||
with_client(peck) {
|
||||
_cleanup_ei_event_ struct ei_event *event = ei_get_event(ei);
|
||||
munit_assert_ptr_not_null(event);
|
||||
munit_assert_int(ei_event_get_type(event), ==, EI_EVENT_DEVICE_ADDED);
|
||||
|
||||
_cleanup_ei_device_ struct ei_device *device = ei_device_new(ei);
|
||||
ei_device_configure_name(device, __func__);
|
||||
ei_device_configure_capability(device, EI_DEVICE_CAP_POINTER);
|
||||
ei_device_add(device);
|
||||
struct ei_device *added = ei_event_get_device(event);
|
||||
munit_assert_ptr_equal(device, added);
|
||||
munit_assert(ei_device_has_capability(added, EI_DEVICE_CAP_POINTER));
|
||||
}
|
||||
|
||||
return MUNIT_OK;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue