-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_stable_camera_feed.py
More file actions
79 lines (64 loc) · 2.23 KB
/
test_stable_camera_feed.py
File metadata and controls
79 lines (64 loc) · 2.23 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
#!/usr/bin/env python3
"""
Test script for stable camera feed with no shaking and proper sizing
"""
import sys
import os
import tkinter as tk
from tkinter import messagebox
import time
import threading
import logging
# Add the src directory to path
sys.path.insert(0, os.path.join(os.path.dirname(__file__), 'src'))
sys.path.insert(0, os.path.join(os.path.dirname(__file__), 'gui'))
# Configure logging
logging.basicConfig(
level=logging.INFO,
format='%(asctime)s - %(name)s - %(levelname)s - %(message)s'
)
logger = logging.getLogger(__name__)
def test_stable_camera_feed():
"""Test the stable camera feed implementation"""
try:
# Import the GUI module
from main_gui import DriverMonitoringGUI
# Create root window
root = tk.Tk()
# Create GUI instance
app = DriverMonitoringGUI(root)
# Set up test message
def show_test_info():
test_msg = """
🔧 STABLE CAMERA FEED TEST
This test verifies the following fixes:
✅ Camera feed no longer shrinks excessively
✅ Detection animations don't shake
✅ Modern white theme with proper layout
✅ Stable frame processing and display
✅ Debounced canvas resizing
✅ Smooth, stable animations
Instructions:
1. Click 'Start Monitoring' to begin
2. Try resizing the window - camera feed should remain stable
3. Observe that animations are smooth and don't shake
4. The camera feed maintains a minimum size
5. UI remains responsive with stable performance
Expected Results:
- Camera feed stays large and centered
- No excessive shrinking below minimum size
- Animations are smooth without jitter
- Window resizing doesn't cause shaking
- Modern white theme with proper spacing
"""
messagebox.showinfo("Test Information", test_msg)
# Show test info after a short delay
root.after(1000, show_test_info)
# Start the main loop
logger.info("Starting stable camera feed test")
root.mainloop()
except Exception as e:
logger.error(f"Error in stable camera feed test: {str(e)}")
messagebox.showerror("Test Error", f"Failed to run test: {str(e)}")
if __name__ == "__main__":
test_stable_camera_feed()