building-planner-with-drm / gradio-ui /test_layout_change.py
dexteredep's picture
adjust risk agent
9bceb4c
"""
Test to verify the layout change from side-by-side to top-bottom
"""
import sys
from pathlib import Path
# Add parent directory to path
sys.path.insert(0, str(Path(__file__).parent))
def test_layout_structure():
"""Test that the layout structure is correct"""
# Read the app.py file
app_path = Path(__file__).parent / 'app.py'
with open(app_path, 'r') as f:
content = f.read()
# Check that inputs are in a Row at the top (not in a Column with scale=1)
assert 'with gr.Row():' in content
assert 'building_type = gr.Dropdown(' in content
# Check that the old side-by-side layout is removed
# The old layout had: with gr.Column(scale=1): followed by inputs
# and with gr.Column(scale=2): followed by results
assert 'with gr.Column(scale=1):' not in content
assert 'with gr.Column(scale=2):' not in content
# Check that results section is at the same indentation level as inputs
assert '### πŸ“‹ Construction Plan Results' in content
# Check that tabs are properly indented
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)