Skip to content

Commit

Permalink
Correct tests to not exclude axis-only devices
Browse files Browse the repository at this point in the history
  • Loading branch information
StelardActek committed Sep 20, 2024
1 parent d9a4880 commit 7485f7a
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions tests/unit/test_groups.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,9 +180,8 @@ def test_skip_camera(self):
self.assertIsNotNone(groups.find(name="gamepad"))

def test_device_with_only_ev_abs(self):
# could be anything, a lot of devices have ABS_X capabilities,
# so it is not treated as gamepad joystick and since it also
# doesn't have key capabilities, there is nothing to map.
# As Input Mapper can now map axes to buttons,
# a single EV_ABS device is valid for mapping.
fixtures["/foo/bar"] = {
"name": "qux",
"phys": "abcd2",
Expand All @@ -192,12 +191,19 @@ def test_device_with_only_ev_abs(self):

groups.refresh()
self.assertIsNotNone(groups.find(name="gamepad"))
self.assertIsNone(groups.find(name="qux"))
self.assertIsNotNone(groups.find(name="qux"))

def test_device_with_no_capabilities(self):
fixtures["/foo/bar"] = {
"name": "nulcap",
"phys": "abcd3",
"info": evdev.DeviceInfo(1, 2, 3, 4),
"capabilities": {},
}

# verify this test even works at all
fixtures["/foo/bar"].capabilities[EV_KEY] = [KEY_A]
groups.refresh()
self.assertIsNotNone(groups.find(name="qux"))
self.assertIsNotNone(groups.find(name="gamepad"))
self.assertIsNone(groups.find(name="nulcap"))

def test_duplicate_device(self):
fixtures["/dev/input/event100"] = {
Expand Down

0 comments on commit 7485f7a

Please sign in to comment.