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.
Files changed (328) hide show
  1. package/build/cjs/vexflow-bravura.js +2 -2
  2. package/build/cjs/vexflow-bravura.js.map +1 -1
  3. package/build/cjs/vexflow-core.js +2 -2
  4. package/build/cjs/vexflow-core.js.map +1 -1
  5. package/build/cjs/vexflow-debug-with-tests.js +126 -26
  6. package/build/cjs/vexflow-debug-with-tests.js.map +1 -1
  7. package/build/cjs/vexflow-debug.js +94 -26
  8. package/build/cjs/vexflow-debug.js.map +1 -1
  9. package/build/cjs/vexflow-gonville.js +2 -2
  10. package/build/cjs/vexflow-gonville.js.map +1 -1
  11. package/build/cjs/vexflow-petaluma.js +2 -2
  12. package/build/cjs/vexflow-petaluma.js.map +1 -1
  13. package/build/cjs/vexflow.js +2 -2
  14. package/build/cjs/vexflow.js.map +1 -1
  15. package/build/esm/src/version.js +3 -3
  16. package/package.json +1 -1
  17. package/src/note.ts +2 -2
  18. package/src/stavenote.ts +80 -16
  19. package/build/esm/entry/vexflow-bravura.js +0 -11
  20. package/build/esm/entry/vexflow-core.js +0 -54
  21. package/build/esm/entry/vexflow-debug-with-tests.js +0 -4
  22. package/build/esm/entry/vexflow-debug.js +0 -3
  23. package/build/esm/entry/vexflow-font-bravura.js +0 -7
  24. package/build/esm/entry/vexflow-font-custom.js +0 -7
  25. package/build/esm/entry/vexflow-font-gonville.js +0 -7
  26. package/build/esm/entry/vexflow-font-petaluma.js +0 -7
  27. package/build/esm/entry/vexflow-gonville.js +0 -11
  28. package/build/esm/entry/vexflow-petaluma.js +0 -11
  29. package/build/esm/entry/vexflow.js +0 -9
  30. package/build/esm/src/accidental.js +0 -348
  31. package/build/esm/src/annotation.js +0 -213
  32. package/build/esm/src/articulation.js +0 -264
  33. package/build/esm/src/barnote.js +0 -58
  34. package/build/esm/src/beam.js +0 -632
  35. package/build/esm/src/bend.js +0 -202
  36. package/build/esm/src/boundingbox.js +0 -59
  37. package/build/esm/src/boundingboxcomputation.js +0 -107
  38. package/build/esm/src/canvascontext.js +0 -202
  39. package/build/esm/src/chordsymbol.js +0 -578
  40. package/build/esm/src/clef.js +0 -153
  41. package/build/esm/src/clefnote.js +0 -65
  42. package/build/esm/src/crescendo.js +0 -77
  43. package/build/esm/src/curve.js +0 -118
  44. package/build/esm/src/dot.js +0 -137
  45. package/build/esm/src/easyscore.js +0 -374
  46. package/build/esm/src/element.js +0 -216
  47. package/build/esm/src/factory.js +0 -440
  48. package/build/esm/src/flow.js +0 -275
  49. package/build/esm/src/font.js +0 -264
  50. package/build/esm/src/fonts/bravura_glyphs.js +0 -3239
  51. package/build/esm/src/fonts/bravura_metrics.js +0 -507
  52. package/build/esm/src/fonts/custom_glyphs.js +0 -78
  53. package/build/esm/src/fonts/custom_metrics.js +0 -5
  54. package/build/esm/src/fonts/gonville_glyphs.js +0 -828
  55. package/build/esm/src/fonts/gonville_metrics.js +0 -421
  56. package/build/esm/src/fonts/load_all.js +0 -10
  57. package/build/esm/src/fonts/load_bravura.js +0 -6
  58. package/build/esm/src/fonts/load_custom.js +0 -6
  59. package/build/esm/src/fonts/load_gonville.js +0 -6
  60. package/build/esm/src/fonts/load_petaluma.js +0 -6
  61. package/build/esm/src/fonts/petaluma_glyphs.js +0 -1335
  62. package/build/esm/src/fonts/petaluma_metrics.js +0 -536
  63. package/build/esm/src/fonts/petalumascript_glyphs.js +0 -863
  64. package/build/esm/src/fonts/robotoslab_glyphs.js +0 -863
  65. package/build/esm/src/fonts/textfonts.js +0 -44
  66. package/build/esm/src/formatter.js +0 -568
  67. package/build/esm/src/fraction.js +0 -171
  68. package/build/esm/src/frethandfinger.js +0 -156
  69. package/build/esm/src/ghostnote.js +0 -50
  70. package/build/esm/src/glyph.js +0 -331
  71. package/build/esm/src/glyphnote.js +0 -55
  72. package/build/esm/src/gracenote.js +0 -133
  73. package/build/esm/src/gracenotegroup.js +0 -128
  74. package/build/esm/src/gracetabnote.js +0 -12
  75. package/build/esm/src/index.js +0 -91
  76. package/build/esm/src/keymanager.js +0 -99
  77. package/build/esm/src/keysignature.js +0 -250
  78. package/build/esm/src/keysignote.js +0 -28
  79. package/build/esm/src/modifier.js +0 -128
  80. package/build/esm/src/modifiercontext.js +0 -110
  81. package/build/esm/src/multimeasurerest.js +0 -173
  82. package/build/esm/src/music.js +0 -322
  83. package/build/esm/src/note.js +0 -371
  84. package/build/esm/src/notehead.js +0 -169
  85. package/build/esm/src/notesubgroup.js +0 -59
  86. package/build/esm/src/ornament.js +0 -206
  87. package/build/esm/src/parenthesis.js +0 -76
  88. package/build/esm/src/parser.js +0 -164
  89. package/build/esm/src/pedalmarking.js +0 -192
  90. package/build/esm/src/registry.js +0 -81
  91. package/build/esm/src/rendercontext.js +0 -24
  92. package/build/esm/src/renderer.js +0 -112
  93. package/build/esm/src/repeatnote.js +0 -22
  94. package/build/esm/src/stave.js +0 -547
  95. package/build/esm/src/stavebarline.js +0 -182
  96. package/build/esm/src/staveconnector.js +0 -196
  97. package/build/esm/src/stavehairpin.js +0 -120
  98. package/build/esm/src/staveline.js +0 -218
  99. package/build/esm/src/stavemodifier.js +0 -77
  100. package/build/esm/src/stavenote.js +0 -799
  101. package/build/esm/src/staverepetition.js +0 -155
  102. package/build/esm/src/stavesection.js +0 -58
  103. package/build/esm/src/stavetempo.js +0 -91
  104. package/build/esm/src/stavetext.js +0 -82
  105. package/build/esm/src/stavetie.js +0 -141
  106. package/build/esm/src/stavevolta.js +0 -67
  107. package/build/esm/src/stem.js +0 -131
  108. package/build/esm/src/stemmablenote.js +0 -193
  109. package/build/esm/src/stringnumber.js +0 -231
  110. package/build/esm/src/strokes.js +0 -200
  111. package/build/esm/src/svgcontext.js +0 -414
  112. package/build/esm/src/system.js +0 -116
  113. package/build/esm/src/tables.js +0 -1102
  114. package/build/esm/src/tabnote.js +0 -299
  115. package/build/esm/src/tabslide.js +0 -76
  116. package/build/esm/src/tabstave.js +0 -17
  117. package/build/esm/src/tabtie.js +0 -19
  118. package/build/esm/src/textbracket.js +0 -144
  119. package/build/esm/src/textdynamics.js +0 -81
  120. package/build/esm/src/textformatter.js +0 -177
  121. package/build/esm/src/textnote.js +0 -176
  122. package/build/esm/src/tickable.js +0 -214
  123. package/build/esm/src/tickcontext.js +0 -170
  124. package/build/esm/src/timesigglyph.js +0 -85
  125. package/build/esm/src/timesignature.js +0 -89
  126. package/build/esm/src/timesignote.js +0 -32
  127. package/build/esm/src/tremolo.js +0 -47
  128. package/build/esm/src/tuning.js +0 -54
  129. package/build/esm/src/tuplet.js +0 -240
  130. package/build/esm/src/typeguard.js +0 -30
  131. package/build/esm/src/util.js +0 -58
  132. package/build/esm/src/vex.js +0 -51
  133. package/build/esm/src/vibrato.js +0 -100
  134. package/build/esm/src/vibratobracket.js +0 -50
  135. package/build/esm/src/voice.js +0 -187
  136. package/build/esm/src/web.js +0 -15
  137. package/build/esm/tests/accidental_tests.js +0 -974
  138. package/build/esm/tests/annotation_tests.js +0 -377
  139. package/build/esm/tests/articulation_tests.js +0 -365
  140. package/build/esm/tests/auto_beam_formatting_tests.js +0 -548
  141. package/build/esm/tests/bach_tests.js +0 -335
  142. package/build/esm/tests/barline_tests.js +0 -52
  143. package/build/esm/tests/beam_tests.js +0 -595
  144. package/build/esm/tests/bend_tests.js +0 -215
  145. package/build/esm/tests/boundingbox_tests.js +0 -53
  146. package/build/esm/tests/boundingboxcomputation_tests.js +0 -183
  147. package/build/esm/tests/chordsymbol_tests.js +0 -320
  148. package/build/esm/tests/clef_tests.js +0 -131
  149. package/build/esm/tests/curve_tests.js +0 -118
  150. package/build/esm/tests/dot_tests.js +0 -123
  151. package/build/esm/tests/easyscore_tests.js +0 -459
  152. package/build/esm/tests/factory_tests.js +0 -44
  153. package/build/esm/tests/font_tests.js +0 -135
  154. package/build/esm/tests/formatter/framestack.js +0 -61
  155. package/build/esm/tests/formatter/tests.js +0 -203
  156. package/build/esm/tests/formatter_tests.js +0 -669
  157. package/build/esm/tests/fraction_tests.js +0 -72
  158. package/build/esm/tests/ghostnote_tests.js +0 -77
  159. package/build/esm/tests/glyphnote_tests.js +0 -113
  160. package/build/esm/tests/gracenote_tests.js +0 -370
  161. package/build/esm/tests/gracetabnote_tests.js +0 -79
  162. package/build/esm/tests/index.js +0 -68
  163. package/build/esm/tests/key_clef_tests.js +0 -103
  164. package/build/esm/tests/keymanager_tests.js +0 -68
  165. package/build/esm/tests/keysignature_tests.js +0 -308
  166. package/build/esm/tests/mocks.js +0 -71
  167. package/build/esm/tests/modifier_tests.js +0 -24
  168. package/build/esm/tests/multimeasurerest_tests.js +0 -141
  169. package/build/esm/tests/music_tests.js +0 -161
  170. package/build/esm/tests/notehead_tests.js +0 -137
  171. package/build/esm/tests/notesubgroup_tests.js +0 -149
  172. package/build/esm/tests/offscreencanvas_tests.js +0 -47
  173. package/build/esm/tests/ornament_tests.js +0 -298
  174. package/build/esm/tests/parser_tests.js +0 -122
  175. package/build/esm/tests/pedalmarking_tests.js +0 -64
  176. package/build/esm/tests/percussion_tests.js +0 -180
  177. package/build/esm/tests/registry_tests.js +0 -64
  178. package/build/esm/tests/renderer_tests.js +0 -113
  179. package/build/esm/tests/rests_tests.js +0 -248
  180. package/build/esm/tests/rhythm_tests.js +0 -357
  181. package/build/esm/tests/stave_tests.js +0 -560
  182. package/build/esm/tests/staveconnector_tests.js +0 -402
  183. package/build/esm/tests/stavehairpin_tests.js +0 -90
  184. package/build/esm/tests/staveline_tests.js +0 -122
  185. package/build/esm/tests/stavemodifier_tests.js +0 -51
  186. package/build/esm/tests/stavenote_tests.js +0 -835
  187. package/build/esm/tests/stavetie_tests.js +0 -108
  188. package/build/esm/tests/stringnumber_tests.js +0 -259
  189. package/build/esm/tests/strokes_tests.js +0 -275
  190. package/build/esm/tests/style_tests.js +0 -98
  191. package/build/esm/tests/support/qunit.js +0 -2765
  192. package/build/esm/tests/tabnote_tests.js +0 -474
  193. package/build/esm/tests/tabslide_tests.js +0 -135
  194. package/build/esm/tests/tabstave_tests.js +0 -23
  195. package/build/esm/tests/tabtie_tests.js +0 -173
  196. package/build/esm/tests/textbracket_tests.js +0 -100
  197. package/build/esm/tests/textformatter_tests.js +0 -24
  198. package/build/esm/tests/textnote_tests.js +0 -215
  199. package/build/esm/tests/threevoice_tests.js +0 -132
  200. package/build/esm/tests/tickcontext_tests.js +0 -36
  201. package/build/esm/tests/timesignature_tests.js +0 -134
  202. package/build/esm/tests/tremolo_tests.js +0 -75
  203. package/build/esm/tests/tuning_tests.js +0 -56
  204. package/build/esm/tests/tuplet_tests.js +0 -450
  205. package/build/esm/tests/typeguard_tests.js +0 -82
  206. package/build/esm/tests/vexflow_test_helpers.js +0 -266
  207. package/build/esm/tests/vf_prefix_tests.js +0 -115
  208. package/build/esm/tests/vibrato_tests.js +0 -92
  209. package/build/esm/tests/vibratobracket_tests.js +0 -45
  210. package/build/esm/tests/voice_tests.js +0 -69
  211. package/build/types/entry/vexflow-bravura.d.ts +0 -3
  212. package/build/types/entry/vexflow-core.d.ts +0 -3
  213. package/build/types/entry/vexflow-debug.d.ts +0 -3
  214. package/build/types/entry/vexflow-font-bravura.d.ts +0 -3771
  215. package/build/types/entry/vexflow-font-custom.d.ts +0 -86
  216. package/build/types/entry/vexflow-font-gonville.d.ts +0 -1267
  217. package/build/types/entry/vexflow-font-petaluma.d.ts +0 -1896
  218. package/build/types/entry/vexflow-gonville.d.ts +0 -3
  219. package/build/types/entry/vexflow-petaluma.d.ts +0 -3
  220. package/build/types/entry/vexflow.d.ts +0 -3
  221. package/build/types/src/accidental.d.ts +0 -66
  222. package/build/types/src/annotation.d.ts +0 -60
  223. package/build/types/src/articulation.d.ts +0 -62
  224. package/build/types/src/barnote.d.ts +0 -29
  225. package/build/types/src/beam.d.ts +0 -124
  226. package/build/types/src/bend.d.ts +0 -73
  227. package/build/types/src/boundingbox.d.ts +0 -42
  228. package/build/types/src/boundingboxcomputation.d.ts +0 -33
  229. package/build/types/src/canvascontext.d.ts +0 -89
  230. package/build/types/src/chordsymbol.d.ts +0 -149
  231. package/build/types/src/clef.d.ts +0 -48
  232. package/build/types/src/clefnote.d.ts +0 -25
  233. package/build/types/src/crescendo.d.ts +0 -27
  234. package/build/types/src/curve.d.ts +0 -41
  235. package/build/types/src/dot.d.ts +0 -20
  236. package/build/types/src/easyscore.d.ts +0 -148
  237. package/build/types/src/element.d.ts +0 -202
  238. package/build/types/src/factory.d.ts +0 -271
  239. package/build/types/src/flow.d.ts +0 -245
  240. package/build/types/src/font.d.ts +0 -181
  241. package/build/types/src/fonts/bravura_glyphs.d.ts +0 -3239
  242. package/build/types/src/fonts/bravura_metrics.d.ts +0 -533
  243. package/build/types/src/fonts/custom_glyphs.d.ts +0 -78
  244. package/build/types/src/fonts/custom_metrics.d.ts +0 -5
  245. package/build/types/src/fonts/gonville_glyphs.d.ts +0 -828
  246. package/build/types/src/fonts/gonville_metrics.d.ts +0 -440
  247. package/build/types/src/fonts/load_all.d.ts +0 -1
  248. package/build/types/src/fonts/load_bravura.d.ts +0 -1
  249. package/build/types/src/fonts/load_custom.d.ts +0 -1
  250. package/build/types/src/fonts/load_gonville.d.ts +0 -1
  251. package/build/types/src/fonts/load_petaluma.d.ts +0 -1
  252. package/build/types/src/fonts/petaluma_glyphs.d.ts +0 -1335
  253. package/build/types/src/fonts/petaluma_metrics.d.ts +0 -562
  254. package/build/types/src/fonts/petalumascript_glyphs.d.ts +0 -863
  255. package/build/types/src/fonts/robotoslab_glyphs.d.ts +0 -863
  256. package/build/types/src/fonts/textfonts.d.ts +0 -1
  257. package/build/types/src/formatter.d.ts +0 -203
  258. package/build/types/src/fraction.d.ts +0 -62
  259. package/build/types/src/frethandfinger.d.ts +0 -22
  260. package/build/types/src/ghostnote.d.ts +0 -16
  261. package/build/types/src/glyph.d.ts +0 -139
  262. package/build/types/src/glyphnote.d.ts +0 -17
  263. package/build/types/src/gracenote.d.ts +0 -19
  264. package/build/types/src/gracenotegroup.d.ts +0 -33
  265. package/build/types/src/gracetabnote.d.ts +0 -5
  266. package/build/types/src/index.d.ts +0 -91
  267. package/build/types/src/keymanager.d.ts +0 -25
  268. package/build/types/src/keysignature.d.ts +0 -50
  269. package/build/types/src/keysignote.d.ts +0 -11
  270. package/build/types/src/modifier.d.ts +0 -97
  271. package/build/types/src/modifiercontext.d.ts +0 -45
  272. package/build/types/src/multimeasurerest.d.ts +0 -61
  273. package/build/types/src/music.d.ts +0 -91
  274. package/build/types/src/note.d.ts +0 -230
  275. package/build/types/src/notehead.d.ts +0 -70
  276. package/build/types/src/notesubgroup.d.ts +0 -18
  277. package/build/types/src/ornament.d.ts +0 -76
  278. package/build/types/src/parenthesis.d.ts +0 -22
  279. package/build/types/src/parser.d.ts +0 -45
  280. package/build/types/src/pedalmarking.d.ts +0 -69
  281. package/build/types/src/registry.d.ts +0 -40
  282. package/build/types/src/rendercontext.d.ts +0 -64
  283. package/build/types/src/renderer.d.ts +0 -35
  284. package/build/types/src/repeatnote.d.ts +0 -6
  285. package/build/types/src/stave.d.ts +0 -186
  286. package/build/types/src/stavebarline.d.ts +0 -28
  287. package/build/types/src/staveconnector.d.ts +0 -67
  288. package/build/types/src/stavehairpin.d.ts +0 -56
  289. package/build/types/src/staveline.d.ts +0 -57
  290. package/build/types/src/stavemodifier.d.ts +0 -44
  291. package/build/types/src/stavenote.d.ts +0 -154
  292. package/build/types/src/staverepetition.d.ts +0 -32
  293. package/build/types/src/stavesection.d.ts +0 -15
  294. package/build/types/src/stavetempo.d.ts +0 -25
  295. package/build/types/src/stavetext.d.ts +0 -25
  296. package/build/types/src/stavetie.d.ts +0 -59
  297. package/build/types/src/stavevolta.d.ts +0 -21
  298. package/build/types/src/stem.d.ts +0 -58
  299. package/build/types/src/stemmablenote.d.ts +0 -39
  300. package/build/types/src/stringnumber.d.ts +0 -27
  301. package/build/types/src/strokes.d.ts +0 -33
  302. package/build/types/src/svgcontext.d.ts +0 -131
  303. package/build/types/src/system.d.ts +0 -92
  304. package/build/types/src/tables.d.ts +0 -96
  305. package/build/types/src/tabnote.d.ts +0 -44
  306. package/build/types/src/tabslide.d.ts +0 -34
  307. package/build/types/src/tabstave.d.ts +0 -7
  308. package/build/types/src/tabtie.d.ts +0 -18
  309. package/build/types/src/textbracket.d.ts +0 -55
  310. package/build/types/src/textdynamics.d.ts +0 -39
  311. package/build/types/src/textformatter.d.ts +0 -109
  312. package/build/types/src/textnote.d.ts +0 -49
  313. package/build/types/src/tickable.d.ts +0 -140
  314. package/build/types/src/tickcontext.d.ts +0 -82
  315. package/build/types/src/timesigglyph.d.ts +0 -14
  316. package/build/types/src/timesignature.d.ts +0 -26
  317. package/build/types/src/timesignote.d.ts +0 -11
  318. package/build/types/src/tremolo.d.ts +0 -17
  319. package/build/types/src/tuning.d.ts +0 -23
  320. package/build/types/src/tuplet.d.ts +0 -105
  321. package/build/types/src/typeguard.d.ts +0 -99
  322. package/build/types/src/util.d.ts +0 -27
  323. package/build/types/src/version.d.ts +0 -3
  324. package/build/types/src/vex.d.ts +0 -18
  325. package/build/types/src/vibrato.d.ts +0 -29
  326. package/build/types/src/vibratobracket.d.ts +0 -33
  327. package/build/types/src/voice.d.ts +0 -108
  328. package/build/types/src/web.d.ts +0 -2
@@ -1,266 +0,0 @@
1
- import { Factory, Flow, Font, Renderer } from '../src/index.js';
2
- import { globalObject } from '../src/util.js';
3
- const global = globalObject();
4
- let originalFontNames;
5
- function useTempFontStack(fontName) {
6
- originalFontNames = Flow.getMusicFont();
7
- Flow.setMusicFont(...VexFlowTests.FONT_STACKS[fontName]);
8
- }
9
- function restoreOriginalFontStack() {
10
- Flow.setMusicFont(...originalFontNames);
11
- }
12
- if (!global.$) {
13
- global.$ = (param) => {
14
- let element;
15
- if (typeof param !== 'string') {
16
- element = param;
17
- }
18
- else if (param.startsWith('<')) {
19
- const tagName = param.match(/[A-Za-z]+/g)[0];
20
- element = document.createElement(tagName);
21
- }
22
- else {
23
- element = document.querySelector(param);
24
- }
25
- const $element = {
26
- get(index) {
27
- return element;
28
- },
29
- addClass(c) {
30
- element.classList.add(c);
31
- return $element;
32
- },
33
- text(t) {
34
- element.textContent = t;
35
- return $element;
36
- },
37
- html(h) {
38
- if (!h) {
39
- return element.innerHTML;
40
- }
41
- else {
42
- element.innerHTML = h;
43
- return $element;
44
- }
45
- },
46
- append(...elementsToAppend) {
47
- elementsToAppend.forEach((e) => {
48
- element.appendChild(e);
49
- });
50
- return $element;
51
- },
52
- attr(attrName, val) {
53
- element.setAttribute(attrName, val);
54
- return $element;
55
- },
56
- };
57
- return $element;
58
- };
59
- }
60
- function sanitizeName(name) {
61
- return name.replace(/[^a-zA-Z0-9]/g, '_');
62
- }
63
- const CANVAS_TEST_CONFIG = {
64
- backend: Renderer.Backends.CANVAS,
65
- tagName: 'canvas',
66
- testType: 'Canvas',
67
- fontStacks: ['Bravura'],
68
- };
69
- const SVG_TEST_CONFIG = {
70
- backend: Renderer.Backends.SVG,
71
- tagName: 'div',
72
- testType: 'SVG',
73
- fontStacks: ['Bravura', 'Gonville', 'Petaluma'],
74
- };
75
- const NODE_TEST_CONFIG = {
76
- backend: Renderer.Backends.CANVAS,
77
- tagName: 'canvas',
78
- testType: 'NodeCanvas',
79
- fontStacks: ['Bravura', 'Gonville', 'Petaluma'],
80
- };
81
- export class VexFlowTests {
82
- static register(test) {
83
- VexFlowTests.tests.push(test);
84
- }
85
- static parseJobOptions(runOptions) {
86
- let { jobs, job } = runOptions || { jobs: 1, job: 0 };
87
- if (window) {
88
- const { location } = window;
89
- if (location) {
90
- const sps = new URLSearchParams(location.search);
91
- const jobsParam = sps.get('jobs');
92
- const jobParam = sps.get('job');
93
- if (jobsParam) {
94
- jobs = parseInt(jobsParam, 10);
95
- }
96
- if (jobParam) {
97
- job = parseInt(jobParam, 10);
98
- }
99
- }
100
- }
101
- return {
102
- jobs,
103
- job,
104
- };
105
- }
106
- static run(runOptions) {
107
- const { jobs, job } = VexFlowTests.parseJobOptions(runOptions);
108
- VexFlowTests.tests.forEach((test, idx) => {
109
- if (jobs === 1 || idx % jobs === job) {
110
- test.Start();
111
- }
112
- });
113
- }
114
- static set NODE_FONT_STACKS(fontStacks) {
115
- NODE_TEST_CONFIG.fontStacks = fontStacks;
116
- }
117
- static generateTestID(prefix) {
118
- return prefix + '_' + VexFlowTests.NEXT_TEST_ID++;
119
- }
120
- static runTests(name, testFunc, params) {
121
- VexFlowTests.runCanvasTest(name, testFunc, params);
122
- VexFlowTests.runSVGTest(name, testFunc, params);
123
- VexFlowTests.runNodeTest(name, testFunc, params);
124
- }
125
- static createTest(elementId, testTitle, tagName, titleId = '') {
126
- const anchorTestTitle = `<a href="#${titleId}">${testTitle}</a>`;
127
- const title = $('<div/>').addClass('name').attr('id', titleId).html(anchorTestTitle).get(0);
128
- const vexOutput = $(`<${tagName}/>`).addClass('vex-tabdiv').attr('id', elementId).get(0);
129
- const container = $('<div/>').addClass('testcanvas').append(title, vexOutput).get(0);
130
- $('#vexflow_testoutput').append(container);
131
- return vexOutput;
132
- }
133
- static makeFactory(options, width = 450, height = 140) {
134
- const { elementId, backend } = options;
135
- return new Factory({ renderer: { elementId, backend, width, height } });
136
- }
137
- static runCanvasTest(name, testFunc, params) {
138
- if (VexFlowTests.RUN_CANVAS_TESTS) {
139
- const helper = null;
140
- VexFlowTests.runWithParams(Object.assign(Object.assign({}, CANVAS_TEST_CONFIG), { name, testFunc, params, helper }));
141
- }
142
- }
143
- static runSVGTest(name, testFunc, params) {
144
- if (VexFlowTests.RUN_SVG_TESTS) {
145
- const helper = null;
146
- VexFlowTests.runWithParams(Object.assign(Object.assign({}, SVG_TEST_CONFIG), { name, testFunc, params, helper }));
147
- }
148
- }
149
- static runNodeTest(name, testFunc, params) {
150
- if (VexFlowTests.RUN_NODE_TESTS) {
151
- const helper = VexFlowTests.runNodeTestHelper;
152
- VexFlowTests.runWithParams(Object.assign(Object.assign({}, NODE_TEST_CONFIG), { name, testFunc, params, helper }));
153
- }
154
- }
155
- static runNodeTestHelper(fontName, element) {
156
- if (Renderer.lastContext !== undefined) {
157
- const moduleName = sanitizeName(QUnit.current_module);
158
- const testName = sanitizeName(QUnit.current_test);
159
- const onlyBravura = NODE_TEST_CONFIG.fontStacks.length === 1 && fontName === 'Bravura';
160
- const fontInfo = onlyBravura ? '' : `.${fontName}`;
161
- const fileName = `${VexFlowTests.NODE_IMAGEDIR}/${moduleName}.${testName}${fontInfo}.png`;
162
- const imageData = element.toDataURL().split(';base64,').pop();
163
- const imageBuffer = Buffer.from(imageData, 'base64');
164
- VexFlowTests.shims.fs.writeFileSync(fileName, imageBuffer, { encoding: 'base64' });
165
- }
166
- }
167
- static runWithParams({ fontStacks, testFunc, name, params, backend, tagName, testType, helper }) {
168
- if (name === undefined) {
169
- throw new Error('Test name is undefined.');
170
- }
171
- const testTypeLowerCase = testType.toLowerCase();
172
- fontStacks.forEach((fontStackName) => {
173
- QUnit.test(name, (assert) => {
174
- useTempFontStack(fontStackName);
175
- const elementId = VexFlowTests.generateTestID(`${testTypeLowerCase}_` + fontStackName);
176
- const moduleName = assert.test.module.name;
177
- const title = moduleName + ' › ' + name + ` › ${testType} + ${fontStackName}`;
178
- let prefix = '';
179
- if (testTypeLowerCase === 'canvas') {
180
- prefix = testTypeLowerCase + '_';
181
- }
182
- else {
183
- }
184
- const titleId = `${prefix}${sanitizeName(moduleName)}.${sanitizeName(name)}.${fontStackName}`;
185
- const element = VexFlowTests.createTest(elementId, title, tagName, titleId);
186
- const options = { elementId, params, assert, backend };
187
- const isSVG = backend === Renderer.Backends.SVG;
188
- const contextBuilder = isSVG ? Renderer.getSVGContext : Renderer.getCanvasContext;
189
- testFunc(options, contextBuilder);
190
- restoreOriginalFontStack();
191
- if (helper)
192
- helper(fontStackName, element);
193
- });
194
- });
195
- }
196
- static plotLegendForNoteWidth(ctx, x, y) {
197
- ctx.save();
198
- ctx.setFont(Font.SANS_SERIF, 8);
199
- const spacing = 12;
200
- let lastY = y;
201
- function legend(color, text) {
202
- ctx.beginPath();
203
- ctx.setStrokeStyle(color);
204
- ctx.setFillStyle(color);
205
- ctx.setLineWidth(10);
206
- ctx.moveTo(x, lastY - 4);
207
- ctx.lineTo(x + 10, lastY - 4);
208
- ctx.stroke();
209
- ctx.setFillStyle('black');
210
- ctx.fillText(text, x + 15, lastY);
211
- lastY += spacing;
212
- }
213
- legend('green', 'Note + Flag');
214
- legend('red', 'Modifiers');
215
- legend('#999', 'Displaced Head');
216
- legend('#DDD', 'Formatter Shift');
217
- ctx.restore();
218
- }
219
- }
220
- VexFlowTests.tests = [];
221
- VexFlowTests.RUN_CANVAS_TESTS = true;
222
- VexFlowTests.RUN_SVG_TESTS = true;
223
- VexFlowTests.RUN_NODE_TESTS = false;
224
- VexFlowTests.Font = { size: 10 };
225
- VexFlowTests.FONT_STACKS = {
226
- Bravura: ['Bravura', 'Gonville', 'Custom'],
227
- Gonville: ['Gonville', 'Bravura', 'Custom'],
228
- Petaluma: ['Petaluma', 'Gonville', 'Bravura', 'Custom'],
229
- };
230
- VexFlowTests.NEXT_TEST_ID = 0;
231
- export const concat = (a, b) => a.concat(b);
232
- export const MAJOR_KEYS = [
233
- 'C',
234
- 'F',
235
- 'Bb',
236
- 'Eb',
237
- 'Ab',
238
- 'Db',
239
- 'Gb',
240
- 'Cb',
241
- 'G',
242
- 'D',
243
- 'A',
244
- 'E',
245
- 'B',
246
- 'F#',
247
- 'C#',
248
- ];
249
- export const MINOR_KEYS = [
250
- 'Am',
251
- 'Dm',
252
- 'Gm',
253
- 'Cm',
254
- 'Fm',
255
- 'Bbm',
256
- 'Ebm',
257
- 'Abm',
258
- 'Em',
259
- 'Bm',
260
- 'F#m',
261
- 'C#m',
262
- 'G#m',
263
- 'D#m',
264
- 'A#m',
265
- ];
266
- Flow.Test = VexFlowTests;
@@ -1,115 +0,0 @@
1
- import { VexFlowTests } from './vexflow_test_helpers.js';
2
- import { Accidental, Annotation, Articulation, Barline, BarNote, Beam, Bend, BoundingBox, BoundingBoxComputation, ChordSymbol, Clef, ClefNote, Crescendo, Curve, Dot, EasyScore, Element, Factory, Flow, Font, Formatter, Fraction, FretHandFinger, GhostNote, Glyph, GlyphNote, GraceNote, GraceNoteGroup, GraceTabNote, KeyManager, KeySignature, KeySigNote, Modifier, ModifierContext, MultiMeasureRest, Music, Note, NoteHead, NoteSubGroup, Ornament, Parser, PedalMarking, Registry, Renderer, RepeatNote, Repetition, Stave, StaveConnector, StaveHairpin, StaveLine, StaveModifier, StaveNote, StaveTempo, StaveText, StaveTie, Stem, StringNumber, Stroke, System, TabNote, TabSlide, TabStave, TabTie, TextBracket, TextDynamics, TextFormatter, TextNote, TickContext, TimeSignature, TimeSigNote, Tremolo, Tuning, Tuplet, Vibrato, VibratoBracket, Voice, Volta, } from '../src/index.js';
3
- const VFPrefixTests = {
4
- Start() {
5
- QUnit.module('VF.* API');
6
- test('VF.* API', VF_Prefix);
7
- test('VF Alias', VF_Alias);
8
- },
9
- };
10
- function VF_Prefix() {
11
- const VF = Vex.Flow;
12
- equal(Accidental, VF.Accidental);
13
- equal(Annotation, VF.Annotation);
14
- equal(Articulation, VF.Articulation);
15
- equal(Barline, VF.Barline);
16
- equal(BarNote, VF.BarNote);
17
- equal(Beam, VF.Beam);
18
- equal(Bend, VF.Bend);
19
- equal(BoundingBox, VF.BoundingBox);
20
- equal(BoundingBoxComputation, VF.BoundingBoxComputation);
21
- equal(ChordSymbol, VF.ChordSymbol);
22
- equal(Clef, VF.Clef);
23
- equal(ClefNote, VF.ClefNote);
24
- equal(Crescendo, VF.Crescendo);
25
- equal(Curve, VF.Curve);
26
- equal(Dot, VF.Dot);
27
- equal(EasyScore, VF.EasyScore);
28
- equal(Element, VF.Element);
29
- equal(Factory, VF.Factory);
30
- equal(Flow.RESOLUTION, VF.RESOLUTION);
31
- equal(Font, VF.Font);
32
- equal(Formatter, VF.Formatter);
33
- propEqual(new Formatter(), new VF.Formatter(), 'new Formatter()');
34
- equal(Fraction, VF.Fraction);
35
- equal(FretHandFinger, VF.FretHandFinger);
36
- equal(GhostNote, VF.GhostNote);
37
- equal(Glyph, VF.Glyph);
38
- equal(GlyphNote, VF.GlyphNote);
39
- equal(GraceNote, VF.GraceNote);
40
- equal(GraceNoteGroup, VF.GraceNoteGroup);
41
- equal(GraceTabNote, VF.GraceTabNote);
42
- equal(KeyManager, VF.KeyManager);
43
- equal(KeySignature, VF.KeySignature);
44
- equal(KeySigNote, VF.KeySigNote);
45
- equal(Modifier, VF.Modifier);
46
- equal(ModifierContext, VF.ModifierContext);
47
- equal(MultiMeasureRest, VF.MultiMeasureRest);
48
- equal(Music, VF.Music);
49
- equal(Note, VF.Note);
50
- equal(NoteHead, VF.NoteHead);
51
- equal(NoteSubGroup, VF.NoteSubGroup);
52
- equal(Ornament, VF.Ornament);
53
- equal(Parser, VF.Parser);
54
- equal(PedalMarking, VF.PedalMarking);
55
- equal(Registry, VF.Registry);
56
- equal(Renderer, VF.Renderer);
57
- equal(RepeatNote, VF.RepeatNote);
58
- equal(Repetition, VF.Repetition);
59
- equal(Stave, VF.Stave);
60
- notEqual(Stave, VF.StaveNote);
61
- equal(StaveConnector, VF.StaveConnector);
62
- equal(StaveHairpin, VF.StaveHairpin);
63
- equal(StaveLine, VF.StaveLine);
64
- equal(StaveModifier, VF.StaveModifier);
65
- equal(StaveNote, VF.StaveNote);
66
- equal(StaveTempo, VF.StaveTempo);
67
- equal(StaveText, VF.StaveText);
68
- equal(StaveTie, VF.StaveTie);
69
- equal(Stem, VF.Stem);
70
- equal(StringNumber, VF.StringNumber);
71
- equal(Stroke, VF.Stroke);
72
- equal(System, VF.System);
73
- equal(TabNote, VF.TabNote);
74
- equal(TabSlide, VF.TabSlide);
75
- equal(TabStave, VF.TabStave);
76
- equal(TabTie, VF.TabTie);
77
- equal(TextBracket, VF.TextBracket);
78
- equal(TextDynamics, VF.TextDynamics);
79
- equal(TextFormatter, VF.TextFormatter);
80
- equal(TextNote, VF.TextNote);
81
- equal(TickContext, VF.TickContext);
82
- equal(TimeSignature, VF.TimeSignature);
83
- equal(TimeSigNote, VF.TimeSigNote);
84
- equal(Tremolo, VF.Tremolo);
85
- equal(Tuning, VF.Tuning);
86
- equal(Tuplet, VF.Tuplet);
87
- equal(Vibrato, VF.Vibrato);
88
- equal(VibratoBracket, VF.VibratoBracket);
89
- equal(Voice, VF.Voice);
90
- equal(Volta, VF.Volta);
91
- }
92
- function VF_Alias() {
93
- const Flow = Vex.Flow;
94
- const VFAliases = {
95
- get VFAccidental() {
96
- return Flow.Accidental;
97
- },
98
- get VFAnnotation() {
99
- return Flow.Annotation;
100
- },
101
- get VFVibrato() {
102
- return Flow.Vibrato;
103
- },
104
- };
105
- const { VFVibrato, VFAccidental, VFAnnotation } = VFAliases;
106
- equal(Accidental, VFAccidental);
107
- equal(Annotation, VFAnnotation);
108
- const vibrato = new VFVibrato();
109
- ok(vibrato);
110
- const acc1 = new VFAccidental('##');
111
- const acc2 = new Accidental('##');
112
- equal(acc1.type, acc2.type);
113
- }
114
- VexFlowTests.register(VFPrefixTests);
115
- export { VFPrefixTests };
@@ -1,92 +0,0 @@
1
- import { VexFlowTests } from './vexflow_test_helpers.js';
2
- import { Bend, Font, Formatter, TabNote, TabStave, Vibrato } from '../src/index.js';
3
- const VibratoTests = {
4
- Start() {
5
- QUnit.module('Vibrato');
6
- const run = VexFlowTests.runTests;
7
- run('Simple Vibrato', simple);
8
- run('Harsh Vibrato', harsh);
9
- run('Vibrato with Bend', withBend);
10
- },
11
- };
12
- const tabNote = (noteStruct) => new TabNote(noteStruct);
13
- function simple(options, contextBuilder) {
14
- const ctx = contextBuilder(options.elementId, 500, 240);
15
- ctx.scale(1.5, 1.5);
16
- ctx.fillStyle = '#221';
17
- ctx.strokeStyle = '#221';
18
- ctx.font = '10pt Arial';
19
- const stave = new TabStave(10, 10, 450).addTabGlyph().setContext(ctx).draw();
20
- const notes = [
21
- tabNote({
22
- positions: [
23
- { str: 2, fret: 10 },
24
- { str: 4, fret: 9 },
25
- ],
26
- duration: 'h',
27
- }).addModifier(new Vibrato(), 0),
28
- tabNote({
29
- positions: [{ str: 2, fret: 10 }],
30
- duration: 'h',
31
- }).addModifier(new Vibrato(), 0),
32
- ];
33
- Formatter.FormatAndDraw(ctx, stave, notes);
34
- ok(true, 'Simple Vibrato');
35
- }
36
- function harsh(options, contextBuilder) {
37
- const ctx = contextBuilder(options.elementId, 500, 240);
38
- ctx.scale(1.5, 1.5);
39
- ctx.fillStyle = '#221';
40
- ctx.strokeStyle = '#221';
41
- ctx.font = '10pt Arial';
42
- const stave = new TabStave(10, 10, 450).addTabGlyph().setContext(ctx).draw();
43
- const notes = [
44
- tabNote({
45
- positions: [
46
- { str: 2, fret: 10 },
47
- { str: 4, fret: 9 },
48
- ],
49
- duration: 'h',
50
- }).addModifier(new Vibrato().setHarsh(true), 0),
51
- tabNote({
52
- positions: [{ str: 2, fret: 10 }],
53
- duration: 'h',
54
- }).addModifier(new Vibrato().setHarsh(true), 0),
55
- ];
56
- Formatter.FormatAndDraw(ctx, stave, notes);
57
- ok(true, 'Harsh Vibrato');
58
- }
59
- function withBend(options, contextBuilder) {
60
- const ctx = contextBuilder(options.elementId, 500, 240);
61
- ctx.scale(1.3, 1.3);
62
- ctx.setFillStyle('#221');
63
- ctx.setStrokeStyle('#221');
64
- ctx.setFont(Font.SANS_SERIF, VexFlowTests.Font.size);
65
- const stave = new TabStave(10, 10, 450).addTabGlyph().setContext(ctx).draw();
66
- const notes = [
67
- tabNote({
68
- positions: [
69
- { str: 2, fret: 9 },
70
- { str: 3, fret: 9 },
71
- ],
72
- duration: 'q',
73
- })
74
- .addModifier(new Bend('1/2', true), 0)
75
- .addModifier(new Bend('1/2', true), 1)
76
- .addModifier(new Vibrato(), 0),
77
- tabNote({
78
- positions: [{ str: 2, fret: 10 }],
79
- duration: 'q',
80
- })
81
- .addModifier(new Bend('Full', false), 0)
82
- .addModifier(new Vibrato().setVibratoWidth(60), 0),
83
- tabNote({
84
- positions: [{ str: 2, fret: 10 }],
85
- duration: 'h',
86
- }).addModifier(new Vibrato().setVibratoWidth(120).setHarsh(true), 0),
87
- ];
88
- Formatter.FormatAndDraw(ctx, stave, notes);
89
- ok(true, 'Vibrato with Bend');
90
- }
91
- VexFlowTests.register(VibratoTests);
92
- export { VibratoTests };
@@ -1,45 +0,0 @@
1
- import { VexFlowTests } from './vexflow_test_helpers.js';
2
- const VibratoBracketTests = {
3
- Start() {
4
- QUnit.module('VibratoBracket');
5
- const run = VexFlowTests.runTests;
6
- run('Simple VibratoBracket', simple);
7
- run('Harsh VibratoBracket Without End Note', withoutEndNote);
8
- run('Harsh VibratoBracket Without Start Note', withoutStartNote);
9
- },
10
- };
11
- function createTest(noteGroup, setupVibratoBracket) {
12
- return (options) => {
13
- const factory = VexFlowTests.makeFactory(options, 650, 200);
14
- const stave = factory.Stave();
15
- const score = factory.EasyScore();
16
- const voice = score.voice(score.notes(noteGroup));
17
- setupVibratoBracket(factory, voice.getTickables());
18
- factory.Formatter().joinVoices([voice]).formatToStave([voice], stave);
19
- factory.draw();
20
- ok(true);
21
- };
22
- }
23
- const simple = createTest('c4/4, c4, c4, c4', (factory, notes) => {
24
- factory.VibratoBracket({
25
- from: notes[0],
26
- to: notes[3],
27
- options: { line: 2 },
28
- });
29
- });
30
- const withoutEndNote = createTest('c4/4, c4, c4, c4', (factory, notes) => {
31
- factory.VibratoBracket({
32
- from: notes[2],
33
- to: null,
34
- options: { line: 2, harsh: true },
35
- });
36
- });
37
- const withoutStartNote = createTest('c4/4, c4, c4, c4', (factory, notes) => {
38
- factory.VibratoBracket({
39
- from: null,
40
- to: notes[2],
41
- options: { line: 2, harsh: true },
42
- });
43
- });
44
- VexFlowTests.register(VibratoBracketTests);
45
- export { VibratoBracketTests };
@@ -1,69 +0,0 @@
1
- import { VexFlowTests } from './vexflow_test_helpers.js';
2
- import { Flow } from '../src/flow.js';
3
- import { Formatter } from '../src/formatter.js';
4
- import { Stave } from '../src/stave.js';
5
- import { Barline } from '../src/stavebarline.js';
6
- import { StaveNote } from '../src/stavenote.js';
7
- import { Voice } from '../src/voice.js';
8
- import { MockTickable } from './mocks.js';
9
- const VoiceTests = {
10
- Start() {
11
- QUnit.module('Voice');
12
- test('Strict Test', strict);
13
- test('Ignore Test', ignore);
14
- VexFlowTests.runTests('Full Voice Mode Test', full);
15
- },
16
- };
17
- const BEAT = (1 * Flow.RESOLUTION) / 4;
18
- const createTickable = () => new MockTickable().setTicks(BEAT);
19
- function strict() {
20
- expect(8);
21
- const tickables = [createTickable(), createTickable(), createTickable()];
22
- const voice = new Voice(Flow.TIME4_4);
23
- equal(voice.getTotalTicks().value(), BEAT * 4, '4/4 Voice has 4 beats');
24
- equal(voice.getTicksUsed().value(), BEAT * 0, 'No beats in voice');
25
- voice.addTickables(tickables);
26
- equal(voice.getTicksUsed().value(), BEAT * 3, 'Three beats in voice');
27
- voice.addTickable(createTickable());
28
- equal(voice.getTicksUsed().value(), BEAT * 4, 'Four beats in voice');
29
- equal(voice.isComplete(), true, 'Voice is complete');
30
- const numeratorBeforeException = voice.getTicksUsed().numerator;
31
- throws(() => voice.addTickable(createTickable()), /BadArgument/, '"Too many ticks" exception');
32
- equal(voice.getTicksUsed().numerator, numeratorBeforeException, 'Revert `ticksUsed` after a "Too many ticks" exception');
33
- equal(voice.getSmallestTickCount().value(), BEAT, 'Smallest tick count is BEAT');
34
- }
35
- function ignore() {
36
- const tickables = [
37
- createTickable(),
38
- createTickable(),
39
- createTickable().setIgnoreTicks(true),
40
- createTickable(),
41
- createTickable().setIgnoreTicks(true),
42
- createTickable(),
43
- ];
44
- const voice = new Voice(Flow.TIME4_4);
45
- voice.addTickables(tickables);
46
- ok(true, 'all pass');
47
- }
48
- function full(options, contextBuilder) {
49
- const ctx = contextBuilder(options.elementId, 550, 200);
50
- const stave = new Stave(10, 50, 500).addClef('treble').addTimeSignature('4/4').setEndBarType(Barline.type.END);
51
- const notes = [
52
- new StaveNote({ keys: ['c/4'], duration: '4' }),
53
- new StaveNote({ keys: ['d/4'], duration: '4' }),
54
- new StaveNote({ keys: ['r/4'], duration: '4r' }),
55
- ];
56
- notes.forEach((note) => note.setStave(stave));
57
- const voice = new Voice(Flow.TIME4_4).setMode(Voice.Mode.FULL).addTickables(notes);
58
- new Formatter().joinVoices([voice]).formatToStave([voice], stave);
59
- stave.setContext(ctx).draw();
60
- voice.draw(ctx);
61
- const bb = voice.getBoundingBox();
62
- if (bb) {
63
- ctx.rect(bb.getX(), bb.getY(), bb.getW(), bb.getH());
64
- }
65
- ctx.stroke();
66
- throws(() => voice.addTickable(new StaveNote({ keys: ['c/4'], duration: '2' })), /BadArgument/, 'Voice cannot exceed full amount of ticks');
67
- }
68
- VexFlowTests.register(VoiceTests);
69
- export { VoiceTests };
@@ -1,3 +0,0 @@
1
- import { Vex } from '../src/vex';
2
- export * from '../src/index';
3
- export default Vex;
@@ -1,3 +0,0 @@
1
- import { Vex } from '../src/vex';
2
- export * from '../src/index';
3
- export default Vex;
@@ -1,3 +0,0 @@
1
- import { Vex } from './vexflow';
2
- export * from '../src/index';
3
- export default Vex;