@@ -2,8 +2,10 @@ import { describe, expect, it } from "vitest";
|
||||
import {
|
||||
constantTempoMidi,
|
||||
cropMidi,
|
||||
deleteNote,
|
||||
dropChannel,
|
||||
encodeMidi,
|
||||
editNote,
|
||||
exportMidiCsv,
|
||||
exportMidiJson,
|
||||
noteSpans,
|
||||
@@ -262,4 +264,31 @@ describe("MIDI editing operations", () => {
|
||||
/outside MIDI/u,
|
||||
);
|
||||
});
|
||||
|
||||
it("edits and deletes one paired note without mutating its neighbours", () => {
|
||||
const source = documentFixture();
|
||||
const first = noteSpans(source)[0]!;
|
||||
const edited = editNote(source, first.onOrder, {
|
||||
note: 61,
|
||||
velocity: 77,
|
||||
startTick: 100,
|
||||
endTick: 700,
|
||||
});
|
||||
expect(noteSpans(edited)[0]).toMatchObject({
|
||||
note: 61,
|
||||
velocity: 77,
|
||||
startTick: 100,
|
||||
endTick: 700,
|
||||
});
|
||||
expect(noteSpans(source)[0]?.note).toBe(60);
|
||||
expect(noteSpans(deleteNote(edited, first.onOrder))).toHaveLength(1);
|
||||
expect(() =>
|
||||
editNote(source, first.onOrder, {
|
||||
note: 60,
|
||||
velocity: 100,
|
||||
startTick: 20,
|
||||
endTick: 20,
|
||||
}),
|
||||
).toThrow(/after its start/u);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user