vexflow 4.0.1-beta.0 → 4.0.1-beta.1
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/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 +126 -26
- package/build/cjs/vexflow-debug-with-tests.js.map +1 -1
- package/build/cjs/vexflow-debug.js +94 -26
- package/build/cjs/vexflow-debug.js.map +1 -1
- package/build/cjs/vexflow-gonville.js +2 -2
- package/build/cjs/vexflow-gonville.js.map +1 -1
- package/build/cjs/vexflow-petaluma.js +2 -2
- package/build/cjs/vexflow-petaluma.js.map +1 -1
- package/build/cjs/vexflow.js +2 -2
- package/build/cjs/vexflow.js.map +1 -1
- package/build/esm/src/version.js +3 -3
- package/package.json +1 -1
- package/src/note.ts +2 -2
- package/src/stavenote.ts +80 -16
- package/build/esm/entry/vexflow-bravura.js +0 -11
- package/build/esm/entry/vexflow-core.js +0 -54
- package/build/esm/entry/vexflow-debug-with-tests.js +0 -4
- package/build/esm/entry/vexflow-debug.js +0 -3
- package/build/esm/entry/vexflow-font-bravura.js +0 -7
- package/build/esm/entry/vexflow-font-custom.js +0 -7
- package/build/esm/entry/vexflow-font-gonville.js +0 -7
- package/build/esm/entry/vexflow-font-petaluma.js +0 -7
- package/build/esm/entry/vexflow-gonville.js +0 -11
- package/build/esm/entry/vexflow-petaluma.js +0 -11
- package/build/esm/entry/vexflow.js +0 -9
- package/build/esm/src/accidental.js +0 -348
- package/build/esm/src/annotation.js +0 -213
- package/build/esm/src/articulation.js +0 -264
- package/build/esm/src/barnote.js +0 -58
- package/build/esm/src/beam.js +0 -632
- package/build/esm/src/bend.js +0 -202
- package/build/esm/src/boundingbox.js +0 -59
- package/build/esm/src/boundingboxcomputation.js +0 -107
- package/build/esm/src/canvascontext.js +0 -202
- package/build/esm/src/chordsymbol.js +0 -578
- package/build/esm/src/clef.js +0 -153
- package/build/esm/src/clefnote.js +0 -65
- package/build/esm/src/crescendo.js +0 -77
- package/build/esm/src/curve.js +0 -118
- package/build/esm/src/dot.js +0 -137
- package/build/esm/src/easyscore.js +0 -374
- package/build/esm/src/element.js +0 -216
- package/build/esm/src/factory.js +0 -440
- package/build/esm/src/flow.js +0 -275
- package/build/esm/src/font.js +0 -264
- package/build/esm/src/fonts/bravura_glyphs.js +0 -3239
- package/build/esm/src/fonts/bravura_metrics.js +0 -507
- package/build/esm/src/fonts/custom_glyphs.js +0 -78
- package/build/esm/src/fonts/custom_metrics.js +0 -5
- package/build/esm/src/fonts/gonville_glyphs.js +0 -828
- package/build/esm/src/fonts/gonville_metrics.js +0 -421
- package/build/esm/src/fonts/load_all.js +0 -10
- package/build/esm/src/fonts/load_bravura.js +0 -6
- package/build/esm/src/fonts/load_custom.js +0 -6
- package/build/esm/src/fonts/load_gonville.js +0 -6
- package/build/esm/src/fonts/load_petaluma.js +0 -6
- package/build/esm/src/fonts/petaluma_glyphs.js +0 -1335
- package/build/esm/src/fonts/petaluma_metrics.js +0 -536
- package/build/esm/src/fonts/petalumascript_glyphs.js +0 -863
- package/build/esm/src/fonts/robotoslab_glyphs.js +0 -863
- package/build/esm/src/fonts/textfonts.js +0 -44
- package/build/esm/src/formatter.js +0 -568
- package/build/esm/src/fraction.js +0 -171
- package/build/esm/src/frethandfinger.js +0 -156
- package/build/esm/src/ghostnote.js +0 -50
- package/build/esm/src/glyph.js +0 -331
- package/build/esm/src/glyphnote.js +0 -55
- package/build/esm/src/gracenote.js +0 -133
- package/build/esm/src/gracenotegroup.js +0 -128
- package/build/esm/src/gracetabnote.js +0 -12
- package/build/esm/src/index.js +0 -91
- package/build/esm/src/keymanager.js +0 -99
- package/build/esm/src/keysignature.js +0 -250
- package/build/esm/src/keysignote.js +0 -28
- package/build/esm/src/modifier.js +0 -128
- package/build/esm/src/modifiercontext.js +0 -110
- package/build/esm/src/multimeasurerest.js +0 -173
- package/build/esm/src/music.js +0 -322
- package/build/esm/src/note.js +0 -371
- package/build/esm/src/notehead.js +0 -169
- package/build/esm/src/notesubgroup.js +0 -59
- package/build/esm/src/ornament.js +0 -206
- package/build/esm/src/parenthesis.js +0 -76
- package/build/esm/src/parser.js +0 -164
- package/build/esm/src/pedalmarking.js +0 -192
- package/build/esm/src/registry.js +0 -81
- package/build/esm/src/rendercontext.js +0 -24
- package/build/esm/src/renderer.js +0 -112
- package/build/esm/src/repeatnote.js +0 -22
- package/build/esm/src/stave.js +0 -547
- package/build/esm/src/stavebarline.js +0 -182
- package/build/esm/src/staveconnector.js +0 -196
- package/build/esm/src/stavehairpin.js +0 -120
- package/build/esm/src/staveline.js +0 -218
- package/build/esm/src/stavemodifier.js +0 -77
- package/build/esm/src/stavenote.js +0 -799
- package/build/esm/src/staverepetition.js +0 -155
- package/build/esm/src/stavesection.js +0 -58
- package/build/esm/src/stavetempo.js +0 -91
- package/build/esm/src/stavetext.js +0 -82
- package/build/esm/src/stavetie.js +0 -141
- package/build/esm/src/stavevolta.js +0 -67
- package/build/esm/src/stem.js +0 -131
- package/build/esm/src/stemmablenote.js +0 -193
- package/build/esm/src/stringnumber.js +0 -231
- package/build/esm/src/strokes.js +0 -200
- package/build/esm/src/svgcontext.js +0 -414
- package/build/esm/src/system.js +0 -116
- package/build/esm/src/tables.js +0 -1102
- package/build/esm/src/tabnote.js +0 -299
- package/build/esm/src/tabslide.js +0 -76
- package/build/esm/src/tabstave.js +0 -17
- package/build/esm/src/tabtie.js +0 -19
- package/build/esm/src/textbracket.js +0 -144
- package/build/esm/src/textdynamics.js +0 -81
- package/build/esm/src/textformatter.js +0 -177
- package/build/esm/src/textnote.js +0 -176
- package/build/esm/src/tickable.js +0 -214
- package/build/esm/src/tickcontext.js +0 -170
- package/build/esm/src/timesigglyph.js +0 -85
- package/build/esm/src/timesignature.js +0 -89
- package/build/esm/src/timesignote.js +0 -32
- package/build/esm/src/tremolo.js +0 -47
- package/build/esm/src/tuning.js +0 -54
- package/build/esm/src/tuplet.js +0 -240
- package/build/esm/src/typeguard.js +0 -30
- package/build/esm/src/util.js +0 -58
- package/build/esm/src/vex.js +0 -51
- package/build/esm/src/vibrato.js +0 -100
- package/build/esm/src/vibratobracket.js +0 -50
- package/build/esm/src/voice.js +0 -187
- package/build/esm/src/web.js +0 -15
- package/build/esm/tests/accidental_tests.js +0 -974
- package/build/esm/tests/annotation_tests.js +0 -377
- package/build/esm/tests/articulation_tests.js +0 -365
- package/build/esm/tests/auto_beam_formatting_tests.js +0 -548
- package/build/esm/tests/bach_tests.js +0 -335
- package/build/esm/tests/barline_tests.js +0 -52
- package/build/esm/tests/beam_tests.js +0 -595
- package/build/esm/tests/bend_tests.js +0 -215
- package/build/esm/tests/boundingbox_tests.js +0 -53
- package/build/esm/tests/boundingboxcomputation_tests.js +0 -183
- package/build/esm/tests/chordsymbol_tests.js +0 -320
- package/build/esm/tests/clef_tests.js +0 -131
- package/build/esm/tests/curve_tests.js +0 -118
- package/build/esm/tests/dot_tests.js +0 -123
- package/build/esm/tests/easyscore_tests.js +0 -459
- package/build/esm/tests/factory_tests.js +0 -44
- package/build/esm/tests/font_tests.js +0 -135
- package/build/esm/tests/formatter/framestack.js +0 -61
- package/build/esm/tests/formatter/tests.js +0 -203
- package/build/esm/tests/formatter_tests.js +0 -669
- package/build/esm/tests/fraction_tests.js +0 -72
- package/build/esm/tests/ghostnote_tests.js +0 -77
- package/build/esm/tests/glyphnote_tests.js +0 -113
- package/build/esm/tests/gracenote_tests.js +0 -370
- package/build/esm/tests/gracetabnote_tests.js +0 -79
- package/build/esm/tests/index.js +0 -68
- package/build/esm/tests/key_clef_tests.js +0 -103
- package/build/esm/tests/keymanager_tests.js +0 -68
- package/build/esm/tests/keysignature_tests.js +0 -308
- package/build/esm/tests/mocks.js +0 -71
- package/build/esm/tests/modifier_tests.js +0 -24
- package/build/esm/tests/multimeasurerest_tests.js +0 -141
- package/build/esm/tests/music_tests.js +0 -161
- package/build/esm/tests/notehead_tests.js +0 -137
- package/build/esm/tests/notesubgroup_tests.js +0 -149
- package/build/esm/tests/offscreencanvas_tests.js +0 -47
- package/build/esm/tests/ornament_tests.js +0 -298
- package/build/esm/tests/parser_tests.js +0 -122
- package/build/esm/tests/pedalmarking_tests.js +0 -64
- package/build/esm/tests/percussion_tests.js +0 -180
- package/build/esm/tests/registry_tests.js +0 -64
- package/build/esm/tests/renderer_tests.js +0 -113
- package/build/esm/tests/rests_tests.js +0 -248
- package/build/esm/tests/rhythm_tests.js +0 -357
- package/build/esm/tests/stave_tests.js +0 -560
- package/build/esm/tests/staveconnector_tests.js +0 -402
- package/build/esm/tests/stavehairpin_tests.js +0 -90
- package/build/esm/tests/staveline_tests.js +0 -122
- package/build/esm/tests/stavemodifier_tests.js +0 -51
- package/build/esm/tests/stavenote_tests.js +0 -835
- package/build/esm/tests/stavetie_tests.js +0 -108
- package/build/esm/tests/stringnumber_tests.js +0 -259
- package/build/esm/tests/strokes_tests.js +0 -275
- package/build/esm/tests/style_tests.js +0 -98
- package/build/esm/tests/support/qunit.js +0 -2765
- package/build/esm/tests/tabnote_tests.js +0 -474
- package/build/esm/tests/tabslide_tests.js +0 -135
- package/build/esm/tests/tabstave_tests.js +0 -23
- package/build/esm/tests/tabtie_tests.js +0 -173
- package/build/esm/tests/textbracket_tests.js +0 -100
- package/build/esm/tests/textformatter_tests.js +0 -24
- package/build/esm/tests/textnote_tests.js +0 -215
- package/build/esm/tests/threevoice_tests.js +0 -132
- package/build/esm/tests/tickcontext_tests.js +0 -36
- package/build/esm/tests/timesignature_tests.js +0 -134
- package/build/esm/tests/tremolo_tests.js +0 -75
- package/build/esm/tests/tuning_tests.js +0 -56
- package/build/esm/tests/tuplet_tests.js +0 -450
- package/build/esm/tests/typeguard_tests.js +0 -82
- package/build/esm/tests/vexflow_test_helpers.js +0 -266
- package/build/esm/tests/vf_prefix_tests.js +0 -115
- package/build/esm/tests/vibrato_tests.js +0 -92
- package/build/esm/tests/vibratobracket_tests.js +0 -45
- package/build/esm/tests/voice_tests.js +0 -69
- package/build/types/entry/vexflow-bravura.d.ts +0 -3
- package/build/types/entry/vexflow-core.d.ts +0 -3
- package/build/types/entry/vexflow-debug.d.ts +0 -3
- package/build/types/entry/vexflow-font-bravura.d.ts +0 -3771
- package/build/types/entry/vexflow-font-custom.d.ts +0 -86
- package/build/types/entry/vexflow-font-gonville.d.ts +0 -1267
- package/build/types/entry/vexflow-font-petaluma.d.ts +0 -1896
- package/build/types/entry/vexflow-gonville.d.ts +0 -3
- package/build/types/entry/vexflow-petaluma.d.ts +0 -3
- package/build/types/entry/vexflow.d.ts +0 -3
- package/build/types/src/accidental.d.ts +0 -66
- package/build/types/src/annotation.d.ts +0 -60
- package/build/types/src/articulation.d.ts +0 -62
- package/build/types/src/barnote.d.ts +0 -29
- package/build/types/src/beam.d.ts +0 -124
- package/build/types/src/bend.d.ts +0 -73
- package/build/types/src/boundingbox.d.ts +0 -42
- package/build/types/src/boundingboxcomputation.d.ts +0 -33
- package/build/types/src/canvascontext.d.ts +0 -89
- package/build/types/src/chordsymbol.d.ts +0 -149
- package/build/types/src/clef.d.ts +0 -48
- package/build/types/src/clefnote.d.ts +0 -25
- package/build/types/src/crescendo.d.ts +0 -27
- package/build/types/src/curve.d.ts +0 -41
- package/build/types/src/dot.d.ts +0 -20
- package/build/types/src/easyscore.d.ts +0 -148
- package/build/types/src/element.d.ts +0 -202
- package/build/types/src/factory.d.ts +0 -271
- package/build/types/src/flow.d.ts +0 -245
- package/build/types/src/font.d.ts +0 -181
- package/build/types/src/fonts/bravura_glyphs.d.ts +0 -3239
- package/build/types/src/fonts/bravura_metrics.d.ts +0 -533
- package/build/types/src/fonts/custom_glyphs.d.ts +0 -78
- package/build/types/src/fonts/custom_metrics.d.ts +0 -5
- package/build/types/src/fonts/gonville_glyphs.d.ts +0 -828
- package/build/types/src/fonts/gonville_metrics.d.ts +0 -440
- package/build/types/src/fonts/load_all.d.ts +0 -1
- package/build/types/src/fonts/load_bravura.d.ts +0 -1
- package/build/types/src/fonts/load_custom.d.ts +0 -1
- package/build/types/src/fonts/load_gonville.d.ts +0 -1
- package/build/types/src/fonts/load_petaluma.d.ts +0 -1
- package/build/types/src/fonts/petaluma_glyphs.d.ts +0 -1335
- package/build/types/src/fonts/petaluma_metrics.d.ts +0 -562
- package/build/types/src/fonts/petalumascript_glyphs.d.ts +0 -863
- package/build/types/src/fonts/robotoslab_glyphs.d.ts +0 -863
- package/build/types/src/fonts/textfonts.d.ts +0 -1
- package/build/types/src/formatter.d.ts +0 -203
- package/build/types/src/fraction.d.ts +0 -62
- package/build/types/src/frethandfinger.d.ts +0 -22
- package/build/types/src/ghostnote.d.ts +0 -16
- package/build/types/src/glyph.d.ts +0 -139
- package/build/types/src/glyphnote.d.ts +0 -17
- package/build/types/src/gracenote.d.ts +0 -19
- package/build/types/src/gracenotegroup.d.ts +0 -33
- package/build/types/src/gracetabnote.d.ts +0 -5
- package/build/types/src/index.d.ts +0 -91
- package/build/types/src/keymanager.d.ts +0 -25
- package/build/types/src/keysignature.d.ts +0 -50
- package/build/types/src/keysignote.d.ts +0 -11
- package/build/types/src/modifier.d.ts +0 -97
- package/build/types/src/modifiercontext.d.ts +0 -45
- package/build/types/src/multimeasurerest.d.ts +0 -61
- package/build/types/src/music.d.ts +0 -91
- package/build/types/src/note.d.ts +0 -230
- package/build/types/src/notehead.d.ts +0 -70
- package/build/types/src/notesubgroup.d.ts +0 -18
- package/build/types/src/ornament.d.ts +0 -76
- package/build/types/src/parenthesis.d.ts +0 -22
- package/build/types/src/parser.d.ts +0 -45
- package/build/types/src/pedalmarking.d.ts +0 -69
- package/build/types/src/registry.d.ts +0 -40
- package/build/types/src/rendercontext.d.ts +0 -64
- package/build/types/src/renderer.d.ts +0 -35
- package/build/types/src/repeatnote.d.ts +0 -6
- package/build/types/src/stave.d.ts +0 -186
- package/build/types/src/stavebarline.d.ts +0 -28
- package/build/types/src/staveconnector.d.ts +0 -67
- package/build/types/src/stavehairpin.d.ts +0 -56
- package/build/types/src/staveline.d.ts +0 -57
- package/build/types/src/stavemodifier.d.ts +0 -44
- package/build/types/src/stavenote.d.ts +0 -154
- package/build/types/src/staverepetition.d.ts +0 -32
- package/build/types/src/stavesection.d.ts +0 -15
- package/build/types/src/stavetempo.d.ts +0 -25
- package/build/types/src/stavetext.d.ts +0 -25
- package/build/types/src/stavetie.d.ts +0 -59
- package/build/types/src/stavevolta.d.ts +0 -21
- package/build/types/src/stem.d.ts +0 -58
- package/build/types/src/stemmablenote.d.ts +0 -39
- package/build/types/src/stringnumber.d.ts +0 -27
- package/build/types/src/strokes.d.ts +0 -33
- package/build/types/src/svgcontext.d.ts +0 -131
- package/build/types/src/system.d.ts +0 -92
- package/build/types/src/tables.d.ts +0 -96
- package/build/types/src/tabnote.d.ts +0 -44
- package/build/types/src/tabslide.d.ts +0 -34
- package/build/types/src/tabstave.d.ts +0 -7
- package/build/types/src/tabtie.d.ts +0 -18
- package/build/types/src/textbracket.d.ts +0 -55
- package/build/types/src/textdynamics.d.ts +0 -39
- package/build/types/src/textformatter.d.ts +0 -109
- package/build/types/src/textnote.d.ts +0 -49
- package/build/types/src/tickable.d.ts +0 -140
- package/build/types/src/tickcontext.d.ts +0 -82
- package/build/types/src/timesigglyph.d.ts +0 -14
- package/build/types/src/timesignature.d.ts +0 -26
- package/build/types/src/timesignote.d.ts +0 -11
- package/build/types/src/tremolo.d.ts +0 -17
- package/build/types/src/tuning.d.ts +0 -23
- package/build/types/src/tuplet.d.ts +0 -105
- package/build/types/src/typeguard.d.ts +0 -99
- package/build/types/src/util.d.ts +0 -27
- package/build/types/src/version.d.ts +0 -3
- package/build/types/src/vex.d.ts +0 -18
- package/build/types/src/vibrato.d.ts +0 -29
- package/build/types/src/vibratobracket.d.ts +0 -33
- package/build/types/src/voice.d.ts +0 -108
- package/build/types/src/web.d.ts +0 -2
|
@@ -1,248 +0,0 @@
|
|
|
1
|
-
import { VexFlowTests } from './vexflow_test_helpers.js';
|
|
2
|
-
import { Beam } from '../src/beam.js';
|
|
3
|
-
import { Dot } from '../src/dot.js';
|
|
4
|
-
import { Flow } from '../src/flow.js';
|
|
5
|
-
import { Formatter } from '../src/formatter.js';
|
|
6
|
-
import { Stave } from '../src/stave.js';
|
|
7
|
-
import { StaveNote } from '../src/stavenote.js';
|
|
8
|
-
import { Tuplet } from '../src/tuplet.js';
|
|
9
|
-
import { Voice } from '../src/voice.js';
|
|
10
|
-
const RestsTests = {
|
|
11
|
-
Start() {
|
|
12
|
-
QUnit.module('Rests');
|
|
13
|
-
const run = VexFlowTests.runTests;
|
|
14
|
-
run('Rests - Dotted', basic);
|
|
15
|
-
run('Auto Align Rests - Beamed Notes Stems Up', beamsUp);
|
|
16
|
-
run('Auto Align Rests - Beamed Notes Stems Down', beamsDown);
|
|
17
|
-
run('Auto Align Rests - Tuplets Stems Up', tupletsUp);
|
|
18
|
-
run('Auto Align Rests - Tuplets Stems Down', tupletsDown);
|
|
19
|
-
run('Auto Align Rests - Single Voice (Default)', singleVoiceDefaultAlignment);
|
|
20
|
-
run('Auto Align Rests - Single Voice (Align All)', singleVoiceAlignAll);
|
|
21
|
-
run('Auto Align Rests - Multi Voice', multiVoice);
|
|
22
|
-
},
|
|
23
|
-
};
|
|
24
|
-
function setupContext(options, contextBuilder, width = 350, height = 150) {
|
|
25
|
-
const context = contextBuilder(options.elementId, width, height);
|
|
26
|
-
context.scale(0.9, 0.9);
|
|
27
|
-
context.fillStyle = '#221';
|
|
28
|
-
context.strokeStyle = '#221';
|
|
29
|
-
context.font = '10pt Arial';
|
|
30
|
-
const stave = new Stave(10, 30, width).addClef('treble').addTimeSignature('4/4').setContext(context).draw();
|
|
31
|
-
return { context, stave };
|
|
32
|
-
}
|
|
33
|
-
function basic(options, contextBuilder) {
|
|
34
|
-
const { context, stave } = setupContext(options, contextBuilder, 700);
|
|
35
|
-
const notes = [
|
|
36
|
-
new StaveNote({ keys: ['b/4'], stem_direction: 1, duration: 'wr' }),
|
|
37
|
-
new StaveNote({ keys: ['b/4'], stem_direction: 1, duration: 'hr' }),
|
|
38
|
-
new StaveNote({ keys: ['b/4'], stem_direction: 1, duration: '4r' }),
|
|
39
|
-
new StaveNote({ keys: ['b/4'], stem_direction: 1, duration: '8r' }),
|
|
40
|
-
new StaveNote({ keys: ['b/4'], stem_direction: 1, duration: '16r' }),
|
|
41
|
-
new StaveNote({ keys: ['b/4'], stem_direction: 1, duration: '32r' }),
|
|
42
|
-
new StaveNote({ keys: ['b/4'], stem_direction: 1, duration: '64r' }),
|
|
43
|
-
new StaveNote({ keys: ['b/4'], stem_direction: 1, duration: '128r' }),
|
|
44
|
-
];
|
|
45
|
-
Dot.buildAndAttach(notes, { all: true });
|
|
46
|
-
Formatter.FormatAndDraw(context, stave, notes);
|
|
47
|
-
ok(true, 'Dotted Rest Test');
|
|
48
|
-
}
|
|
49
|
-
const note = (noteStruct) => new StaveNote(noteStruct);
|
|
50
|
-
function beamsUp(options, contextBuilder) {
|
|
51
|
-
const { context, stave } = setupContext(options, contextBuilder, 600, 160);
|
|
52
|
-
const notes = [
|
|
53
|
-
note({ keys: ['e/5'], stem_direction: 1, duration: '8' }),
|
|
54
|
-
note({ keys: ['b/4'], stem_direction: 1, duration: '8r' }),
|
|
55
|
-
note({ keys: ['b/5'], stem_direction: 1, duration: '8' }),
|
|
56
|
-
note({ keys: ['c/5'], stem_direction: 1, duration: '8' }),
|
|
57
|
-
note({ keys: ['b/4', 'd/5', 'a/5'], stem_direction: 1, duration: '8' }),
|
|
58
|
-
note({ keys: ['b/4'], stem_direction: 1, duration: '8r' }),
|
|
59
|
-
note({ keys: ['b/4'], stem_direction: 1, duration: '8r' }),
|
|
60
|
-
note({ keys: ['c/4'], stem_direction: 1, duration: '8' }),
|
|
61
|
-
note({ keys: ['b/4', 'd/5', 'a/5'], stem_direction: 1, duration: '8' }),
|
|
62
|
-
note({ keys: ['b/4'], stem_direction: 1, duration: '8' }),
|
|
63
|
-
note({ keys: ['b/4'], stem_direction: 1, duration: '8r' }),
|
|
64
|
-
note({ keys: ['c/4'], stem_direction: 1, duration: '8' }),
|
|
65
|
-
];
|
|
66
|
-
const beam1 = new Beam(notes.slice(0, 4));
|
|
67
|
-
const beam2 = new Beam(notes.slice(4, 8));
|
|
68
|
-
const beam3 = new Beam(notes.slice(8, 12));
|
|
69
|
-
Formatter.FormatAndDraw(context, stave, notes);
|
|
70
|
-
beam1.setContext(context).draw();
|
|
71
|
-
beam2.setContext(context).draw();
|
|
72
|
-
beam3.setContext(context).draw();
|
|
73
|
-
ok(true, 'Auto Align Rests - Beams Up Test');
|
|
74
|
-
}
|
|
75
|
-
function beamsDown(options, contextBuilder) {
|
|
76
|
-
const { context, stave } = setupContext(options, contextBuilder, 600, 160);
|
|
77
|
-
const notes = [
|
|
78
|
-
note({ keys: ['a/5'], stem_direction: -1, duration: '8' }),
|
|
79
|
-
note({ keys: ['b/4'], stem_direction: -1, duration: '8r' }),
|
|
80
|
-
note({ keys: ['b/5'], stem_direction: -1, duration: '8' }),
|
|
81
|
-
note({ keys: ['c/5'], stem_direction: -1, duration: '8' }),
|
|
82
|
-
note({ keys: ['b/4', 'd/5', 'a/5'], stem_direction: -1, duration: '8' }),
|
|
83
|
-
note({ keys: ['b/4'], stem_direction: -1, duration: '8r' }),
|
|
84
|
-
note({ keys: ['b/4'], stem_direction: -1, duration: '8r' }),
|
|
85
|
-
note({ keys: ['e/4'], stem_direction: -1, duration: '8' }),
|
|
86
|
-
note({ keys: ['b/4', 'd/5', 'a/5'], stem_direction: -1, duration: '8' }),
|
|
87
|
-
note({ keys: ['b/4'], stem_direction: -1, duration: '8' }),
|
|
88
|
-
note({ keys: ['b/4'], stem_direction: -1, duration: '8r' }),
|
|
89
|
-
note({ keys: ['e/4'], stem_direction: -1, duration: '8' }),
|
|
90
|
-
];
|
|
91
|
-
const beam1 = new Beam(notes.slice(0, 4));
|
|
92
|
-
const beam2 = new Beam(notes.slice(4, 8));
|
|
93
|
-
const beam3 = new Beam(notes.slice(8, 12));
|
|
94
|
-
Formatter.FormatAndDraw(context, stave, notes);
|
|
95
|
-
beam1.setContext(context).draw();
|
|
96
|
-
beam2.setContext(context).draw();
|
|
97
|
-
beam3.setContext(context).draw();
|
|
98
|
-
ok(true, 'Auto Align Rests - Beams Down Test');
|
|
99
|
-
}
|
|
100
|
-
function tupletsUp(options, contextBuilder) {
|
|
101
|
-
const { context, stave } = setupContext(options, contextBuilder, 600, 160);
|
|
102
|
-
const notes = [
|
|
103
|
-
note({ keys: ['b/4'], stem_direction: 1, duration: '4' }),
|
|
104
|
-
note({ keys: ['b/4'], stem_direction: 1, duration: '4' }),
|
|
105
|
-
note({ keys: ['a/5'], stem_direction: 1, duration: '4r' }),
|
|
106
|
-
note({ keys: ['a/5'], stem_direction: 1, duration: '4r' }),
|
|
107
|
-
note({ keys: ['g/5'], stem_direction: 1, duration: '4r' }),
|
|
108
|
-
note({ keys: ['b/5'], stem_direction: 1, duration: '4' }),
|
|
109
|
-
note({ keys: ['a/5'], stem_direction: 1, duration: '4' }),
|
|
110
|
-
note({ keys: ['g/5'], stem_direction: 1, duration: '4r' }),
|
|
111
|
-
note({ keys: ['b/4'], stem_direction: 1, duration: '4' }),
|
|
112
|
-
note({ keys: ['a/5'], stem_direction: 1, duration: '4' }),
|
|
113
|
-
note({ keys: ['b/4'], stem_direction: 1, duration: '4r' }),
|
|
114
|
-
note({ keys: ['b/4'], stem_direction: 1, duration: '4r' }),
|
|
115
|
-
];
|
|
116
|
-
const tuplet1 = new Tuplet(notes.slice(0, 3)).setTupletLocation(Tuplet.LOCATION_TOP);
|
|
117
|
-
const tuplet2 = new Tuplet(notes.slice(3, 6)).setTupletLocation(Tuplet.LOCATION_TOP);
|
|
118
|
-
const tuplet3 = new Tuplet(notes.slice(6, 9)).setTupletLocation(Tuplet.LOCATION_TOP);
|
|
119
|
-
const tuplet4 = new Tuplet(notes.slice(9, 12)).setTupletLocation(Tuplet.LOCATION_TOP);
|
|
120
|
-
Formatter.FormatAndDraw(context, stave, notes);
|
|
121
|
-
tuplet1.setContext(context).draw();
|
|
122
|
-
tuplet2.setContext(context).draw();
|
|
123
|
-
tuplet3.setContext(context).draw();
|
|
124
|
-
tuplet4.setContext(context).draw();
|
|
125
|
-
ok(true, 'Auto Align Rests - Tuplets Stem Up Test');
|
|
126
|
-
}
|
|
127
|
-
function tupletsDown(options, contextBuilder) {
|
|
128
|
-
const { context, stave } = setupContext(options, contextBuilder, 600, 160);
|
|
129
|
-
const notes = [
|
|
130
|
-
note({ keys: ['a/5'], stem_direction: -1, duration: '8r' }),
|
|
131
|
-
note({ keys: ['g/5'], stem_direction: -1, duration: '8r' }),
|
|
132
|
-
note({ keys: ['b/4'], stem_direction: -1, duration: '8' }),
|
|
133
|
-
note({ keys: ['a/5'], stem_direction: -1, duration: '8r' }),
|
|
134
|
-
note({ keys: ['g/5'], stem_direction: -1, duration: '8' }),
|
|
135
|
-
note({ keys: ['b/5'], stem_direction: -1, duration: '8' }),
|
|
136
|
-
note({ keys: ['a/5'], stem_direction: -1, duration: '8' }),
|
|
137
|
-
note({ keys: ['g/5'], stem_direction: -1, duration: '8r' }),
|
|
138
|
-
note({ keys: ['b/4'], stem_direction: -1, duration: '8' }),
|
|
139
|
-
note({ keys: ['a/5'], stem_direction: -1, duration: '8' }),
|
|
140
|
-
note({ keys: ['g/5'], stem_direction: -1, duration: '8r' }),
|
|
141
|
-
note({ keys: ['b/4'], stem_direction: -1, duration: '8r' }),
|
|
142
|
-
];
|
|
143
|
-
const beam1 = new Beam(notes.slice(0, 3));
|
|
144
|
-
const beam2 = new Beam(notes.slice(3, 6));
|
|
145
|
-
const beam3 = new Beam(notes.slice(6, 9));
|
|
146
|
-
const beam4 = new Beam(notes.slice(9, 12));
|
|
147
|
-
const tuplet1 = new Tuplet(notes.slice(0, 3)).setTupletLocation(Tuplet.LOCATION_BOTTOM);
|
|
148
|
-
const tuplet2 = new Tuplet(notes.slice(3, 6)).setTupletLocation(Tuplet.LOCATION_BOTTOM);
|
|
149
|
-
const tuplet3 = new Tuplet(notes.slice(6, 9)).setTupletLocation(Tuplet.LOCATION_BOTTOM);
|
|
150
|
-
const tuplet4 = new Tuplet(notes.slice(9, 12)).setTupletLocation(Tuplet.LOCATION_BOTTOM);
|
|
151
|
-
Formatter.FormatAndDraw(context, stave, notes);
|
|
152
|
-
tuplet1.setContext(context).draw();
|
|
153
|
-
tuplet2.setContext(context).draw();
|
|
154
|
-
tuplet3.setContext(context).draw();
|
|
155
|
-
tuplet4.setContext(context).draw();
|
|
156
|
-
beam1.setContext(context).draw();
|
|
157
|
-
beam2.setContext(context).draw();
|
|
158
|
-
beam3.setContext(context).draw();
|
|
159
|
-
beam4.setContext(context).draw();
|
|
160
|
-
ok(true, 'Auto Align Rests - Tuplets Stem Down Test');
|
|
161
|
-
}
|
|
162
|
-
function singleVoiceDefaultAlignment(options, contextBuilder) {
|
|
163
|
-
const { context, stave } = setupContext(options, contextBuilder, 600, 160);
|
|
164
|
-
const notes = [
|
|
165
|
-
note({ keys: ['b/4'], stem_direction: -1, duration: '4r' }),
|
|
166
|
-
note({ keys: ['b/4'], stem_direction: -1, duration: '4r' }),
|
|
167
|
-
note({ keys: ['f/4'], stem_direction: -1, duration: '4' }),
|
|
168
|
-
note({ keys: ['e/5'], stem_direction: -1, duration: '8' }),
|
|
169
|
-
note({ keys: ['b/4'], stem_direction: -1, duration: '8r' }),
|
|
170
|
-
note({ keys: ['a/5'], stem_direction: -1, duration: '8' }),
|
|
171
|
-
note({ keys: ['b/4'], stem_direction: -1, duration: '8r' }),
|
|
172
|
-
note({ keys: ['b/4'], stem_direction: -1, duration: '8' }),
|
|
173
|
-
note({ keys: ['e/5'], stem_direction: -1, duration: '8' }),
|
|
174
|
-
note({ keys: ['a/5'], stem_direction: 1, duration: '4' }),
|
|
175
|
-
note({ keys: ['b/4'], stem_direction: 1, duration: '4r' }),
|
|
176
|
-
note({ keys: ['b/5'], stem_direction: 1, duration: '4' }),
|
|
177
|
-
note({ keys: ['d/5'], stem_direction: -1, duration: '4' }),
|
|
178
|
-
note({ keys: ['g/5'], stem_direction: -1, duration: '4' }),
|
|
179
|
-
note({ keys: ['b/4'], stem_direction: -1, duration: '4r' }),
|
|
180
|
-
note({ keys: ['b/4'], stem_direction: -1, duration: '4r' }),
|
|
181
|
-
];
|
|
182
|
-
const beam = new Beam(notes.slice(5, 9));
|
|
183
|
-
const tuplet = new Tuplet(notes.slice(9, 12)).setTupletLocation(Tuplet.LOCATION_TOP);
|
|
184
|
-
Formatter.FormatAndDraw(context, stave, notes);
|
|
185
|
-
tuplet.setContext(context).draw();
|
|
186
|
-
beam.setContext(context).draw();
|
|
187
|
-
ok(true, 'Auto Align Rests - Default Test');
|
|
188
|
-
}
|
|
189
|
-
function singleVoiceAlignAll(options, contextBuilder) {
|
|
190
|
-
const { context, stave } = setupContext(options, contextBuilder, 600, 160);
|
|
191
|
-
const notes = [
|
|
192
|
-
note({ keys: ['b/4'], stem_direction: -1, duration: '4r' }),
|
|
193
|
-
note({ keys: ['b/4'], stem_direction: -1, duration: '4r' }),
|
|
194
|
-
note({ keys: ['f/4'], stem_direction: -1, duration: '4' }),
|
|
195
|
-
note({ keys: ['e/5'], stem_direction: -1, duration: '8' }),
|
|
196
|
-
note({ keys: ['b/4'], stem_direction: -1, duration: '8r' }),
|
|
197
|
-
note({ keys: ['a/5'], stem_direction: -1, duration: '8' }),
|
|
198
|
-
note({ keys: ['b/4'], stem_direction: -1, duration: '8r' }),
|
|
199
|
-
note({ keys: ['b/4'], stem_direction: -1, duration: '8' }),
|
|
200
|
-
note({ keys: ['e/5'], stem_direction: -1, duration: '8' }),
|
|
201
|
-
note({ keys: ['a/5'], stem_direction: 1, duration: '4' }),
|
|
202
|
-
note({ keys: ['b/4'], stem_direction: 1, duration: '4r' }),
|
|
203
|
-
note({ keys: ['b/5'], stem_direction: 1, duration: '4' }),
|
|
204
|
-
note({ keys: ['d/5'], stem_direction: -1, duration: '4' }),
|
|
205
|
-
note({ keys: ['g/5'], stem_direction: -1, duration: '4' }),
|
|
206
|
-
note({ keys: ['b/4'], stem_direction: -1, duration: '4r' }),
|
|
207
|
-
note({ keys: ['b/4'], stem_direction: -1, duration: '4r' }),
|
|
208
|
-
];
|
|
209
|
-
const beam = new Beam(notes.slice(5, 9));
|
|
210
|
-
const tuplet = new Tuplet(notes.slice(9, 12)).setTupletLocation(Tuplet.LOCATION_TOP);
|
|
211
|
-
Formatter.FormatAndDraw(context, stave, notes, { align_rests: true });
|
|
212
|
-
tuplet.setContext(context).draw();
|
|
213
|
-
beam.setContext(context).draw();
|
|
214
|
-
ok(true, 'Auto Align Rests - Align All Test');
|
|
215
|
-
}
|
|
216
|
-
function multiVoice(options, contextBuilder) {
|
|
217
|
-
const ctx = contextBuilder(options.elementId, 600, 200);
|
|
218
|
-
const stave = new Stave(50, 10, 500).addClef('treble').setContext(ctx).addTimeSignature('4/4').draw();
|
|
219
|
-
const noteOnStave = (noteStruct) => new StaveNote(noteStruct).setStave(stave);
|
|
220
|
-
const notes1 = [
|
|
221
|
-
noteOnStave({ keys: ['c/4', 'e/4', 'g/4'], duration: '4' }),
|
|
222
|
-
noteOnStave({ keys: ['b/4'], duration: '4r' }),
|
|
223
|
-
noteOnStave({ keys: ['c/4', 'd/4', 'a/4'], duration: '4' }),
|
|
224
|
-
noteOnStave({ keys: ['b/4'], duration: '4r' }),
|
|
225
|
-
];
|
|
226
|
-
const notes2 = [
|
|
227
|
-
noteOnStave({ keys: ['e/3'], stem_direction: -1, duration: '8' }),
|
|
228
|
-
noteOnStave({ keys: ['b/4'], stem_direction: -1, duration: '8r' }),
|
|
229
|
-
noteOnStave({ keys: ['b/4'], stem_direction: -1, duration: '8r' }),
|
|
230
|
-
noteOnStave({ keys: ['e/3'], stem_direction: -1, duration: '8' }),
|
|
231
|
-
noteOnStave({ keys: ['e/3'], stem_direction: -1, duration: '8' }),
|
|
232
|
-
noteOnStave({ keys: ['b/4'], stem_direction: -1, duration: '8r' }),
|
|
233
|
-
noteOnStave({ keys: ['e/3'], stem_direction: -1, duration: '8' }),
|
|
234
|
-
noteOnStave({ keys: ['e/3'], stem_direction: -1, duration: '8' }),
|
|
235
|
-
];
|
|
236
|
-
const voice1 = new Voice(Flow.TIME4_4).addTickables(notes1);
|
|
237
|
-
const voice2 = new Voice(Flow.TIME4_4).addTickables(notes2);
|
|
238
|
-
new Formatter().joinVoices([voice1, voice2]).formatToStave([voice1, voice2], stave, { align_rests: true });
|
|
239
|
-
const beam2_1 = new Beam(notes2.slice(0, 4));
|
|
240
|
-
const beam2_2 = new Beam(notes2.slice(4, 8));
|
|
241
|
-
voice2.draw(ctx);
|
|
242
|
-
voice1.draw(ctx);
|
|
243
|
-
beam2_1.setContext(ctx).draw();
|
|
244
|
-
beam2_2.setContext(ctx).draw();
|
|
245
|
-
ok(true, 'Strokes Test Multi Voice');
|
|
246
|
-
}
|
|
247
|
-
VexFlowTests.register(RestsTests);
|
|
248
|
-
export { RestsTests };
|
|
@@ -1,357 +0,0 @@
|
|
|
1
|
-
import { VexFlowTests } from './vexflow_test_helpers.js';
|
|
2
|
-
import { Annotation } from '../src/annotation.js';
|
|
3
|
-
import { Beam } from '../src/beam.js';
|
|
4
|
-
import { Formatter } from '../src/formatter.js';
|
|
5
|
-
import { Stave } from '../src/stave.js';
|
|
6
|
-
import { BarlineType } from '../src/stavebarline.js';
|
|
7
|
-
import { StaveNote } from '../src/stavenote.js';
|
|
8
|
-
const RhythmTests = {
|
|
9
|
-
Start() {
|
|
10
|
-
QUnit.module('Rhythm');
|
|
11
|
-
const run = VexFlowTests.runTests;
|
|
12
|
-
run('Rhythm Draw - slash notes', drawBasic);
|
|
13
|
-
run('Rhythm Draw - beamed slash notes', drawBeamedSlashNotes);
|
|
14
|
-
run('Rhythm Draw - beamed slash notes, some rests', drawSlashAndBeamAndRests);
|
|
15
|
-
run('Rhythm Draw - 16th note rhythm with scratches', drawSixtenthWithScratches);
|
|
16
|
-
run('Rhythm Draw - 32nd note rhythm with scratches', drawThirtySecondWithScratches);
|
|
17
|
-
},
|
|
18
|
-
};
|
|
19
|
-
function drawBasic(options, contextBuilder) {
|
|
20
|
-
const ctx = contextBuilder(options.elementId, 800, 150);
|
|
21
|
-
const staveBar1 = new Stave(10, 30, 150);
|
|
22
|
-
staveBar1.setBegBarType(BarlineType.DOUBLE);
|
|
23
|
-
staveBar1.setEndBarType(BarlineType.SINGLE);
|
|
24
|
-
staveBar1.addClef('treble');
|
|
25
|
-
staveBar1.addTimeSignature('4/4');
|
|
26
|
-
staveBar1.addKeySignature('C');
|
|
27
|
-
staveBar1.setContext(ctx).draw();
|
|
28
|
-
const notesBar1 = [new StaveNote({ keys: ['b/4'], duration: '1s', stem_direction: -1 })];
|
|
29
|
-
Formatter.FormatAndDraw(ctx, staveBar1, notesBar1);
|
|
30
|
-
const staveBar2 = new Stave(staveBar1.getWidth() + staveBar1.getX(), staveBar1.getY(), 120);
|
|
31
|
-
staveBar2.setBegBarType(BarlineType.SINGLE);
|
|
32
|
-
staveBar2.setEndBarType(BarlineType.SINGLE);
|
|
33
|
-
staveBar2.setContext(ctx).draw();
|
|
34
|
-
const notesBar2 = [
|
|
35
|
-
new StaveNote({ keys: ['b/4'], duration: '2s', stem_direction: -1 }),
|
|
36
|
-
new StaveNote({ keys: ['b/4'], duration: '2s', stem_direction: -1 }),
|
|
37
|
-
];
|
|
38
|
-
Formatter.FormatAndDraw(ctx, staveBar2, notesBar2);
|
|
39
|
-
const staveBar3 = new Stave(staveBar2.getWidth() + staveBar2.getX(), staveBar2.getY(), 170);
|
|
40
|
-
staveBar3.setContext(ctx).draw();
|
|
41
|
-
const notesBar3 = [
|
|
42
|
-
new StaveNote({
|
|
43
|
-
keys: ['b/4'],
|
|
44
|
-
duration: '4s',
|
|
45
|
-
stem_direction: -1,
|
|
46
|
-
}),
|
|
47
|
-
new StaveNote({
|
|
48
|
-
keys: ['b/4'],
|
|
49
|
-
duration: '4s',
|
|
50
|
-
stem_direction: -1,
|
|
51
|
-
}),
|
|
52
|
-
new StaveNote({
|
|
53
|
-
keys: ['b/4'],
|
|
54
|
-
duration: '4s',
|
|
55
|
-
stem_direction: -1,
|
|
56
|
-
}),
|
|
57
|
-
new StaveNote({
|
|
58
|
-
keys: ['b/4'],
|
|
59
|
-
duration: '4s',
|
|
60
|
-
stem_direction: -1,
|
|
61
|
-
}),
|
|
62
|
-
];
|
|
63
|
-
Formatter.FormatAndDraw(ctx, staveBar3, notesBar3);
|
|
64
|
-
const staveBar4 = new Stave(staveBar3.getWidth() + staveBar3.getX(), staveBar3.getY(), 200);
|
|
65
|
-
staveBar4.setContext(ctx).draw();
|
|
66
|
-
const notesBar4 = [
|
|
67
|
-
new StaveNote({
|
|
68
|
-
keys: ['b/4'],
|
|
69
|
-
duration: '8s',
|
|
70
|
-
stem_direction: -1,
|
|
71
|
-
}),
|
|
72
|
-
new StaveNote({
|
|
73
|
-
keys: ['b/4'],
|
|
74
|
-
duration: '8s',
|
|
75
|
-
stem_direction: -1,
|
|
76
|
-
}),
|
|
77
|
-
new StaveNote({
|
|
78
|
-
keys: ['b/4'],
|
|
79
|
-
duration: '8s',
|
|
80
|
-
stem_direction: -1,
|
|
81
|
-
}),
|
|
82
|
-
new StaveNote({
|
|
83
|
-
keys: ['b/4'],
|
|
84
|
-
duration: '8s',
|
|
85
|
-
stem_direction: -1,
|
|
86
|
-
}),
|
|
87
|
-
new StaveNote({
|
|
88
|
-
keys: ['b/4'],
|
|
89
|
-
duration: '8s',
|
|
90
|
-
stem_direction: -1,
|
|
91
|
-
}),
|
|
92
|
-
new StaveNote({
|
|
93
|
-
keys: ['b/4'],
|
|
94
|
-
duration: '8s',
|
|
95
|
-
stem_direction: -1,
|
|
96
|
-
}),
|
|
97
|
-
new StaveNote({
|
|
98
|
-
keys: ['b/4'],
|
|
99
|
-
duration: '8s',
|
|
100
|
-
stem_direction: -1,
|
|
101
|
-
}),
|
|
102
|
-
new StaveNote({
|
|
103
|
-
keys: ['b/4'],
|
|
104
|
-
duration: '8s',
|
|
105
|
-
stem_direction: -1,
|
|
106
|
-
}),
|
|
107
|
-
];
|
|
108
|
-
Formatter.FormatAndDraw(ctx, staveBar4, notesBar4);
|
|
109
|
-
expect(0);
|
|
110
|
-
}
|
|
111
|
-
function drawBeamedSlashNotes(options, contextBuilder) {
|
|
112
|
-
const ctx = contextBuilder(options.elementId, 800, 150);
|
|
113
|
-
const staveBar1 = new Stave(10, 30, 300);
|
|
114
|
-
staveBar1.setBegBarType(BarlineType.DOUBLE);
|
|
115
|
-
staveBar1.setEndBarType(BarlineType.SINGLE);
|
|
116
|
-
staveBar1.addClef('treble');
|
|
117
|
-
staveBar1.addTimeSignature('4/4');
|
|
118
|
-
staveBar1.addKeySignature('C');
|
|
119
|
-
staveBar1.setContext(ctx).draw();
|
|
120
|
-
const notesBar1_part1 = [
|
|
121
|
-
new StaveNote({
|
|
122
|
-
keys: ['b/4'],
|
|
123
|
-
duration: '8s',
|
|
124
|
-
stem_direction: -1,
|
|
125
|
-
}),
|
|
126
|
-
new StaveNote({
|
|
127
|
-
keys: ['b/4'],
|
|
128
|
-
duration: '8s',
|
|
129
|
-
stem_direction: -1,
|
|
130
|
-
}),
|
|
131
|
-
new StaveNote({
|
|
132
|
-
keys: ['b/4'],
|
|
133
|
-
duration: '8s',
|
|
134
|
-
stem_direction: -1,
|
|
135
|
-
}),
|
|
136
|
-
new StaveNote({
|
|
137
|
-
keys: ['b/4'],
|
|
138
|
-
duration: '8s',
|
|
139
|
-
stem_direction: -1,
|
|
140
|
-
}),
|
|
141
|
-
];
|
|
142
|
-
const notesBar1_part2 = [
|
|
143
|
-
new StaveNote({
|
|
144
|
-
keys: ['b/4'],
|
|
145
|
-
duration: '8s',
|
|
146
|
-
stem_direction: -1,
|
|
147
|
-
}),
|
|
148
|
-
new StaveNote({
|
|
149
|
-
keys: ['b/4'],
|
|
150
|
-
duration: '8s',
|
|
151
|
-
stem_direction: -1,
|
|
152
|
-
}),
|
|
153
|
-
new StaveNote({
|
|
154
|
-
keys: ['b/4'],
|
|
155
|
-
duration: '8s',
|
|
156
|
-
stem_direction: -1,
|
|
157
|
-
}),
|
|
158
|
-
new StaveNote({
|
|
159
|
-
keys: ['b/4'],
|
|
160
|
-
duration: '8s',
|
|
161
|
-
stem_direction: -1,
|
|
162
|
-
}),
|
|
163
|
-
];
|
|
164
|
-
const beam1 = new Beam(notesBar1_part1);
|
|
165
|
-
const beam2 = new Beam(notesBar1_part2);
|
|
166
|
-
const notesBar1 = notesBar1_part1.concat(notesBar1_part2);
|
|
167
|
-
Formatter.FormatAndDraw(ctx, staveBar1, notesBar1);
|
|
168
|
-
beam1.setContext(ctx).draw();
|
|
169
|
-
beam2.setContext(ctx).draw();
|
|
170
|
-
expect(0);
|
|
171
|
-
}
|
|
172
|
-
function drawSlashAndBeamAndRests(options, contextBuilder) {
|
|
173
|
-
const ctx = contextBuilder(options.elementId, 800, 150);
|
|
174
|
-
const staveBar1 = new Stave(10, 30, 300);
|
|
175
|
-
staveBar1.setBegBarType(BarlineType.DOUBLE);
|
|
176
|
-
staveBar1.setEndBarType(BarlineType.SINGLE);
|
|
177
|
-
staveBar1.addClef('treble');
|
|
178
|
-
staveBar1.addTimeSignature('4/4');
|
|
179
|
-
staveBar1.addKeySignature('F');
|
|
180
|
-
staveBar1.setContext(ctx).draw();
|
|
181
|
-
const notesBar1_part1 = [
|
|
182
|
-
new StaveNote({
|
|
183
|
-
keys: ['b/4'],
|
|
184
|
-
duration: '8s',
|
|
185
|
-
stem_direction: -1,
|
|
186
|
-
}),
|
|
187
|
-
new StaveNote({ keys: ['b/4'], duration: '8s', stem_direction: -1 }),
|
|
188
|
-
];
|
|
189
|
-
notesBar1_part1[0].addModifier(new Annotation('C7').setFont('Times', VexFlowTests.Font.size + 2), 0);
|
|
190
|
-
const notesBar1_part2 = [
|
|
191
|
-
new StaveNote({
|
|
192
|
-
keys: ['b/4'],
|
|
193
|
-
duration: '8r',
|
|
194
|
-
stem_direction: -1,
|
|
195
|
-
}),
|
|
196
|
-
new StaveNote({
|
|
197
|
-
keys: ['b/4'],
|
|
198
|
-
duration: '8s',
|
|
199
|
-
stem_direction: -1,
|
|
200
|
-
}),
|
|
201
|
-
new StaveNote({
|
|
202
|
-
keys: ['b/4'],
|
|
203
|
-
duration: '8r',
|
|
204
|
-
stem_direction: -1,
|
|
205
|
-
}),
|
|
206
|
-
new StaveNote({
|
|
207
|
-
keys: ['b/4'],
|
|
208
|
-
duration: '8s',
|
|
209
|
-
stem_direction: -1,
|
|
210
|
-
}),
|
|
211
|
-
new StaveNote({
|
|
212
|
-
keys: ['b/4'],
|
|
213
|
-
duration: '8r',
|
|
214
|
-
stem_direction: -1,
|
|
215
|
-
}),
|
|
216
|
-
new StaveNote({
|
|
217
|
-
keys: ['b/4'],
|
|
218
|
-
duration: '8s',
|
|
219
|
-
stem_direction: -1,
|
|
220
|
-
}),
|
|
221
|
-
];
|
|
222
|
-
const beam1 = new Beam(notesBar1_part1);
|
|
223
|
-
Formatter.FormatAndDraw(ctx, staveBar1, notesBar1_part1.concat(notesBar1_part2));
|
|
224
|
-
beam1.setContext(ctx).draw();
|
|
225
|
-
const staveBar2 = new Stave(staveBar1.getWidth() + staveBar1.getX(), staveBar1.getY(), 220);
|
|
226
|
-
staveBar2.setContext(ctx).draw();
|
|
227
|
-
const notesBar2 = [
|
|
228
|
-
new StaveNote({
|
|
229
|
-
keys: ['b/4'],
|
|
230
|
-
duration: '1s',
|
|
231
|
-
stem_direction: -1,
|
|
232
|
-
}),
|
|
233
|
-
];
|
|
234
|
-
notesBar2[0].addModifier(new Annotation('F').setFont('Times', VexFlowTests.Font.size + 2), 0);
|
|
235
|
-
Formatter.FormatAndDraw(ctx, staveBar2, notesBar2);
|
|
236
|
-
expect(0);
|
|
237
|
-
}
|
|
238
|
-
function drawSixtenthWithScratches(options, contextBuilder) {
|
|
239
|
-
const ctx = contextBuilder(options.elementId, 800, 150);
|
|
240
|
-
const staveBar1 = new Stave(10, 30, 300);
|
|
241
|
-
staveBar1.setBegBarType(BarlineType.DOUBLE);
|
|
242
|
-
staveBar1.setEndBarType(BarlineType.SINGLE);
|
|
243
|
-
staveBar1.addClef('treble');
|
|
244
|
-
staveBar1.addTimeSignature('4/4');
|
|
245
|
-
staveBar1.addKeySignature('F');
|
|
246
|
-
staveBar1.setContext(ctx).draw();
|
|
247
|
-
const notesBar1_part1 = [
|
|
248
|
-
new StaveNote({
|
|
249
|
-
keys: ['b/4'],
|
|
250
|
-
duration: '16s',
|
|
251
|
-
stem_direction: -1,
|
|
252
|
-
}),
|
|
253
|
-
new StaveNote({
|
|
254
|
-
keys: ['b/4'],
|
|
255
|
-
duration: '16s',
|
|
256
|
-
stem_direction: -1,
|
|
257
|
-
}),
|
|
258
|
-
new StaveNote({
|
|
259
|
-
keys: ['b/4'],
|
|
260
|
-
duration: '16m',
|
|
261
|
-
stem_direction: -1,
|
|
262
|
-
}),
|
|
263
|
-
new StaveNote({
|
|
264
|
-
keys: ['b/4'],
|
|
265
|
-
duration: '16s',
|
|
266
|
-
stem_direction: -1,
|
|
267
|
-
}),
|
|
268
|
-
];
|
|
269
|
-
const notesBar1_part2 = [
|
|
270
|
-
new StaveNote({
|
|
271
|
-
keys: ['b/4'],
|
|
272
|
-
duration: '16m',
|
|
273
|
-
stem_direction: -1,
|
|
274
|
-
}),
|
|
275
|
-
new StaveNote({
|
|
276
|
-
keys: ['b/4'],
|
|
277
|
-
duration: '16s',
|
|
278
|
-
stem_direction: -1,
|
|
279
|
-
}),
|
|
280
|
-
new StaveNote({
|
|
281
|
-
keys: ['b/4'],
|
|
282
|
-
duration: '16r',
|
|
283
|
-
stem_direction: -1,
|
|
284
|
-
}),
|
|
285
|
-
new StaveNote({
|
|
286
|
-
keys: ['b/4'],
|
|
287
|
-
duration: '16s',
|
|
288
|
-
stem_direction: -1,
|
|
289
|
-
}),
|
|
290
|
-
];
|
|
291
|
-
notesBar1_part1[0].addModifier(new Annotation('C7').setFont('Times', VexFlowTests.Font.size + 3), 0);
|
|
292
|
-
const beam1 = new Beam(notesBar1_part1);
|
|
293
|
-
const beam2 = new Beam(notesBar1_part2);
|
|
294
|
-
Formatter.FormatAndDraw(ctx, staveBar1, notesBar1_part1.concat(notesBar1_part2));
|
|
295
|
-
beam1.setContext(ctx).draw();
|
|
296
|
-
beam2.setContext(ctx).draw();
|
|
297
|
-
expect(0);
|
|
298
|
-
}
|
|
299
|
-
function drawThirtySecondWithScratches(options, contextBuilder) {
|
|
300
|
-
const ctx = contextBuilder(options.elementId, 800, 150);
|
|
301
|
-
const staveBar1 = new Stave(10, 30, 300);
|
|
302
|
-
staveBar1.setBegBarType(BarlineType.DOUBLE);
|
|
303
|
-
staveBar1.setEndBarType(BarlineType.SINGLE);
|
|
304
|
-
staveBar1.addClef('treble');
|
|
305
|
-
staveBar1.addTimeSignature('4/4');
|
|
306
|
-
staveBar1.addKeySignature('F');
|
|
307
|
-
staveBar1.setContext(ctx).draw();
|
|
308
|
-
const notesBar1_part1 = [
|
|
309
|
-
new StaveNote({
|
|
310
|
-
keys: ['b/4'],
|
|
311
|
-
duration: '32s',
|
|
312
|
-
stem_direction: 1,
|
|
313
|
-
}),
|
|
314
|
-
new StaveNote({
|
|
315
|
-
keys: ['b/4'],
|
|
316
|
-
duration: '32s',
|
|
317
|
-
stem_direction: 1,
|
|
318
|
-
}),
|
|
319
|
-
new StaveNote({
|
|
320
|
-
keys: ['b/4'],
|
|
321
|
-
duration: '32m',
|
|
322
|
-
stem_direction: 1,
|
|
323
|
-
}),
|
|
324
|
-
new StaveNote({
|
|
325
|
-
keys: ['b/4'],
|
|
326
|
-
duration: '32s',
|
|
327
|
-
stem_direction: 1,
|
|
328
|
-
}),
|
|
329
|
-
new StaveNote({
|
|
330
|
-
keys: ['b/4'],
|
|
331
|
-
duration: '32m',
|
|
332
|
-
stem_direction: 1,
|
|
333
|
-
}),
|
|
334
|
-
new StaveNote({
|
|
335
|
-
keys: ['b/4'],
|
|
336
|
-
duration: '32s',
|
|
337
|
-
stem_direction: 1,
|
|
338
|
-
}),
|
|
339
|
-
new StaveNote({
|
|
340
|
-
keys: ['b/4'],
|
|
341
|
-
duration: '32r',
|
|
342
|
-
stem_direction: 1,
|
|
343
|
-
}),
|
|
344
|
-
new StaveNote({
|
|
345
|
-
keys: ['b/4'],
|
|
346
|
-
duration: '32s',
|
|
347
|
-
stem_direction: 1,
|
|
348
|
-
}),
|
|
349
|
-
];
|
|
350
|
-
notesBar1_part1[0].addModifier(new Annotation('C7').setFont('Times', VexFlowTests.Font.size + 3), 0);
|
|
351
|
-
const beam1 = new Beam(notesBar1_part1);
|
|
352
|
-
Formatter.FormatAndDraw(ctx, staveBar1, notesBar1_part1);
|
|
353
|
-
beam1.setContext(ctx).draw();
|
|
354
|
-
expect(0);
|
|
355
|
-
}
|
|
356
|
-
VexFlowTests.register(RhythmTests);
|
|
357
|
-
export { RhythmTests };
|