|
|
""" |
|
|
Test to verify the layout change from side-by-side to top-bottom |
|
|
""" |
|
|
|
|
|
import sys |
|
|
from pathlib import Path |
|
|
|
|
|
|
|
|
sys.path.insert(0, str(Path(__file__).parent)) |
|
|
|
|
|
|
|
|
def test_layout_structure(): |
|
|
"""Test that the layout structure is correct""" |
|
|
|
|
|
|
|
|
app_path = Path(__file__).parent / 'app.py' |
|
|
with open(app_path, 'r') as f: |
|
|
content = f.read() |
|
|
|
|
|
|
|
|
assert 'with gr.Row():' in content |
|
|
assert 'building_type = gr.Dropdown(' in content |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
assert 'with gr.Column(scale=1):' not in content |
|
|
assert 'with gr.Column(scale=2):' not in content |
|
|
|
|
|
|
|
|
assert '### π Construction Plan Results' in content |
|
|
|
|
|
|
|
|
assert 'with gr.Tabs() as tabs:' in content |
|
|
|
|
|
print("β
Layout structure is correct") |
|
|
print("\nLayout changes:") |
|
|
print(" β Inputs moved from left column to top row") |
|
|
print(" β Results section now takes full width") |
|
|
print(" β Side-by-side layout removed") |
|
|
print(" β Top-bottom layout implemented") |
|
|
|
|
|
return True |
|
|
|
|
|
|
|
|
if __name__ == '__main__': |
|
|
print("Testing layout change...\n") |
|
|
print("=" * 60) |
|
|
|
|
|
try: |
|
|
test_layout_structure() |
|
|
|
|
|
print("\n" + "=" * 60) |
|
|
print("β
Layout test passed!") |
|
|
print("\nNew Layout Structure:") |
|
|
print(" 1. Header and description (full width)") |
|
|
print(" 2. Input fields in a horizontal row (full width)") |
|
|
print(" 3. Submit button (full width)") |
|
|
print(" 4. Results tabs (full width)") |
|
|
print(" 5. Export options (full width)") |
|
|
|
|
|
except AssertionError as e: |
|
|
print(f"\nβ Test failed: {e}") |
|
|
import traceback |
|
|
traceback.print_exc() |
|
|
sys.exit(1) |
|
|
except Exception as e: |
|
|
print(f"\nβ Unexpected error: {e}") |
|
|
import traceback |
|
|
traceback.print_exc() |
|
|
sys.exit(1) |
|
|
|