feat: Add comprehensive tests for punch button functionality and multiple dose handling

This commit is contained in:
William Valentin
2025-07-28 23:12:50 -07:00
parent bce6c8c27d
commit 2a1edeb76e
6 changed files with 0 additions and 0 deletions

View File

@@ -0,0 +1,81 @@
#!/usr/bin/env python3
"""
Simple test to just verify punch button functionality works in isolation.
"""
import os
import sys
import tkinter as tk
sys.path.insert(0, os.path.join(os.path.dirname(__file__), "src"))
import logging
from ui_manager import UIManager
def test_punch_button_only():
"""Test just the punch button functionality."""
print("🎯 Testing Punch Button Functionality Only")
print("=" * 45)
root = tk.Tk()
root.title("Punch Button Test")
root.geometry("800x600")
logger = logging.getLogger("punch_test")
ui_manager = UIManager(root, logger)
# Simple test values
sample_values = (
"07/29/2025",
5,
3,
7,
6,
1,
"",
0,
"",
0,
"",
0,
"",
"Punch button test",
)
def simple_save(*args):
print("Save button clicked - closing window")
if args and hasattr(args[0], "destroy"):
args[0].destroy()
callbacks = {"save": simple_save, "delete": lambda x: x.destroy()}
try:
edit_window = ui_manager.create_edit_window(sample_values, callbacks)
edit_window.lift()
edit_window.focus_force()
print("\n🔨 SIMPLE TEST:")
print("1. Enter '100mg' in the Bupropion dose field")
print("2. Click 'Take Bupropion' button")
print("3. Look for DEBUG PUNCH messages in the console")
print("4. Check if the dose appears in the text area")
print("5. Click Save when done")
print("\n⏳ Performing test...")
edit_window.wait_window()
print("✅ Test completed")
except Exception as e:
print(f"❌ Error: {e}")
import traceback
traceback.print_exc()
finally:
root.destroy()
if __name__ == "__main__":
os.chdir("/home/will/Code/thechart")
test_punch_button_only()