def test_set_get_name(self): l = Libevdev() name = l.name self.assertEqual(name, '') l.name = "foo" name = l.name self.assertEqual(name, "foo") l.name = None name = l.name self.assertEqual(name, "")
def testSyspath(self): dev = Libevdev() dev.name = "test device" dev.enable("EV_REL", "REL_X") dev.enable("EV_REL", "REL_Y") uinput = UinputDevice(dev) self.assertTrue(uinput.syspath.startswith("/sys/devices/virtual/input/input"))
def testDeviceNode(self): dev = Libevdev() dev.name = "test device" dev.enable("EV_REL", "REL_X") dev.enable("EV_REL", "REL_Y") uinput = UinputDevice(dev) self.assertTrue(uinput.devnode.startswith("/dev/input/event"))
def testButton(self): dev = Libevdev() dev.name = "test device" dev.enable("EV_KEY", "BTN_LEFT") dev.enable("EV_KEY", "KEY_A") uinput = UinputDevice(dev) self.assertIsNotNone(uinput.devnode) with open(uinput.devnode) as f: newdev = Libevdev(f) self.assertTrue(self.is_identical(dev, newdev))
def testRelative(self): dev = Libevdev() dev.name = "test device" dev.enable("EV_REL", "REL_X") dev.enable("EV_REL", "REL_Y") uinput = UinputDevice(dev) self.assertIsNotNone(uinput.devnode) with open(uinput.devnode) as f: newdev = Libevdev(f) self.assertTrue(self.is_identical(dev, newdev))
def testAbsolute(self): absinfo = {"minimum": 0, "maximum": 1} dev = Libevdev() dev.name = "test device" dev.enable("EV_ABS", "ABS_X", absinfo) dev.enable("EV_ABS", "ABS_Y", absinfo) uinput = UinputDevice(dev) self.assertIsNotNone(uinput.devnode) with open(uinput.devnode) as f: newdev = Libevdev(f) self.assertTrue(self.is_identical(dev, newdev))