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