diff options
| author | Paul Buetow <paul@buetow.org> | 2026-03-06 14:44:34 +0200 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2026-03-06 14:44:34 +0200 |
| commit | 479f399aae8d3b28d9714214ea624d4a8cc0e886 (patch) | |
| tree | 0609eee6378d170b3e6a4601560f58e98bf09cc8 /internal/tui/flamegraph/renderer_test.go | |
| parent | 3e08a3d199fdf603b7c0a4002ca9822b6ecf2575 (diff) | |
flamegraph: keep non-matches visible in filter and add pgup/pgdn selection jumps
Diffstat (limited to 'internal/tui/flamegraph/renderer_test.go')
| -rw-r--r-- | internal/tui/flamegraph/renderer_test.go | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/internal/tui/flamegraph/renderer_test.go b/internal/tui/flamegraph/renderer_test.go index 0f1587b..b85bceb 100644 --- a/internal/tui/flamegraph/renderer_test.go +++ b/internal/tui/flamegraph/renderer_test.go @@ -203,7 +203,7 @@ func TestRenderTerminalViewShowsPersistentFilterContext(t *testing.T) { } } -func TestRenderTerminalViewFilterOnlyShowsMatchingBranchToRoot(t *testing.T) { +func TestRenderTerminalViewFilterKeepsNonMatchingBranchesVisible(t *testing.T) { snapshot := &snapshotNode{ Name: "root", Total: 100, @@ -231,15 +231,18 @@ func TestRenderTerminalViewFilterOnlyShowsMatchingBranchToRoot(t *testing.T) { } matchSet := map[int]bool{needleIdx: true} - out := RenderTerminalView(frames, 80, 8, needleIdx, nil, matchSet, nil, 100, true, false, "needle") + out := RenderTerminalView(frames, 180, 8, needleIdx, nil, matchSet, nil, 100, true, false, "needle") if !strings.Contains(out, `Filter "needle": 60.0% system`) { t.Fatalf("expected filter status to report 60.0%% system share, got %q", out) } if !strings.Contains(out, "keep") || !strings.Contains(out, "needle") { t.Fatalf("expected matching branch to remain visible, got %q", out) } - if strings.Contains(out, "drop") || strings.Contains(out, "noise") { - t.Fatalf("expected non-matching branch to be hidden, got %q", out) + if !strings.Contains(out, "drop") || !strings.Contains(out, "noise") { + t.Fatalf("expected non-matching branch to remain visible (greyed), got %q", out) + } + if !strings.Contains(out, "100.00% filter") { + t.Fatalf("expected selected match share to be computed against filtered total, got %q", out) } } |
