Moved test scripts
This commit is contained in:
61
tests/debug_mouse_detection.py
Normal file
61
tests/debug_mouse_detection.py
Normal file
@@ -0,0 +1,61 @@
|
||||
#!/usr/bin/env python3
|
||||
"""
|
||||
Debug script to test mouse movement detection
|
||||
"""
|
||||
|
||||
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'))
|
||||
|
||||
import pyautogui
|
||||
from logging_config import setup_logging, get_logger
|
||||
|
||||
def test_mouse_detection():
|
||||
"""Test mouse movement detection logic"""
|
||||
setup_logging(debug=True)
|
||||
logger = get_logger(__name__)
|
||||
|
||||
print("🧪 Testing Mouse Movement Detection")
|
||||
print("========================================")
|
||||
print("Move your mouse around and watch the detection...")
|
||||
print("Press Ctrl+C to stop")
|
||||
print("")
|
||||
|
||||
# Initialize position tracking
|
||||
xold, yold = pyautogui.position()
|
||||
print(f"Initial position: ({xold}, {yold})")
|
||||
|
||||
movement_threshold = 2
|
||||
countdown = 30 # 30 second test countdown
|
||||
|
||||
try:
|
||||
while countdown > 0:
|
||||
x, y = pyautogui.position()
|
||||
|
||||
# Calculate movement
|
||||
x_diff = abs(x - xold) if xold is not None else movement_threshold + 1
|
||||
y_diff = abs(y - yold) if yold is not None else movement_threshold + 1
|
||||
|
||||
if x_diff <= movement_threshold and y_diff <= movement_threshold:
|
||||
# Mouse is idle
|
||||
print(f"⏸️ IDLE: pos=({x},{y}), last=({xold},{yold}), diff=({x_diff},{y_diff}), countdown={countdown}")
|
||||
countdown -= 1
|
||||
else:
|
||||
# Mouse moved
|
||||
print(f"🐭 MOVED: pos=({x},{y}), last=({xold},{yold}), diff=({x_diff},{y_diff}), TIMER RESET!")
|
||||
countdown = 30 # Reset for testing
|
||||
xold = x
|
||||
yold = y
|
||||
|
||||
time.sleep(1)
|
||||
|
||||
except KeyboardInterrupt:
|
||||
print("\n⏹️ Test stopped by user")
|
||||
|
||||
print("✅ Test completed!")
|
||||
|
||||
if __name__ == "__main__":
|
||||
test_mouse_detection()
|
||||
Reference in New Issue
Block a user