test: rename 'sw' to 'dev' for the lid tests

More in line with other tests and allows us to use 'sw' as name for the actual
switch to be toggled later. The variable name 'sw' stays in those tests where
we have touchpad/keyboard/etc. devices as well.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
Peter Hutterer 2017-04-21 17:27:27 +10:00
parent 3004163725
commit e055803321

View file

@ -31,14 +31,14 @@
START_TEST(lid_switch)
{
struct litest_device *sw = litest_current_device();
struct libinput *li = sw->libinput;
struct litest_device *dev = litest_current_device();
struct libinput *li = dev->libinput;
struct libinput_event *event;
litest_drain_events(li);
/* lid closed */
litest_switch_action(sw,
litest_switch_action(dev,
LIBINPUT_SWITCH_LID,
LIBINPUT_SWITCH_STATE_ON);
libinput_dispatch(li);
@ -50,7 +50,7 @@ START_TEST(lid_switch)
libinput_event_destroy(event);
/* lid opened */
litest_switch_action(sw,
litest_switch_action(dev,
LIBINPUT_SWITCH_LID,
LIBINPUT_SWITCH_STATE_OFF);
libinput_dispatch(li);
@ -67,13 +67,13 @@ END_TEST
START_TEST(lid_switch_double)
{
struct litest_device *sw = litest_current_device();
struct libinput *li = sw->libinput;
struct litest_device *dev = litest_current_device();
struct libinput *li = dev->libinput;
struct libinput_event *event;
litest_drain_events(li);
litest_switch_action(sw,
litest_switch_action(dev,
LIBINPUT_SWITCH_LID,
LIBINPUT_SWITCH_STATE_ON);
libinput_dispatch(li);
@ -86,7 +86,7 @@ START_TEST(lid_switch_double)
/* This will be filtered by the kernel, so this test is a bit
* useless */
litest_switch_action(sw,
litest_switch_action(dev,
LIBINPUT_SWITCH_LID,
LIBINPUT_SWITCH_STATE_ON);
libinput_dispatch(li);
@ -114,21 +114,21 @@ lid_switch_is_reliable(struct litest_device *dev)
START_TEST(lid_switch_down_on_init)
{
struct litest_device *sw = litest_current_device();
struct litest_device *dev = litest_current_device();
struct libinput *li;
struct libinput_event *event;
if (!lid_switch_is_reliable(sw))
if (!lid_switch_is_reliable(dev))
return;
litest_switch_action(sw,
litest_switch_action(dev,
LIBINPUT_SWITCH_LID,
LIBINPUT_SWITCH_STATE_ON);
/* need separate context to test */
li = litest_create_context();
libinput_path_add_device(li,
libevdev_uinput_get_devnode(sw->uinput));
libevdev_uinput_get_devnode(dev->uinput));
libinput_dispatch(li);
litest_wait_for_event_of_type(li, LIBINPUT_EVENT_SWITCH_TOGGLE, -1);
@ -144,7 +144,7 @@ START_TEST(lid_switch_down_on_init)
libinput_event_destroy(event);
}
litest_switch_action(sw,
litest_switch_action(dev,
LIBINPUT_SWITCH_LID,
LIBINPUT_SWITCH_STATE_OFF);
libinput_dispatch(li);
@ -162,21 +162,21 @@ END_TEST
START_TEST(lid_switch_not_down_on_init)
{
struct litest_device *sw = litest_current_device();
struct litest_device *dev = litest_current_device();
struct libinput *li;
struct libinput_event *event;
if (lid_switch_is_reliable(sw))
if (lid_switch_is_reliable(dev))
return;
litest_switch_action(sw,
litest_switch_action(dev,
LIBINPUT_SWITCH_LID,
LIBINPUT_SWITCH_STATE_ON);
/* need separate context to test */
li = litest_create_context();
libinput_path_add_device(li,
libevdev_uinput_get_devnode(sw->uinput));
libevdev_uinput_get_devnode(dev->uinput));
libinput_dispatch(li);
while ((event = libinput_get_event(li)) != NULL) {
@ -185,7 +185,7 @@ START_TEST(lid_switch_not_down_on_init)
libinput_event_destroy(event);
}
litest_switch_action(sw,
litest_switch_action(dev,
LIBINPUT_SWITCH_LID,
LIBINPUT_SWITCH_STATE_OFF);
litest_assert_empty_queue(li);