Moved test scripts
This commit is contained in:
59
tests/test_original_logic.py
Normal file
59
tests/test_original_logic.py
Normal file
@@ -0,0 +1,59 @@
|
||||
#!/usr/bin/env python3
|
||||
"""
|
||||
Test to understand the original mouse.py logic exactly
|
||||
"""
|
||||
|
||||
import time
|
||||
import pyautogui
|
||||
|
||||
def test_original_logic():
|
||||
"""Test the exact logic from the original mouse.py script"""
|
||||
print("🧪 Testing Original mouse.py Logic")
|
||||
print("=====================================")
|
||||
print("This simulates exactly what your original script does")
|
||||
print("Move your mouse and watch the behavior...")
|
||||
print("Press Ctrl+C to stop")
|
||||
print("")
|
||||
|
||||
WAITTIME = 30 # 30 seconds for testing
|
||||
countdown = WAITTIME
|
||||
|
||||
xold = 0
|
||||
yold = 0
|
||||
|
||||
try:
|
||||
iteration = 0
|
||||
while True:
|
||||
iteration += 1
|
||||
x, y = pyautogui.position()
|
||||
|
||||
print(f"\n--- Iteration {iteration} ---")
|
||||
print(f"Current position: ({x}, {y})")
|
||||
print(f"Previous: xold={xold}, yold={yold}")
|
||||
|
||||
if countdown <= 0:
|
||||
print("🔥 TIMER EXPIRED - Would move mouse here")
|
||||
countdown = WAITTIME
|
||||
print(f"Timer reset to {WAITTIME}")
|
||||
continue
|
||||
|
||||
# The key condition from your original script
|
||||
if x == xold or y == yold:
|
||||
print(f"💤 IDLE DETECTED: (x=={xold}) = {x==xold}, (y=={yold}) = {y==yold}")
|
||||
print(f"Countdown: {countdown}")
|
||||
countdown -= 1
|
||||
time.sleep(1)
|
||||
else:
|
||||
print(f"🐭 MOVEMENT DETECTED: Mouse moved from ({xold}, {yold}) to ({x}, {y})")
|
||||
print(f"Timer RESET from {countdown} to {WAITTIME}")
|
||||
countdown = WAITTIME
|
||||
yold = y # Only update yold!
|
||||
print(f"Updated yold to {yold}, xold stays {xold}")
|
||||
|
||||
except KeyboardInterrupt:
|
||||
print("\n⏹️ Test stopped by user")
|
||||
|
||||
print("✅ Test completed!")
|
||||
|
||||
if __name__ == "__main__":
|
||||
test_original_logic()
|
||||
Reference in New Issue
Block a user