diff --git a/quick_extend_test.py b/quick_extend_test.py deleted file mode 100644 index b99ef89..0000000 --- a/quick_extend_test.py +++ /dev/null @@ -1,20 +0,0 @@ -import mcrfpy - -# Create grid -t = mcrfpy.Texture("assets/kenney_ice.png", 16, 16) -g = mcrfpy.Grid(5, 5, t, (0, 0), (100, 100)) - -# Create some entities -entities = [mcrfpy.Entity((i, i), t, i, g) for i in range(3)] - -# Test extend -print(f"Initial entities: {len(g.entities)}") -g.entities.extend(entities) -print(f"After extend: {len(g.entities)}") - -# Test with tuple -more = (mcrfpy.Entity((3, 3), t, 3, g), mcrfpy.Entity((4, 4), t, 4, g)) -g.entities.extend(more) -print(f"After second extend: {len(g.entities)}") - -print("✓ EntityCollection.extend() works!") \ No newline at end of file diff --git a/quick_index_test.py b/quick_index_test.py deleted file mode 100644 index 0a09571..0000000 --- a/quick_index_test.py +++ /dev/null @@ -1,12 +0,0 @@ -import mcrfpy -t = mcrfpy.Texture("assets/kenney_ice.png", 16, 16) -g = mcrfpy.Grid(5, 5, t, (0, 0), (100, 100)) -e1 = mcrfpy.Entity((1, 1), t, 1, g) -e2 = mcrfpy.Entity((2, 2), t, 2, g) -g.entities.append(e1) -g.entities.append(e2) -print("Entity 1 index:", e1.index()) -print("Entity 2 index:", e2.index()) -# Test removal -g.entities.remove(e1.index()) -print("After removal, Entity 2 index:", e2.index()) \ No newline at end of file diff --git a/quick_sprite_test.py b/quick_sprite_test.py deleted file mode 100644 index a532e6e..0000000 --- a/quick_sprite_test.py +++ /dev/null @@ -1,25 +0,0 @@ -import mcrfpy - -# Test sprite index validation -t = mcrfpy.Texture("assets/kenney_ice.png", 16, 16) -s = mcrfpy.Sprite(10, 10, t, 5) - -print(f"Initial sprite index: {s.sprite_number}") - -# Try valid index -s.sprite_number = 50 -print(f"Set to 50: {s.sprite_number}") - -# Try invalid index -try: - s.sprite_number = 200 - print("ERROR: Should have rejected index 200") -except ValueError as e: - print(f"✓ Correctly rejected: {e}") - -# Try negative -try: - s.sprite_number = -1 - print("ERROR: Should have rejected negative index") -except ValueError as e: - print(f"✓ Correctly rejected negative: {e}") \ No newline at end of file diff --git a/temp_test.py b/temp_test.py deleted file mode 100644 index 41b65b4..0000000 --- a/temp_test.py +++ /dev/null @@ -1,120 +0,0 @@ -import sys; sys.path.insert(0, '.') -#!/usr/bin/env python3 -"""Test for UICollection - Related to issue #69 (Sequence Protocol)""" -import mcrfpy -from mcrfpy import automation -from datetime import datetime - -def test_UICollection(): - """Test UICollection sequence protocol compliance""" - # Create test scene - mcrfpy.createScene("collection_test") - mcrfpy.setScene("collection_test") - ui = mcrfpy.sceneUI("collection_test") - - # Add various UI elements - frame = mcrfpy.Frame(10, 10, 100, 100) - caption = mcrfpy.Caption(mcrfpy.Vector(120, 10), text="Test") - sprite = mcrfpy.Sprite(10, 120) - - ui.append(frame) - ui.append(caption) - ui.append(sprite) - - print("Testing UICollection sequence protocol (Issue #69)...") - - # Test len() - try: - length = len(ui) - print(f"✓ len() works: {length} items") - except Exception as e: - print(f"✗ len() failed: {e}") - - # Test indexing - try: - item0 = ui[0] - item1 = ui[1] - item2 = ui[2] - print(f"✓ Indexing works: [{type(item0).__name__}, {type(item1).__name__}, {type(item2).__name__}]") - - # Test negative indexing - last_item = ui[-1] - print(f"✓ Negative indexing works: ui[-1] = {type(last_item).__name__}") - except Exception as e: - print(f"✗ Indexing failed: {e}") - - # Test slicing (if implemented) - try: - slice_items = ui[0:2] - print(f"✓ Slicing works: got {len(slice_items)} items") - except Exception as e: - print(f"✗ Slicing not implemented (Issue #69): {e}") - - # Test iteration - try: - types = [] - for item in ui: - types.append(type(item).__name__) - print(f"✓ Iteration works: {types}") - except Exception as e: - print(f"✗ Iteration failed: {e}") - - # Test contains - try: - if frame in ui: - print("✓ 'in' operator works") - else: - print("✗ 'in' operator returned False for existing item") - except Exception as e: - print(f"✗ 'in' operator not implemented (Issue #69): {e}") - - # Test remove - try: - ui.remove(1) # Remove caption - print(f"✓ remove() works, now {len(ui)} items") - except Exception as e: - print(f"✗ remove() failed: {e}") - - # Test type preservation (Issue #76) - try: - # Add a frame with children to test nested collections - parent_frame = mcrfpy.Frame(250, 10, 200, 200, - fill_color=mcrfpy.Color(200, 200, 200)) - child_caption = mcrfpy.Caption(mcrfpy.Vector(10, 10), text="Child") - parent_frame.children.append(child_caption) - ui.append(parent_frame) - - # Check if type is preserved when retrieving - retrieved = ui[-1] - if type(retrieved).__name__ == "Frame": - print("✓ Type preservation works") - else: - print(f"✗ Type not preserved (Issue #76): got {type(retrieved).__name__}") - except Exception as e: - print(f"✗ Type preservation test failed: {e}") - - # Test find by name (Issue #41 - not yet implemented) - try: - found = ui.find("Test") - print(f"✓ find() method works: {type(found).__name__}") - except AttributeError: - print("✗ find() method not implemented (Issue #41)") - except Exception as e: - print(f"✗ find() method error: {e}") - - # Take screenshot - timestamp = datetime.now().strftime("%Y%m%d_%H%M%S") - filename = f"test_UICollection_issue69_{timestamp}.png" - automation.screenshot(filename) - print(f"Screenshot saved: {filename}") - print("PASS") - -# Set up timer to run test -mcrfpy.setTimer("test", test_UICollection, 1000) - -# Cancel timer after running once -def cleanup(): - mcrfpy.delTimer("test") - mcrfpy.delTimer("cleanup") - -mcrfpy.setTimer("cleanup", cleanup, 1100) \ No newline at end of file