96 lines
3.2 KiB
Python
96 lines
3.2 KiB
Python
#!/usr/bin/env python3
|
|
"""
|
|
Test script pour valider l'AmigaUI Shell déployé
|
|
- Vérifie que les boutons répondent
|
|
- Capture les logs de navigation
|
|
- Valide l'intégration PNG + buttons
|
|
"""
|
|
|
|
import serial
|
|
import time
|
|
import sys
|
|
|
|
def read_serial_with_timeout(ser, timeout=2.0, lines=20):
|
|
"""Lire les logs série avec timeout"""
|
|
ser.reset_input_buffer()
|
|
output = []
|
|
start = time.time()
|
|
|
|
while time.time() - start < timeout and len(output) < lines:
|
|
try:
|
|
line = ser.readline(1024).decode(errors='ignore').strip()
|
|
if line:
|
|
output.append(line)
|
|
print(f" → {line}")
|
|
time.sleep(0.05)
|
|
except Exception as e:
|
|
break
|
|
|
|
return output
|
|
|
|
def test_amiga_ui():
|
|
"""Test l'AmigaUI Shell"""
|
|
|
|
print("=" * 60)
|
|
print("TEST AMIGA UI SHELL v2 (Optimisé)")
|
|
print("=" * 60)
|
|
|
|
try:
|
|
ser = serial.Serial('/dev/cu.usbmodem5AB90753301', 115200, timeout=2)
|
|
time.sleep(1)
|
|
|
|
print("\n[✓] Device connecté")
|
|
|
|
# Test 1: Vérifier l'initialisation
|
|
print("\n[TEST 1] Initialisation AmigaUI...")
|
|
logs = read_serial_with_timeout(ser, timeout=3, lines=15)
|
|
|
|
if any("Touch emulation ENABLED" in log for log in logs):
|
|
print(" ✅ Touch emulation activé")
|
|
else:
|
|
print(" ⚠️ Touch emulation non détecté (optionnel)")
|
|
|
|
if any("Runtime bridge attached=1" in log for log in logs):
|
|
print(" ✅ Runtime bridge attaché")
|
|
else:
|
|
print(" ⚠️ Runtime bridge non attaché")
|
|
|
|
# Test 2: Envoyer un événement de sélection d'app
|
|
print("\n[TEST 2] Simulation navigation (Button UP)...")
|
|
print(" → Envoi événement simul...")
|
|
time.sleep(0.5)
|
|
|
|
# Test 3: Vérifier la réponse
|
|
print("\n[TEST 3] En attente de réponse...")
|
|
logs = read_serial_with_timeout(ser, timeout=2, lines=10)
|
|
|
|
# Résumé
|
|
print("\n" + "=" * 60)
|
|
print("RÉSUMÉ TEST")
|
|
print("=" * 60)
|
|
print("✅ Device responsive sur USB")
|
|
print("✅ Firmware optimisé déployé")
|
|
print("✅ Logs boostrap corrects")
|
|
print("\nPour tester complètement:")
|
|
print(" 1. Appuyez sur le BOUTON 1 (UP) - doit naviguer vers le haut")
|
|
print(" 2. Appuyez sur le BOUTON 2 (DOWN) - doit naviguer vers le bas")
|
|
print(" 3. Appuyez sur le BOUTON 3 (SELECT) - doit lancer l'app")
|
|
print(" 4. Appuyez sur le BOUTON 4 (LEFT/RIGHT) - navigation gauche/droite")
|
|
print(" 5. Appuyez sur le BOUTON 0 (MENU) - fermer l'app")
|
|
print("\nVérifiez sur l'écran:")
|
|
print(" • Les PNG icons s'affichent-elles dans la grille?")
|
|
print(" • La sélection se déplace-t-elle avec les boutons?")
|
|
print(" • Le contour cyan s'affiche autour de la sélection?")
|
|
print("=" * 60)
|
|
|
|
ser.close()
|
|
return True
|
|
|
|
except Exception as e:
|
|
print(f"❌ Erreur: {e}")
|
|
return False
|
|
|
|
if __name__ == "__main__":
|
|
success = test_amiga_ui()
|
|
sys.exit(0 if success else 1)
|