vexflow 5.0.0-beta.1 → 5.1.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.
Files changed (127) hide show
  1. package/LICENSE +3 -3
  2. package/README.md +32 -50
  3. package/build/cjs/vexflow-bravura.js +2 -2
  4. package/build/cjs/vexflow-bravura.js.map +1 -1
  5. package/build/cjs/vexflow-core.js +2 -2
  6. package/build/cjs/vexflow-core.js.map +1 -1
  7. package/build/cjs/vexflow-debug-with-tests.js +3685 -1386
  8. package/build/cjs/vexflow-debug-with-tests.js.map +1 -1
  9. package/build/cjs/vexflow-debug.js +2443 -980
  10. package/build/cjs/vexflow-debug.js.map +1 -1
  11. package/build/cjs/vexflow.js +2 -2
  12. package/build/cjs/vexflow.js.map +1 -1
  13. package/build/esm/src/accidental.js +1 -0
  14. package/build/esm/src/annotation.js +31 -8
  15. package/build/esm/src/beam.js +4 -2
  16. package/build/esm/src/chordsymbol.js +3 -1
  17. package/build/esm/src/clef.js +3 -1
  18. package/build/esm/src/curve.js +68 -11
  19. package/build/esm/src/easyscore.js +40 -1
  20. package/build/esm/src/element.js +42 -9
  21. package/build/esm/src/factory.js +46 -9
  22. package/build/esm/src/flag.js +3 -1
  23. package/build/esm/src/font.js +17 -0
  24. package/build/esm/src/formatter.js +34 -36
  25. package/build/esm/src/fraction.js +4 -1
  26. package/build/esm/src/glyphnote.js +3 -1
  27. package/build/esm/src/gracenotegroup.js +18 -1
  28. package/build/esm/src/index.js +2 -0
  29. package/build/esm/src/keysignature.js +3 -1
  30. package/build/esm/src/metrics.js +55 -1
  31. package/build/esm/src/modifiercontext.js +15 -1
  32. package/build/esm/src/note.js +2 -2
  33. package/build/esm/src/notehead.js +3 -1
  34. package/build/esm/src/ornament.js +3 -1
  35. package/build/esm/src/pedalmarking.js +44 -5
  36. package/build/esm/src/registry.js +16 -6
  37. package/build/esm/src/rendercontext.js +10 -0
  38. package/build/esm/src/sheet.js +117 -0
  39. package/build/esm/src/stave.js +13 -8
  40. package/build/esm/src/stavebarline.js +53 -1
  41. package/build/esm/src/staveline.js +2 -0
  42. package/build/esm/src/stavenote.js +54 -19
  43. package/build/esm/src/stavetie.js +3 -1
  44. package/build/esm/src/stem.js +2 -1
  45. package/build/esm/src/stemmablenote.js +9 -0
  46. package/build/esm/src/stringnumber.js +0 -1
  47. package/build/esm/src/strokes.js +10 -0
  48. package/build/esm/src/svgcontext.js +14 -4
  49. package/build/esm/src/svgexport.js +68 -0
  50. package/build/esm/src/system.js +14 -0
  51. package/build/esm/src/tables.js +69 -37
  52. package/build/esm/src/tabnote.js +20 -1
  53. package/build/esm/src/textbracket.js +5 -4
  54. package/build/esm/src/textdynamics.js +5 -0
  55. package/build/esm/src/textnote.js +3 -3
  56. package/build/esm/src/tickable.js +56 -22
  57. package/build/esm/src/timesignature.js +30 -9
  58. package/build/esm/src/timesignote.js +3 -1
  59. package/build/esm/src/tuning.js +2 -2
  60. package/build/esm/src/tuplet.js +79 -29
  61. package/build/esm/src/util.js +1 -0
  62. package/build/esm/src/version.js +3 -3
  63. package/build/esm/src/vexflow.js +14 -2
  64. package/build/esm/src/voice.js +44 -8
  65. package/build/esm/tests/accidental_tests.js +52 -0
  66. package/build/esm/tests/annotation_tests.js +38 -0
  67. package/build/esm/tests/articulation_tests.js +34 -0
  68. package/build/esm/tests/beam_tests.js +17 -0
  69. package/build/esm/tests/curve_tests.js +81 -0
  70. package/build/esm/tests/font_tests.js +32 -1
  71. package/build/esm/tests/formatter_tests.js +58 -23
  72. package/build/esm/tests/gracenote_tests.js +58 -0
  73. package/build/esm/tests/gracetabnote_tests.js +40 -0
  74. package/build/esm/tests/keysignature_tests.js +14 -3
  75. package/build/esm/tests/node/package-input-tests.mjs +149 -0
  76. package/build/esm/tests/node/render-metrics-tests.mjs +78 -0
  77. package/build/esm/tests/node/rendering-tests.mjs +75 -0
  78. package/build/esm/tests/node/sheet-tests.mjs +202 -0
  79. package/build/esm/tests/node/svg-export-tests.mjs +182 -0
  80. package/build/esm/tests/pedalmarking_tests.js +25 -0
  81. package/build/esm/tests/rests_tests.js +6 -0
  82. package/build/esm/tests/stave_tests.js +6 -3
  83. package/build/esm/tests/stavenote_tests.js +100 -55
  84. package/build/esm/tests/strokes_tests.js +19 -5
  85. package/build/esm/tests/timesignature_tests.js +19 -0
  86. package/build/esm/tests/tuplet_tests.js +273 -12
  87. package/build/esm/tests/unison_tests.js +13 -13
  88. package/build/esm/tests/voice_tests.js +34 -0
  89. package/build/esm/tools/render-metrics.mjs +49 -0
  90. package/build/esm/tools/score-fixtures.mjs +94 -0
  91. package/build/esm/tools/sheet-fixture.mjs +90 -0
  92. package/build/esm/tools/visual-regression.mjs +106 -0
  93. package/build/types/src/annotation.d.ts +17 -1
  94. package/build/types/src/curve.d.ts +24 -7
  95. package/build/types/src/easyscore.d.ts +8 -0
  96. package/build/types/src/element.d.ts +5 -0
  97. package/build/types/src/factory.d.ts +18 -1
  98. package/build/types/src/font.d.ts +2 -0
  99. package/build/types/src/formatter.d.ts +23 -14
  100. package/build/types/src/gracenotegroup.d.ts +5 -0
  101. package/build/types/src/index.d.ts +2 -0
  102. package/build/types/src/metrics.d.ts +2 -0
  103. package/build/types/src/modifiercontext.d.ts +4 -0
  104. package/build/types/src/pedalmarking.d.ts +4 -1
  105. package/build/types/src/registry.d.ts +2 -0
  106. package/build/types/src/rendercontext.d.ts +12 -0
  107. package/build/types/src/sheet.d.ts +49 -0
  108. package/build/types/src/stave.d.ts +4 -4
  109. package/build/types/src/stavebarline.d.ts +10 -0
  110. package/build/types/src/stavenote.d.ts +11 -0
  111. package/build/types/src/strokes.d.ts +4 -0
  112. package/build/types/src/svgcontext.d.ts +5 -0
  113. package/build/types/src/svgexport.d.ts +22 -0
  114. package/build/types/src/system.d.ts +4 -0
  115. package/build/types/src/tables.d.ts +9 -0
  116. package/build/types/src/tabnote.d.ts +4 -0
  117. package/build/types/src/textbracket.d.ts +1 -1
  118. package/build/types/src/textdynamics.d.ts +3 -0
  119. package/build/types/src/tickable.d.ts +27 -10
  120. package/build/types/src/timesignature.d.ts +4 -0
  121. package/build/types/src/tuplet.d.ts +8 -0
  122. package/build/types/src/util.d.ts +1 -0
  123. package/build/types/src/vexflow.d.ts +8 -1
  124. package/build/types/src/voice.d.ts +6 -0
  125. package/changelog/CHANGELOG.md +94 -0
  126. package/package.json +42 -26
  127. package/tests/flow.html +15 -7
@@ -20,6 +20,8 @@ import { TickContext } from '../src/tickcontext.js';
20
20
  const StaveNoteTests = {
21
21
  Start() {
22
22
  QUnit.module('StaveNote');
23
+ QUnit.test('lyricTieClearance', lyricTieClearance);
24
+ QUnit.test('restClearance', restClearance);
23
25
  QUnit.test('Tick', ticks);
24
26
  QUnit.test('Tick - New API', ticksNewAPI);
25
27
  QUnit.test('Stem', stem);
@@ -757,9 +759,9 @@ function dotsAndBeamsDown(options, contextBuilder) {
757
759
  options.assert.ok(true, 'Full Dot');
758
760
  }
759
761
  function noteHeadsSimple(options) {
760
- const vf = VexFlowTests.makeFactory(options, 800, 250);
761
- const score = vf.EasyScore();
762
- const system1 = vf.System({ y: 100, x: 50, width: 200 });
762
+ const factory = VexFlowTests.makeFactory(options, 800, 250);
763
+ const score = factory.EasyScore();
764
+ const system1 = factory.System({ y: 100, x: 50, width: 200 });
763
765
  system1
764
766
  .addStave({
765
767
  voices: [
@@ -769,29 +771,29 @@ function noteHeadsSimple(options) {
769
771
  })
770
772
  .addClef('treble')
771
773
  .addTimeSignature('4/4');
772
- const system2 = vf.System({ y: 100, x: 250, width: 150 });
774
+ const system2 = factory.System({ y: 100, x: 250, width: 150 });
773
775
  system2.addStave({
774
776
  voices: [score.voice(score.notes('b4/h, b4/h/r')), score.voice(score.notes('b4/w'))],
775
777
  });
776
- const system3 = vf.System({ y: 100, x: 400, width: 150 });
778
+ const system3 = factory.System({ y: 100, x: 400, width: 150 });
777
779
  system3.addStave({
778
780
  voices: [score.voice(score.notes('d5/h, d5/h/r')), score.voice(score.notes('e4/w'))],
779
781
  });
780
- const system4 = vf.System({ y: 100, x: 550, width: 150 });
782
+ const system4 = factory.System({ y: 100, x: 550, width: 150 });
781
783
  system4.addStave({
782
784
  voices: [
783
785
  score.voice(score.notes('e4/q, e4/q/r, e4/h/r')),
784
786
  score.voice(score.notes('e4/8, e4/8/r, e4/q/r, e4/h/r')),
785
787
  ],
786
788
  });
787
- vf.draw();
789
+ factory.draw();
788
790
  options.assert.expect(0);
789
791
  }
790
792
  function noPadding(options) {
791
- const vf = VexFlowTests.makeFactory(options, 800, 500);
792
- const score = vf.EasyScore();
793
+ const factory = VexFlowTests.makeFactory(options, 800, 500);
794
+ const score = factory.EasyScore();
793
795
  function newStave(y, noPadding) {
794
- let system = vf.System({ y, x: 50, width: 200, noPadding });
796
+ let system = factory.System({ y, x: 50, width: 200, noPadding });
795
797
  system
796
798
  .addStave({
797
799
  voices: [
@@ -801,28 +803,28 @@ function noPadding(options) {
801
803
  })
802
804
  .addClef('treble')
803
805
  .addTimeSignature('4/4');
804
- system = vf.System({ y, x: 250, width: 150, noPadding });
806
+ system = factory.System({ y, x: 250, width: 150, noPadding });
805
807
  system.addStave({
806
808
  voices: [score.voice(score.notes('b4/h, b4/h')), score.voice(score.notes('b4/w'))],
807
809
  });
808
- system = vf.System({ y, x: 400, width: 150, noPadding });
810
+ system = factory.System({ y, x: 400, width: 150, noPadding });
809
811
  system.addStave({
810
812
  voices: [score.voice(score.notes('d5/h, d5/h')), score.voice(score.notes('e4/w'))],
811
813
  });
812
- system = vf.System({ y, x: 550, width: 150, noPadding });
814
+ system = factory.System({ y, x: 550, width: 150, noPadding });
813
815
  system.addStave({
814
816
  voices: [score.voice(score.notes('e4/q, e4/q, e4/h')), score.voice(score.notes('e4/8, e4/8, e4/q, e4/h'))],
815
817
  });
816
818
  }
817
819
  newStave(100, true);
818
820
  newStave(200, false);
819
- vf.draw();
821
+ factory.draw();
820
822
  options.assert.expect(0);
821
823
  }
822
824
  function noteHeadsHidden(options) {
823
- const vf = VexFlowTests.makeFactory(options, 800, 250);
824
- const score = vf.EasyScore();
825
- const system1 = vf.System({ y: 100, x: 50, width: 200 });
825
+ const factory = VexFlowTests.makeFactory(options, 800, 250);
826
+ const score = factory.EasyScore();
827
+ const system1 = factory.System({ y: 100, x: 50, width: 200 });
826
828
  const notes1 = score.notes('g4/w');
827
829
  notes1[0].renderOptions.draw = false;
828
830
  system1
@@ -834,64 +836,64 @@ function noteHeadsHidden(options) {
834
836
  })
835
837
  .addClef('treble')
836
838
  .addTimeSignature('4/4');
837
- const system2 = vf.System({ y: 100, x: 250, width: 150 });
839
+ const system2 = factory.System({ y: 100, x: 250, width: 150 });
838
840
  const notes2 = score.notes('b4/w');
839
841
  notes2[0].renderOptions.draw = false;
840
842
  system2.addStave({
841
843
  voices: [score.voice(score.notes('b4/h, b4/h/r')), score.voice(notes2)],
842
844
  });
843
- const system3 = vf.System({ y: 100, x: 400, width: 150 });
845
+ const system3 = factory.System({ y: 100, x: 400, width: 150 });
844
846
  system3.addStave({
845
847
  voices: [score.voice(score.notes('d5/h, d5/h/r')), score.voice(score.notes('e4/w'))],
846
848
  });
847
- const system4 = vf.System({ y: 100, x: 550, width: 150 });
849
+ const system4 = factory.System({ y: 100, x: 550, width: 150 });
848
850
  const notes4 = score.notes('e4/q, e4/q/r, e4/h/r');
849
851
  notes4[0].renderOptions.draw = false;
850
852
  notes4[2].renderOptions.draw = false;
851
853
  system4.addStave({
852
854
  voices: [score.voice(notes4), score.voice(score.notes('e4/8, e4/8/r, e4/q/r, e4/h/r'))],
853
855
  });
854
- vf.draw();
856
+ factory.draw();
855
857
  options.assert.expect(0);
856
858
  }
857
859
  function centerAlignedRest(options) {
858
- const f = VexFlowTests.makeFactory(options, 400, 160);
859
- const stave = f.Stave({ x: 10, y: 10, width: 350 }).addClef('treble').addTimeSignature('4/4');
860
- const note = f.StaveNote({ keys: ['b/4'], duration: '1r', alignCenter: true });
861
- const voice = f.Voice().setStrict(false).addTickables([note]);
862
- f.Formatter().joinVoices([voice]).formatToStave([voice], stave);
863
- f.draw();
860
+ const factory = VexFlowTests.makeFactory(options, 400, 160);
861
+ const stave = factory.Stave({ x: 10, y: 10, width: 350 }).addClef('treble').addTimeSignature('4/4');
862
+ const note = factory.StaveNote({ keys: ['b/4'], duration: '1r', alignCenter: true });
863
+ const voice = factory.Voice().setStrict(false).addTickables([note]);
864
+ factory.Formatter().joinVoices([voice]).formatToStave([voice], stave);
865
+ factory.draw();
864
866
  options.assert.ok(true);
865
867
  }
866
868
  function centerAlignedRestFermata(options) {
867
- const f = VexFlowTests.makeFactory(options, 400, 160);
868
- const stave = f.Stave({ x: 10, y: 10, width: 350 }).addClef('treble').addTimeSignature('4/4');
869
- const note = f
869
+ const factory = VexFlowTests.makeFactory(options, 400, 160);
870
+ const stave = factory.Stave({ x: 10, y: 10, width: 350 }).addClef('treble').addTimeSignature('4/4');
871
+ const note = factory
870
872
  .StaveNote({ keys: ['b/4'], duration: '1r', alignCenter: true })
871
873
  .addModifier(new Articulation('a@a').setPosition(3), 0);
872
- const voice = f.Voice().setStrict(false).addTickables([note]);
873
- f.Formatter().joinVoices([voice]).formatToStave([voice], stave);
874
- f.draw();
874
+ const voice = factory.Voice().setStrict(false).addTickables([note]);
875
+ factory.Formatter().joinVoices([voice]).formatToStave([voice], stave);
876
+ factory.draw();
875
877
  options.assert.ok(true);
876
878
  }
877
879
  function centerAlignedRestAnnotation(options) {
878
- const f = VexFlowTests.makeFactory(options, 400, 160);
879
- const stave = f.Stave({ x: 10, y: 10, width: 350 }).addClef('treble').addTimeSignature('4/4');
880
- const note = f
880
+ const factory = VexFlowTests.makeFactory(options, 400, 160);
881
+ const stave = factory.Stave({ x: 10, y: 10, width: 350 }).addClef('treble').addTimeSignature('4/4');
882
+ const note = factory
881
883
  .StaveNote({ keys: ['b/4'], duration: '1r', alignCenter: true })
882
884
  .addModifier(new Annotation('Whole measure rest').setVerticalJustification(AnnotationVerticalJustify.TOP), 0);
883
- const voice = f.Voice().setStrict(false).addTickables([note]);
884
- f.Formatter().joinVoices([voice]).formatToStave([voice], stave);
885
- f.draw();
885
+ const voice = factory.Voice().setStrict(false).addTickables([note]);
886
+ factory.Formatter().joinVoices([voice]).formatToStave([voice], stave);
887
+ factory.draw();
886
888
  options.assert.ok(true);
887
889
  }
888
890
  function centerAlignedNoteMultiModifiers(options) {
889
- const f = VexFlowTests.makeFactory(options, 400, 160);
890
- const stave = f.Stave({ x: 10, y: 10, width: 350 }).addClef('treble').addTimeSignature('4/4');
891
+ const factory = VexFlowTests.makeFactory(options, 400, 160);
892
+ const stave = factory.Stave({ x: 10, y: 10, width: 350 }).addClef('treble').addTimeSignature('4/4');
891
893
  function newFinger(num, pos) {
892
894
  return new FretHandFinger(num).setPosition(pos);
893
895
  }
894
- const note = f
896
+ const note = factory
895
897
  .StaveNote({ keys: ['c/4', 'e/4', 'g/4'], duration: '4', alignCenter: true })
896
898
  .addModifier(new Annotation('Test').setPosition(3), 0)
897
899
  .addStroke(0, new Stroke(2))
@@ -901,36 +903,79 @@ function centerAlignedNoteMultiModifiers(options) {
901
903
  .addModifier(newFinger('1', Modifier.Position.RIGHT), 1)
902
904
  .addModifier(new StringNumber('4').setPosition(Modifier.Position.BELOW), 2);
903
905
  Dot.buildAndAttach([note], { all: true });
904
- const voice = f.Voice().setStrict(false).addTickables([note]);
905
- f.Formatter().joinVoices([voice]).formatToStave([voice], stave);
906
- f.draw();
906
+ const voice = factory.Voice().setStrict(false).addTickables([note]);
907
+ factory.Formatter().joinVoices([voice]).formatToStave([voice], stave);
908
+ factory.draw();
907
909
  options.assert.ok(true);
908
910
  }
909
911
  function centerAlignedMultiVoice(options) {
910
- const f = VexFlowTests.makeFactory(options, 400, 160);
911
- const stave = f.Stave({ x: 10, y: 10, width: 350 }).addClef('treble').addTimeSignature('3/8');
912
+ const factory = VexFlowTests.makeFactory(options, 400, 160);
913
+ const stave = factory.Stave({ x: 10, y: 10, width: 350 }).addClef('treble').addTimeSignature('3/8');
912
914
  const customDuration = new Fraction(3, 8);
913
915
  const notes0 = [
914
- f.StaveNote({
916
+ factory.StaveNote({
915
917
  keys: ['c/4'],
916
918
  duration: '1r',
917
919
  alignCenter: true,
918
920
  durationOverride: customDuration,
919
921
  }),
920
922
  ];
921
- const createStaveNote = (struct) => f.StaveNote(struct);
923
+ const createStaveNote = (struct) => factory.StaveNote(struct);
922
924
  const notes1 = [
923
925
  { keys: ['b/4'], duration: '8' },
924
926
  { keys: ['b/4'], duration: '8' },
925
927
  { keys: ['b/4'], duration: '8' },
926
928
  ].map(createStaveNote);
927
- notes1[1].addModifier(f.Accidental({ type: '#' }), 0);
928
- f.Beam({ notes: notes1 });
929
- const voice0 = f.Voice({ time: '3/8' }).setStrict(false).addTickables(notes0);
930
- const voice1 = f.Voice({ time: '3/8' }).setStrict(false).addTickables(notes1);
931
- f.Formatter().joinVoices([voice0, voice1]).formatToStave([voice0, voice1], stave);
932
- f.draw();
929
+ notes1[1].addModifier(factory.Accidental({ type: '#' }), 0);
930
+ factory.Beam({ notes: notes1 });
931
+ const voice0 = factory.Voice({ time: '3/8' }).setStrict(false).addTickables(notes0);
932
+ const voice1 = factory.Voice({ time: '3/8' }).setStrict(false).addTickables(notes1);
933
+ factory.Formatter().joinVoices([voice0, voice1]).formatToStave([voice0, voice1], stave);
934
+ factory.draw();
933
935
  options.assert.ok(true);
934
936
  }
935
937
  VexFlowTests.register(StaveNoteTests);
936
938
  export { StaveNoteTests };
939
+ function restClearance(assert) {
940
+ const fonts = VexFlow.getFonts();
941
+ try {
942
+ for (const family of ['Bravura', 'Petaluma']) {
943
+ VexFlow.setFonts(family, 'Academico');
944
+ for (const direction of [1, -1]) {
945
+ const stave = new Stave(20, 100, 500);
946
+ const rest = new StaveNote({ keys: ['b/4'], duration: 'qr', stemDirection: direction }).setStave(stave);
947
+ const chord = new StaveNote({
948
+ keys: direction > 0 ? ['g/4', 'c/5', 'g/5'] : ['c/4', 'e/4', 'g/4'],
949
+ duration: 'q',
950
+ stemDirection: -direction,
951
+ }).setStave(stave);
952
+ const voices = (direction > 0 ? [rest, chord] : [chord, rest]).map((n) => new VexFlow.Voice('1/4').addTickables([n]));
953
+ new Formatter().joinVoices(voices).formatToStave(voices, stave);
954
+ const a = rest.getBoundingBox(), b = chord.getBoundingBox();
955
+ assert.ok(direction > 0 ? a.y + a.h <= b.y : a.y >= b.y + b.h, family + ' rest clearance');
956
+ }
957
+ }
958
+ }
959
+ finally {
960
+ VexFlow.setFonts(...fonts);
961
+ }
962
+ }
963
+ function lyricTieClearance(assert) {
964
+ const offset = (lyric, nearby) => {
965
+ const stave = new Stave(10, 10, 600);
966
+ const notes = [0, 1].map(() => new StaveNote({ keys: ['c/4'], duration: 'h' }).setStave(stave));
967
+ if (lyric)
968
+ notes[0].addModifier(new Annotation('A very long lyric').setVerticalJustification(nearby === 'inline' ? 'center' : 'bottom'), 0);
969
+ if (nearby === 'dot')
970
+ Dot.buildAndAttach([notes[0]]);
971
+ if (nearby === 'number')
972
+ notes[0].addModifier(new StringNumber('3').setPosition(Modifier.Position.RIGHT), 0);
973
+ const voice = new VexFlow.Voice('4/4').addTickables(notes);
974
+ new Formatter().joinVoices([voice]).formatToStave([voice], stave);
975
+ return notes[0].getTieRightX() - notes[0].getAbsoluteX();
976
+ };
977
+ for (const nearby of ['', 'dot', 'number']) {
978
+ assert.equal(offset(true, nearby), offset(false, nearby), nearby + ' retains clearance');
979
+ }
980
+ assert.ok(offset(true, 'inline') > offset(false, ''), 'Inline annotations retain their width');
981
+ }
@@ -4,11 +4,12 @@ const StrokesTests = {
4
4
  Start() {
5
5
  QUnit.module('Strokes');
6
6
  const run = VexFlowTests.runTests;
7
- run('Strokes - Brush/Roll/Rasgueado', brushRollRasgueado);
8
- run('Strokes - Arpeggio directionless (without arrows)', arpeggioDirectionless);
9
- run('Strokes - Multi Voice', multiVoice);
10
- run('Strokes - Notation and Tab', notesWithTab);
11
- run('Strokes - Multi-Voice Notation and Tab', multiNotationAndTab);
7
+ run('Brush/Roll/Rasgueado', brushRollRasgueado, { drawBoundingBox: false });
8
+ run('Brush/Roll/Rasgueado - bounding box', brushRollRasgueado, { drawBoundingBox: true });
9
+ run('Arpeggio directionless (without arrows)', arpeggioDirectionless);
10
+ run('Multi Voice', multiVoice);
11
+ run('Notation and Tab', notesWithTab);
12
+ run('Multi-Voice Notation and Tab', multiNotationAndTab);
12
13
  },
13
14
  };
14
15
  function brushRollRasgueado(options) {
@@ -41,6 +42,19 @@ function brushRollRasgueado(options) {
41
42
  const voice2 = score.voice(notes2);
42
43
  f.Formatter().joinVoices([voice2]).formatToStave([voice2], stave2);
43
44
  f.draw();
45
+ const drawBoundingBoxes = (notes) => {
46
+ notes.forEach((note) => {
47
+ note.getModifiersByType("Stroke").forEach((stroke) => {
48
+ const bb = stroke.getBoundingBox();
49
+ f.getContext().rect(bb.getX(), bb.getY(), bb.getW(), bb.getH());
50
+ f.getContext().stroke();
51
+ });
52
+ });
53
+ };
54
+ if (options.params.drawBoundingBox) {
55
+ drawBoundingBoxes(notes1);
56
+ drawBoundingBoxes(notes2);
57
+ }
44
58
  options.assert.ok(true, 'Brush/Roll/Rasgueado');
45
59
  }
46
60
  function arpeggioDirectionless(options) {
@@ -14,6 +14,7 @@ const TimeSignatureTests = {
14
14
  run('Interchangeable Signature Test', interchangeable);
15
15
  run('Aggregate Signature Test', agregate);
16
16
  run('Complex Signature Test', complex);
17
+ run('Bounding Box Test', boundingBox);
17
18
  run('Time Signature multiple staves alignment test', multiple);
18
19
  run('Time Signature Change Test', change);
19
20
  },
@@ -115,6 +116,24 @@ function complex(options, contextBuilder) {
115
116
  .drawWithStyle();
116
117
  options.assert.ok(true, 'all pass');
117
118
  }
119
+ function boundingBox(options, contextBuilder) {
120
+ const ctx = contextBuilder(options.elementId, 600, 120);
121
+ const stave = new Stave(10, 10, 500)
122
+ .addTimeSignature('(2+3)/16')
123
+ .addTimeSignature('+')
124
+ .addTimeSignature('3/8')
125
+ .addTimeSignature('4/4')
126
+ .addTimeSignature('C')
127
+ .addTimeSignature('5322/3')
128
+ .addTimeSignature('3/54444')
129
+ .setContext(ctx)
130
+ .drawWithStyle();
131
+ const timeSignatures = stave.getModifiers();
132
+ timeSignatures.forEach((timeSignature) => {
133
+ VexFlowTests.drawBoundingBox(ctx, timeSignature);
134
+ });
135
+ options.assert.ok(true, 'all pass');
136
+ }
118
137
  function multiple(options, contextBuilder) {
119
138
  const ctx = contextBuilder(options.elementId, 400, 350);
120
139
  const stave1LineConfig = [false, false, true, false, false].map((visible) => ({ visible }));