master_adapt_detect/test_split_mode.py
2025-10-01 14:32:55 -05:00

51 lines
No EOL
1.5 KiB
Python

#!/usr/bin/env python3
"""
Test script for the new --split mode functionality
"""
import sys
import os
from pathlib import Path
from panel_splitter import PanelSplitter
def test_basic_splitting():
"""Test basic panel splitting functionality"""
print("Testing basic panel splitting...")
# Initialize splitter
splitter = PanelSplitter(debug=True)
# Test with a sample layout image
layouts_path = Path("layouts")
layout_files = list(layouts_path.glob("*.jpg"))
if not layout_files:
print("No layout images found in layouts/ directory")
return
# Test with first layout
test_layout = layout_files[0]
print(f"Testing with: {test_layout.name}")
# Split panels with target count of 2
target_count = 2
splits = splitter.split_panels(str(test_layout), target_count)
print(f"Generated {len(splits)} splits")
for i, split in enumerate(splits):
print(f" Split {i+1}: bounds={split['bounds']}, confidence={split['confidence']:.3f}")
print("Basic splitting test completed!")
def test_cli_integration():
"""Test CLI integration with --split flag"""
print("\nTesting CLI integration...")
print("You can now test the --split flag with:")
print(" python cli.py --test --split")
print(" python cli.py --test --openai --split")
print(" python cli.py --test --vector-mode --split")
print(" python cli.py --test --hybrid --split")
if __name__ == "__main__":
test_basic_splitting()
test_cli_integration()