stream-bot/tests/test_controller_redirect.py
Joey Yakimowich-Payne ec1c5958ce Initial working version
2025-05-14 17:45:07 -06:00

37 lines
No EOL
1.2 KiB
Python

import time
import traceback
import sys
print("Starting controller redirection test...")
try:
from src.game.input.gamepad import VirtualController
print("Controller support module imported successfully")
controller = VirtualController()
print(f"Controller available: {controller.is_available()}")
print(f"Physical controller available: {controller.is_physical_controller_available()}")
if controller.is_physical_controller_available():
print("Testing controller redirection...")
# Start redirection
success = controller.start_controller_redirection()
print(f"Redirection started: {success}")
if success:
# Let it run for a few seconds
print("Redirection active for 5 seconds. Try using your physical controller...")
for i in range(5, 0, -1):
print(f"{i}...")
time.sleep(1)
# Stop redirection
controller.stop_controller_redirection()
print("Redirection stopped")
print("Test completed successfully!")
except Exception as e:
print(f"Error during testing: {e}")
traceback.print_exc()
sys.exit(1)