def test_prop_names(self): self.assertEqual(evemu.input_prop_get_value("INPUT_PROP_POINTER"), 0x00) self.assertEqual(evemu.input_prop_get_value("INPUT_PROP_DIRECT"), 0x01) self.assertEqual(evemu.input_prop_get_value("INPUT_PROP_FOO"), None) self.assertEqual(evemu.input_prop_get_value(1), 1) self.assertEqual(evemu.input_prop_get_value(None), None) self.assertEqual(evemu.input_prop_get_name(0x00), "INPUT_PROP_POINTER") self.assertEqual(evemu.input_prop_get_name(0x01), "INPUT_PROP_DIRECT") self.assertEqual(evemu.input_prop_get_name(-1), None) self.assertEqual(evemu.input_prop_get_name("foo"), None) self.assertEqual(evemu.input_prop_get_name(None), None)
def test_has_prop(self): propmax = evemu.input_prop_get_value("INPUT_PROP_MAX") keys = range(0, propmax + 1) results = dict((x, self._device.has_prop(x)) for x in keys) self.assertEqual(results, self.get_expected_propbits())
def get_expected_propbits(self): # no props for N-Trig-MultiTouch-Virtual-Device, so we # return a dict with all keys on False propmax = input_prop_get_value("INPUT_PROP_MAX") keys = range(0, propmax + 1) return dict.fromkeys(keys, False)