#!/usr/bin/env python3 """ Test the updated mouse movement logic that should now match the original """ import sys import os import time # Add src directory to path sys.path.insert(0, os.path.join(os.path.dirname(os.path.dirname(__file__)), 'src')) from mouse_mover import MouseMover from logging_config import setup_logging, get_logger def test_updated_mouse_logic(): """Test the updated mouse movement logic""" setup_logging(debug=True) logger = get_logger(__name__) print("🧪 Testing Updated Mouse Movement Logic") print("========================================") print("This should now behave EXACTLY like your original mouse.py script:") print("- Timer resets immediately when mouse moves") print("- Countdown starts immediately when mouse stops") print("- Uses exact same OR logic and position tracking") print("") print("Starting with 15-second timer for testing...") print("Move your mouse continuously to keep resetting the timer") print("Stop moving to see countdown start immediately") print("Press Ctrl+C to stop") print("") # Create mouse mover with short wait time for testing mouse_mover = MouseMover(wait_time=15, move_px=10) # 15 second wait for testing try: mouse_mover.start() # Let it run and monitor start_time = time.time() while time.time() - start_time < 60: # Run for 1 minute max status = mouse_mover.get_status() elapsed = int(time.time() - start_time) print(f"⏱️ Elapsed: {elapsed:2d}s, Countdown: {status['countdown']:2d}s") time.sleep(2) # Check every 2 seconds except KeyboardInterrupt: print("\n⏹️ Test interrupted by user") finally: mouse_mover.stop() print("✅ Test completed!") print("") print("Expected behavior:") print("- Timer should reset to 15 immediately when you move mouse") print("- Countdown should start immediately when you stop moving") print("- No more 10-second delay chunks!") if __name__ == "__main__": test_updated_mouse_logic()