tests for the last few issues (these test scripts should work with recent APIs, while the rest of the test suite needs an overhaul)
This commit is contained in:
parent
a57f0875f8
commit
2f4ebf3420
21 changed files with 1570 additions and 0 deletions
43
tests/test_iteration.py
Normal file
43
tests/test_iteration.py
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
#!/usr/bin/env python3
|
||||
"""Test iteration works with hidden types"""
|
||||
import sys
|
||||
import mcrfpy
|
||||
|
||||
print("Step 1: Creating scene...")
|
||||
scene = mcrfpy.Scene("test_scene")
|
||||
print(f" scene: {scene}")
|
||||
|
||||
print("Step 2: Getting children...")
|
||||
ui = scene.children
|
||||
print(f" children: {ui}")
|
||||
|
||||
print("Step 3: Creating Frame...")
|
||||
frame = mcrfpy.Frame(pos=(0,0), size=(50,50))
|
||||
print(f" frame: {frame}")
|
||||
|
||||
print("Step 4: Appending Frame...")
|
||||
ui.append(frame)
|
||||
print(f" append succeeded, len={len(ui)}")
|
||||
|
||||
print("Step 5: Creating Caption...")
|
||||
caption = mcrfpy.Caption(text="hi", pos=(0,0))
|
||||
print(f" caption: {caption}")
|
||||
|
||||
print("Step 6: Appending Caption...")
|
||||
ui.append(caption)
|
||||
print(f" append succeeded, len={len(ui)}")
|
||||
|
||||
print("Step 7: Starting iteration...")
|
||||
count = 0
|
||||
for item in ui:
|
||||
count += 1
|
||||
print(f" Item {count}: {item}")
|
||||
|
||||
print(f"Step 8: Iteration complete, {count} items")
|
||||
|
||||
if count == 2:
|
||||
print("PASS")
|
||||
sys.exit(0)
|
||||
else:
|
||||
print(f"FAIL: expected 2 items, got {count}")
|
||||
sys.exit(1)
|
||||
Loading…
Add table
Add a link
Reference in a new issue