summaryrefslogtreecommitdiff
path: root/internal/tui/flamegraph/renderer_test.go
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2026-03-06 08:27:34 +0200
committerPaul Buetow <paul@buetow.org>2026-03-06 08:27:34 +0200
commit0a69582e7f8111c2a508d8f062de91a06f296974 (patch)
tree99c2da1931920c00ea8163083e1a1a649bc7b2db /internal/tui/flamegraph/renderer_test.go
parent07dc1db3180d86b5b6fc61563c0a5004098e26cc (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.go19
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",