maze_python/tests/test_start_button_multiple_clicks.py

43 lines
1.4 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/usr/bin/env python3
"""
快速测试主程序的Start按钮多次点击功能
这个脚本模拟用户快速点击Start按钮的情况
"""
import sys
import os
sys.path.append(os.path.dirname(os.path.abspath(__file__)))
print("=== Start按钮多次点击测试 ===")
print()
print("此测试将启动主程序。请按以下步骤测试:")
print()
print("1. 程序启动后,点击 [Start] 按钮生成第一个迷宫")
print("2. 观察历史步数和路径长度信息")
print("3. 点击 [历史模式] 按钮,进入历史展示模式")
print("4. 使用历史控制按钮前进几步")
print("5. 再次点击 [Start] 按钮生成第二个迷宫")
print("6. 验证:")
print(" - 历史步数应该是新的(不是之前的累加)")
print(" - 应该自动切换回路径模式")
print(" - 历史步骤应该重置为0")
print(" - 所有播放状态应该停止")
print("7. 可以重复步骤1-6多次验证")
print()
print("预期结果:")
print("- 每次点击Start后控制台会显示'所有状态已重置'")
print("- 每次生成的历史步数是独立的新数据")
print("- 不会出现历史数据累加或状态混乱")
print("- UI应该正确显示当前模式和步数")
print()
input("按 Enter 键启动程序进行测试...")
try:
import main
except KeyboardInterrupt:
print("\n测试完成,程序已退出")
except Exception as e:
print(f"\n程序运行出现错误: {str(e)}")
print("请检查相关代码和依赖")