feat: added sheet music (stuff notation) view to the piano roll window MIDI mode

This commit is contained in:
Xiaohan-Tian
2026-05-09 23:50:02 -07:00
parent 841575e01f
commit d69b3924e5
14 changed files with 1440 additions and 80 deletions
@@ -40,6 +40,11 @@ vi.mock('../../core/KGCore', () => ({
describe('PianoRollToolbar', () => {
const baseProps = {
sheetMusicViewEnabled: false,
onSheetMusicViewToggle: vi.fn(),
sheetQuantization: '16,48',
onSheetQuantizationChange: vi.fn(),
sheetQuantizationOptions: ['16,48', '32,96'],
activeTool: 'pointer' as const,
onToolSelect: vi.fn(),
quantPosition: '1/8',
@@ -72,6 +77,7 @@ describe('PianoRollToolbar', () => {
expect(screen.getByRole('button', { name: 'Toggle automation lane' })).toBeInTheDocument();
expect(screen.getByRole('button', { name: /Pitch Bend/i })).toBeInTheDocument();
expect(screen.getByRole('button', { name: 'Sheet Music View' })).toBeInTheDocument();
fireEvent.click(screen.getByRole('button', { name: 'Toggle automation lane' }));
expect(onAutomationToggle).toHaveBeenCalledTimes(1);
@@ -109,4 +115,19 @@ describe('PianoRollToolbar', () => {
expect(screen.queryByRole('button', { name: 'Toggle automation lane' })).not.toBeInTheDocument();
expect(screen.queryByRole('button', { name: /Pitch Bend/i })).not.toBeInTheDocument();
});
it('shows only the sheet controls when sheet mode is enabled', () => {
render(
<PianoRollToolbar
{...baseProps}
sheetMusicViewEnabled={true}
mode="midi-edit"
/>
);
expect(screen.getByRole('button', { name: 'Sheet Music View' })).toBeInTheDocument();
expect(screen.getByRole('button', { name: /16,48/i })).toBeInTheDocument();
expect(screen.queryByRole('button', { name: 'Pointer Tool' })).not.toBeInTheDocument();
expect(screen.queryByRole('button', { name: /Pitch Bend/i })).not.toBeInTheDocument();
});
});