Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
AaronDavidNewman committed Oct 17, 2021
2 parents f526c2c + ca9c6b7 commit 90f5d3d
Show file tree
Hide file tree
Showing 2 changed files with 57 additions and 0 deletions.
2 changes: 2 additions & 0 deletions tests/run.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ import { TextNoteTests } from './textnote_tests';
import { ThreeVoicesTests } from './threevoice_tests';
import { TickContextTests } from './tickcontext_tests';
import { TimeSignatureTests } from './timesignature_tests';
import { TremoloTests } from './tremolo_tests';
import { TuningTests } from './tuning_tests';
import { TupletTests } from './tuplet_tests';
import { TypeGuardTests } from './typeguard_tests';
Expand Down Expand Up @@ -124,6 +125,7 @@ VexFlowTests.run = function () {
ThreeVoicesTests.Start();
TickContextTests.Start();
TimeSignatureTests.Start();
TremoloTests.Start();
TuningTests.Start();
TupletTests.Start();
TypeGuardTests.Start();
Expand Down
55 changes: 55 additions & 0 deletions tests/tremolo_tests.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
// [VexFlow](http://vexflow.com) - Copyright (c) Mohit Muthanna 2010.
// MIT License
//
// Tremolo Tests

import { TestOptions, VexFlowTests } from './vexflow_test_helpers';
import { Barline } from 'stavebarline';
import { Tremolo } from 'tremolo';

const TremoloTests = {
Start(): void {
QUnit.module('Tremolo');
const run = VexFlowTests.runTests;
run('Tremolo - Basic', tremoloBasic);
},
};

function tremoloBasic(options: TestOptions): void {
const f = VexFlowTests.makeFactory(options, 600, 200);
const score = f.EasyScore();

// bar 1
const stave1 = f.Stave({ width: 250 }).setEndBarType(Barline.type.DOUBLE);

const notes1 = score.notes('e4/4, e4, e4, e4', { stem: 'up' });

notes1[0].addModifier(new Tremolo(3));
notes1[1].addModifier(new Tremolo(2));
notes1[2].addModifier(new Tremolo(1));

const voice1 = score.voice(notes1);

f.Formatter().joinVoices([voice1]).formatToStave([voice1], stave1);

// bar 2
const stave2 = f
.Stave({ x: stave1.getWidth() + stave1.getX(), y: stave1.getY(), width: 300 })
.setEndBarType(Barline.type.DOUBLE);

const notes2 = score.notes('e5/4, e5, e5, e5', { stem: 'down' });

notes2[1].addModifier(new Tremolo(1));
notes2[2].addModifier(new Tremolo(2));
notes2[3].addModifier(new Tremolo(3));

const voice2 = score.voice(notes2);

f.Formatter().joinVoices([voice2]).formatToStave([voice2], stave2);

f.draw();

ok(true, 'Tremolo - Basic');
}

export { TremoloTests };

0 comments on commit 90f5d3d

Please sign in to comment.