Exemplo n.º 1
0
    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, "")
Exemplo n.º 2
0
 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"))
Exemplo n.º 3
0
 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"))
Exemplo n.º 4
0
    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))
Exemplo n.º 5
0
    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))
Exemplo n.º 6
0
    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))