Skip to content

Commit 256de47

Browse files
0xrinegadeclaude
andcommitted
test(ascii_graph): Fix animation test to use correct frame pattern
The test incorrectly assumed next_frame() would update existing cells. Animation actually works at draw-time: the frame counter determines where '•' bullets are placed when draw_flow_arrow() is called. Fixed by creating separate canvases at different frame values, which properly tests the frame-dependent animation logic: - Frame 0: bullets at positions where (x + 0) % 4 == 0 - Frame 1: bullets at positions where (x + 1) % 4 == 0 Test results: 554 passed, 0 failed, 17 ignored 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
1 parent 209b3ca commit 256de47

File tree

1 file changed

+19
-12
lines changed

1 file changed

+19
-12
lines changed

src/services/enhanced_ascii_graph.rs

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -469,18 +469,25 @@ mod tests {
469469
}
470470

471471
#[test]
472-
#[ignore = "animation frame change bug - bullets not moving"]
473472
fn test_flow_animation() {
474-
let mut canvas = EnhancedCanvas::new(100, 20);
475-
476-
canvas.draw_flow_arrow(10, 10, 50, 10, 1_000_000.0, false, 1);
477-
canvas.next_frame();
478-
479-
let output1 = canvas.render(false);
480-
canvas.next_frame();
481-
let output2 = canvas.render(false);
482-
483-
// Animation should change output
484-
assert_ne!(output1, output2);
473+
// Animation works by drawing at different frame values
474+
// The frame counter affects where '•' bullets are placed during draw_flow_arrow()
475+
476+
// Frame 0: Draw arrow with initial bullet positions
477+
let mut canvas1 = EnhancedCanvas::new(100, 20);
478+
canvas1.draw_flow_arrow(10, 10, 50, 10, 1_000_000.0, false, 1);
479+
let output1 = canvas1.render(false);
480+
481+
// Frame 1: Create new canvas, advance frame, then draw
482+
// This simulates redrawing on a new frame (as real animation loop would)
483+
let mut canvas2 = EnhancedCanvas::new(100, 20);
484+
canvas2.next_frame(); // frame = 1
485+
canvas2.draw_flow_arrow(10, 10, 50, 10, 1_000_000.0, false, 1);
486+
let output2 = canvas2.render(false);
487+
488+
// Animation should change bullet positions
489+
// At frame=0: bullets at positions where (x + 0) % 4 == 0
490+
// At frame=1: bullets at positions where (x + 1) % 4 == 0
491+
assert_ne!(output1, output2, "Bullet positions should differ between frames");
485492
}
486493
}

0 commit comments

Comments
 (0)