Skip to content

Commit

Permalink
Migrate VexFlowTests.
Browse files Browse the repository at this point in the history
Clean up EasyScore tests.
  • Loading branch information
ronyeh committed Jul 24, 2021
1 parent c23f485 commit a0248a3
Show file tree
Hide file tree
Showing 4 changed files with 337 additions and 257 deletions.
4 changes: 1 addition & 3 deletions src/note.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,7 @@ export abstract class Note extends Tickable {
return 'note';
}

/** Debug helper. Displays various note metrics for the given
* note.
*/
/** Debug helper. Displays various note metrics for the given note. */
static plotMetrics(ctx: RenderContext, note: Note, yPos: number): void {
const metrics = note.getMetrics();
const xStart = note.getAbsoluteX() - metrics.modLeftPx - metrics.leftDisplacedHeadPx;
Expand Down
1 change: 1 addition & 0 deletions tests/declarations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ export const notStrictEqual = global.notStrictEqual;
// TODO: npm install @types/qunit
/* eslint-disable @typescript-eslint/no-explicit-any */
export interface Assert {
test: any;
expect(amount: number): void;
ok(state: any, message?: string): void;
notOk(state: any, message?: string): void;
Expand Down
31 changes: 14 additions & 17 deletions tests/easyscore_tests.ts
Original file line number Diff line number Diff line change
@@ -1,36 +1,35 @@
/**
* VexFlow - EasyScore Tests
* Copyright Mohit Muthanna 2010 <mohit@muthanna.com>
*/
// [VexFlow](https://vexflow.com/) - Copyright (c) Mohit Muthanna 2010.
// MIT License
//
// EasyScore Tests

import { EasyScore } from '../src/easyscore';
import { StaveNote } from '../src/stavenote';
import { System } from '../src/system';
import { FretHandFinger } from '../src/frethandfinger';
import { QUnit, expect, Assert, TestOptions } from './declarations';
import { Articulation } from '../src/articulation';
import { VexFlowTests } from './vexflow_test_helpers';

// eslint-disable-next-line
declare const VF: any; // TODO: Remove after migrating vexflow_test_helpers.js.
// eslint-disable-next-line
declare let Vex: any; // TODO: Remove after migrating vex.js.
declare const VF: any; // TODO: Remove soon!

const EasyScoreTests = {
Start: function (): void {
const VFT = Vex.Flow.Test;
QUnit.module('EasyScore');
QUnit.test('Basic', EasyScoreTests.basic);
QUnit.test('Accidentals', EasyScoreTests.accidentals);
QUnit.test('Durations', EasyScoreTests.durations);
QUnit.test('Chords', EasyScoreTests.chords);
QUnit.test('Dots', EasyScoreTests.dots);
QUnit.test('Options', EasyScoreTests.options);
VFT.runTests('Draw Basic', EasyScoreTests.drawBasicTest);
VFT.runTests('Draw Accidentals', EasyScoreTests.drawAccidentalsTest);
VFT.runTests('Draw Beams', EasyScoreTests.drawBeamsTest);
VFT.runTests('Draw Tuplets', EasyScoreTests.drawTupletsTest);
VFT.runTests('Draw Dots', EasyScoreTests.drawDotsTest);
VFT.runTests('Draw Options', EasyScoreTests.drawOptionsTest);
VFT.runTests('Draw Fingerings', EasyScoreTests.drawFingeringsTest);
VexFlowTests.runTests('Draw Basic', EasyScoreTests.drawBasicTest);
VexFlowTests.runTests('Draw Accidentals', EasyScoreTests.drawAccidentalsTest);
VexFlowTests.runTests('Draw Beams', EasyScoreTests.drawBeamsTest);
VexFlowTests.runTests('Draw Tuplets', EasyScoreTests.drawTupletsTest);
VexFlowTests.runTests('Draw Dots', EasyScoreTests.drawDotsTest);
VexFlowTests.runTests('Draw Options', EasyScoreTests.drawOptionsTest);
VexFlowTests.runTests('Draw Fingerings', EasyScoreTests.drawFingeringsTest);
},

basic: function (assert: Assert): void {
Expand Down Expand Up @@ -411,6 +410,4 @@ const EasyScoreTests = {
},
};

// Vex.Flow.Test.EasyScore = EasyScoreTests;

export { EasyScoreTests };
Loading

0 comments on commit a0248a3

Please sign in to comment.