Fix narrow web layouts and loader branding

This commit is contained in:
hz
2026-07-16 23:07:26 -05:00
parent a778a680e0
commit ae283c2243
6 changed files with 110 additions and 34 deletions
+49
View File
@@ -0,0 +1,49 @@
extends SceneTree
var failures := 0
func _initialize() -> void:
call_deferred("_run")
func _run() -> void:
var host := Control.new()
host.size = Vector2(240, 720)
root.add_child(host)
var selector = load("res://scripts/ui/study_selector.gd").new()
selector.size = host.size
host.add_child(selector)
await process_frame
selector._show_stage("step3")
selector._refresh_grid_columns()
await process_frame
_assert(selector.stage_scroll != null, "study selection should scroll vertically on short web viewports")
_assert(selector.stage_scroll.horizontal_scroll_mode == ScrollContainer.SCROLL_MODE_DISABLED, "study selection should never introduce horizontal scrolling")
_assert(selector.mode_grid.columns == 1, "phone-width mode cards should use one column")
_assert(selector.stage_content.get_combined_minimum_size().x <= host.size.x, "phone-width study content should fit inside the web canvas (minimum %.1f px)" % selector.stage_content.get_combined_minimum_size().x)
for card in selector.responsive_cards:
_assert(card.custom_minimum_size.x == 0.0, "phone-width cards should release their desktop minimum width")
for row in selector.responsive_card_rows:
_assert(row.vertical, "phone-width card content should stack instead of clipping")
var main_screen = load("res://scripts/ui/main.gd").new()
main_screen.size = host.size
host.add_child(main_screen)
await process_frame
main_screen._update_responsive_layout()
_assert(main_screen.theme_button.custom_minimum_size == Vector2(44, 44), "the theme toggle should keep a stable square footprint")
_assert(main_screen.theme_button.size.x >= 44.0 and main_screen.theme_button.size.y >= 44.0, "the theme toggle should not collapse into an oval")
_assert(not main_screen.user_label.visible and not main_screen.account_chevron_button.visible, "nonessential account controls should collapse on phone-width headers")
host.queue_free()
await process_frame
quit(1 if failures > 0 else 0)
func _assert(condition: bool, message: String) -> void:
if condition:
return
failures += 1
push_error(message)