diff options
| author | Paul Buetow <paul@buetow.org> | 2026-03-06 08:27:34 +0200 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2026-03-06 08:27:34 +0200 |
| commit | 0a69582e7f8111c2a508d8f062de91a06f296974 (patch) | |
| tree | 99c2da1931920c00ea8163083e1a1a649bc7b2db /internal/tui/flamegraph/renderer_test.go | |
| parent | 07dc1db3180d86b5b6fc61563c0a5004098e26cc (diff) | |
Keep flame children visible under heavy rounding and clarify filter percent
Diffstat (limited to 'internal/tui/flamegraph/renderer_test.go')
| -rw-r--r-- | internal/tui/flamegraph/renderer_test.go | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/internal/tui/flamegraph/renderer_test.go b/internal/tui/flamegraph/renderer_test.go index 2bd93fc..efd8063 100644 --- a/internal/tui/flamegraph/renderer_test.go +++ b/internal/tui/flamegraph/renderer_test.go @@ -90,6 +90,25 @@ func TestBuildTerminalLayoutCullsSubCellFramesAndRespectsHeight(t *testing.T) { } } +func TestBuildTerminalLayoutKeepsChildrenVisibleWhenRoundingWouldCullAll(t *testing.T) { + children := make([]*snapshotNode, 0, 200) + for i := 0; i < 200; i++ { + children = append(children, &snapshotNode{Name: "c", Total: 1}) + } + snapshot := &snapshotNode{Name: "root", Children: children} + + frames := BuildTerminalLayout(snapshot, 120, 6) + depthOne := 0 + for _, frame := range frames { + if frame.Depth == 1 { + depthOne++ + } + } + if depthOne == 0 { + t.Fatalf("expected at least one visible depth-1 frame, got none") + } +} + func TestBuildTerminalLayoutUsesPathSeparatorAndColor(t *testing.T) { snapshot := &snapshotNode{ Name: "root", |
