Initial working version
This commit is contained in:
commit
ec1c5958ce
33 changed files with 4547 additions and 0 deletions
50
tests/test_game_controls.py
Normal file
50
tests/test_game_controls.py
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
import time
|
||||
import traceback
|
||||
import sys
|
||||
|
||||
print("Starting game control test...")
|
||||
|
||||
try:
|
||||
from src.game.input.gamepad import VirtualController
|
||||
print("Controller support module imported successfully")
|
||||
|
||||
controller = VirtualController()
|
||||
print(f"Controller available: {controller.is_available()}")
|
||||
|
||||
if controller.is_available():
|
||||
print("Testing basic controller actions...")
|
||||
|
||||
# Test some basic controller actions
|
||||
print("Pressing A button")
|
||||
controller.press_a()
|
||||
time.sleep(0.5)
|
||||
|
||||
print("Pressing B button")
|
||||
controller.press_b()
|
||||
time.sleep(0.5)
|
||||
|
||||
print("Moving left stick up")
|
||||
controller.move_left_stick_up()
|
||||
time.sleep(0.5)
|
||||
|
||||
print("Moving right stick right")
|
||||
controller.move_right_stick_right()
|
||||
time.sleep(0.5)
|
||||
|
||||
print("Pressing left trigger")
|
||||
controller.press_left_trigger()
|
||||
time.sleep(0.5)
|
||||
|
||||
print("Pressing D-pad up")
|
||||
controller.press_dpad_up()
|
||||
time.sleep(0.5)
|
||||
|
||||
# Reset controller at the end
|
||||
controller.reset()
|
||||
print("Controller reset")
|
||||
|
||||
print("Test completed successfully!")
|
||||
except Exception as e:
|
||||
print(f"Error during testing: {e}")
|
||||
traceback.print_exc()
|
||||
sys.exit(1)
|
||||
Loading…
Add table
Add a link
Reference in a new issue