summaryrefslogtreecommitdiff
path: root/internal/tui/dashboard/histogram_test.go
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2026-02-26 09:47:28 +0200
committerPaul Buetow <paul@buetow.org>2026-02-26 09:47:28 +0200
commit81ffb947201690088ef25a1839a8993bbfc27f03 (patch)
tree948400add2b7df214c1587f04fe4ec9bd51c439a /internal/tui/dashboard/histogram_test.go
parentad4d7fca20d80f71ccabef3281e3f80081f4db62 (diff)
tui: fix responsive layout and stream viewport chrome
Diffstat (limited to 'internal/tui/dashboard/histogram_test.go')
-rw-r--r--internal/tui/dashboard/histogram_test.go31
1 files changed, 31 insertions, 0 deletions
diff --git a/internal/tui/dashboard/histogram_test.go b/internal/tui/dashboard/histogram_test.go
index 9da1c47..7790394 100644
--- a/internal/tui/dashboard/histogram_test.go
+++ b/internal/tui/dashboard/histogram_test.go
@@ -5,6 +5,8 @@ import (
"testing"
"ior/internal/statsengine"
+
+ "github.com/charmbracelet/lipgloss"
)
func TestRenderHistogramNoBuckets(t *testing.T) {
@@ -74,3 +76,32 @@ func TestRenderHistogramTruncatesForSmallHeight(t *testing.T) {
t.Fatalf("expected histogram rows to be truncated for small height: %q", out)
}
}
+
+func TestRenderLatencyGapsTabDoesNotOverflowWidth(t *testing.T) {
+ snap := statsengine.NewSnapshot(
+ []float64{10, 20, 15, 30, 18, 35},
+ []float64{2, 4, 3, 5, 7, 6},
+ nil,
+ nil,
+ nil,
+ nil,
+ statsengine.NewHistogramSnapshot(6, []statsengine.HistogramBucketSnapshot{
+ {Label: "[0,1us)", Count: 1},
+ {Label: "[1us,10us)", Count: 2},
+ {Label: "[10us,100us)", Count: 3},
+ }),
+ statsengine.NewHistogramSnapshot(6, []statsengine.HistogramBucketSnapshot{
+ {Label: "[0,1us)", Count: 1},
+ {Label: "[1us,10us)", Count: 2},
+ {Label: "[10us,100us)", Count: 3},
+ }),
+ )
+
+ const width = 100
+ out := renderLatencyGapsTab(&snap, width, 24)
+ for _, line := range strings.Split(out, "\n") {
+ if lipgloss.Width(line) > width {
+ t.Fatalf("latency/gaps line exceeds width %d: got %d in %q", width, lipgloss.Width(line), line)
+ }
+ }
+}