Skip to content

Commit

Permalink
Merge branch 'master' into ESM
Browse files Browse the repository at this point in the history
  • Loading branch information
ronyeh committed Dec 14, 2021
2 parents f5393d0 + 3ccbd64 commit 5392e00
Show file tree
Hide file tree
Showing 11 changed files with 945 additions and 148 deletions.
592 changes: 489 additions & 103 deletions package-lock.json

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@
"prettier": "^2.5.0",
"qunit": "^2.17.2",
"sharp": "^0.29.3",
"recursive-copy": "^2.0.13",
"svg2pdf.js": "^2.2.0",
"ts-loader": "^9.2.6",
"typedoc": "^0.22.10",
Expand All @@ -123,6 +124,7 @@
"generate:current": "node ./tools/generate_png_images.js ../build/cjs ./build/images/current ${VF_GENERATE_OPTIONS}",
"generate:reference": "node ./tools/generate_png_images.js ../reference ./build/images/reference ${VF_GENERATE_OPTIONS}",
"diff:reference": "./tools/visual_regression.sh reference",
"get:releases": "node ./tools/get_releases.mjs",
"test": "npm run lint && npm run qunit && npm run generate:current",
"test:reference": "npm run lint && npm run qunit && npm run generate:current && npm run generate:reference && npm run diff:reference",
"cache:save:reference": "if [ -d ./build/images/reference ]; then rm -rf ./reference/images && mv ./build/images/reference ./reference/images; fi;",
Expand Down
18 changes: 17 additions & 1 deletion src/fonts/bravura_glyphs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,14 @@ export const BravuraFont = {
ha: 256,
o: 'm 220 20 b 210 33 215 20 210 26 l 210 166 b 200 177 210 171 206 177 l 166 177 b 156 166 160 177 156 171 l 156 33 b 145 20 156 27 150 20 l 10 20 b -1 10 4 20 -1 16 l -1 -24 b 10 -35 -1 -30 4 -35 l 145 -35 b 156 -46 153 -35 156 -42 l 156 -180 b 166 -192 156 -186 160 -192 l 200 -192 b 210 -180 206 -192 210 -186 l 210 -48 b 222 -35 210 -39 216 -35 l 356 -35 b 367 -24 361 -35 367 -30 l 367 10 b 356 20 367 16 361 20 z',
},
timeSigMinus: {
x_min: 0,
x_max: 448,
y_min: -35,
y_max: 40,
ha: 75,
o: 'm 645 39 b 619 58 645 49 634 58 l 27 58 b 0 39 12 58 0 49 l 0 -32 b 27 -50 0 -42 12 -50 l 619 -50 b 645 -32 634 -50 645 -42 z',
},
timeSigParensRight: {
x_min: 0,
x_max: 184,
Expand All @@ -224,6 +232,14 @@ export const BravuraFont = {
ha: 980,
o: 'm 265 -658 b 259 -641 265 -651 262 -644 b 98 1 156 -497 98 -311 b 261 644 98 315 153 503 b 265 665 265 651 265 665 l 265 696 b 261 707 265 703 264 707 b 253 701 259 707 253 701 b 0 1 78 531 0 289 b 258 -703 0 -282 78 -530 b 262 -704 259 -704 261 -704 b 265 -696 264 -704 265 -698 z',
},
timeSigParensLeftSmall: {
x_min: 0,
x_max: 110,
y_min: -251,
y_max: 249,
ha: 500,
o: 'm 158 -337 b 154 -328 158 -333 156 -330 b 68 0 96 -249 68 -160 b 156 327 68 160 98 246 b 158 338 158 330 158 338 l 158 353 b 154 359 158 357 156 359 b 0 0 49 272 0 147 b 156 -361 0 -145 46 -272 b 158 -356 157 -361 158 -357 z',
},
noteheadDoubleWhole: {
x_min: 0,
x_max: 599,
Expand Down Expand Up @@ -3195,5 +3211,5 @@ export const BravuraFont = {
},
fontFamily: 'Bravura',
resolution: 1000,
generatedOn: '2021-11-30T21:02:12.674Z',
generatedOn: '2021-12-06T21:04:30.234Z',
};
30 changes: 21 additions & 9 deletions src/fonts/gonville_glyphs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -139,16 +139,22 @@ export const GonvilleFont = {
o: 'm 289 545 b 298 546 292 545 295 546 b 318 533 306 546 315 541 b 319 428 319 530 319 528 l 319 327 l 334 327 b 526 223 412 326 485 285 b 543 172 537 206 543 190 b 447 76 543 122 503 76 b 445 76 446 76 446 76 b 359 165 394 77 359 119 b 368 205 359 179 362 192 b 441 251 382 233 412 251 b 455 249 446 251 451 251 b 460 248 458 249 460 248 b 460 248 460 248 460 248 b 454 254 460 249 458 251 b 334 295 419 280 378 294 l 319 295 l 319 4 l 319 -287 l 321 -285 b 328 -285 322 -285 325 -285 b 524 -99 424 -277 507 -198 b 541 -79 526 -84 530 -79 b 556 -97 551 -79 556 -84 b 548 -133 556 -105 553 -117 b 334 -317 521 -233 434 -306 b 322 -319 329 -317 323 -317 l 319 -319 l 319 -424 b 319 -471 319 -444 319 -459 b 313 -541 319 -544 318 -535 b 298 -548 308 -545 303 -548 b 279 -534 289 -548 281 -542 b 277 -424 277 -531 277 -530 l 277 -317 l 273 -317 b 13 -95 153 -305 51 -217 b 0 2 4 -62 0 -29 b 182 295 0 126 66 238 b 274 324 210 309 249 320 l 277 324 l 277 427 b 279 533 277 528 277 530 b 289 545 281 538 285 542 m 277 2 b 277 291 277 161 277 291 b 268 288 277 291 273 290 b 144 1 179 265 144 184 b 276 -284 144 -199 175 -267 l 277 -285 l 277 2 ',
},
timeSigPlus: {
x_min: -212.328125,
x_max: 210.96875,
ha: 215,
o: 'm -8 216 b -1 217 -6 216 -4 217 b 19 204 8 217 16 212 b 20 111 20 201 20 199 l 20 20 l 107 20 b 142 20 121 20 133 20 b 205 13 205 20 198 19 b 210 0 209 9 210 4 b 198 -20 210 -9 206 -16 b 107 -22 194 -22 193 -22 l 20 -22 l 20 -112 b 20 -148 20 -126 20 -138 b 13 -212 20 -213 19 -206 b 0 -219 9 -216 4 -219 b -20 -205 -8 -219 -16 -213 b -21 -112 -21 -202 -21 -201 l -21 -22 l -108 -22 b -200 -20 -194 -22 -196 -22 b -212 0 -208 -16 -212 -9 b -206 13 -212 4 -210 9 b -144 20 -200 19 -206 20 b -108 20 -134 20 -122 20 l -21 20 l -21 111 b -20 204 -21 199 -21 201 b -8 216 -17 209 -13 213 ',
x_min: 0,
x_max: 319.859375,
ha: 326,
o: 'm 149 508 b 159 509 152 509 155 509 b 186 494 170 509 181 503 b 190 440 190 487 190 488 l 190 430 l 190 377 l 242 377 l 251 377 b 303 373 298 377 296 377 b 319 345 314 367 319 356 b 304 319 319 335 314 324 b 250 315 296 315 299 315 l 242 315 l 190 315 l 190 262 l 190 252 b 186 198 190 204 190 205 b 159 183 179 188 170 183 b 132 198 148 183 138 188 b 127 252 127 205 127 204 l 127 262 l 127 315 l 76 315 l 68 315 b 14 319 20 315 21 315 b 0 347 4 324 0 335 b 14 373 0 356 4 367 b 68 377 21 377 20 377 l 76 377 l 127 377 l 127 430 l 127 440 b 132 494 127 488 127 487 b 149 508 136 501 142 505 ',
},
timeSigPlusSmall: {
x_min: -212.328125,
x_max: 210.96875,
ha: 215,
o: 'm -8 216 b -1 217 -6 216 -4 217 b 19 204 8 217 16 212 b 20 111 20 201 20 199 l 20 20 l 107 20 b 142 20 121 20 133 20 b 205 13 205 20 198 19 b 210 0 209 9 210 4 b 198 -20 210 -9 206 -16 b 107 -22 194 -22 193 -22 l 20 -22 l 20 -112 b 20 -148 20 -126 20 -138 b 13 -212 20 -213 19 -206 b 0 -219 9 -216 4 -219 b -20 -205 -8 -219 -16 -213 b -21 -112 -21 -202 -21 -201 l -21 -22 l -108 -22 b -200 -20 -194 -22 -196 -22 b -212 0 -208 -16 -212 -9 b -206 13 -212 4 -210 9 b -144 20 -200 19 -206 20 b -108 20 -134 20 -122 20 l -21 20 l -21 111 b -20 204 -21 199 -21 201 b -8 216 -17 209 -13 213 ',
x_min: 0,
x_max: 319.859375,
ha: 326,
o: 'm 149 508 b 159 509 152 509 155 509 b 186 494 170 509 181 503 b 190 440 190 487 190 488 l 190 430 l 190 377 l 242 377 l 251 377 b 303 373 298 377 296 377 b 319 345 314 367 319 356 b 304 319 319 335 314 324 b 250 315 296 315 299 315 l 242 315 l 190 315 l 190 262 l 190 252 b 186 198 190 204 190 205 b 159 183 179 188 170 183 b 132 198 148 183 138 188 b 127 252 127 205 127 204 l 127 262 l 127 315 l 76 315 l 68 315 b 14 319 20 315 21 315 b 0 347 4 324 0 335 b 14 373 0 356 4 367 b 68 377 21 377 20 377 l 76 377 l 127 377 l 127 430 l 127 440 b 132 494 127 488 127 487 b 149 508 136 501 142 505 ',
},
timeSigMinus: {
x_min: 0,
x_max: 318.5,
ha: 325,
o: 'm 20 376 b 167 377 23 377 96 377 b 296 376 231 377 294 377 b 318 347 311 371 318 359 b 296 316 318 333 311 320 b 159 315 294 315 227 315 b 21 316 91 315 24 315 b 0 345 6 320 0 333 b 20 376 0 359 6 371 ',
},
timeSigParensRight: {
x_min: 25.859375,
Expand All @@ -157,12 +163,18 @@ export const GonvilleFont = {
o: 'm 34 369 b 40 370 35 370 38 370 b 59 353 49 370 50 367 b 164 40 122 254 155 158 b 164 0 164 33 164 16 b 164 -40 164 -16 164 -34 b 59 -353 155 -158 122 -254 b 40 -371 53 -366 47 -371 b 34 -370 38 -371 36 -370 b 25 -358 28 -367 25 -363 b 31 -337 25 -352 27 -347 b 92 0 72 -234 92 -117 b 31 335 92 116 72 233 b 25 356 27 345 25 352 b 34 369 25 363 28 366 ',
},
timeSigParensRightSmall: {
x_min: 25.859375,
x_max: 164.6875,
ha: 168,
o: 'm 34 369 b 40 370 35 370 38 370 b 59 353 49 370 50 367 b 164 40 122 254 155 158 b 164 0 164 33 164 16 b 164 -40 164 -16 164 -34 b 59 -353 155 -158 122 -254 b 40 -371 53 -366 47 -371 b 34 -370 38 -371 36 -370 b 25 -358 28 -367 25 -363 b 31 -337 25 -352 27 -347 b 92 0 72 -234 92 -117 b 31 335 92 116 72 233 b 25 356 27 345 25 352 b 34 369 25 363 28 366 ',
},
timeSigParensLeft: {
x_min: -166.0625,
x_max: -25.859375,
ha: 0,
o: 'm -49 369 b -42 370 -46 369 -44 370 b -27 360 -36 370 -29 366 b -25 355 -27 359 -25 358 b -32 335 -25 351 -28 347 b -92 52 -66 248 -87 159 b -93 -1 -93 43 -93 20 b -92 -54 -93 -23 -93 -45 b -32 -337 -85 -162 -66 -251 b -25 -355 -27 -349 -25 -352 b -42 -371 -25 -365 -32 -371 b -61 -353 -50 -371 -51 -369 b -163 -63 -119 -262 -153 -165 b -166 -1 -166 -37 -166 -31 b -163 62 -166 30 -166 36 b -61 352 -153 163 -119 260 b -49 369 -54 365 -51 366 ',
},
timeSigParensLeft: {
timeSigParensLeftSmall: {
x_min: -166.0625,
x_max: -25.859375,
ha: 0,
Expand Down
18 changes: 17 additions & 1 deletion src/fonts/petaluma_glyphs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,14 @@ export const PetalumaFont = {
ha: 396,
o: 'm 301 -284 b 330 -238 320 -284 324 -255 b 348 -46 350 -176 341 -111 b 374 -20 351 -27 356 -23 b 481 -17 409 -16 445 -17 b 566 -9 510 -17 537 -16 b 602 3 579 -7 602 -16 b 566 29 602 19 582 24 b 526 33 553 32 539 33 b 384 39 478 36 432 39 b 356 62 363 39 356 42 l 356 68 b 359 177 359 104 359 141 l 359 251 b 341 287 359 264 361 285 b 311 255 324 287 314 272 b 310 228 311 246 310 236 l 301 69 b 275 39 301 49 295 39 l 271 39 b 210 40 251 40 230 40 b 167 39 196 40 181 40 b 89 40 141 37 115 40 b 24 30 68 40 46 37 b 0 17 17 27 0 30 l 0 13 b 27 -17 3 0 7 -13 b 91 -22 49 -22 71 -22 b 153 -22 115 -22 137 -20 l 275 -22 b 295 -40 289 -22 295 -27 l 295 -48 b 288 -235 288 -109 287 -171 b 287 -264 288 -243 287 -253 b 301 -284 287 -275 289 -284 z',
},
timeSigMinus: {
x_min: 0,
x_max: 662,
y_min: -54,
y_max: 55,
ha: 109,
o: 'm 39 -78 b 49 -76 42 -78 45 -76 b 452 -75 94 -75 272 -75 b 861 -76 632 -75 814 -76 b 953 -20 927 -79 953 -66 b 948 27 953 -7 950 9 b 946 37 948 30 948 35 b 896 79 940 63 929 79 b 471 78 827 78 648 78 l 42 78 b 0 37 14 78 0 69 b 23 -66 0 0 17 -32 b 39 -78 24 -75 32 -76 z',
},
timeSigParensRight: {
x_min: 0,
x_max: 274.26483738379414,
Expand All @@ -224,6 +232,14 @@ export const PetalumaFont = {
ha: 1456,
o: 'm 562 -1048 b 573 -1043 566 -1048 570 -1047 b 553 -988 582 -1025 564 -1004 b 472 -884 527 -952 497 -920 b 210 -354 366 -717 275 -541 b 148 -6 170 -240 148 -124 b 160 148 148 45 153 96 b 315 678 189 331 242 508 b 431 901 350 755 380 834 b 459 950 451 926 461 939 b 435 995 459 962 451 972 b 364 1048 405 1034 383 1048 b 305 996 343 1048 325 1028 b 127 624 226 881 174 753 b 1 30 56 432 9 235 b 1 -32 1 9 0 -12 b 180 -629 13 -245 92 -438 b 363 -936 230 -739 298 -835 b 526 -1041 402 -995 448 -1041 b 562 -1048 537 -1040 552 -1048 z',
},
timeSigParensLeftSmall: {
x_min: 0,
x_max: 173.45497224367904,
y_min: -405,
y_max: 404,
ha: 809,
o: 'm 197 -583 b 222 -553 212 -582 219 -566 b 229 -497 226 -534 229 -516 b 213 -425 229 -472 225 -448 b 102 -177 173 -344 132 -262 b 62 30 78 -111 58 -42 b 91 183 66 82 75 134 b 215 426 118 271 156 356 b 249 552 246 465 252 505 b 230 582 249 563 246 582 b 197 563 219 582 206 576 b 71 356 144 500 105 429 b 0 50 26 259 3 158 b 13 -112 4 -3 7 -58 b 176 -559 29 -275 105 -416 b 196 -583 180 -569 186 -583 z',
},
noteheadDoubleWhole: {
x_min: -0.4444444444444444,
x_max: 614.1875,
Expand Down Expand Up @@ -1291,5 +1307,5 @@ export const PetalumaFont = {
},
fontFamily: 'Petaluma',
resolution: 1000,
generatedOn: '2021-11-30T21:01:57.770Z',
generatedOn: '2021-12-06T21:04:23.441Z',
};
64 changes: 44 additions & 20 deletions src/timesigglyph.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
// [VexFlow](https://vexflow.com) - Copyright (c) Mohit Muthanna 2010.
//
// ## Description
// Renders time signatures glyphs for staffs
// This class is used by TimeSignature to render the associated glyphs

import { Glyph, GlyphMetrics } from './glyph';
import { TimeSignature } from './timesignature';
import { defined } from './util';
Expand All @@ -11,8 +17,8 @@ export class TimeSignatureGlyph extends Glyph {

constructor(
timeSignature: TimeSignature,
topDigits: string[],
botDigits: string[],
topDigits: string,
botDigits: string,
code: string,
point: number,
options?: { category: string }
Expand All @@ -24,17 +30,42 @@ export class TimeSignatureGlyph extends Glyph {

let topWidth = 0;
for (let i = 0; i < topDigits.length; ++i) {
const num = topDigits[i];
const topGlyph = new Glyph('timeSig' + num, this.timeSignature.point);
let timeSigType = topDigits[i];
switch (topDigits[i]) {
case '-':
timeSigType = 'Minus';
break;
case '+':
timeSigType = botDigits.length > 0 ? 'PlusSmall' : 'Plus';
break;
case '(':
timeSigType = botDigits.length > 0 ? 'ParensLeftSmall' : 'ParensLeft';
break;
case ')':
timeSigType = botDigits.length > 0 ? 'ParensRightSmall' : 'ParensRight';
break;
}
const topGlyph = new Glyph('timeSig' + timeSigType, this.timeSignature.point);

this.topGlyphs.push(topGlyph);
topWidth += topGlyph.getMetrics().width ?? 0;
}

let botWidth = 0;
for (let i = 0; i < botDigits.length; ++i) {
const num = botDigits[i];
const botGlyph = new Glyph('timeSig' + num, this.timeSignature.point);
let timeSigType = botDigits[i];
switch (botDigits[i]) {
case '+':
timeSigType = 'PlusSmall';
break;
case '(':
timeSigType = 'ParensLeftSmall';
break;
case ')':
timeSigType = 'ParensRightSmall';
break;
}
const botGlyph = new Glyph('timeSig' + timeSigType, this.timeSignature.point);

this.botGlyphs.push(botGlyph);
botWidth += defined(botGlyph.getMetrics().width);
Expand All @@ -57,31 +88,24 @@ export class TimeSignatureGlyph extends Glyph {

renderToStave(x: number): void {
const stave = this.checkStave();
const ctx = this.checkContext();

let start_x = x + this.topStartX;
let y = 0;
if (this.botGlyphs.length > 0) y = stave.getYForLine(this.timeSignature.topLine);
else y = (stave.getYForLine(this.timeSignature.topLine) + stave.getYForLine(this.timeSignature.bottomLine)) / 2;
for (let i = 0; i < this.topGlyphs.length; ++i) {
const glyph = this.topGlyphs[i];
Glyph.renderOutline(
this.checkContext(),
glyph.getMetrics().outline,
this.scale,
start_x + this.x_shift,
stave.getYForLine(this.timeSignature.topLine)
);
Glyph.renderOutline(ctx, glyph.getMetrics().outline, this.scale, start_x + this.x_shift, y);
start_x += defined(glyph.getMetrics().width);
}

start_x = x + this.botStartX;
y = stave.getYForLine(this.timeSignature.bottomLine);
for (let i = 0; i < this.botGlyphs.length; ++i) {
const glyph = this.botGlyphs[i];
this.timeSignature.placeGlyphOnLine(glyph, stave, 0);
Glyph.renderOutline(
this.checkContext(),
glyph.getMetrics().outline,
this.scale,
start_x + glyph.getMetrics().x_shift,
stave.getYForLine(this.timeSignature.bottomLine)
);
Glyph.renderOutline(ctx, glyph.getMetrics().outline, this.scale, start_x + glyph.getMetrics().x_shift, y);
start_x += defined(glyph.getMetrics().width);
}
}
Expand Down
19 changes: 10 additions & 9 deletions src/timesignature.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,20 @@ export interface TimeSignatureInfo {
num: boolean;
}

const assertIsValidFraction = (timeSpec: string) => {
const numbers = timeSpec.split('/').filter((number) => number !== '');
const assertIsValidTimeSig = (timeSpec: string) => {
const numbers = timeSpec.split('/');

if (numbers.length !== 2) {
if (numbers.length !== 2 && numbers[0] !== '+' && numbers[0] !== '-') {
throw new RuntimeError(
'BadTimeSignature',
`Invalid time spec: ${timeSpec}. Must be in the form "<numerator>/<denominator>"`
);
}

numbers.forEach((number) => {
if (isNaN(Number(number))) {
throw new RuntimeError('BadTimeSignature', `Invalid time spec: ${timeSpec}. Must contain two valid numbers.`);
// Characters consisting in number 0..9, '+', '-', '(' or ')'
if (/^[0-9+\-()]+$/.test(number) == false) {
throw new RuntimeError('BadTimeSignature', `Invalid time spec: ${timeSpec}. Must contain valid signatures.`);
}
});
};
Expand Down Expand Up @@ -89,18 +90,18 @@ export class TimeSignature extends StaveModifier {
}

if (this.validate_args) {
assertIsValidFraction(timeSpec);
assertIsValidTimeSig(timeSpec);
}

const [topDigits, botDigits] = timeSpec.split('/').map((number) => number.split(''));
const parts = timeSpec.split('/');

return {
num: true,
glyph: this.makeTimeSignatureGlyph(topDigits, botDigits),
glyph: this.makeTimeSignatureGlyph(parts[0] ?? '', parts[1] ?? ''),
};
}

makeTimeSignatureGlyph(topDigits: string[], botDigits: string[]): Glyph {
makeTimeSignatureGlyph(topDigits: string, botDigits: string): Glyph {
return new TimeSignatureGlyph(this, topDigits, botDigits, 'timeSig0', this.point);
}

Expand Down
61 changes: 59 additions & 2 deletions tests/timesignature_tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@ const TimeSignatureTests = {
const run = VexFlowTests.runTests;
run('Basic Time Signatures', basic);
run('Big Signature Test', big);
run('Additive Signature Test', additive);
run('Alternating Signature Test', alternating);
run('Interchangeable Signature Test', interchangeable);
run('Aggregate Signature Test', agregate);
run('Complex Signature Test', complex);
run('Time Signature multiple staves alignment test', multiple);
run('Time Signature Change Test', change);
},
Expand All @@ -25,12 +30,12 @@ const TimeSignatureTests = {
function parser(): void {
const timeSig = new TimeSignature();

const mustFail = ['asdf', '123/', '/10', '/', '4567', 'C+'];
const mustFail = ['asdf', '123/', '/10', '/', '4567', 'C+', '1+', '+1', '(3+', '+3)', '()', '(+)'];
mustFail.forEach((invalidString) => {
throws(() => timeSig.parseTimeSpec(invalidString), /BadTimeSignature/);
});

const mustPass = ['4/4', '10/12', '1/8', '1234567890/1234567890', 'C', 'C|'];
const mustPass = ['4/4', '10/12', '1/8', '1234567890/1234567890', 'C', 'C|', '+'];
mustPass.forEach((validString) => timeSig.parseTimeSpec(validString));

ok(true, 'all pass');
Expand Down Expand Up @@ -73,6 +78,58 @@ function big(options: TestOptions, contextBuilder: ContextBuilder): void {
ok(true, 'all pass');
}

function additive(options: TestOptions, contextBuilder: ContextBuilder): void {
const ctx = contextBuilder(options.elementId, 400, 120);

new Stave(10, 10, 300).addTimeSignature('2+3+2/8').setContext(ctx).draw();

ok(true, 'all pass');
}

function alternating(options: TestOptions, contextBuilder: ContextBuilder): void {
const ctx = contextBuilder(options.elementId, 400, 120);

new Stave(10, 10, 300).addTimeSignature('6/8').addTimeSignature('+').addTimeSignature('3/4').setContext(ctx).draw();

ok(true, 'all pass');
}

function interchangeable(options: TestOptions, contextBuilder: ContextBuilder): void {
const ctx = contextBuilder(options.elementId, 400, 120);

new Stave(10, 10, 300).addTimeSignature('3/4').addTimeSignature('-').addTimeSignature('2/4').setContext(ctx).draw();

ok(true, 'all pass');
}

function agregate(options: TestOptions, contextBuilder: ContextBuilder): void {
const ctx = contextBuilder(options.elementId, 400, 120);

new Stave(10, 10, 300)
.addTimeSignature('2/4')
.addTimeSignature('+')
.addTimeSignature('3/8')
.addTimeSignature('+')
.addTimeSignature('5/4')
.setContext(ctx)
.draw();

ok(true, 'all pass');
}

function complex(options: TestOptions, contextBuilder: ContextBuilder): void {
const ctx = contextBuilder(options.elementId, 400, 120);

new Stave(10, 10, 300)
.addTimeSignature('(2+3)/16')
.addTimeSignature('+')
.addTimeSignature('3/8')
.setContext(ctx)
.draw();

ok(true, 'all pass');
}

function multiple(options: TestOptions, contextBuilder: ContextBuilder): void {
const ctx = contextBuilder(options.elementId, 400, 350);

Expand Down
Loading

0 comments on commit 5392e00

Please sign in to comment.