mirror of
https://gitlab.freedesktop.org/libinput/libei.git
synced 2026-04-04 07:30:43 +02:00
test: add a test for a device dropped to zero caps and refused
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
parent
a95d2bdd8b
commit
7ae661a029
1 changed files with 38 additions and 0 deletions
|
|
@ -177,12 +177,50 @@ test_ei_device_add(const MunitParameter params[], void *user_data)
|
|||
return MUNIT_OK;
|
||||
}
|
||||
|
||||
static MunitResult
|
||||
test_ei_device_add_zero_caps(const MunitParameter params[], void *user_data)
|
||||
{
|
||||
_cleanup_peck_ struct peck *peck = peck_new();
|
||||
|
||||
/* Device with pointer caps but those caps are rejected -> device
|
||||
immediately removed by EIS */
|
||||
peck_enable_eis_behavior(peck, PECK_EIS_BEHAVIOR_ACCEPT_ALL);
|
||||
peck_enable_eis_behavior(peck, PECK_EIS_BEHAVIOR_REJECT_POINTER);
|
||||
|
||||
peck_dispatch_eis(peck);
|
||||
peck_dispatch_ei(peck);
|
||||
peck_dispatch_eis(peck);
|
||||
peck_dispatch_ei(peck);
|
||||
|
||||
_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);
|
||||
|
||||
with_client(peck) {
|
||||
ei_dispatch(ei);
|
||||
|
||||
_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_REMOVED);
|
||||
}
|
||||
|
||||
return MUNIT_OK;
|
||||
}
|
||||
|
||||
static MunitTest ei_tests[] = {
|
||||
{ .name = "/ei/ref", .test = test_ei_ref_unref },
|
||||
{ .name = "/ei/reject", .test = test_ei_reject },
|
||||
{ .name = "/ei/reject_after_connect", .test = test_ei_reject_after_connect },
|
||||
{ .name = "/device/basics", .test = test_ei_device_basics },
|
||||
{ .name = "/device/add", .test = test_ei_device_add },
|
||||
{ .name = "/device/add_zero_caps", .test = test_ei_device_add_zero_caps },
|
||||
};
|
||||
|
||||
static const MunitSuite iotest_suite = {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue