test: update yank tests to verify clips are stopped after yank

Co-authored-by: aider (deepseek/deepseek-coder) <aider@aider.chat>
This commit is contained in:
Loic Coenen
2026-05-01 19:31:45 +00:00
parent e6d5d3d0fb
commit 2c02901d4e

View File

@@ -808,12 +808,11 @@ void test_yank_single_clip(void) {
engine->clips[clip_idx].state = CLIP_LOOPING; engine->clips[clip_idx].state = CLIP_LOOPING;
engine->clips[clip_idx].buffer_size = 100; engine->clips[clip_idx].buffer_size = 100;
// Simulate yanking the clip // Simulate yanking the clip - should stop it
int yank_buffer[1] = {clip_idx}; engine_trigger_clip(engine, clip_idx); // Toggle to stop
int yank_count = 1; engine_process_commands(engine);
assert(yank_buffer[0] == 15); assert(engine->clips[clip_idx].state == CLIP_STOPPED);
assert(yank_count == 1);
destroy_test_engine(engine); destroy_test_engine(engine);
printf("PASSED\n"); printf("PASSED\n");
@@ -831,18 +830,15 @@ void test_yank_visual_selection(void) {
engine->clips[clips[i]].buffer_size = 100; engine->clips[clips[i]].buffer_size = 100;
} }
// Simulate yanking the selection // Simulate yanking the selection - should stop all clips
int yank_buffer[4];
int yank_count = 4;
for (int i = 0; i < 4; i++) { for (int i = 0; i < 4; i++) {
yank_buffer[i] = clips[i]; engine_trigger_clip(engine, clips[i]); // Toggle to stop
} }
engine_process_commands(engine);
assert(yank_count == 4); for (int i = 0; i < 4; i++) {
assert(yank_buffer[0] == 18); assert(engine->clips[clips[i]].state == CLIP_STOPPED);
assert(yank_buffer[1] == 19); }
assert(yank_buffer[2] == 26);
assert(yank_buffer[3] == 27);
destroy_test_engine(engine); destroy_test_engine(engine);
printf("PASSED\n"); printf("PASSED\n");
@@ -1140,16 +1136,16 @@ void test_visual_yank_then_escape(void) {
engine->clips[clips[i]].buffer_size = 100; engine->clips[clips[i]].buffer_size = 100;
} }
// Simulate yanking the selection // Simulate yanking the selection - should stop all clips
int yank_buffer[4];
int yank_count = 4;
for (int i = 0; i < 4; i++) { for (int i = 0; i < 4; i++) {
yank_buffer[i] = clips[i]; engine_trigger_clip(engine, clips[i]); // Toggle to stop
} }
engine_process_commands(engine);
assert(yank_count == 4); // Verify clips are stopped
assert(yank_buffer[0] == 18); for (int i = 0; i < 4; i++) {
assert(yank_buffer[3] == 27); assert(engine->clips[clips[i]].state == CLIP_STOPPED);
}
// Simulate returning to normal mode // Simulate returning to normal mode
UIMode current_mode = MODE_NORMAL; UIMode current_mode = MODE_NORMAL;