Skip to content

Commit

Permalink
Move helper functions up.
Browse files Browse the repository at this point in the history
Test methods are now private to the JS module.
Only the Start() method is exported.
  • Loading branch information
ronyeh committed Sep 2, 2021
1 parent 9e8fb99 commit 6dad8b2
Show file tree
Hide file tree
Showing 64 changed files with 14,504 additions and 14,576 deletions.
1,787 changes: 895 additions & 892 deletions tests/accidental_tests.ts

Large diffs are not rendered by default.

699 changes: 355 additions & 344 deletions tests/annotation_tests.ts

Large diffs are not rendered by default.

662 changes: 331 additions & 331 deletions tests/articulation_tests.ts

Large diffs are not rendered by default.

1,217 changes: 608 additions & 609 deletions tests/auto_beam_formatting_tests.ts

Large diffs are not rendered by default.

808 changes: 402 additions & 406 deletions tests/bach_tests.ts

Large diffs are not rendered by default.

85 changes: 42 additions & 43 deletions tests/barline_tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,59 +14,58 @@ import { Barline, BarlineType } from 'stavebarline';
const BarlineTests = {
Start(): void {
QUnit.module('Barline');
test('Enums', this.enums);

test('Enums', enums);
const run = VexFlowTests.runTests;
run('Simple BarNotes', this.simple);
run('Style BarNotes', this.style);
run('Simple BarNotes', simple);
run('Style BarNotes', style);
},
};

enums(): void {
// VexFlow 4.0 renamed Barline.type => BarlineType.
// The old way still works, for backwards compatibility.
equal(Barline.type, BarlineType);
},
function enums(): void {
// VexFlow 4.0 renamed Barline.type => BarlineType.
// The old way still works, for backwards compatibility.
equal(Barline.type, BarlineType);
}

simple(options: TestOptions): void {
const f = VexFlowTests.makeFactory(options, 380, 160);
const stave = f.Stave();
function simple(options: TestOptions): void {
const f = VexFlowTests.makeFactory(options, 380, 160);
const stave = f.Stave();

const notes = [
f.StaveNote({ keys: ['d/4', 'e/4', 'f/4'], stem_direction: -1, duration: '2' }),
f.BarNote({ type: 'single' }), // => f.BarNote({ type: BarlineType.SINGLE })
f
.StaveNote({ keys: ['c/4', 'f/4', 'a/4'], stem_direction: -1, duration: '2' })
.addAccidental(0, f.Accidental({ type: 'n' }))
.addAccidental(1, f.Accidental({ type: '#' })),
];
const notes = [
f.StaveNote({ keys: ['d/4', 'e/4', 'f/4'], stem_direction: -1, duration: '2' }),
f.BarNote({ type: 'single' }), // => f.BarNote({ type: BarlineType.SINGLE })
f
.StaveNote({ keys: ['c/4', 'f/4', 'a/4'], stem_direction: -1, duration: '2' })
.addAccidental(0, f.Accidental({ type: 'n' }))
.addAccidental(1, f.Accidental({ type: '#' })),
];

const voice = f.Voice().addTickables(notes);
f.Formatter().joinVoices([voice]).formatToStave([voice], stave);
f.draw();
const voice = f.Voice().addTickables(notes);
f.Formatter().joinVoices([voice]).formatToStave([voice], stave);
f.draw();

ok(true, 'Simple Test');
},
ok(true, 'Simple Test');
}

style(options: TestOptions): void {
const f = VexFlowTests.makeFactory(options, 380, 160);
const stave = f.Stave();
function style(options: TestOptions): void {
const f = VexFlowTests.makeFactory(options, 380, 160);
const stave = f.Stave();

const notes = [
f.StaveNote({ keys: ['d/4', 'e/4', 'f/4'], stem_direction: -1, duration: '2' }),
f.BarNote({ type: 'single' }), // => f.BarNote({ type: BarlineType.SINGLE })
f
.StaveNote({ keys: ['c/4', 'f/4', 'a/4'], stem_direction: -1, duration: '2' })
.addAccidental(0, f.Accidental({ type: 'n' }))
.addAccidental(1, f.Accidental({ type: '#' })),
];
notes[1].setStyle({ shadowBlur: 15, shadowColor: 'blue', fillStyle: 'blue', strokeStyle: 'blue' });
const notes = [
f.StaveNote({ keys: ['d/4', 'e/4', 'f/4'], stem_direction: -1, duration: '2' }),
f.BarNote({ type: 'single' }), // => f.BarNote({ type: BarlineType.SINGLE })
f
.StaveNote({ keys: ['c/4', 'f/4', 'a/4'], stem_direction: -1, duration: '2' })
.addAccidental(0, f.Accidental({ type: 'n' }))
.addAccidental(1, f.Accidental({ type: '#' })),
];
notes[1].setStyle({ shadowBlur: 15, shadowColor: 'blue', fillStyle: 'blue', strokeStyle: 'blue' });

const voice = f.Voice().addTickables(notes);
f.Formatter().joinVoices([voice]).formatToStave([voice], stave);
f.draw();
const voice = f.Voice().addTickables(notes);
f.Formatter().joinVoices([voice]).formatToStave([voice], stave);
f.draw();

ok(true, 'Style');
},
};
ok(true, 'Style');
}

export { BarlineTests };
Loading

0 comments on commit 6dad8b2

Please sign in to comment.