Esempio n. 1
0
 def test_code_to_name_invalid(self):
     name = Libevdev.event_to_name(0, 1000)
     self.assertIsNone(name)
     name = Libevdev.event_to_name(0, -1)
     self.assertIsNone(name)
     with self.assertRaises(ctypes.ArgumentError):
         name = Libevdev.event_to_name(0, "foo")
Esempio n. 2
0
    def test_type_to_name(self):
        name = Libevdev.event_to_name(1)
        self.assertEqual(name, "EV_KEY")

        prevname = None
        for i in range(5):
            name = Libevdev.event_to_name(i)
            self.assertIsNotNone(name)
            self.assertTrue(name.startswith("EV_"))
            self.assertNotEqual(prevname, name)
            prevname = name
Esempio n. 3
0
    def test_code_to_name(self):
        name = Libevdev.event_to_name(0, 0)
        self.assertEqual(name, "SYN_REPORT")

        name = Libevdev.event_to_name(1, 1)
        self.assertEqual(name, "KEY_ESC")