TestStaleResizeSettleIsDiscarded: a settle whose gen no longer matches m.resizeGen (a newer resize bumped it after scheduling) must be a no-op, else the chrome flickers back mid-drag on each stale tick.
(t *testing.T)
| 135 | // m.resizeGen (a newer resize bumped it after scheduling) must be a no-op, |
| 136 | // else the chrome flickers back mid-drag on each stale tick. |
| 137 | func TestStaleResizeSettleIsDiscarded(t *testing.T) { |
| 138 | cfg, _, _ := config.Bootstrap(t.TempDir()) |
| 139 | m := New(cfg, llm.New("http://x", cfg.ActiveProfile().LLM, ""), t.TempDir(), "test") |
| 140 | var mm tea.Model = m |
| 141 | |
| 142 | mm, _ = mm.Update(tea.WindowSizeMsg{Width: 100, Height: 30}) |
| 143 | mm, _ = mm.Update(tea.WindowSizeMsg{Width: 80, Height: 30}) |
| 144 | mm, _ = mm.Update(tea.WindowSizeMsg{Width: 60, Height: 30}) |
| 145 | nm := mm.(Model) |
| 146 | |
| 147 | if nm.resizeGen < 2 { |
| 148 | t.Fatalf("setup precondition: resizeGen must be >= 2 after two narrowings, got %d", nm.resizeGen) |
| 149 | } |
| 150 | |
| 151 | stale := resizeSettleMsg{gen: nm.resizeGen - 1} |
| 152 | mm2, cmd := nm.Update(stale) |
| 153 | nm2 := mm2.(Model) |
| 154 | |
| 155 | if !nm2.suppressView { |
| 156 | t.Error("stale settle must NOT flip suppressView off") |
| 157 | } |
| 158 | if cmd != nil { |
| 159 | t.Error("stale settle must return nil cmd (no clear, no further work)") |
| 160 | } |
| 161 | } |
| 162 | |
| 163 | // TestRedundantResizeIsNoOp: a WindowSizeMsg with unchanged dimensions |
| 164 | // (some terminals send these on focus) must not fire the hardening path; |