test: semi-fix the switch_suspend_with_touchpad test
authorPeter Hutterer <peter.hutterer@who-t.net>
Mon, 3 Aug 2020 05:23:51 +0000 (15:23 +1000)
committerPeter Hutterer <peter.hutterer@who-t.net>
Mon, 3 Aug 2020 05:24:45 +0000 (15:24 +1000)
This used to do nothing, now at least it does the same thing as the
corresponding keyboard test. It merely tests the switch going on/off while a
touchpad is present, so short of an unexpected error message or a crash this
test doesn't actually test for any specific behavior.

Fixes #502

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
test/test-switch.c

index 3c6275a9eddd92ccdbf360f275ef420bb7fffce3..4dc06f1676cf10307a14839c1f7afc5e48b8cc99 100644 (file)
@@ -691,11 +691,16 @@ START_TEST(switch_suspend_with_touchpad)
 
        litest_drain_events(li);
 
-       touchpad = litest_add_device(li, LITEST_SYNAPTICS_I2C);
-       litest_delete_device(touchpad);
        touchpad = litest_add_device(li, LITEST_SYNAPTICS_I2C);
        litest_drain_events(li);
 
+       litest_grab_device(sw);
+       litest_switch_action(sw, which, LIBINPUT_SWITCH_STATE_ON);
+       litest_drain_events(li);
+       litest_switch_action(sw, which, LIBINPUT_SWITCH_STATE_OFF);
+       litest_drain_events(li);
+       litest_ungrab_device(sw);
+
        litest_delete_device(sw);
        litest_drain_events(li);
        litest_delete_device(touchpad);