vexflow 5.0.0-alpha.3 → 5.0.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -6
- package/build/cjs/vexflow-bravura.js +2 -2
- package/build/cjs/vexflow-bravura.js.map +1 -1
- package/build/cjs/vexflow-core.js +2 -2
- package/build/cjs/vexflow-core.js.map +1 -1
- package/build/cjs/vexflow-debug-with-tests.js +2066 -1877
- package/build/cjs/vexflow-debug-with-tests.js.map +1 -1
- package/build/cjs/vexflow-debug.js +1052 -993
- package/build/cjs/vexflow-debug.js.map +1 -1
- package/build/cjs/vexflow.js +2 -2
- package/build/cjs/vexflow.js.map +1 -1
- package/build/esm/src/accidental.js +22 -28
- package/build/esm/src/annotation.js +0 -2
- package/build/esm/src/barnote.js +3 -3
- package/build/esm/src/beam.js +26 -46
- package/build/esm/src/bend.js +11 -3
- package/build/esm/src/chordsymbol.js +0 -4
- package/build/esm/src/clef.js +0 -2
- package/build/esm/src/clefnote.js +6 -1
- package/build/esm/src/curve.js +8 -5
- package/build/esm/src/element.js +94 -118
- package/build/esm/src/factory.js +4 -4
- package/build/esm/src/flag.js +20 -0
- package/build/esm/src/fonts/gonville.js +1 -1
- package/build/esm/src/formatter.js +13 -21
- package/build/esm/src/fraction.js +15 -22
- package/build/esm/src/glyphnote.js +3 -4
- package/build/esm/src/gracenote.js +0 -2
- package/build/esm/src/gracenotegroup.js +17 -8
- package/build/esm/src/index.js +1 -0
- package/build/esm/src/keysignature.js +38 -31
- package/build/esm/src/keysignote.js +1 -1
- package/build/esm/src/metrics.js +58 -7
- package/build/esm/src/modifier.js +10 -23
- package/build/esm/src/multimeasurerest.js +16 -25
- package/build/esm/src/note.js +7 -0
- package/build/esm/src/notehead.js +6 -1
- package/build/esm/src/ornament.js +0 -2
- package/build/esm/src/pedalmarking.js +33 -41
- package/build/esm/src/registry.js +5 -19
- package/build/esm/src/stave.js +11 -19
- package/build/esm/src/stavebarline.js +2 -3
- package/build/esm/src/stavehairpin.js +1 -1
- package/build/esm/src/staveline.js +0 -4
- package/build/esm/src/stavemodifier.js +0 -2
- package/build/esm/src/stavenote.js +42 -68
- package/build/esm/src/staverepetition.js +3 -2
- package/build/esm/src/stavesection.js +13 -15
- package/build/esm/src/stavetempo.js +7 -13
- package/build/esm/src/stavetext.js +2 -2
- package/build/esm/src/stavetie.js +82 -40
- package/build/esm/src/stavevolta.js +3 -2
- package/build/esm/src/stem.js +0 -4
- package/build/esm/src/stemmablenote.js +5 -6
- package/build/esm/src/stringnumber.js +0 -2
- package/build/esm/src/svgcontext.js +5 -13
- package/build/esm/src/tabnote.js +2 -8
- package/build/esm/src/textbracket.js +0 -3
- package/build/esm/src/textnote.js +0 -2
- package/build/esm/src/tickable.js +13 -26
- package/build/esm/src/tickcontext.js +20 -2
- package/build/esm/src/timesignature.js +2 -4
- package/build/esm/src/timesignote.js +2 -0
- package/build/esm/src/tuplet.js +37 -30
- package/build/esm/src/version.js +3 -3
- package/build/esm/src/vexflow.js +6 -2
- package/build/esm/src/vibrato.js +6 -1
- package/build/esm/tests/accidental_tests.js +30 -17
- package/build/esm/tests/annotation_tests.js +12 -12
- package/build/esm/tests/articulation_tests.js +13 -13
- package/build/esm/tests/auto_beam_formatting_tests.js +33 -33
- package/build/esm/tests/beam_tests.js +1 -1
- package/build/esm/tests/bend_tests.js +7 -7
- package/build/esm/tests/chordsymbol_tests.js +8 -8
- package/build/esm/tests/clef_tests.js +5 -1
- package/build/esm/tests/curve_tests.js +34 -0
- package/build/esm/tests/{bach_tests.js → demo_petzold_tests.js} +7 -7
- package/build/esm/tests/dot_tests.js +4 -4
- package/build/esm/tests/formatter_tests.js +25 -25
- package/build/esm/tests/glyphnote_tests.js +6 -0
- package/build/esm/tests/gracenote_tests.js +2 -1
- package/build/esm/tests/gracetabnote_tests.js +1 -1
- package/build/esm/tests/index.js +1 -1
- package/build/esm/tests/key_clef_tests.js +6 -6
- package/build/esm/tests/keysignature_tests.js +20 -17
- package/build/esm/tests/notehead_tests.js +10 -7
- package/build/esm/tests/offscreencanvas_tests.js +1 -1
- package/build/esm/tests/ornament_tests.js +8 -8
- package/build/esm/tests/pedalmarking_tests.js +27 -0
- package/build/esm/tests/percussion_tests.js +6 -3
- package/build/esm/tests/renderer_tests.js +1 -1
- package/build/esm/tests/rests_tests.js +26 -26
- package/build/esm/tests/rhythm_tests.js +15 -15
- package/build/esm/tests/stave_tests.js +44 -43
- package/build/esm/tests/staveconnector_tests.js +73 -73
- package/build/esm/tests/stavehairpin_tests.js +1 -1
- package/build/esm/tests/stavemodifier_tests.js +3 -3
- package/build/esm/tests/stavenote_tests.js +29 -29
- package/build/esm/tests/stavetie_tests.js +29 -0
- package/build/esm/tests/stringnumber_tests.js +1 -1
- package/build/esm/tests/strokes_tests.js +1 -1
- package/build/esm/tests/style_tests.js +1 -1
- package/build/esm/tests/tabnote_tests.js +7 -7
- package/build/esm/tests/tabslide_tests.js +6 -6
- package/build/esm/tests/tabstave_tests.js +2 -1
- package/build/esm/tests/tabtie_tests.js +8 -8
- package/build/esm/tests/textnote_tests.js +1 -1
- package/build/esm/tests/threevoice_tests.js +2 -2
- package/build/esm/tests/timesignature_tests.js +23 -13
- package/build/esm/tests/vexflow_test_helpers.js +25 -39
- package/build/esm/tests/vibrato_tests.js +3 -3
- package/build/esm/tests/voice_tests.js +1 -1
- package/build/types/src/accidental.d.ts +19 -1
- package/build/types/src/annotation.d.ts +1 -1
- package/build/types/src/beam.d.ts +12 -1
- package/build/types/src/bend.d.ts +6 -0
- package/build/types/src/clefnote.d.ts +2 -0
- package/build/types/src/curve.d.ts +5 -4
- package/build/types/src/element.d.ts +23 -14
- package/build/types/src/factory.d.ts +2 -2
- package/build/types/src/flag.d.ts +12 -0
- package/build/types/src/fonts/gonville.d.ts +1 -1
- package/build/types/src/formatter.d.ts +5 -3
- package/build/types/src/fraction.d.ts +12 -7
- package/build/types/src/frethandfinger.d.ts +1 -1
- package/build/types/src/index.d.ts +1 -0
- package/build/types/src/keysignature.d.ts +7 -7
- package/build/types/src/metrics.d.ts +5 -0
- package/build/types/src/modifier.d.ts +3 -2
- package/build/types/src/multimeasurerest.d.ts +4 -1
- package/build/types/src/note.d.ts +2 -0
- package/build/types/src/pedalmarking.d.ts +2 -2
- package/build/types/src/registry.d.ts +1 -1
- package/build/types/src/stave.d.ts +1 -3
- package/build/types/src/stavebarline.d.ts +1 -1
- package/build/types/src/staveline.d.ts +1 -1
- package/build/types/src/stavemodifier.d.ts +0 -1
- package/build/types/src/stavenote.d.ts +2 -1
- package/build/types/src/staverepetition.d.ts +1 -1
- package/build/types/src/stavesection.d.ts +3 -4
- package/build/types/src/stavetempo.d.ts +4 -5
- package/build/types/src/stavetext.d.ts +1 -2
- package/build/types/src/stavetie.d.ts +39 -2
- package/build/types/src/stavevolta.d.ts +1 -2
- package/build/types/src/stemmablenote.d.ts +2 -3
- package/build/types/src/svgcontext.d.ts +1 -1
- package/build/types/src/tickable.d.ts +2 -1
- package/build/types/src/tickcontext.d.ts +30 -0
- package/build/types/src/tuplet.d.ts +2 -12
- package/build/types/src/typeguard.d.ts +1 -0
- package/package.json +33 -29
- package/tests/flow.html +2 -2
|
@@ -27,7 +27,7 @@ function drawOrnaments(options, contextBuilder) {
|
|
|
27
27
|
options.assert.expect(0);
|
|
28
28
|
const ctx = contextBuilder(options.elementId, 750, 195);
|
|
29
29
|
const stave = new Stave(10, 30, 700);
|
|
30
|
-
stave.setContext(ctx).
|
|
30
|
+
stave.setContext(ctx).drawWithStyle();
|
|
31
31
|
const notes = [
|
|
32
32
|
new StaveNote({ keys: ['c/4'], duration: '4', stemDirection: 1 }),
|
|
33
33
|
new StaveNote({ keys: ['c/4'], duration: '4', stemDirection: 1 }),
|
|
@@ -62,7 +62,7 @@ function drawOrnamentsDisplaced(options, contextBuilder) {
|
|
|
62
62
|
options.assert.expect(0);
|
|
63
63
|
const ctx = contextBuilder(options.elementId, 750, 195);
|
|
64
64
|
const stave = new Stave(10, 30, 700);
|
|
65
|
-
stave.setContext(ctx).
|
|
65
|
+
stave.setContext(ctx).drawWithStyle();
|
|
66
66
|
const notes = [
|
|
67
67
|
new StaveNote({ keys: ['a/5'], duration: '4', stemDirection: -1 }),
|
|
68
68
|
new StaveNote({ keys: ['a/5'], duration: '4', stemDirection: -1 }),
|
|
@@ -97,7 +97,7 @@ function drawOrnamentsDisplaced(options, contextBuilder) {
|
|
|
97
97
|
const addDelayedTurns = (f) => {
|
|
98
98
|
const context = f.getContext();
|
|
99
99
|
const stave = f.Stave({ x: 10, y: 30, width: 500 });
|
|
100
|
-
stave.setContext(context).
|
|
100
|
+
stave.setContext(context).drawWithStyle();
|
|
101
101
|
const notes = [
|
|
102
102
|
f.StaveNote({ keys: ['a/4'], duration: '4', stemDirection: 1 }),
|
|
103
103
|
f.StaveNote({ keys: ['a/4'], duration: '4', stemDirection: 1 }),
|
|
@@ -150,7 +150,7 @@ function drawOrnamentsDelayedMultipleVoices(options, contextBuilder) {
|
|
|
150
150
|
formatter.joinVoices([voice1]);
|
|
151
151
|
formatter.joinVoices([voice2]);
|
|
152
152
|
formatter.format([voice1, voice2], formatWidth);
|
|
153
|
-
stave.setContext(ctx).
|
|
153
|
+
stave.setContext(ctx).drawWithStyle();
|
|
154
154
|
voice1.draw(ctx, stave);
|
|
155
155
|
voice2.draw(ctx, stave);
|
|
156
156
|
}
|
|
@@ -159,7 +159,7 @@ function drawOrnamentsStacked(options) {
|
|
|
159
159
|
const f = VexFlowTests.makeFactory(options, 550, 195);
|
|
160
160
|
const ctx = f.getContext();
|
|
161
161
|
const stave = f.Stave({ x: 10, y: 30, width: 500 });
|
|
162
|
-
stave.setContext(ctx).
|
|
162
|
+
stave.setContext(ctx).drawWithStyle();
|
|
163
163
|
const notes = [
|
|
164
164
|
f.StaveNote({ keys: ['a/4'], duration: '4', stemDirection: 1 }),
|
|
165
165
|
f.StaveNote({ keys: ['a/4'], duration: '4', stemDirection: 1 }),
|
|
@@ -181,7 +181,7 @@ function drawOrnamentsWithAccidentals(options) {
|
|
|
181
181
|
const f = VexFlowTests.makeFactory(options, 650, 250);
|
|
182
182
|
const ctx = f.getContext();
|
|
183
183
|
const stave = f.Stave({ x: 10, y: 60, width: 600 });
|
|
184
|
-
stave.setContext(ctx).
|
|
184
|
+
stave.setContext(ctx).drawWithStyle();
|
|
185
185
|
const notes = [
|
|
186
186
|
f.StaveNote({ keys: ['f/4'], duration: '4', stemDirection: 1 }),
|
|
187
187
|
f.StaveNote({ keys: ['f/4'], duration: '4', stemDirection: 1 }),
|
|
@@ -221,7 +221,7 @@ function jazzOrnaments(options) {
|
|
|
221
221
|
}
|
|
222
222
|
return n;
|
|
223
223
|
};
|
|
224
|
-
const stave = new Stave(x, y, width).addClef('treble').setContext(ctx).
|
|
224
|
+
const stave = new Stave(x, y, width).addClef('treble').setContext(ctx).drawWithStyle();
|
|
225
225
|
const notes = [
|
|
226
226
|
note(keys, '4d', modifiers[0], stemDirection),
|
|
227
227
|
note(keys, '8', modifiers[1], stemDirection),
|
|
@@ -239,7 +239,7 @@ function jazzOrnaments(options) {
|
|
|
239
239
|
voice.addTickables(notes);
|
|
240
240
|
const formatter = new Formatter().joinVoices([voice]);
|
|
241
241
|
formatter.format([voice], width - Stave.defaultPadding - clefWidth);
|
|
242
|
-
stave.setContext(ctx).
|
|
242
|
+
stave.setContext(ctx).drawWithStyle();
|
|
243
243
|
voice.draw(ctx, stave);
|
|
244
244
|
}
|
|
245
245
|
options.assert.expect(0);
|
|
@@ -4,9 +4,14 @@ const PedalMarkingTests = {
|
|
|
4
4
|
QUnit.module('PedalMarking');
|
|
5
5
|
const run = VexFlowTests.runTests;
|
|
6
6
|
run('Simple Pedal 1', simple1);
|
|
7
|
+
run('Simple Pedal 1b', simple1b);
|
|
7
8
|
run('Simple Pedal 2', simple2);
|
|
9
|
+
run('Simple Pedal 2b', simple2b);
|
|
8
10
|
run('Simple Pedal 3', simple3);
|
|
11
|
+
run('Simple Pedal 3b', simple3b);
|
|
12
|
+
run('Release and Depress on Same Note 1b', releaseDepress1b);
|
|
9
13
|
run('Release and Depress on Same Note 1', releaseDepress1);
|
|
14
|
+
run('Release and Depress on Same Note 2b', releaseDepress2b);
|
|
10
15
|
run('Release and Depress on Same Note 2', releaseDepress2);
|
|
11
16
|
run('Custom Text 1', customTest1);
|
|
12
17
|
run('Custom Text 2', customTest2);
|
|
@@ -27,6 +32,23 @@ function createTest(makePedal) {
|
|
|
27
32
|
options.assert.ok(true, 'Must render');
|
|
28
33
|
};
|
|
29
34
|
}
|
|
35
|
+
function createTest2(makePedal) {
|
|
36
|
+
return (options) => {
|
|
37
|
+
const f = VexFlowTests.makeFactory(options, 550, 200);
|
|
38
|
+
const score = f.EasyScore();
|
|
39
|
+
const stave0 = f.Stave({ width: 250 }).addClef('treble');
|
|
40
|
+
const voice0 = score.voice(score.notes('b4/4, b4, b4, b4', { stem: 'down' }));
|
|
41
|
+
const voice0b = score.voice(score.notes('b5/4, b5, b5, b5', { stem: 'up' }));
|
|
42
|
+
f.Formatter().joinVoices([voice0, voice0b]).formatToStave([voice0, voice0b], stave0);
|
|
43
|
+
const stave1 = f.Stave({ width: 260, x: 250 });
|
|
44
|
+
const voice1 = score.voice(score.notes('c4/4, c4, c4, c4', { stem: 'down' }));
|
|
45
|
+
const voice1b = score.voice(score.notes('c5/4, c5, c5, c5/16, c5/16, c5/16, c5/16', { stem: 'up' }));
|
|
46
|
+
f.Formatter().joinVoices([voice1, voice1b]).formatToStave([voice1, voice1b], stave1);
|
|
47
|
+
makePedal(f, voice0.getTickables(), voice1.getTickables());
|
|
48
|
+
f.draw();
|
|
49
|
+
options.assert.ok(true, 'Must render');
|
|
50
|
+
};
|
|
51
|
+
}
|
|
30
52
|
function withSimplePedal(style) {
|
|
31
53
|
return (factory, notes0, notes1) => factory.PedalMarking({
|
|
32
54
|
notes: [notes0[0], notes0[2], notes0[3], notes1[3]],
|
|
@@ -44,6 +66,11 @@ const simple2 = createTest(withSimplePedal('bracket'));
|
|
|
44
66
|
const simple3 = createTest(withSimplePedal('mixed'));
|
|
45
67
|
const releaseDepress1 = createTest(withReleaseAndDepressedPedal('bracket'));
|
|
46
68
|
const releaseDepress2 = createTest(withReleaseAndDepressedPedal('mixed'));
|
|
69
|
+
const simple1b = createTest2(withSimplePedal('text'));
|
|
70
|
+
const simple2b = createTest2(withSimplePedal('bracket'));
|
|
71
|
+
const simple3b = createTest2(withSimplePedal('mixed'));
|
|
72
|
+
const releaseDepress1b = createTest2(withReleaseAndDepressedPedal('bracket'));
|
|
73
|
+
const releaseDepress2b = createTest2(withReleaseAndDepressedPedal('mixed'));
|
|
47
74
|
const customTest1 = createTest((factory, notes0, notes1) => {
|
|
48
75
|
const pedal = factory.PedalMarking({
|
|
49
76
|
notes: [notes0[0], notes1[3]],
|
|
@@ -18,13 +18,13 @@ const PercussionTests = {
|
|
|
18
18
|
};
|
|
19
19
|
function draw(options, contextBuilder) {
|
|
20
20
|
const ctx = contextBuilder(options.elementId, 400, 120);
|
|
21
|
-
new Stave(10, 10, 300).addClef('percussion').setContext(ctx).
|
|
21
|
+
new Stave(10, 10, 300).addClef('percussion').setContext(ctx).drawWithStyle();
|
|
22
22
|
options.assert.ok(true);
|
|
23
23
|
}
|
|
24
24
|
function showNote(struct, stave, ctx, x) {
|
|
25
25
|
const staveNote = new StaveNote(struct).setStave(stave);
|
|
26
26
|
new TickContext().addTickable(staveNote).preFormat().setX(x);
|
|
27
|
-
staveNote.setContext(ctx).
|
|
27
|
+
staveNote.setContext(ctx).drawWithStyle();
|
|
28
28
|
return staveNote;
|
|
29
29
|
}
|
|
30
30
|
function drawNotes(options, contextBuilder) {
|
|
@@ -46,7 +46,10 @@ function drawNotes(options, contextBuilder) {
|
|
|
46
46
|
];
|
|
47
47
|
const ctx = contextBuilder(options.elementId, notes.length * 25 + 100, 240);
|
|
48
48
|
for (let h = 0; h < 2; ++h) {
|
|
49
|
-
const stave = new Stave(10, 10 + h * 120, notes.length * 25 + 75)
|
|
49
|
+
const stave = new Stave(10, 10 + h * 120, notes.length * 25 + 75)
|
|
50
|
+
.addClef('percussion')
|
|
51
|
+
.setContext(ctx)
|
|
52
|
+
.drawWithStyle();
|
|
50
53
|
for (let i = 0; i < notes.length; ++i) {
|
|
51
54
|
const note = notes[i];
|
|
52
55
|
note.stemDirection = h === 0 ? -1 : 1;
|
|
@@ -18,7 +18,7 @@ const RendererTests = {
|
|
|
18
18
|
},
|
|
19
19
|
};
|
|
20
20
|
function drawStave(stave, context) {
|
|
21
|
-
stave.addClef('bass').addTimeSignature('3/4').
|
|
21
|
+
stave.addClef('bass').addTimeSignature('3/4').drawWithStyle();
|
|
22
22
|
Formatter.FormatAndDraw(context, stave, [
|
|
23
23
|
new StaveNote({ keys: ['C/4'], duration: '4' }),
|
|
24
24
|
new StaveNote({ keys: ['E/4'], duration: '4' }),
|
|
@@ -26,7 +26,7 @@ function setupContext(options, contextBuilder, width = 350, height = 150) {
|
|
|
26
26
|
const context = contextBuilder(options.elementId, width, height);
|
|
27
27
|
context.scale(0.9, 0.9);
|
|
28
28
|
context.font = '10pt Arial';
|
|
29
|
-
const stave = new Stave(10, 30, width).addClef('treble').addTimeSignature('4/4').setContext(context).
|
|
29
|
+
const stave = new Stave(10, 30, width).addClef('treble').addTimeSignature('4/4').setContext(context).drawWithStyle();
|
|
30
30
|
return { context, stave };
|
|
31
31
|
}
|
|
32
32
|
function basic(options, contextBuilder) {
|
|
@@ -79,9 +79,9 @@ function beamsUp(options, contextBuilder) {
|
|
|
79
79
|
const beam2 = new Beam(notes.slice(4, 8));
|
|
80
80
|
const beam3 = new Beam(notes.slice(8, 12));
|
|
81
81
|
Formatter.FormatAndDraw(context, stave, notes);
|
|
82
|
-
beam1.setContext(context).
|
|
83
|
-
beam2.setContext(context).
|
|
84
|
-
beam3.setContext(context).
|
|
82
|
+
beam1.setContext(context).drawWithStyle();
|
|
83
|
+
beam2.setContext(context).drawWithStyle();
|
|
84
|
+
beam3.setContext(context).drawWithStyle();
|
|
85
85
|
options.assert.ok(true, 'Auto Align Rests - Beams Up Test');
|
|
86
86
|
}
|
|
87
87
|
function beamsDown(options, contextBuilder) {
|
|
@@ -104,9 +104,9 @@ function beamsDown(options, contextBuilder) {
|
|
|
104
104
|
const beam2 = new Beam(notes.slice(4, 8));
|
|
105
105
|
const beam3 = new Beam(notes.slice(8, 12));
|
|
106
106
|
Formatter.FormatAndDraw(context, stave, notes);
|
|
107
|
-
beam1.setContext(context).
|
|
108
|
-
beam2.setContext(context).
|
|
109
|
-
beam3.setContext(context).
|
|
107
|
+
beam1.setContext(context).drawWithStyle();
|
|
108
|
+
beam2.setContext(context).drawWithStyle();
|
|
109
|
+
beam3.setContext(context).drawWithStyle();
|
|
110
110
|
options.assert.ok(true, 'Auto Align Rests - Beams Down Test');
|
|
111
111
|
}
|
|
112
112
|
function tupletsUp(options, contextBuilder) {
|
|
@@ -130,10 +130,10 @@ function tupletsUp(options, contextBuilder) {
|
|
|
130
130
|
const tuplet3 = new Tuplet(notes.slice(6, 9)).setTupletLocation(Tuplet.LOCATION_TOP);
|
|
131
131
|
const tuplet4 = new Tuplet(notes.slice(9, 12)).setTupletLocation(Tuplet.LOCATION_TOP);
|
|
132
132
|
Formatter.FormatAndDraw(context, stave, notes);
|
|
133
|
-
tuplet1.setContext(context).
|
|
134
|
-
tuplet2.setContext(context).
|
|
135
|
-
tuplet3.setContext(context).
|
|
136
|
-
tuplet4.setContext(context).
|
|
133
|
+
tuplet1.setContext(context).drawWithStyle();
|
|
134
|
+
tuplet2.setContext(context).drawWithStyle();
|
|
135
|
+
tuplet3.setContext(context).drawWithStyle();
|
|
136
|
+
tuplet4.setContext(context).drawWithStyle();
|
|
137
137
|
options.assert.ok(true, 'Auto Align Rests - Tuplets Stem Up Test');
|
|
138
138
|
}
|
|
139
139
|
function tupletsDown(options, contextBuilder) {
|
|
@@ -161,14 +161,14 @@ function tupletsDown(options, contextBuilder) {
|
|
|
161
161
|
const tuplet3 = new Tuplet(notes.slice(6, 9)).setTupletLocation(Tuplet.LOCATION_BOTTOM);
|
|
162
162
|
const tuplet4 = new Tuplet(notes.slice(9, 12)).setTupletLocation(Tuplet.LOCATION_BOTTOM);
|
|
163
163
|
Formatter.FormatAndDraw(context, stave, notes);
|
|
164
|
-
tuplet1.setContext(context).
|
|
165
|
-
tuplet2.setContext(context).
|
|
166
|
-
tuplet3.setContext(context).
|
|
167
|
-
tuplet4.setContext(context).
|
|
168
|
-
beam1.setContext(context).
|
|
169
|
-
beam2.setContext(context).
|
|
170
|
-
beam3.setContext(context).
|
|
171
|
-
beam4.setContext(context).
|
|
164
|
+
tuplet1.setContext(context).drawWithStyle();
|
|
165
|
+
tuplet2.setContext(context).drawWithStyle();
|
|
166
|
+
tuplet3.setContext(context).drawWithStyle();
|
|
167
|
+
tuplet4.setContext(context).drawWithStyle();
|
|
168
|
+
beam1.setContext(context).drawWithStyle();
|
|
169
|
+
beam2.setContext(context).drawWithStyle();
|
|
170
|
+
beam3.setContext(context).drawWithStyle();
|
|
171
|
+
beam4.setContext(context).drawWithStyle();
|
|
172
172
|
options.assert.ok(true, 'Auto Align Rests - Tuplets Stem Down Test');
|
|
173
173
|
}
|
|
174
174
|
function singleVoiceDefaultAlignment(options, contextBuilder) {
|
|
@@ -194,8 +194,8 @@ function singleVoiceDefaultAlignment(options, contextBuilder) {
|
|
|
194
194
|
const beam = new Beam(notes.slice(5, 9));
|
|
195
195
|
const tuplet = new Tuplet(notes.slice(9, 12)).setTupletLocation(Tuplet.LOCATION_TOP);
|
|
196
196
|
Formatter.FormatAndDraw(context, stave, notes);
|
|
197
|
-
tuplet.setContext(context).
|
|
198
|
-
beam.setContext(context).
|
|
197
|
+
tuplet.setContext(context).drawWithStyle();
|
|
198
|
+
beam.setContext(context).drawWithStyle();
|
|
199
199
|
options.assert.ok(true, 'Auto Align Rests - Default Test');
|
|
200
200
|
}
|
|
201
201
|
function singleVoiceAlignAll(options, contextBuilder) {
|
|
@@ -221,13 +221,13 @@ function singleVoiceAlignAll(options, contextBuilder) {
|
|
|
221
221
|
const beam = new Beam(notes.slice(5, 9));
|
|
222
222
|
const tuplet = new Tuplet(notes.slice(9, 12)).setTupletLocation(Tuplet.LOCATION_TOP);
|
|
223
223
|
Formatter.FormatAndDraw(context, stave, notes, { alignRests: true });
|
|
224
|
-
tuplet.setContext(context).
|
|
225
|
-
beam.setContext(context).
|
|
224
|
+
tuplet.setContext(context).drawWithStyle();
|
|
225
|
+
beam.setContext(context).drawWithStyle();
|
|
226
226
|
options.assert.ok(true, 'Auto Align Rests - Align All Test');
|
|
227
227
|
}
|
|
228
228
|
function multiVoice(options, contextBuilder) {
|
|
229
229
|
const ctx = contextBuilder(options.elementId, 600, 200);
|
|
230
|
-
const stave = new Stave(50, 10, 500).addClef('treble').setContext(ctx).addTimeSignature('4/4').
|
|
230
|
+
const stave = new Stave(50, 10, 500).addClef('treble').setContext(ctx).addTimeSignature('4/4').drawWithStyle();
|
|
231
231
|
const noteOnStave = (noteStruct) => new StaveNote(noteStruct).setStave(stave);
|
|
232
232
|
const notes1 = [
|
|
233
233
|
noteOnStave({ keys: ['c/4', 'e/4', 'g/4'], duration: '4' }),
|
|
@@ -252,8 +252,8 @@ function multiVoice(options, contextBuilder) {
|
|
|
252
252
|
const beam2_2 = new Beam(notes2.slice(4, 8));
|
|
253
253
|
voice2.draw(ctx);
|
|
254
254
|
voice1.draw(ctx);
|
|
255
|
-
beam2_1.setContext(ctx).
|
|
256
|
-
beam2_2.setContext(ctx).
|
|
255
|
+
beam2_1.setContext(ctx).drawWithStyle();
|
|
256
|
+
beam2_2.setContext(ctx).drawWithStyle();
|
|
257
257
|
options.assert.ok(true, 'Strokes Test Multi Voice');
|
|
258
258
|
}
|
|
259
259
|
VexFlowTests.register(RestsTests);
|
|
@@ -24,20 +24,20 @@ function drawBasic(options, contextBuilder) {
|
|
|
24
24
|
staveBar1.addClef('treble');
|
|
25
25
|
staveBar1.addTimeSignature('4/4');
|
|
26
26
|
staveBar1.addKeySignature('C');
|
|
27
|
-
staveBar1.setContext(ctx).
|
|
27
|
+
staveBar1.setContext(ctx).drawWithStyle();
|
|
28
28
|
const notesBar1 = [new StaveNote({ keys: ['b/4'], duration: '1s', stemDirection: -1 })];
|
|
29
29
|
Formatter.FormatAndDraw(ctx, staveBar1, notesBar1);
|
|
30
30
|
const staveBar2 = new Stave(staveBar1.getWidth() + staveBar1.getX(), staveBar1.getY(), 120);
|
|
31
31
|
staveBar2.setBegBarType(BarlineType.SINGLE);
|
|
32
32
|
staveBar2.setEndBarType(BarlineType.SINGLE);
|
|
33
|
-
staveBar2.setContext(ctx).
|
|
33
|
+
staveBar2.setContext(ctx).drawWithStyle();
|
|
34
34
|
const notesBar2 = [
|
|
35
35
|
new StaveNote({ keys: ['b/4'], duration: '2s', stemDirection: -1 }),
|
|
36
36
|
new StaveNote({ keys: ['b/4'], duration: '2s', stemDirection: -1 }),
|
|
37
37
|
];
|
|
38
38
|
Formatter.FormatAndDraw(ctx, staveBar2, notesBar2);
|
|
39
39
|
const staveBar3 = new Stave(staveBar2.getWidth() + staveBar2.getX(), staveBar2.getY(), 170);
|
|
40
|
-
staveBar3.setContext(ctx).
|
|
40
|
+
staveBar3.setContext(ctx).drawWithStyle();
|
|
41
41
|
const notesBar3 = [
|
|
42
42
|
new StaveNote({
|
|
43
43
|
keys: ['b/4'],
|
|
@@ -62,7 +62,7 @@ function drawBasic(options, contextBuilder) {
|
|
|
62
62
|
];
|
|
63
63
|
Formatter.FormatAndDraw(ctx, staveBar3, notesBar3);
|
|
64
64
|
const staveBar4 = new Stave(staveBar3.getWidth() + staveBar3.getX(), staveBar3.getY(), 200);
|
|
65
|
-
staveBar4.setContext(ctx).
|
|
65
|
+
staveBar4.setContext(ctx).drawWithStyle();
|
|
66
66
|
const notesBar4 = [
|
|
67
67
|
new StaveNote({
|
|
68
68
|
keys: ['b/4'],
|
|
@@ -116,7 +116,7 @@ function drawBeamedSlashNotes(options, contextBuilder) {
|
|
|
116
116
|
staveBar1.addClef('treble');
|
|
117
117
|
staveBar1.addTimeSignature('4/4');
|
|
118
118
|
staveBar1.addKeySignature('C');
|
|
119
|
-
staveBar1.setContext(ctx).
|
|
119
|
+
staveBar1.setContext(ctx).drawWithStyle();
|
|
120
120
|
const notesBar1Part1 = [
|
|
121
121
|
new StaveNote({
|
|
122
122
|
keys: ['b/4'],
|
|
@@ -165,8 +165,8 @@ function drawBeamedSlashNotes(options, contextBuilder) {
|
|
|
165
165
|
const beam2 = new Beam(notesBar1Part2);
|
|
166
166
|
const notesBar1 = notesBar1Part1.concat(notesBar1Part2);
|
|
167
167
|
Formatter.FormatAndDraw(ctx, staveBar1, notesBar1);
|
|
168
|
-
beam1.setContext(ctx).
|
|
169
|
-
beam2.setContext(ctx).
|
|
168
|
+
beam1.setContext(ctx).drawWithStyle();
|
|
169
|
+
beam2.setContext(ctx).drawWithStyle();
|
|
170
170
|
options.assert.expect(0);
|
|
171
171
|
}
|
|
172
172
|
function drawSlashAndBeamAndRests(options, contextBuilder) {
|
|
@@ -177,7 +177,7 @@ function drawSlashAndBeamAndRests(options, contextBuilder) {
|
|
|
177
177
|
staveBar1.addClef('treble');
|
|
178
178
|
staveBar1.addTimeSignature('4/4');
|
|
179
179
|
staveBar1.addKeySignature('F');
|
|
180
|
-
staveBar1.setContext(ctx).
|
|
180
|
+
staveBar1.setContext(ctx).drawWithStyle();
|
|
181
181
|
const notesBar1Part1 = [
|
|
182
182
|
new StaveNote({
|
|
183
183
|
keys: ['b/4'],
|
|
@@ -221,9 +221,9 @@ function drawSlashAndBeamAndRests(options, contextBuilder) {
|
|
|
221
221
|
];
|
|
222
222
|
const beam1 = new Beam(notesBar1Part1);
|
|
223
223
|
Formatter.FormatAndDraw(ctx, staveBar1, notesBar1Part1.concat(notesBar1Part2));
|
|
224
|
-
beam1.setContext(ctx).
|
|
224
|
+
beam1.setContext(ctx).drawWithStyle();
|
|
225
225
|
const staveBar2 = new Stave(staveBar1.getWidth() + staveBar1.getX(), staveBar1.getY(), 220);
|
|
226
|
-
staveBar2.setContext(ctx).
|
|
226
|
+
staveBar2.setContext(ctx).drawWithStyle();
|
|
227
227
|
const notesBar2 = [
|
|
228
228
|
new StaveNote({
|
|
229
229
|
keys: ['b/4'],
|
|
@@ -243,7 +243,7 @@ function drawSixtenthWithScratches(options, contextBuilder) {
|
|
|
243
243
|
staveBar1.addClef('treble');
|
|
244
244
|
staveBar1.addTimeSignature('4/4');
|
|
245
245
|
staveBar1.addKeySignature('F');
|
|
246
|
-
staveBar1.setContext(ctx).
|
|
246
|
+
staveBar1.setContext(ctx).drawWithStyle();
|
|
247
247
|
const notesBar1Part1 = [
|
|
248
248
|
new StaveNote({
|
|
249
249
|
keys: ['b/4'],
|
|
@@ -292,8 +292,8 @@ function drawSixtenthWithScratches(options, contextBuilder) {
|
|
|
292
292
|
const beam1 = new Beam(notesBar1Part1);
|
|
293
293
|
const beam2 = new Beam(notesBar1Part2);
|
|
294
294
|
Formatter.FormatAndDraw(ctx, staveBar1, notesBar1Part1.concat(notesBar1Part2));
|
|
295
|
-
beam1.setContext(ctx).
|
|
296
|
-
beam2.setContext(ctx).
|
|
295
|
+
beam1.setContext(ctx).drawWithStyle();
|
|
296
|
+
beam2.setContext(ctx).drawWithStyle();
|
|
297
297
|
options.assert.expect(0);
|
|
298
298
|
}
|
|
299
299
|
function drawThirtySecondWithScratches(options, contextBuilder) {
|
|
@@ -304,7 +304,7 @@ function drawThirtySecondWithScratches(options, contextBuilder) {
|
|
|
304
304
|
staveBar1.addClef('treble');
|
|
305
305
|
staveBar1.addTimeSignature('4/4');
|
|
306
306
|
staveBar1.addKeySignature('F');
|
|
307
|
-
staveBar1.setContext(ctx).
|
|
307
|
+
staveBar1.setContext(ctx).drawWithStyle();
|
|
308
308
|
const notesBar1Part1 = [
|
|
309
309
|
new StaveNote({
|
|
310
310
|
keys: ['b/4'],
|
|
@@ -350,7 +350,7 @@ function drawThirtySecondWithScratches(options, contextBuilder) {
|
|
|
350
350
|
notesBar1Part1[0].addModifier(new Annotation('C7').setFont('Times', VexFlowTests.Font.size + 3), 0);
|
|
351
351
|
const beam1 = new Beam(notesBar1Part1);
|
|
352
352
|
Formatter.FormatAndDraw(ctx, staveBar1, notesBar1Part1);
|
|
353
|
-
beam1.setContext(ctx).
|
|
353
|
+
beam1.setContext(ctx).drawWithStyle();
|
|
354
354
|
options.assert.expect(0);
|
|
355
355
|
}
|
|
356
356
|
VexFlowTests.register(RhythmTests);
|