summaryrefslogtreecommitdiff
path: root/internal/tui/flamegraph/renderer_test.go
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2026-03-06 08:02:58 +0200
committerPaul Buetow <paul@buetow.org>2026-03-06 08:02:58 +0200
commitc6ec3b3ee34c9e77daa7159e8c164e413c2101b5 (patch)
tree0b7bba3228caddbdc24614c1734560a64dcd7770 /internal/tui/flamegraph/renderer_test.go
parent1955effb0daa5269d1b4069f3fb5175dbc29793f (diff)
Improve flamegraph selection, filter, and zoom feedback
Diffstat (limited to 'internal/tui/flamegraph/renderer_test.go')
-rw-r--r--internal/tui/flamegraph/renderer_test.go28
1 files changed, 27 insertions, 1 deletions
diff --git a/internal/tui/flamegraph/renderer_test.go b/internal/tui/flamegraph/renderer_test.go
index eb111b8..2bd93fc 100644
--- a/internal/tui/flamegraph/renderer_test.go
+++ b/internal/tui/flamegraph/renderer_test.go
@@ -150,7 +150,7 @@ func TestRenderTerminalViewIncludesToolbarAndStatus(t *testing.T) {
frames := BuildTerminalLayout(snapshot, 80, 6)
out := RenderTerminalView(frames, 80, 6, 1, nil, nil, true, false, "")
- if !strings.Contains(out, "Flame | frames:2") {
+ if !strings.Contains(out, "Flame | view:root | frames:2") {
t.Fatalf("expected toolbar to include frame count, got %q", out)
}
if !strings.Contains(out, "Selected: child") {
@@ -158,6 +158,32 @@ func TestRenderTerminalViewIncludesToolbarAndStatus(t *testing.T) {
}
}
+func TestFrameLabelAddsSelectionAndMatchMarkers(t *testing.T) {
+ if got := frameLabel("child", 7, true, false); got != ">child<" {
+ t.Fatalf("expected selected marker label, got %q", got)
+ }
+ if got := frameLabel("child", 6, false, true); got != "*child" {
+ t.Fatalf("expected match marker label, got %q", got)
+ }
+}
+
+func TestRenderTerminalViewShowsPersistentFilterContext(t *testing.T) {
+ snapshot := &snapshotNode{
+ Name: "root",
+ Total: 10,
+ Children: []*snapshotNode{
+ {Name: "child", Total: 10},
+ },
+ }
+ frames := BuildTerminalLayout(snapshot, 80, 6)
+ matchSet := map[int]bool{1: true}
+
+ out := RenderTerminalView(frames, 80, 6, 1, nil, matchSet, true, false, "child")
+ if !strings.Contains(out, `Filter "child"`) {
+ t.Fatalf("expected filter context in status line, got %q", out)
+ }
+}
+
func TestRenderTerminalViewShowsDeepLevelTruncationHint(t *testing.T) {
snapshot := &snapshotNode{
Name: "root",