Update pygameControls/tests/test_controller.py

This commit is contained in:
2025-05-07 06:49:57 +02:00
parent 98ea8ef5b9
commit a6b4964e80

View File

@@ -10,4 +10,22 @@ class TestController(unittest.TestCase):
self.mock_js.get_name.return_value = "DualSense Wireless Controller"
self.mock_js.get_guid.return_value = "030000004c0500000c0e000011010000"
self.
self.controller = Controller(self.mock_js)
def test_button_press(self):
self.assertEqual(self.controller.get_button(0), 1)
self.assertEqual(self.controller.get_button(1), 0)
def test_axis_reading(self):
self.assertAlmostEqual(self.controller.get_axis(1), 0.5)
def test_profile_mapping(self):
self.assertEqual(self.controller.get_mapping(), "Sony DualSense")
def test_custom_config(self):
cfg = self.controller.get_custom_config()
self.assertIn("cross", cfg)
self.assertEqual(cfg["cross"], 0)
if __name__ == "__main__":
unittest.main()