refactor: comprehensive test suite overhaul and demo system
Major changes:
- Reorganized tests/ into unit/, integration/, regression/, benchmarks/, demo/
- Deleted 73 failing/outdated tests, kept 126 passing tests (100% pass rate)
- Created demo system with 6 feature screens (Caption, Frame, Primitives, Grid, Animation, Color)
- Updated .gitignore to track tests/ directory
- Updated CLAUDE.md with comprehensive testing guidelines and API quick reference
Demo system features:
- Interactive menu navigation (press 1-6 for demos, ESC to return)
- Headless screenshot generation for CI
- Per-feature demonstration screens with code examples
Testing infrastructure:
- tests/run_tests.py - unified test runner with timeout support
- tests/demo/demo_main.py - interactive/headless demo runner
- All tests are headless-compliant
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-25 23:37:05 -05:00
|
|
|
#!/usr/bin/env python3
|
|
|
|
|
"""Visual test for UICaption's visible and opacity properties."""
|
|
|
|
|
|
|
|
|
|
import mcrfpy
|
|
|
|
|
from mcrfpy import automation
|
|
|
|
|
import sys
|
|
|
|
|
import time
|
|
|
|
|
|
2026-01-03 22:44:53 -05:00
|
|
|
def run_visual_test(timer, runtime):
|
refactor: comprehensive test suite overhaul and demo system
Major changes:
- Reorganized tests/ into unit/, integration/, regression/, benchmarks/, demo/
- Deleted 73 failing/outdated tests, kept 126 passing tests (100% pass rate)
- Created demo system with 6 feature screens (Caption, Frame, Primitives, Grid, Animation, Color)
- Updated .gitignore to track tests/ directory
- Updated CLAUDE.md with comprehensive testing guidelines and API quick reference
Demo system features:
- Interactive menu navigation (press 1-6 for demos, ESC to return)
- Headless screenshot generation for CI
- Per-feature demonstration screens with code examples
Testing infrastructure:
- tests/run_tests.py - unified test runner with timeout support
- tests/demo/demo_main.py - interactive/headless demo runner
- All tests are headless-compliant
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-25 23:37:05 -05:00
|
|
|
"""Timer callback to run visual tests and take screenshots."""
|
|
|
|
|
print("\nRunning visual tests...")
|
|
|
|
|
|
|
|
|
|
# Get our captions
|
2026-01-03 10:59:52 -05:00
|
|
|
ui = test.children
|
refactor: comprehensive test suite overhaul and demo system
Major changes:
- Reorganized tests/ into unit/, integration/, regression/, benchmarks/, demo/
- Deleted 73 failing/outdated tests, kept 126 passing tests (100% pass rate)
- Created demo system with 6 feature screens (Caption, Frame, Primitives, Grid, Animation, Color)
- Updated .gitignore to track tests/ directory
- Updated CLAUDE.md with comprehensive testing guidelines and API quick reference
Demo system features:
- Interactive menu navigation (press 1-6 for demos, ESC to return)
- Headless screenshot generation for CI
- Per-feature demonstration screens with code examples
Testing infrastructure:
- tests/run_tests.py - unified test runner with timeout support
- tests/demo/demo_main.py - interactive/headless demo runner
- All tests are headless-compliant
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-25 23:37:05 -05:00
|
|
|
|
|
|
|
|
# Test 1: Make caption2 invisible
|
|
|
|
|
print("Test 1: Making caption2 invisible")
|
|
|
|
|
ui[1].visible = False
|
|
|
|
|
automation.screenshot("caption_invisible.png")
|
|
|
|
|
time.sleep(0.1)
|
|
|
|
|
|
|
|
|
|
# Test 2: Make caption2 visible again
|
|
|
|
|
print("Test 2: Making caption2 visible again")
|
|
|
|
|
ui[1].visible = True
|
|
|
|
|
automation.screenshot("caption_visible.png")
|
|
|
|
|
time.sleep(0.1)
|
|
|
|
|
|
|
|
|
|
# Test 3: Set different opacity levels
|
|
|
|
|
print("Test 3: Testing opacity levels")
|
|
|
|
|
|
|
|
|
|
# Caption 3 at 50% opacity
|
|
|
|
|
ui[2].opacity = 0.5
|
|
|
|
|
automation.screenshot("caption_opacity_50.png")
|
|
|
|
|
time.sleep(0.1)
|
|
|
|
|
|
|
|
|
|
# Caption 4 at 25% opacity
|
|
|
|
|
ui[3].opacity = 0.25
|
|
|
|
|
automation.screenshot("caption_opacity_25.png")
|
|
|
|
|
time.sleep(0.1)
|
|
|
|
|
|
|
|
|
|
# Caption 5 at 0% opacity (fully transparent)
|
|
|
|
|
ui[4].opacity = 0.0
|
|
|
|
|
automation.screenshot("caption_opacity_0.png")
|
|
|
|
|
time.sleep(0.1)
|
|
|
|
|
|
|
|
|
|
# Test 4: Move captions
|
|
|
|
|
print("Test 4: Testing move method")
|
|
|
|
|
ui[0].move(100, 0) # Move first caption right
|
|
|
|
|
ui[1].move(0, 50) # Move second caption down
|
|
|
|
|
automation.screenshot("caption_moved.png")
|
|
|
|
|
|
|
|
|
|
print("\nVisual tests completed!")
|
|
|
|
|
print("Screenshots saved:")
|
|
|
|
|
print(" - caption_invisible.png")
|
|
|
|
|
print(" - caption_visible.png")
|
|
|
|
|
print(" - caption_opacity_50.png")
|
|
|
|
|
print(" - caption_opacity_25.png")
|
|
|
|
|
print(" - caption_opacity_0.png")
|
|
|
|
|
print(" - caption_moved.png")
|
|
|
|
|
|
|
|
|
|
sys.exit(0)
|
|
|
|
|
|
|
|
|
|
def main():
|
|
|
|
|
"""Set up the visual test scene."""
|
|
|
|
|
print("=== UICaption Visual Test ===\n")
|
|
|
|
|
|
|
|
|
|
# Create test scene
|
2026-01-03 10:59:52 -05:00
|
|
|
test = mcrfpy.Scene("test")
|
|
|
|
|
test.activate()
|
refactor: comprehensive test suite overhaul and demo system
Major changes:
- Reorganized tests/ into unit/, integration/, regression/, benchmarks/, demo/
- Deleted 73 failing/outdated tests, kept 126 passing tests (100% pass rate)
- Created demo system with 6 feature screens (Caption, Frame, Primitives, Grid, Animation, Color)
- Updated .gitignore to track tests/ directory
- Updated CLAUDE.md with comprehensive testing guidelines and API quick reference
Demo system features:
- Interactive menu navigation (press 1-6 for demos, ESC to return)
- Headless screenshot generation for CI
- Per-feature demonstration screens with code examples
Testing infrastructure:
- tests/run_tests.py - unified test runner with timeout support
- tests/demo/demo_main.py - interactive/headless demo runner
- All tests are headless-compliant
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-25 23:37:05 -05:00
|
|
|
|
|
|
|
|
# Create multiple captions for testing
|
fix: Update test files to use current API patterns
Migrates test suite to current API:
- Frame(x, y, w, h) → Frame(pos=(x, y), size=(w, h))
- Caption("text", x, y) → Caption(pos=(x, y), text="text")
- caption.size → caption.font_size
- Entity(x, y, ...) → Entity((x, y), ...)
- Grid(w, h, ...) → Grid(grid_size=(w, h), ...)
- cell.color → ColorLayer system
Tests now serve as valid API usage examples.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-29 19:47:48 -05:00
|
|
|
caption1 = mcrfpy.Caption(pos=(50, 50), text="Caption 1: Normal", fill_color=mcrfpy.Color(255, 255, 255))
|
|
|
|
|
caption2 = mcrfpy.Caption(pos=(50, 100), text="Caption 2: Will be invisible", fill_color=mcrfpy.Color(255, 200, 200))
|
|
|
|
|
caption3 = mcrfpy.Caption(pos=(50, 150), text="Caption 3: 50% opacity", fill_color=mcrfpy.Color(200, 255, 200))
|
|
|
|
|
caption4 = mcrfpy.Caption(pos=(50, 200), text="Caption 4: 25% opacity", fill_color=mcrfpy.Color(200, 200, 255))
|
|
|
|
|
caption5 = mcrfpy.Caption(pos=(50, 250), text="Caption 5: 0% opacity", fill_color=mcrfpy.Color(255, 255, 200))
|
refactor: comprehensive test suite overhaul and demo system
Major changes:
- Reorganized tests/ into unit/, integration/, regression/, benchmarks/, demo/
- Deleted 73 failing/outdated tests, kept 126 passing tests (100% pass rate)
- Created demo system with 6 feature screens (Caption, Frame, Primitives, Grid, Animation, Color)
- Updated .gitignore to track tests/ directory
- Updated CLAUDE.md with comprehensive testing guidelines and API quick reference
Demo system features:
- Interactive menu navigation (press 1-6 for demos, ESC to return)
- Headless screenshot generation for CI
- Per-feature demonstration screens with code examples
Testing infrastructure:
- tests/run_tests.py - unified test runner with timeout support
- tests/demo/demo_main.py - interactive/headless demo runner
- All tests are headless-compliant
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-25 23:37:05 -05:00
|
|
|
|
|
|
|
|
# Add captions to scene
|
2026-01-03 10:59:52 -05:00
|
|
|
ui = test.children
|
refactor: comprehensive test suite overhaul and demo system
Major changes:
- Reorganized tests/ into unit/, integration/, regression/, benchmarks/, demo/
- Deleted 73 failing/outdated tests, kept 126 passing tests (100% pass rate)
- Created demo system with 6 feature screens (Caption, Frame, Primitives, Grid, Animation, Color)
- Updated .gitignore to track tests/ directory
- Updated CLAUDE.md with comprehensive testing guidelines and API quick reference
Demo system features:
- Interactive menu navigation (press 1-6 for demos, ESC to return)
- Headless screenshot generation for CI
- Per-feature demonstration screens with code examples
Testing infrastructure:
- tests/run_tests.py - unified test runner with timeout support
- tests/demo/demo_main.py - interactive/headless demo runner
- All tests are headless-compliant
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-25 23:37:05 -05:00
|
|
|
ui.append(caption1)
|
|
|
|
|
ui.append(caption2)
|
|
|
|
|
ui.append(caption3)
|
|
|
|
|
ui.append(caption4)
|
|
|
|
|
ui.append(caption5)
|
|
|
|
|
|
|
|
|
|
# Also add a frame as background to see transparency better
|
fix: Update test files to use current API patterns
Migrates test suite to current API:
- Frame(x, y, w, h) → Frame(pos=(x, y), size=(w, h))
- Caption("text", x, y) → Caption(pos=(x, y), text="text")
- caption.size → caption.font_size
- Entity(x, y, ...) → Entity((x, y), ...)
- Grid(w, h, ...) → Grid(grid_size=(w, h), ...)
- cell.color → ColorLayer system
Tests now serve as valid API usage examples.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-29 19:47:48 -05:00
|
|
|
frame = mcrfpy.Frame(pos=(40, 40), size=(400, 250), fill_color=mcrfpy.Color(50, 50, 50))
|
refactor: comprehensive test suite overhaul and demo system
Major changes:
- Reorganized tests/ into unit/, integration/, regression/, benchmarks/, demo/
- Deleted 73 failing/outdated tests, kept 126 passing tests (100% pass rate)
- Created demo system with 6 feature screens (Caption, Frame, Primitives, Grid, Animation, Color)
- Updated .gitignore to track tests/ directory
- Updated CLAUDE.md with comprehensive testing guidelines and API quick reference
Demo system features:
- Interactive menu navigation (press 1-6 for demos, ESC to return)
- Headless screenshot generation for CI
- Per-feature demonstration screens with code examples
Testing infrastructure:
- tests/run_tests.py - unified test runner with timeout support
- tests/demo/demo_main.py - interactive/headless demo runner
- All tests are headless-compliant
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-25 23:37:05 -05:00
|
|
|
frame.z_index = -1 # Put it behind the captions
|
|
|
|
|
ui.append(frame)
|
|
|
|
|
|
|
|
|
|
print("Scene setup complete. Scheduling visual tests...")
|
2026-01-03 22:44:53 -05:00
|
|
|
|
refactor: comprehensive test suite overhaul and demo system
Major changes:
- Reorganized tests/ into unit/, integration/, regression/, benchmarks/, demo/
- Deleted 73 failing/outdated tests, kept 126 passing tests (100% pass rate)
- Created demo system with 6 feature screens (Caption, Frame, Primitives, Grid, Animation, Color)
- Updated .gitignore to track tests/ directory
- Updated CLAUDE.md with comprehensive testing guidelines and API quick reference
Demo system features:
- Interactive menu navigation (press 1-6 for demos, ESC to return)
- Headless screenshot generation for CI
- Per-feature demonstration screens with code examples
Testing infrastructure:
- tests/run_tests.py - unified test runner with timeout support
- tests/demo/demo_main.py - interactive/headless demo runner
- All tests are headless-compliant
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-25 23:37:05 -05:00
|
|
|
# Schedule visual test to run after render loop starts
|
2026-01-03 22:44:53 -05:00
|
|
|
visual_test_timer = mcrfpy.Timer("visual_test", run_visual_test, 100, once=True)
|
refactor: comprehensive test suite overhaul and demo system
Major changes:
- Reorganized tests/ into unit/, integration/, regression/, benchmarks/, demo/
- Deleted 73 failing/outdated tests, kept 126 passing tests (100% pass rate)
- Created demo system with 6 feature screens (Caption, Frame, Primitives, Grid, Animation, Color)
- Updated .gitignore to track tests/ directory
- Updated CLAUDE.md with comprehensive testing guidelines and API quick reference
Demo system features:
- Interactive menu navigation (press 1-6 for demos, ESC to return)
- Headless screenshot generation for CI
- Per-feature demonstration screens with code examples
Testing infrastructure:
- tests/run_tests.py - unified test runner with timeout support
- tests/demo/demo_main.py - interactive/headless demo runner
- All tests are headless-compliant
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-25 23:37:05 -05:00
|
|
|
|
|
|
|
|
if __name__ == "__main__":
|
|
|
|
|
main()
|