summaryrefslogtreecommitdiff
path: root/internal/tui/flamegraph/model_test.go
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2026-05-27 08:21:33 +0300
committerPaul Buetow <paul@buetow.org>2026-05-27 08:21:33 +0300
commit44fa9635c64477fe2e5a1205dd68e82c7c6b6ce9 (patch)
tree199096ffbbfce56dffb8b4ada609a4822b5099ff /internal/tui/flamegraph/model_test.go
parent4365542fc8c08f7ce11040fa62a94a78fba1c2e2 (diff)
flamegraph: show selected height metric in status line (zo)
Diffstat (limited to 'internal/tui/flamegraph/model_test.go')
-rw-r--r--internal/tui/flamegraph/model_test.go30
1 files changed, 30 insertions, 0 deletions
diff --git a/internal/tui/flamegraph/model_test.go b/internal/tui/flamegraph/model_test.go
index c5da062..80a86bb 100644
--- a/internal/tui/flamegraph/model_test.go
+++ b/internal/tui/flamegraph/model_test.go
@@ -890,6 +890,36 @@ func TestViewSelectionStatusUsesBytesLabelInBytesMode(t *testing.T) {
}
}
+func TestSelectionStatusLineIncludesSelectedHeightValueAndMaxShare(t *testing.T) {
+ m := NewModel(nil)
+ m.width = 220
+ m.height = 20
+ m.heightField = "duration"
+ m.frames = []tuiFrame{
+ {Name: "root", Depth: 0, Col: 0, Row: 0, Width: 120, Total: 100, Percent: 100, Path: "root", HeightTotal: 200},
+ {Name: "child", Depth: 1, Col: 0, Row: 1, Width: 60, Total: 40, Percent: 40, Path: "root" + pathSeparator + "child", HeightTotal: 50},
+ }
+ m.selectedIdx = 1
+ m.globalTotal = 100
+
+ line := m.selectionStatusLine()
+ if !strings.Contains(line, "height(duration)=50 (25.0% of max)") {
+ t.Fatalf("expected selected height metric fragment, got %q", line)
+ }
+}
+
+func TestSelectionStatusLineUsesHeightLabelWithoutSelectedValueWhenNoSelection(t *testing.T) {
+ m := NewModel(nil)
+ m.width = 220
+ m.height = 20
+ m.heightField = "duration"
+
+ line := m.selectionStatusLine()
+ if !strings.Contains(line, "height:duration") {
+ t.Fatalf("expected height field label without selected value when no frames, got %q", line)
+ }
+}
+
func TestViewFitsViewportHeightAndKeepsSearchFooterVisible(t *testing.T) {
m := NewModel(nil)
m.width = 100