def test_joystick_num_hats(self): if self.jcount == 0: self.skipTest("no joysticks detected") for index in range(self.jcount): stick = joystick.joystick_open(index) self.assertIsInstance(stick, joystick.SDL_Joystick) hats = joystick.joystick_num_hats(stick) self.assertGreaterEqual(hats, 0) joystick.joystick_close(stick)
def test_joystick_get_hat(self): if self.jcount == 0: self.skipTest("no joysticks detected") for index in range(self.jcount): stick = joystick.joystick_open(index) for hat in range(joystick.joystick_num_hats(stick)): val = joystick.joystick_get_hat(stick, hat) self.assertIsInstance(val, int) # TODO joystick.joystick_close(stick)