test(overview): check the span and wording of cascade band cards
- commit
- dc4ba25ee50a8713ba9f123f56b4a915c4f9d6f5
- author
- brice · · 2026-10-08 12:18 UTC
- parent
- 553cc10
- signature
- GPG Verified
CD88F9E564E0102646FB6077A1A07C7C7C3E349D· arch-gpg Verified for the committer email
2 files · +16 -9
M internal/core/overview.go +2 -1
| @@ -863,7 +863,8 @@ func (w *Workspace) overviewZoom() float64 { | |||
| 863 | 863 | } | |
| 864 | 864 | ||
| 865 | 865 | // zoomSpan is overviewZoom with the unscaled span of the tiles it fits. A | |
| 866 | - | // cascade workspace spans one screen whatever its band count. | |
| 866 | + | // cascade workspace spans one screen whatever its band count, plus the room | |
| 867 | + | // of the cards a maximized column hides. | |
| 867 | 868 | func (w *Workspace) zoomSpan() (float64, int) { | |
| 868 | 869 | // Only the span is read: the tiles go in the zoom scratch, dead on return. | |
| 869 | 870 | var span int | |
| @@ -863,7 +863,8 @@ func (w *Workspace) overviewZoom() float64 { | |||||
| 863 | } | 863 | } | ||
| 864 | 864 | ||||
| 865 | // zoomSpan is overviewZoom with the unscaled span of the tiles it fits. A | 865 | // zoomSpan is overviewZoom with the unscaled span of the tiles it fits. A | ||
| 866 | - | // cascade workspace spans one screen whatever its band count. | 866 | + | // cascade workspace spans one screen whatever its band count, plus the room |
| 867 | + | // of the cards a maximized column hides. | |||
| 867 | func (w *Workspace) zoomSpan() (float64, int) { | 868 | func (w *Workspace) zoomSpan() (float64, int) { | ||
| 868 | // Only the span is read: the tiles go in the zoom scratch, dead on return. | 869 | // Only the span is read: the tiles go in the zoom scratch, dead on return. | ||
| 869 | var span int | 870 | var span int | ||
M internal/core/overview_cascade_test.go +14 -8
| @@ -75,10 +75,10 @@ func TestOverviewCascadeZoomIgnoresBandCount(t *testing.T) { | |||
| 75 | 75 | } | |
| 76 | 76 | } | |
| 77 | 77 | ||
| 78 | - | // A maximized column fills its band in the preview, inset for the columns | |
| 79 | - | // it hides: they are dimmed cards at their cell size behind it, on their | |
| 80 | - | // side, the nearest one step out, the farther ones two (the band's edge). | |
| 81 | - | // Other bands keep their cells. | |
| 78 | + | // A maximized column keeps its full size in the preview (the workspace's | |
| 79 | + | // ratio); the columns it hides are dimmed cards at their cell size behind | |
| 80 | + | // it, peeking out on their side, the nearest one step, the farther ones two. | |
| 81 | + | // The row widens by that room; other bands keep their cells. | |
| 82 | 82 | func TestOverviewCascadeMaximizedColumnCards(t *testing.T) { | |
| 83 | 83 | // Four columns, three per band: band 0 holds 0..2, band 1 holds 3. | |
| 84 | 84 | for _, tc := range []struct { | |
| @@ -97,12 +97,15 @@ func TestOverviewCascadeMaximizedColumnCards(t *testing.T) { | |||
| 97 | 97 | w := cascadeWorkspace(tc.n) | |
| 98 | 98 | w.Focus = tc.max | |
| 99 | 99 | w.maximize(tc.max) | |
| 100 | - | tiles, _, sel := w.previewTiles() | |
| 100 | + | tiles, span, sel := w.previewTiles() | |
| 101 | 101 | g, h, s := w.gap(), w.Usable.H-2*w.gap(), w.bandCardStep() | |
| 102 | 102 | off := 0 | |
| 103 | 103 | if slices.ContainsFunc(tc.cards, func(k int) bool { return k != 0 }) { | |
| 104 | 104 | off = 2 * s | |
| 105 | 105 | } | |
| 106 | + | if span != w.Usable.W+2*off { | |
| 107 | + | t.Fatalf("n=%d max=%d span %d, want %d", tc.n, tc.max, span, w.Usable.W+2*off) | |
| 108 | + | } | |
| 106 | 109 | var order []int | |
| 107 | 110 | for _, p := range tiles { | |
| 108 | 111 | i := int(p.ID) - 1 | |
| @@ -120,6 +123,9 @@ func TestOverviewCascadeMaximizedColumnCards(t *testing.T) { | |||
| 120 | 123 | case k > 0: | |
| 121 | 124 | want.X = w.Usable.W - g + (2+k)*s - want.W | |
| 122 | 125 | } | |
| 126 | + | if p.Rect.X < 0 || p.Rect.X+p.Rect.W > span { | |
| 127 | + | t.Fatalf("n=%d max=%d column %d %+v outside span %d", tc.n, tc.max, i, p.Rect, span) | |
| 128 | + | } | |
| 123 | 129 | if p.Hidden || p.Peek != (tc.cards[i] != 0) || p.Focused != (i == tc.max) || p.Rect != want { | |
| 124 | 130 | t.Fatalf("n=%d max=%d column %d: %+v, want rect %+v card %v", tc.n, tc.max, i, p, want, tc.cards[i] != 0) | |
| 125 | 131 | } | |
| @@ -198,9 +204,9 @@ func TestOverviewCascadeMaximizedCardPickRecordsWindow(t *testing.T) { | |||
| 198 | 204 | } | |
| 199 | 205 | } | |
| 200 | 206 | ||
| 201 | - | // Only the focused maximized column is inset for cards: a FullWidth column | |
| 202 | - | // elsewhere fills its band. | |
| 203 | - | func TestOverviewCascadeUnfocusedMaximizedNotInset(t *testing.T) { | |
| 207 | + | // A FullWidth column outside the focused band fills its band, shifted like | |
| 208 | + | // every tile by the room of the focused column's cards. | |
| 209 | + | func TestOverviewCascadeUnfocusedMaximizedFillsBand(t *testing.T) { | |
| 204 | 210 | w := cascadeWorkspace(6) | |
| 205 | 211 | w.SetGaps(8) | |
| 206 | 212 | w.Focus = 4 | |
| @@ -75,10 +75,10 @@ func TestOverviewCascadeZoomIgnoresBandCount(t *testing.T) { | |||||
| 75 | } | 75 | } | ||
| 76 | } | 76 | } | ||
| 77 | 77 | ||||
| 78 | - | // A maximized column fills its band in the preview, inset for the columns | 78 | + | // A maximized column keeps its full size in the preview (the workspace's |
| 79 | - | // it hides: they are dimmed cards at their cell size behind it, on their | 79 | + | // ratio); the columns it hides are dimmed cards at their cell size behind |
| 80 | - | // side, the nearest one step out, the farther ones two (the band's edge). | 80 | + | // it, peeking out on their side, the nearest one step, the farther ones two. |
| 81 | - | // Other bands keep their cells. | 81 | + | // The row widens by that room; other bands keep their cells. |
| 82 | func TestOverviewCascadeMaximizedColumnCards(t *testing.T) { | 82 | func TestOverviewCascadeMaximizedColumnCards(t *testing.T) { | ||
| 83 | // Four columns, three per band: band 0 holds 0..2, band 1 holds 3. | 83 | // Four columns, three per band: band 0 holds 0..2, band 1 holds 3. | ||
| 84 | for _, tc := range []struct { | 84 | for _, tc := range []struct { | ||
| @@ -97,12 +97,15 @@ func TestOverviewCascadeMaximizedColumnCards(t *testing.T) { | |||||
| 97 | w := cascadeWorkspace(tc.n) | 97 | w := cascadeWorkspace(tc.n) | ||
| 98 | w.Focus = tc.max | 98 | w.Focus = tc.max | ||
| 99 | w.maximize(tc.max) | 99 | w.maximize(tc.max) | ||
| 100 | - | tiles, _, sel := w.previewTiles() | 100 | + | tiles, span, sel := w.previewTiles() |
| 101 | g, h, s := w.gap(), w.Usable.H-2*w.gap(), w.bandCardStep() | 101 | g, h, s := w.gap(), w.Usable.H-2*w.gap(), w.bandCardStep() | ||
| 102 | off := 0 | 102 | off := 0 | ||
| 103 | if slices.ContainsFunc(tc.cards, func(k int) bool { return k != 0 }) { | 103 | if slices.ContainsFunc(tc.cards, func(k int) bool { return k != 0 }) { | ||
| 104 | off = 2 * s | 104 | off = 2 * s | ||
| 105 | } | 105 | } | ||
| 106 | + | if span != w.Usable.W+2*off { | |||
| 107 | + | t.Fatalf("n=%d max=%d span %d, want %d", tc.n, tc.max, span, w.Usable.W+2*off) | |||
| 108 | + | } | |||
| 106 | var order []int | 109 | var order []int | ||
| 107 | for _, p := range tiles { | 110 | for _, p := range tiles { | ||
| 108 | i := int(p.ID) - 1 | 111 | i := int(p.ID) - 1 | ||
| @@ -120,6 +123,9 @@ func TestOverviewCascadeMaximizedColumnCards(t *testing.T) { | |||||
| 120 | case k > 0: | 123 | case k > 0: | ||
| 121 | want.X = w.Usable.W - g + (2+k)*s - want.W | 124 | want.X = w.Usable.W - g + (2+k)*s - want.W | ||
| 122 | } | 125 | } | ||
| 126 | + | if p.Rect.X < 0 || p.Rect.X+p.Rect.W > span { | |||
| 127 | + | t.Fatalf("n=%d max=%d column %d %+v outside span %d", tc.n, tc.max, i, p.Rect, span) | |||
| 128 | + | } | |||
| 123 | if p.Hidden || p.Peek != (tc.cards[i] != 0) || p.Focused != (i == tc.max) || p.Rect != want { | 129 | if p.Hidden || p.Peek != (tc.cards[i] != 0) || p.Focused != (i == tc.max) || p.Rect != want { | ||
| 124 | t.Fatalf("n=%d max=%d column %d: %+v, want rect %+v card %v", tc.n, tc.max, i, p, want, tc.cards[i] != 0) | 130 | t.Fatalf("n=%d max=%d column %d: %+v, want rect %+v card %v", tc.n, tc.max, i, p, want, tc.cards[i] != 0) | ||
| 125 | } | 131 | } | ||
| @@ -198,9 +204,9 @@ func TestOverviewCascadeMaximizedCardPickRecordsWindow(t *testing.T) { | |||||
| 198 | } | 204 | } | ||
| 199 | } | 205 | } | ||
| 200 | 206 | ||||
| 201 | - | // Only the focused maximized column is inset for cards: a FullWidth column | 207 | + | // A FullWidth column outside the focused band fills its band, shifted like |
| 202 | - | // elsewhere fills its band. | 208 | + | // every tile by the room of the focused column's cards. |
| 203 | - | func TestOverviewCascadeUnfocusedMaximizedNotInset(t *testing.T) { | 209 | + | func TestOverviewCascadeUnfocusedMaximizedFillsBand(t *testing.T) { |
| 204 | w := cascadeWorkspace(6) | 210 | w := cascadeWorkspace(6) | ||
| 205 | w.SetGaps(8) | 211 | w.SetGaps(8) | ||
| 206 | w.Focus = 4 | 212 | w.Focus = 4 | ||