@mcqj/vexflow 0.0.1-alpha.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/LICENSE +22 -0
- package/README.md +208 -0
- package/build/cjs/vexflow-bravura.js +2 -0
- package/build/cjs/vexflow-bravura.js.map +1 -0
- package/build/cjs/vexflow-core.js +2 -0
- package/build/cjs/vexflow-core.js.map +1 -0
- package/build/cjs/vexflow-debug-with-tests.js +43475 -0
- package/build/cjs/vexflow-debug-with-tests.js.map +1 -0
- package/build/cjs/vexflow-debug.js +19194 -0
- package/build/cjs/vexflow-debug.js.map +1 -0
- package/build/cjs/vexflow.js +2 -0
- package/build/cjs/vexflow.js.map +1 -0
- package/build/esm/entry/vexflow-bravura.js +17 -0
- package/build/esm/entry/vexflow-core.js +4 -0
- package/build/esm/entry/vexflow-debug-with-tests.js +38 -0
- package/build/esm/entry/vexflow-debug.js +31 -0
- package/build/esm/entry/vexflow.js +31 -0
- package/build/esm/package.json +3 -0
- package/build/esm/src/accidental.js +330 -0
- package/build/esm/src/annotation.js +231 -0
- package/build/esm/src/articulation.js +281 -0
- package/build/esm/src/barnote.js +56 -0
- package/build/esm/src/beam.js +644 -0
- package/build/esm/src/bend.js +186 -0
- package/build/esm/src/boundingbox.js +59 -0
- package/build/esm/src/canvascontext.js +216 -0
- package/build/esm/src/chordsymbol.js +325 -0
- package/build/esm/src/clef.js +120 -0
- package/build/esm/src/clefnote.js +35 -0
- package/build/esm/src/crescendo.js +78 -0
- package/build/esm/src/curve.js +126 -0
- package/build/esm/src/dot.js +129 -0
- package/build/esm/src/easyscore.js +374 -0
- package/build/esm/src/element.js +409 -0
- package/build/esm/src/factory.js +463 -0
- package/build/esm/src/flag.js +22 -0
- package/build/esm/src/font.js +237 -0
- package/build/esm/src/fonts/academico.js +1 -0
- package/build/esm/src/fonts/academicobold.js +1 -0
- package/build/esm/src/fonts/bravura.js +1 -0
- package/build/esm/src/fonts/gonville.js +1 -0
- package/build/esm/src/fonts/petaluma.js +1 -0
- package/build/esm/src/fonts/petalumascript.js +1 -0
- package/build/esm/src/formatter.js +610 -0
- package/build/esm/src/fraction.js +170 -0
- package/build/esm/src/frethandfinger.js +141 -0
- package/build/esm/src/ghostnote.js +50 -0
- package/build/esm/src/glyphnote.js +44 -0
- package/build/esm/src/glyphs.js +2936 -0
- package/build/esm/src/gracenote.js +106 -0
- package/build/esm/src/gracenotegroup.js +138 -0
- package/build/esm/src/gracetabnote.js +11 -0
- package/build/esm/src/index.js +86 -0
- package/build/esm/src/keymanager.js +99 -0
- package/build/esm/src/keysignature.js +220 -0
- package/build/esm/src/keysignote.js +28 -0
- package/build/esm/src/metrics.js +237 -0
- package/build/esm/src/modifier.js +121 -0
- package/build/esm/src/modifiercontext.js +110 -0
- package/build/esm/src/multimeasurerest.js +127 -0
- package/build/esm/src/music.js +322 -0
- package/build/esm/src/note.js +383 -0
- package/build/esm/src/notehead.js +89 -0
- package/build/esm/src/notesubgroup.js +59 -0
- package/build/esm/src/ornament.js +192 -0
- package/build/esm/src/parenthesis.js +61 -0
- package/build/esm/src/parser.js +164 -0
- package/build/esm/src/pedalmarking.js +168 -0
- package/build/esm/src/registry.js +81 -0
- package/build/esm/src/rendercontext.js +20 -0
- package/build/esm/src/renderer.js +112 -0
- package/build/esm/src/repeatnote.js +17 -0
- package/build/esm/src/stave.js +579 -0
- package/build/esm/src/stavebarline.js +237 -0
- package/build/esm/src/staveconnector.js +180 -0
- package/build/esm/src/stavehairpin.js +115 -0
- package/build/esm/src/staveline.js +199 -0
- package/build/esm/src/stavemodifier.js +56 -0
- package/build/esm/src/stavenote.js +861 -0
- package/build/esm/src/staverepetition.js +120 -0
- package/build/esm/src/stavesection.js +36 -0
- package/build/esm/src/stavetempo.js +110 -0
- package/build/esm/src/stavetext.js +55 -0
- package/build/esm/src/stavetie.js +186 -0
- package/build/esm/src/stavevolta.js +53 -0
- package/build/esm/src/stem.js +133 -0
- package/build/esm/src/stemmablenote.js +193 -0
- package/build/esm/src/stringnumber.js +228 -0
- package/build/esm/src/strokes.js +164 -0
- package/build/esm/src/svgcontext.js +402 -0
- package/build/esm/src/system.js +166 -0
- package/build/esm/src/tables.js +696 -0
- package/build/esm/src/tabnote.js +278 -0
- package/build/esm/src/tabslide.js +68 -0
- package/build/esm/src/tabstave.js +17 -0
- package/build/esm/src/tabtie.js +19 -0
- package/build/esm/src/textbracket.js +128 -0
- package/build/esm/src/textdynamics.js +53 -0
- package/build/esm/src/textnote.js +116 -0
- package/build/esm/src/tickable.js +224 -0
- package/build/esm/src/tickcontext.js +189 -0
- package/build/esm/src/timesignature.js +169 -0
- package/build/esm/src/timesignote.js +30 -0
- package/build/esm/src/tremolo.js +30 -0
- package/build/esm/src/tuning.js +55 -0
- package/build/esm/src/tuplet.js +258 -0
- package/build/esm/src/typeguard.js +30 -0
- package/build/esm/src/util.js +67 -0
- package/build/esm/src/version.js +3 -0
- package/build/esm/src/vexflow.js +309 -0
- package/build/esm/src/vibrato.js +68 -0
- package/build/esm/src/vibratobracket.js +44 -0
- package/build/esm/src/voice.js +178 -0
- package/build/esm/src/web.js +15 -0
- package/build/esm/tests/accidental_tests.js +1055 -0
- package/build/esm/tests/annotation_tests.js +381 -0
- package/build/esm/tests/articulation_tests.js +432 -0
- package/build/esm/tests/auto_beam_formatting_tests.js +551 -0
- package/build/esm/tests/barline_tests.js +52 -0
- package/build/esm/tests/beam_tests.js +669 -0
- package/build/esm/tests/bend_tests.js +223 -0
- package/build/esm/tests/boundingbox_tests.js +53 -0
- package/build/esm/tests/browser_test_runner.js +128 -0
- package/build/esm/tests/chordsymbol_tests.js +405 -0
- package/build/esm/tests/clef_tests.js +141 -0
- package/build/esm/tests/crossbeam_tests.js +306 -0
- package/build/esm/tests/curve_tests.js +152 -0
- package/build/esm/tests/demo_petzold_tests.js +335 -0
- package/build/esm/tests/dot_tests.js +119 -0
- package/build/esm/tests/easyscore_tests.js +488 -0
- package/build/esm/tests/factory_tests.js +44 -0
- package/build/esm/tests/font_tests.js +134 -0
- package/build/esm/tests/formatter/framestack.js +61 -0
- package/build/esm/tests/formatter/tests.js +251 -0
- package/build/esm/tests/formatter_tests.js +759 -0
- package/build/esm/tests/fraction_tests.js +72 -0
- package/build/esm/tests/ghostnote_tests.js +77 -0
- package/build/esm/tests/glyphnote_tests.js +119 -0
- package/build/esm/tests/gracenote_tests.js +414 -0
- package/build/esm/tests/gracetabnote_tests.js +79 -0
- package/build/esm/tests/index.js +68 -0
- package/build/esm/tests/key_clef_tests.js +106 -0
- package/build/esm/tests/keymanager_tests.js +68 -0
- package/build/esm/tests/keysignature_tests.js +322 -0
- package/build/esm/tests/mocks.js +70 -0
- package/build/esm/tests/modifier_tests.js +24 -0
- package/build/esm/tests/multimeasurerest_tests.js +141 -0
- package/build/esm/tests/music_tests.js +161 -0
- package/build/esm/tests/node_test_runner.js +31 -0
- package/build/esm/tests/notehead_tests.js +224 -0
- package/build/esm/tests/notesubgroup_tests.js +149 -0
- package/build/esm/tests/offscreencanvas_tests.js +47 -0
- package/build/esm/tests/ornament_tests.js +333 -0
- package/build/esm/tests/parser_tests.js +122 -0
- package/build/esm/tests/pedalmarking_tests.js +91 -0
- package/build/esm/tests/percussion_tests.js +184 -0
- package/build/esm/tests/playwright/flow.spec.js +127 -0
- package/build/esm/tests/playwright/visual_helpers.js +30 -0
- package/build/esm/tests/registry_tests.js +64 -0
- package/build/esm/tests/renderer_tests.js +113 -0
- package/build/esm/tests/rests_tests.js +266 -0
- package/build/esm/tests/rhythm_tests.js +357 -0
- package/build/esm/tests/stave_tests.js +570 -0
- package/build/esm/tests/staveconnector_tests.js +402 -0
- package/build/esm/tests/stavehairpin_tests.js +90 -0
- package/build/esm/tests/staveline_tests.js +123 -0
- package/build/esm/tests/stavemodifier_tests.js +51 -0
- package/build/esm/tests/stavenote_tests.js +936 -0
- package/build/esm/tests/stavetie_tests.js +137 -0
- package/build/esm/tests/stringnumber_tests.js +283 -0
- package/build/esm/tests/strokes_tests.js +289 -0
- package/build/esm/tests/style_tests.js +96 -0
- package/build/esm/tests/tabnote_tests.js +462 -0
- package/build/esm/tests/tabslide_tests.js +133 -0
- package/build/esm/tests/tabstave_tests.js +24 -0
- package/build/esm/tests/tabtie_tests.js +171 -0
- package/build/esm/tests/test_runner.js +23 -0
- package/build/esm/tests/textbracket_tests.js +100 -0
- package/build/esm/tests/textnote_tests.js +216 -0
- package/build/esm/tests/threevoice_tests.js +132 -0
- package/build/esm/tests/tickcontext_tests.js +36 -0
- package/build/esm/tests/timesignature_tests.js +173 -0
- package/build/esm/tests/tremolo_tests.js +34 -0
- package/build/esm/tests/tuning_tests.js +56 -0
- package/build/esm/tests/tuplet_tests.js +711 -0
- package/build/esm/tests/typeguard_tests.js +82 -0
- package/build/esm/tests/unison_tests.js +74 -0
- package/build/esm/tests/vexflow_test_helpers.js +318 -0
- package/build/esm/tests/vf_prefix_tests.js +101 -0
- package/build/esm/tests/vibrato_tests.js +93 -0
- package/build/esm/tests/vibratobracket_tests.js +45 -0
- package/build/esm/tests/vitest/job-0.test.js +2 -0
- package/build/esm/tests/vitest/job-1.test.js +2 -0
- package/build/esm/tests/vitest/job-2.test.js +2 -0
- package/build/esm/tests/vitest/job-3.test.js +2 -0
- package/build/esm/tests/vitest/run.js +5 -0
- package/build/esm/tests/vitest.setup.js +44 -0
- package/build/esm/tests/voice_tests.js +69 -0
- package/build/types/entry/vexflow-bravura.d.ts +3 -0
- package/build/types/entry/vexflow-core.d.ts +3 -0
- package/build/types/entry/vexflow-debug.d.ts +3 -0
- package/build/types/entry/vexflow.d.ts +3 -0
- package/build/types/src/accidental.d.ts +60 -0
- package/build/types/src/annotation.d.ts +58 -0
- package/build/types/src/articulation.d.ts +78 -0
- package/build/types/src/barnote.d.ts +29 -0
- package/build/types/src/beam.d.ts +158 -0
- package/build/types/src/bend.d.ts +67 -0
- package/build/types/src/boundingbox.d.ts +42 -0
- package/build/types/src/canvascontext.d.ts +93 -0
- package/build/types/src/chordsymbol.d.ts +109 -0
- package/build/types/src/clef.d.ts +38 -0
- package/build/types/src/clefnote.d.ts +17 -0
- package/build/types/src/crescendo.d.ts +26 -0
- package/build/types/src/curve.d.ts +42 -0
- package/build/types/src/dot.d.ts +19 -0
- package/build/types/src/easyscore.d.ts +152 -0
- package/build/types/src/element.d.ts +278 -0
- package/build/types/src/factory.d.ts +273 -0
- package/build/types/src/flag.d.ts +12 -0
- package/build/types/src/font.d.ts +96 -0
- package/build/types/src/fonts/academico.d.ts +1 -0
- package/build/types/src/fonts/academicobold.d.ts +1 -0
- package/build/types/src/fonts/bravura.d.ts +1 -0
- package/build/types/src/fonts/gonville.d.ts +1 -0
- package/build/types/src/fonts/petaluma.d.ts +1 -0
- package/build/types/src/fonts/petalumascript.d.ts +1 -0
- package/build/types/src/formatter.d.ts +226 -0
- package/build/types/src/fraction.d.ts +65 -0
- package/build/types/src/frethandfinger.d.ts +19 -0
- package/build/types/src/ghostnote.d.ts +16 -0
- package/build/types/src/glyphnote.d.ts +14 -0
- package/build/types/src/glyphs.d.ts +2935 -0
- package/build/types/src/gracenote.d.ts +17 -0
- package/build/types/src/gracenotegroup.d.ts +33 -0
- package/build/types/src/gracetabnote.d.ts +5 -0
- package/build/types/src/index.d.ts +86 -0
- package/build/types/src/keymanager.d.ts +25 -0
- package/build/types/src/keysignature.d.ts +50 -0
- package/build/types/src/keysignote.d.ts +11 -0
- package/build/types/src/metrics.d.ts +25 -0
- package/build/types/src/modifier.d.ts +90 -0
- package/build/types/src/modifiercontext.d.ts +48 -0
- package/build/types/src/multimeasurerest.d.ts +61 -0
- package/build/types/src/music.d.ts +91 -0
- package/build/types/src/note.d.ts +232 -0
- package/build/types/src/notehead.d.ts +50 -0
- package/build/types/src/notesubgroup.d.ts +18 -0
- package/build/types/src/ornament.d.ts +71 -0
- package/build/types/src/parenthesis.d.ts +21 -0
- package/build/types/src/parser.d.ts +45 -0
- package/build/types/src/pedalmarking.d.ts +63 -0
- package/build/types/src/registry.d.ts +40 -0
- package/build/types/src/rendercontext.d.ts +59 -0
- package/build/types/src/renderer.d.ts +35 -0
- package/build/types/src/repeatnote.d.ts +6 -0
- package/build/types/src/stave.d.ts +181 -0
- package/build/types/src/stavebarline.d.ts +38 -0
- package/build/types/src/staveconnector.d.ts +53 -0
- package/build/types/src/stavehairpin.d.ts +56 -0
- package/build/types/src/staveline.d.ts +49 -0
- package/build/types/src/stavemodifier.d.ts +35 -0
- package/build/types/src/stavenote.d.ts +150 -0
- package/build/types/src/staverepetition.d.ts +30 -0
- package/build/types/src/stavesection.d.ts +8 -0
- package/build/types/src/stavetempo.d.ts +43 -0
- package/build/types/src/stavetext.d.ts +11 -0
- package/build/types/src/stavetie.d.ts +104 -0
- package/build/types/src/stavevolta.d.ts +15 -0
- package/build/types/src/stem.d.ts +58 -0
- package/build/types/src/stemmablenote.d.ts +39 -0
- package/build/types/src/stringnumber.d.ts +26 -0
- package/build/types/src/strokes.d.ts +35 -0
- package/build/types/src/svgcontext.d.ts +135 -0
- package/build/types/src/system.d.ts +121 -0
- package/build/types/src/tables.d.ts +86 -0
- package/build/types/src/tabnote.d.ts +45 -0
- package/build/types/src/tabslide.d.ts +36 -0
- package/build/types/src/tabstave.d.ts +7 -0
- package/build/types/src/tabtie.d.ts +18 -0
- package/build/types/src/textbracket.d.ts +45 -0
- package/build/types/src/textdynamics.d.ts +34 -0
- package/build/types/src/textnote.d.ts +48 -0
- package/build/types/src/tickable.d.ts +149 -0
- package/build/types/src/tickcontext.d.ts +112 -0
- package/build/types/src/timesignature.d.ts +75 -0
- package/build/types/src/timesignote.d.ts +11 -0
- package/build/types/src/tremolo.d.ts +12 -0
- package/build/types/src/tuning.d.ts +23 -0
- package/build/types/src/tuplet.d.ts +98 -0
- package/build/types/src/typeguard.d.ts +100 -0
- package/build/types/src/util.d.ts +42 -0
- package/build/types/src/version.d.ts +3 -0
- package/build/types/src/vexflow.d.ts +261 -0
- package/build/types/src/vibrato.d.ts +20 -0
- package/build/types/src/vibratobracket.d.ts +28 -0
- package/build/types/src/voice.d.ts +109 -0
- package/build/types/src/web.d.ts +2 -0
- package/package.json +145 -0
- package/tests/flow.html +256 -0
|
@@ -0,0 +1,405 @@
|
|
|
1
|
+
import { VexFlowTests } from './vexflow_test_helpers.js';
|
|
2
|
+
import { Accidental } from '../src/accidental.js';
|
|
3
|
+
import { ChordSymbol } from '../src/chordsymbol.js';
|
|
4
|
+
import { Element } from '../src/element.js';
|
|
5
|
+
import { Formatter } from '../src/formatter.js';
|
|
6
|
+
import { Ornament } from '../src/ornament.js';
|
|
7
|
+
import { Stave } from '../src/stave.js';
|
|
8
|
+
import { StaveNote } from '../src/stavenote.js';
|
|
9
|
+
const ChordSymbolTests = {
|
|
10
|
+
Start() {
|
|
11
|
+
VexFlowTests.module('ChordSymbol');
|
|
12
|
+
const run = VexFlowTests.runTests;
|
|
13
|
+
run('Bounding Box', withModifiers, { drawBoundingBox: true });
|
|
14
|
+
run('Chord Symbol With Modifiers', withModifiers, { drawBoundingBox: false });
|
|
15
|
+
run('Chord Symbol Font Size Tests', fontSize);
|
|
16
|
+
run('Chord Symbol Kerning Tests', kern);
|
|
17
|
+
run('Top Chord Symbols', top);
|
|
18
|
+
run('Top Chord Symbols Justified', topJustify);
|
|
19
|
+
run('Bottom Chord Symbols', bottom);
|
|
20
|
+
run('Bottom Stem Down Chord Symbols', bottomStemDown);
|
|
21
|
+
run('Double Bottom Chord Symbols', doubleBottom);
|
|
22
|
+
run('Wide Chord Symbols', wide);
|
|
23
|
+
},
|
|
24
|
+
};
|
|
25
|
+
const superscript = { symbolModifier: ChordSymbol.symbolModifiers.SUPERSCRIPT };
|
|
26
|
+
const subscript = { symbolModifier: ChordSymbol.symbolModifiers.SUBSCRIPT };
|
|
27
|
+
const note = (factory, keys, duration, chordSymbol) => factory.StaveNote({ keys, duration }).addModifier(chordSymbol, 0);
|
|
28
|
+
function getGlyphWidth(charCode) {
|
|
29
|
+
const el = new Element();
|
|
30
|
+
el.setText(String.fromCharCode(charCode));
|
|
31
|
+
return el.getWidth();
|
|
32
|
+
}
|
|
33
|
+
function withModifiers(options) {
|
|
34
|
+
const f = VexFlowTests.makeFactory(options, 750, 580);
|
|
35
|
+
const ctx = f.getContext();
|
|
36
|
+
ctx.scale(1.5, 1.5);
|
|
37
|
+
function draw(chords, y) {
|
|
38
|
+
const notes = [
|
|
39
|
+
note(f, ['c/4'], 'q', chords[0]).addModifier(new Ornament('doit')),
|
|
40
|
+
note(f, ['c/4'], 'q', chords[1]),
|
|
41
|
+
note(f, ['c/4'], 'q', chords[2]).addModifier(new Ornament('fall')),
|
|
42
|
+
note(f, ['c/4'], 'q', chords[3]),
|
|
43
|
+
];
|
|
44
|
+
const score = f.EasyScore();
|
|
45
|
+
const voice = score.voice(notes, { time: '4/4' });
|
|
46
|
+
const formatter = f.Formatter();
|
|
47
|
+
formatter.joinVoices([voice]);
|
|
48
|
+
const voiceW = formatter.preCalculateMinTotalWidth([voice]);
|
|
49
|
+
const staffW = voiceW + Stave.defaultPadding + getGlyphWidth(0xe050);
|
|
50
|
+
formatter.format([voice], voiceW);
|
|
51
|
+
const staff = f.Stave({ x: 10, y, width: staffW }).addClef('treble').drawWithStyle();
|
|
52
|
+
voice.draw(ctx, staff);
|
|
53
|
+
}
|
|
54
|
+
let chords = [];
|
|
55
|
+
chords.push(f
|
|
56
|
+
.ChordSymbol({ fontSize: 10 })
|
|
57
|
+
.addText('F7')
|
|
58
|
+
.addGlyph('leftParenTall')
|
|
59
|
+
.addGlyphOrText('b9', superscript)
|
|
60
|
+
.addGlyphOrText('#11', subscript)
|
|
61
|
+
.addGlyph('rightParenTall'));
|
|
62
|
+
chords.push(f.ChordSymbol({ fontSize: 12 }).addText('F7').addGlyphOrText('b9', superscript).addGlyphOrText('#11', subscript));
|
|
63
|
+
chords.push(f
|
|
64
|
+
.ChordSymbol({ fontSize: 14 })
|
|
65
|
+
.addText('F7')
|
|
66
|
+
.addGlyph('leftParenTall')
|
|
67
|
+
.addGlyphOrText('add 3', superscript)
|
|
68
|
+
.addGlyphOrText('omit 9', subscript)
|
|
69
|
+
.addGlyph('rightParenTall'));
|
|
70
|
+
chords.push(f
|
|
71
|
+
.ChordSymbol({ fontSize: 16 })
|
|
72
|
+
.addText('F7')
|
|
73
|
+
.addGlyph('leftParenTall')
|
|
74
|
+
.addGlyphOrText('b9', superscript)
|
|
75
|
+
.addGlyphOrText('#11', subscript)
|
|
76
|
+
.addGlyph('rightParenTall'));
|
|
77
|
+
draw(chords, 40);
|
|
78
|
+
if (options.params.drawBoundingBox === true) {
|
|
79
|
+
chords.forEach((element) => VexFlowTests.drawBoundingBox(f.getContext(), element));
|
|
80
|
+
}
|
|
81
|
+
chords = [];
|
|
82
|
+
chords.push(f
|
|
83
|
+
.ChordSymbol({ fontSize: 10 })
|
|
84
|
+
.setFontSize(10)
|
|
85
|
+
.addText('F7')
|
|
86
|
+
.addGlyphOrText('#11', superscript)
|
|
87
|
+
.addGlyphOrText('b9', subscript));
|
|
88
|
+
chords.push(f.ChordSymbol({ fontSize: 12 }).addText('F7').addGlyphOrText('#11', superscript).addGlyphOrText('b9', subscript));
|
|
89
|
+
chords.push(f.ChordSymbol({ fontSize: 14 }).addText('F7').addGlyphOrText('#11', superscript).addGlyphOrText('b9', subscript));
|
|
90
|
+
chords.push(f
|
|
91
|
+
.ChordSymbol({ fontSize: 16 })
|
|
92
|
+
.setFontSize(16)
|
|
93
|
+
.addText('F7')
|
|
94
|
+
.addGlyphOrText('#11', superscript)
|
|
95
|
+
.addGlyphOrText('b9', subscript));
|
|
96
|
+
draw(chords, 140);
|
|
97
|
+
if (options.params.drawBoundingBox === true) {
|
|
98
|
+
chords.forEach((element) => VexFlowTests.drawBoundingBox(f.getContext(), element));
|
|
99
|
+
}
|
|
100
|
+
chords = [
|
|
101
|
+
f.ChordSymbol({ fontSize: 10 }).addGlyphOrText('Ab').addGlyphOrText('7(#11b9)', superscript),
|
|
102
|
+
f.ChordSymbol({ fontSize: 14 }).addGlyphOrText('C#').addGlyphOrText('7(#11b9)', superscript),
|
|
103
|
+
f.ChordSymbol({ fontSize: 16 }).addGlyphOrText('Ab').addGlyphOrText('7(#11b9)', superscript),
|
|
104
|
+
f.ChordSymbol({ fontSize: 18 }).addGlyphOrText('C#').addGlyphOrText('7(#11b9)', superscript),
|
|
105
|
+
];
|
|
106
|
+
draw(chords, 240);
|
|
107
|
+
if (options.params.drawBoundingBox === true) {
|
|
108
|
+
chords.forEach((element) => VexFlowTests.drawBoundingBox(f.getContext(), element));
|
|
109
|
+
}
|
|
110
|
+
options.assert.ok(true, 'Font Size Chord Symbol');
|
|
111
|
+
}
|
|
112
|
+
function fontSize(options) {
|
|
113
|
+
const f = VexFlowTests.makeFactory(options, 750, 580);
|
|
114
|
+
const ctx = f.getContext();
|
|
115
|
+
ctx.scale(1.5, 1.5);
|
|
116
|
+
function draw(chords, y) {
|
|
117
|
+
const stave = f.Stave({ x: 10, y, width: 450 }).addClef('treble');
|
|
118
|
+
const notes = [
|
|
119
|
+
note(f, ['c/4'], 'q', chords[0]),
|
|
120
|
+
note(f, ['c/4'], 'q', chords[1]),
|
|
121
|
+
note(f, ['c/4'], 'q', chords[2]),
|
|
122
|
+
note(f, ['c/4'], 'q', chords[3]),
|
|
123
|
+
];
|
|
124
|
+
const score = f.EasyScore();
|
|
125
|
+
const voice = score.voice(notes, { time: '4/4' });
|
|
126
|
+
f.Formatter().joinVoices([voice]).formatToStave([voice], stave);
|
|
127
|
+
f.draw();
|
|
128
|
+
}
|
|
129
|
+
let chords = [];
|
|
130
|
+
chords.push(f
|
|
131
|
+
.ChordSymbol({ fontSize: 10 })
|
|
132
|
+
.addText('F7')
|
|
133
|
+
.addGlyph('leftParenTall')
|
|
134
|
+
.addGlyphOrText('b9', superscript)
|
|
135
|
+
.addGlyphOrText('#11', subscript)
|
|
136
|
+
.addGlyph('rightParenTall'));
|
|
137
|
+
chords.push(f.ChordSymbol({ fontSize: 12 }).addText('F7').addGlyphOrText('b9', superscript).addGlyphOrText('#11', subscript));
|
|
138
|
+
chords.push(f
|
|
139
|
+
.ChordSymbol({ fontSize: 14 })
|
|
140
|
+
.addText('F7')
|
|
141
|
+
.addGlyph('leftParenTall')
|
|
142
|
+
.addGlyphOrText('add 3', superscript)
|
|
143
|
+
.addGlyphOrText('omit 9', subscript)
|
|
144
|
+
.addGlyph('rightParenTall'));
|
|
145
|
+
chords.push(f
|
|
146
|
+
.ChordSymbol({ fontSize: 16 })
|
|
147
|
+
.addText('F7')
|
|
148
|
+
.addGlyph('leftParenTall')
|
|
149
|
+
.addGlyphOrText('b9', superscript)
|
|
150
|
+
.addGlyphOrText('#11', subscript)
|
|
151
|
+
.addGlyph('rightParenTall'));
|
|
152
|
+
draw(chords, 40);
|
|
153
|
+
chords = [];
|
|
154
|
+
chords.push(f
|
|
155
|
+
.ChordSymbol({ fontSize: 10 })
|
|
156
|
+
.setFontSize(10)
|
|
157
|
+
.addText('F7')
|
|
158
|
+
.addGlyphOrText('#11', superscript)
|
|
159
|
+
.addGlyphOrText('b9', subscript));
|
|
160
|
+
chords.push(f.ChordSymbol({ fontSize: 12 }).addText('F7').addGlyphOrText('#11', superscript).addGlyphOrText('b9', subscript));
|
|
161
|
+
chords.push(f.ChordSymbol({ fontSize: 14 }).addText('F7').addGlyphOrText('#11', superscript).addGlyphOrText('b9', subscript));
|
|
162
|
+
chords.push(f
|
|
163
|
+
.ChordSymbol({ fontSize: 16 })
|
|
164
|
+
.setFontSize(16)
|
|
165
|
+
.addText('F7')
|
|
166
|
+
.addGlyphOrText('#11', superscript)
|
|
167
|
+
.addGlyphOrText('b9', subscript));
|
|
168
|
+
draw(chords, 140);
|
|
169
|
+
chords = [
|
|
170
|
+
f.ChordSymbol({ fontSize: 10 }).addGlyphOrText('Ab').addGlyphOrText('7(#11b9)', superscript),
|
|
171
|
+
f.ChordSymbol({ fontSize: 14 }).addGlyphOrText('C#').addGlyphOrText('7(#11b9)', superscript),
|
|
172
|
+
f.ChordSymbol({ fontSize: 16 }).addGlyphOrText('Ab').addGlyphOrText('7(#11b9)', superscript),
|
|
173
|
+
f.ChordSymbol({ fontSize: 18 }).addGlyphOrText('C#').addGlyphOrText('7(#11b9)', superscript),
|
|
174
|
+
];
|
|
175
|
+
draw(chords, 240);
|
|
176
|
+
options.assert.ok(true, 'Font Size Chord Symbol');
|
|
177
|
+
}
|
|
178
|
+
function kern(options) {
|
|
179
|
+
const f = VexFlowTests.makeFactory(options, 650 * 1.5, 650);
|
|
180
|
+
const ctx = f.getContext();
|
|
181
|
+
ctx.scale(1.5, 1.5);
|
|
182
|
+
function draw(chords, y) {
|
|
183
|
+
const stave = f.Stave({ x: 10, y, width: 450 }).addClef('treble').setContext(ctx).drawWithStyle();
|
|
184
|
+
const notes = [
|
|
185
|
+
note(f, ['C/4'], 'q', chords[0]),
|
|
186
|
+
note(f, ['C/4'], 'q', chords[1]),
|
|
187
|
+
note(f, ['C/4'], 'q', chords[2]),
|
|
188
|
+
note(f, ['C/4'], 'q', chords[3]),
|
|
189
|
+
];
|
|
190
|
+
const score = f.EasyScore();
|
|
191
|
+
const voice = score.voice(notes, { time: '4/4' });
|
|
192
|
+
f.Formatter().joinVoices([voice]).formatToStave([voice], stave);
|
|
193
|
+
f.draw();
|
|
194
|
+
}
|
|
195
|
+
let chords = [
|
|
196
|
+
f.ChordSymbol().addText('A').addGlyphSuperscript('dim'),
|
|
197
|
+
f.ChordSymbol().addText('A').addGlyphSuperscript('dim'),
|
|
198
|
+
f.ChordSymbol({ hJustify: 'left' }).addText('C').addGlyph('halfDiminished', superscript),
|
|
199
|
+
f.ChordSymbol().addText('D').addGlyph('halfDiminished', superscript),
|
|
200
|
+
];
|
|
201
|
+
draw(chords, 10);
|
|
202
|
+
chords = [
|
|
203
|
+
f.ChordSymbol().addText('A').addGlyphSuperscript('dim'),
|
|
204
|
+
f.ChordSymbol().addText('A').addGlyphSuperscript('dim'),
|
|
205
|
+
f.ChordSymbol().addText('A').addGlyphSuperscript('+').addTextSuperscript('5'),
|
|
206
|
+
f.ChordSymbol().addText('G').addGlyphSuperscript('+').addTextSuperscript('5'),
|
|
207
|
+
];
|
|
208
|
+
draw(chords, 110);
|
|
209
|
+
chords = [
|
|
210
|
+
f.ChordSymbol().addText('A').addGlyph('-'),
|
|
211
|
+
f.ChordSymbol().addText('E').addGlyph('-'),
|
|
212
|
+
f.ChordSymbol().addText('A').addGlyphOrText('(#11)', superscript),
|
|
213
|
+
f.ChordSymbol().addText('E').addGlyphOrText('(#9)', superscript),
|
|
214
|
+
];
|
|
215
|
+
draw(chords, 210);
|
|
216
|
+
chords = [
|
|
217
|
+
f.ChordSymbol().addGlyphOrText('F/B').addGlyphOrText('b', superscript),
|
|
218
|
+
f.ChordSymbol().addText('E').addGlyphOrText('V/V'),
|
|
219
|
+
f.ChordSymbol().addText('A').addGlyphOrText('(#11)', superscript),
|
|
220
|
+
f.ChordSymbol().addText('E').addGlyphOrText('(#9)', superscript),
|
|
221
|
+
];
|
|
222
|
+
draw(chords, 310);
|
|
223
|
+
options.assert.ok(true, 'Chord Symbol Kerning Tests');
|
|
224
|
+
}
|
|
225
|
+
function top(options) {
|
|
226
|
+
const f = VexFlowTests.makeFactory(options, 650 * 1.5, 650);
|
|
227
|
+
const ctx = f.getContext();
|
|
228
|
+
ctx.scale(1.5, 1.5);
|
|
229
|
+
const note = (factory, keys, duration, chordSymbol, direction) => factory.StaveNote({ keys, duration, stemDirection: direction }).addModifier(chordSymbol, 0);
|
|
230
|
+
function draw(c1, c2, y) {
|
|
231
|
+
const stave = f.Stave({ x: 10, y, width: 450 }).addClef('treble').setContext(ctx).drawWithStyle();
|
|
232
|
+
const notes = [
|
|
233
|
+
note(f, ['e/4', 'a/4', 'd/5'], 'h', c1, 1).addModifier(new Accidental('b'), 0),
|
|
234
|
+
note(f, ['c/5', 'e/5', 'c/6'], 'h', c2, -1),
|
|
235
|
+
];
|
|
236
|
+
const score = f.EasyScore();
|
|
237
|
+
const voice = score.voice(notes, { time: '4/4' });
|
|
238
|
+
f.Formatter().joinVoices([voice]).formatToStave([voice], stave);
|
|
239
|
+
f.draw();
|
|
240
|
+
}
|
|
241
|
+
let chord1 = f.ChordSymbol().addText('F7').setHorizontal('left').addGlyphOrText('(#11b9)', superscript);
|
|
242
|
+
let chord2 = f.ChordSymbol().addText('C').setHorizontal('left').addGlyphSuperscript('majorSeventh');
|
|
243
|
+
draw(chord1, chord2, 40);
|
|
244
|
+
chord1 = f
|
|
245
|
+
.ChordSymbol()
|
|
246
|
+
.addText('F7')
|
|
247
|
+
.addTextSuperscript('(')
|
|
248
|
+
.addGlyphOrText('#11b9', superscript)
|
|
249
|
+
.addTextSuperscript(')');
|
|
250
|
+
chord2 = f.ChordSymbol().addText('C').setHorizontal('left').addTextSuperscript('Maj.');
|
|
251
|
+
draw(chord1, chord2, 140);
|
|
252
|
+
chord1 = f
|
|
253
|
+
.ChordSymbol()
|
|
254
|
+
.addText('F7')
|
|
255
|
+
.setHorizontal('left')
|
|
256
|
+
.addGlyphOrText('#11', superscript)
|
|
257
|
+
.addGlyphOrText('b9', subscript);
|
|
258
|
+
chord2 = f.ChordSymbol().addText('C').addTextSuperscript('sus4');
|
|
259
|
+
draw(chord1, chord2, 240);
|
|
260
|
+
options.assert.ok(true, 'Top Chord Symbol');
|
|
261
|
+
}
|
|
262
|
+
function topJustify(options) {
|
|
263
|
+
const f = VexFlowTests.makeFactory(options, 500 * 1.5, 680);
|
|
264
|
+
const ctx = f.getContext();
|
|
265
|
+
ctx.scale(1.5, 1.5);
|
|
266
|
+
function draw(chord1, chord2, y) {
|
|
267
|
+
const stave = new Stave(10, y, 450).addClef('treble').setContext(ctx).drawWithStyle();
|
|
268
|
+
const notes = [
|
|
269
|
+
note(f, ['e/4', 'a/4', 'd/5'], 'h', chord1).addModifier(new Accidental('b'), 0),
|
|
270
|
+
note(f, ['c/4', 'e/4', 'B/4'], 'h', chord2),
|
|
271
|
+
];
|
|
272
|
+
Formatter.FormatAndDraw(ctx, stave, notes);
|
|
273
|
+
}
|
|
274
|
+
let chord1 = f.ChordSymbol().addText('F7').setHorizontal('left').addGlyphOrText('(#11b9)', superscript);
|
|
275
|
+
let chord2 = f.ChordSymbol({ hJustify: 'left' }).addText('C').addGlyphSuperscript('majorSeventh');
|
|
276
|
+
draw(chord1, chord2, 40);
|
|
277
|
+
chord1 = f
|
|
278
|
+
.ChordSymbol({ hJustify: 'center' })
|
|
279
|
+
.addText('F7')
|
|
280
|
+
.setHorizontal('left')
|
|
281
|
+
.addGlyphOrText('(#11b9)', superscript);
|
|
282
|
+
chord2 = f.ChordSymbol({ hJustify: 'center' }).addText('C').addTextSuperscript('Maj.');
|
|
283
|
+
draw(chord1, chord2, 140);
|
|
284
|
+
chord1 = f
|
|
285
|
+
.ChordSymbol({ hJustify: 'right' })
|
|
286
|
+
.addText('F7')
|
|
287
|
+
.setHorizontal('left')
|
|
288
|
+
.addGlyphOrText('#11', superscript)
|
|
289
|
+
.addGlyphOrText('b9', subscript);
|
|
290
|
+
chord2 = f.ChordSymbol({ hJustify: 'right' }).addText('C').addTextSuperscript('Maj.');
|
|
291
|
+
draw(chord1, chord2, 240);
|
|
292
|
+
chord1 = f
|
|
293
|
+
.ChordSymbol({ hJustify: 'left' })
|
|
294
|
+
.addText('F7')
|
|
295
|
+
.setHorizontal('left')
|
|
296
|
+
.addGlyphOrText('#11', superscript)
|
|
297
|
+
.addGlyphOrText('b9', subscript);
|
|
298
|
+
chord2 = f.ChordSymbol({ hJustify: 'centerStem' }).addText('C').addTextSuperscript('Maj.');
|
|
299
|
+
draw(chord1, chord2, 340);
|
|
300
|
+
options.assert.ok(true, 'Top Chord Justified');
|
|
301
|
+
}
|
|
302
|
+
function bottom(options) {
|
|
303
|
+
const f = VexFlowTests.makeFactory(options, 600 * 1.5, 230);
|
|
304
|
+
const ctx = f.getContext();
|
|
305
|
+
ctx.scale(1.5, 1.5);
|
|
306
|
+
function draw(chords, y) {
|
|
307
|
+
const stave = new Stave(10, y, 400).addClef('treble').setContext(ctx).drawWithStyle();
|
|
308
|
+
const notes = [
|
|
309
|
+
note(f, ['c/4', 'f/4', 'a/4'], 'q', chords[0]),
|
|
310
|
+
note(f, ['c/4', 'e/4', 'b/4'], 'q', chords[1]).addModifier(new Accidental('b'), 2),
|
|
311
|
+
note(f, ['c/4', 'e/4', 'g/4'], 'q', chords[2]),
|
|
312
|
+
note(f, ['c/4', 'f/4', 'a/4'], 'q', chords[3]).addModifier(new Accidental('#'), 1),
|
|
313
|
+
];
|
|
314
|
+
Formatter.FormatAndDraw(ctx, stave, notes);
|
|
315
|
+
}
|
|
316
|
+
const chords = [
|
|
317
|
+
f.ChordSymbol({ vJustify: 'bottom' }).addText('I').addTextSuperscript('6').addTextSubscript('4'),
|
|
318
|
+
f.ChordSymbol({ vJustify: 'bottom' }).addGlyphOrText('V'),
|
|
319
|
+
f.ChordSymbol({ vJustify: 'bottom' }).addLine(),
|
|
320
|
+
f.ChordSymbol({ vJustify: 'bottom' }).addGlyphOrText('V/V'),
|
|
321
|
+
];
|
|
322
|
+
draw(chords, 10);
|
|
323
|
+
options.assert.ok(true, 'Bottom Chord Symbol');
|
|
324
|
+
}
|
|
325
|
+
function bottomStemDown(options) {
|
|
326
|
+
const f = VexFlowTests.makeFactory(options, 600 * 1.5, 330);
|
|
327
|
+
const ctx = f.getContext();
|
|
328
|
+
ctx.scale(1.5, 1.5);
|
|
329
|
+
function draw(chords, y) {
|
|
330
|
+
const note = (keys, duration, chordSymbol) => new StaveNote({ keys, duration, stemDirection: -1 }).addModifier(chordSymbol, 0);
|
|
331
|
+
const stave = new Stave(10, y, 400).addClef('treble').setContext(ctx).drawWithStyle();
|
|
332
|
+
const notes = [
|
|
333
|
+
note(['c/4', 'f/4', 'a/4'], 'q', chords[0]),
|
|
334
|
+
note(['c/4', 'e/4', 'b/4'], 'q', chords[1]).addModifier(new Accidental('b'), 2),
|
|
335
|
+
note(['c/4', 'e/4', 'g/4'], 'q', chords[2]),
|
|
336
|
+
note(['c/4', 'f/4', 'a/4'], 'q', chords[3]).addModifier(new Accidental('#'), 1),
|
|
337
|
+
];
|
|
338
|
+
Formatter.FormatAndDraw(ctx, stave, notes);
|
|
339
|
+
}
|
|
340
|
+
const chords = [
|
|
341
|
+
f.ChordSymbol({ vJustify: 'bottom' }).addGlyphOrText('F'),
|
|
342
|
+
f.ChordSymbol({ vJustify: 'bottom' }).addGlyphOrText('C7'),
|
|
343
|
+
f.ChordSymbol({ vJustify: 'bottom' }).addLine(),
|
|
344
|
+
f.ChordSymbol({ vJustify: 'bottom' }).addText('A').addGlyphSuperscript('dim'),
|
|
345
|
+
];
|
|
346
|
+
draw(chords, 10);
|
|
347
|
+
options.assert.ok(true, 'Bottom Stem Down Chord Symbol');
|
|
348
|
+
}
|
|
349
|
+
function doubleBottom(options) {
|
|
350
|
+
const f = VexFlowTests.makeFactory(options, 600 * 1.5, 260);
|
|
351
|
+
const ctx = f.getContext();
|
|
352
|
+
ctx.scale(1.5, 1.5);
|
|
353
|
+
function draw(chords, chords2, y) {
|
|
354
|
+
const note = (keys, duration, chordSymbol1, chordSymbol2) => new StaveNote({ keys, duration }).addModifier(chordSymbol1, 0).addModifier(chordSymbol2, 0);
|
|
355
|
+
const stave = f.Stave({ x: 10, y, width: 450 }).addClef('treble').setContext(ctx).drawWithStyle();
|
|
356
|
+
const notes = [
|
|
357
|
+
note(['c/4', 'f/4', 'a/4'], 'q', chords[0], chords2[0]),
|
|
358
|
+
note(['c/4', 'e/4', 'b/4'], 'q', chords[1], chords2[1]).addModifier(f.Accidental({ type: 'b' }), 2),
|
|
359
|
+
note(['c/4', 'e/4', 'g/4'], 'q', chords[2], chords2[2]),
|
|
360
|
+
note(['c/4', 'f/4', 'a/4'], 'q', chords[3], chords2[3]).addModifier(f.Accidental({ type: '#' }), 1),
|
|
361
|
+
];
|
|
362
|
+
Formatter.FormatAndDraw(ctx, stave, notes);
|
|
363
|
+
}
|
|
364
|
+
const chords1 = [
|
|
365
|
+
f.ChordSymbol({ vJustify: 'bottom' }).addText('I').addTextSuperscript('6').addTextSubscript('4'),
|
|
366
|
+
f.ChordSymbol({ vJustify: 'bottom' }).addGlyphOrText('V'),
|
|
367
|
+
f.ChordSymbol({ vJustify: 'bottom' }).addLine(),
|
|
368
|
+
f.ChordSymbol({ vJustify: 'bottom' }).addGlyphOrText('V/V'),
|
|
369
|
+
];
|
|
370
|
+
const chords2 = [
|
|
371
|
+
f.ChordSymbol({ vJustify: 'bottom' }).addText('T'),
|
|
372
|
+
f.ChordSymbol({ vJustify: 'bottom' }).addText('D'),
|
|
373
|
+
f.ChordSymbol({ vJustify: 'bottom' }).addText('D'),
|
|
374
|
+
f.ChordSymbol({ vJustify: 'bottom' }).addText('SD'),
|
|
375
|
+
];
|
|
376
|
+
draw(chords1, chords2, 10);
|
|
377
|
+
options.assert.ok(true, '2 Bottom Chord Symbol');
|
|
378
|
+
}
|
|
379
|
+
function wide(options) {
|
|
380
|
+
const f = VexFlowTests.makeFactory(options, 300 * 1.5, 680);
|
|
381
|
+
const ctx = f.getContext();
|
|
382
|
+
ctx.scale(1.5, 1.5);
|
|
383
|
+
function draw(chord1, chord2, y) {
|
|
384
|
+
const stave = new Stave(10, y, 250).addClef('treble').setContext(ctx).drawWithStyle();
|
|
385
|
+
const notes = [
|
|
386
|
+
note(f, ['e/4', 'a/4', 'd/5'], 'h', chord1).addModifier(new Accidental('b'), 0),
|
|
387
|
+
note(f, ['c/4', 'e/4', 'B/4'], 'h', chord2),
|
|
388
|
+
];
|
|
389
|
+
Formatter.FormatAndDraw(ctx, stave, notes);
|
|
390
|
+
}
|
|
391
|
+
let chord1 = f.ChordSymbol().addText('FrogToad7').setHorizontal('left').addGlyphOrText('(#11b9)', superscript);
|
|
392
|
+
let chord2 = f.ChordSymbol({ hJustify: 'left' }).addText('CToShiningC').addGlyphSuperscript('majorSeventh');
|
|
393
|
+
draw(chord1, chord2, 40);
|
|
394
|
+
chord1 = f
|
|
395
|
+
.ChordSymbol({ hJustify: 'right' })
|
|
396
|
+
.addText('FrogToad7')
|
|
397
|
+
.setHorizontal('left')
|
|
398
|
+
.addGlyphOrText('#11', superscript)
|
|
399
|
+
.addGlyphOrText('b9', subscript);
|
|
400
|
+
chord2 = f.ChordSymbol({ hJustify: 'left' }).addText('CToShiningC').addTextSuperscript('Maj.');
|
|
401
|
+
draw(chord1, chord2, 240);
|
|
402
|
+
options.assert.ok(true, 'Wide Chord Symbols');
|
|
403
|
+
}
|
|
404
|
+
VexFlowTests.register(ChordSymbolTests);
|
|
405
|
+
export { ChordSymbolTests };
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
import { VexFlowTests } from './vexflow_test_helpers.js';
|
|
2
|
+
const ClefTests = {
|
|
3
|
+
Start() {
|
|
4
|
+
VexFlowTests.module('Clef');
|
|
5
|
+
const run = VexFlowTests.runTests;
|
|
6
|
+
run('Bounding Box', draw, { drawBoundingBox: true });
|
|
7
|
+
run('Bounding Box Clef Change', drawClefChange, { drawBoundingBox: true });
|
|
8
|
+
run('Clef Test', draw, { drawBoundingBox: false });
|
|
9
|
+
run('Clef End Test', drawEnd);
|
|
10
|
+
run('Small Clef Test', drawSmall);
|
|
11
|
+
run('Small Clef End Test', drawSmallEnd);
|
|
12
|
+
run('Clef Change Test', drawClefChange, { drawBoundingBox: false });
|
|
13
|
+
},
|
|
14
|
+
};
|
|
15
|
+
function draw(options) {
|
|
16
|
+
const f = VexFlowTests.makeFactory(options, 800, 120);
|
|
17
|
+
const stave = f
|
|
18
|
+
.Stave()
|
|
19
|
+
.addClef('treble')
|
|
20
|
+
.addClef('treble', 'default', '8va')
|
|
21
|
+
.addClef('treble', 'default', '8vb')
|
|
22
|
+
.addClef('alto')
|
|
23
|
+
.addClef('tenor')
|
|
24
|
+
.addClef('soprano')
|
|
25
|
+
.addClef('bass')
|
|
26
|
+
.addClef('bass', 'default', '8vb')
|
|
27
|
+
.addClef('mezzo-soprano')
|
|
28
|
+
.addClef('baritone-c')
|
|
29
|
+
.addClef('baritone-f')
|
|
30
|
+
.addClef('subbass')
|
|
31
|
+
.addClef('percussion')
|
|
32
|
+
.addClef('french')
|
|
33
|
+
.addEndClef('treble');
|
|
34
|
+
f.draw();
|
|
35
|
+
if (options.params.drawBoundingBox === true) {
|
|
36
|
+
const elements = stave.getModifiers(undefined, 'Clef');
|
|
37
|
+
elements.forEach((element) => VexFlowTests.drawBoundingBox(f.getContext(), element));
|
|
38
|
+
}
|
|
39
|
+
options.assert.ok(true, 'all pass');
|
|
40
|
+
}
|
|
41
|
+
function drawEnd(options) {
|
|
42
|
+
const f = VexFlowTests.makeFactory(options, 800, 120);
|
|
43
|
+
f.Stave()
|
|
44
|
+
.addClef('bass')
|
|
45
|
+
.addEndClef('treble')
|
|
46
|
+
.addEndClef('treble', 'default', '8va')
|
|
47
|
+
.addEndClef('treble', 'default', '8vb')
|
|
48
|
+
.addEndClef('alto')
|
|
49
|
+
.addEndClef('tenor')
|
|
50
|
+
.addEndClef('soprano')
|
|
51
|
+
.addEndClef('bass')
|
|
52
|
+
.addEndClef('bass', 'default', '8vb')
|
|
53
|
+
.addEndClef('mezzo-soprano')
|
|
54
|
+
.addEndClef('baritone-c')
|
|
55
|
+
.addEndClef('baritone-f')
|
|
56
|
+
.addEndClef('subbass')
|
|
57
|
+
.addEndClef('percussion')
|
|
58
|
+
.addEndClef('french');
|
|
59
|
+
f.draw();
|
|
60
|
+
options.assert.ok(true, 'all pass');
|
|
61
|
+
}
|
|
62
|
+
function drawSmall(options) {
|
|
63
|
+
const f = VexFlowTests.makeFactory(options, 800, 120);
|
|
64
|
+
f.Stave()
|
|
65
|
+
.addClef('treble', 'small')
|
|
66
|
+
.addClef('treble', 'small', '8va')
|
|
67
|
+
.addClef('treble', 'small', '8vb')
|
|
68
|
+
.addClef('alto', 'small')
|
|
69
|
+
.addClef('tenor', 'small')
|
|
70
|
+
.addClef('soprano', 'small')
|
|
71
|
+
.addClef('bass', 'small')
|
|
72
|
+
.addClef('bass', 'small', '8vb')
|
|
73
|
+
.addClef('mezzo-soprano', 'small')
|
|
74
|
+
.addClef('baritone-c', 'small')
|
|
75
|
+
.addClef('baritone-f', 'small')
|
|
76
|
+
.addClef('subbass', 'small')
|
|
77
|
+
.addClef('percussion', 'small')
|
|
78
|
+
.addClef('french', 'small')
|
|
79
|
+
.addEndClef('treble', 'small');
|
|
80
|
+
f.draw();
|
|
81
|
+
options.assert.ok(true, 'all pass');
|
|
82
|
+
}
|
|
83
|
+
function drawSmallEnd(options) {
|
|
84
|
+
const f = VexFlowTests.makeFactory(options, 800, 120);
|
|
85
|
+
f.Stave()
|
|
86
|
+
.addClef('bass', 'small')
|
|
87
|
+
.addEndClef('treble', 'small')
|
|
88
|
+
.addEndClef('treble', 'small', '8va')
|
|
89
|
+
.addEndClef('treble', 'small', '8vb')
|
|
90
|
+
.addEndClef('alto', 'small')
|
|
91
|
+
.addEndClef('tenor', 'small')
|
|
92
|
+
.addEndClef('soprano', 'small')
|
|
93
|
+
.addEndClef('bass', 'small')
|
|
94
|
+
.addEndClef('bass', 'small', '8vb')
|
|
95
|
+
.addEndClef('mezzo-soprano', 'small')
|
|
96
|
+
.addEndClef('baritone-c', 'small')
|
|
97
|
+
.addEndClef('baritone-f', 'small')
|
|
98
|
+
.addEndClef('subbass', 'small')
|
|
99
|
+
.addEndClef('percussion', 'small')
|
|
100
|
+
.addEndClef('french', 'small');
|
|
101
|
+
f.draw();
|
|
102
|
+
options.assert.ok(true, 'all pass');
|
|
103
|
+
}
|
|
104
|
+
function drawClefChange(options) {
|
|
105
|
+
const f = VexFlowTests.makeFactory(options, 800, 180);
|
|
106
|
+
const stave = f.Stave().addClef('treble');
|
|
107
|
+
const notes = [
|
|
108
|
+
f.StaveNote({ keys: ['c/4'], duration: '4', clef: 'treble' }),
|
|
109
|
+
f.ClefNote({ type: 'alto', options: { size: 'small' } }),
|
|
110
|
+
f.StaveNote({ keys: ['c/4'], duration: '4', clef: 'alto' }),
|
|
111
|
+
f.ClefNote({ type: 'tenor', options: { size: 'small' } }),
|
|
112
|
+
f.StaveNote({ keys: ['c/4'], duration: '4', clef: 'tenor' }),
|
|
113
|
+
f.ClefNote({ type: 'soprano', options: { size: 'small' } }),
|
|
114
|
+
f.StaveNote({ keys: ['c/4'], duration: '4', clef: 'soprano' }),
|
|
115
|
+
f.ClefNote({ type: 'bass', options: { size: 'small' } }),
|
|
116
|
+
f.StaveNote({ keys: ['c/4'], duration: '4', clef: 'bass' }),
|
|
117
|
+
f.ClefNote({ type: 'mezzo-soprano', options: { size: 'small' } }),
|
|
118
|
+
f.StaveNote({ keys: ['c/4'], duration: '4', clef: 'mezzo-soprano' }),
|
|
119
|
+
f.ClefNote({ type: 'baritone-c', options: { size: 'small' } }),
|
|
120
|
+
f.StaveNote({ keys: ['c/4'], duration: '4', clef: 'baritone-c' }),
|
|
121
|
+
f.ClefNote({ type: 'baritone-f', options: { size: 'small' } }),
|
|
122
|
+
f.StaveNote({ keys: ['c/4'], duration: '4', clef: 'baritone-f' }),
|
|
123
|
+
f.ClefNote({ type: 'subbass', options: { size: 'small' } }),
|
|
124
|
+
f.StaveNote({ keys: ['c/4'], duration: '4', clef: 'subbass' }),
|
|
125
|
+
f.ClefNote({ type: 'french', options: { size: 'small' } }),
|
|
126
|
+
f.StaveNote({ keys: ['c/4'], duration: '4', clef: 'french' }),
|
|
127
|
+
f.ClefNote({ type: 'treble', options: { size: 'small', annotation: '8vb' } }),
|
|
128
|
+
f.StaveNote({ keys: ['c/4'], duration: '4', clef: 'treble', octaveShift: -1 }),
|
|
129
|
+
f.ClefNote({ type: 'treble', options: { size: 'small', annotation: '8va' } }),
|
|
130
|
+
f.StaveNote({ keys: ['c/4'], duration: '4', clef: 'treble', octaveShift: 1 }),
|
|
131
|
+
];
|
|
132
|
+
const voice = f.Voice({ time: '12/4' }).addTickables(notes);
|
|
133
|
+
f.Formatter().joinVoices([voice]).formatToStave([voice], stave);
|
|
134
|
+
f.draw();
|
|
135
|
+
if (options.params.drawBoundingBox === true) {
|
|
136
|
+
notes.forEach((element) => VexFlowTests.drawBoundingBox(f.getContext(), element));
|
|
137
|
+
}
|
|
138
|
+
options.assert.ok(true, 'all pass');
|
|
139
|
+
}
|
|
140
|
+
VexFlowTests.register(ClefTests);
|
|
141
|
+
export { ClefTests };
|