1234567891011121314151617181920212223242526272829303132333435363738394041424344 |
- /* eslint-disable @typescript-eslint/no-unused-expressions */
- import {GraphicalMusicSheet} from "../../../../src/MusicalScore/Graphical/GraphicalMusicSheet";
- import {IXmlElement} from "../../../../src/Common/FileIO/Xml";
- import {MusicSheet} from "../../../../src/MusicalScore/MusicSheet";
- import {MusicSheetReader} from "../../../../src/MusicalScore/ScoreIO/MusicSheetReader";
- import {VexFlowMusicSheetCalculator} from "../../../../src/MusicalScore/Graphical/VexFlow/VexFlowMusicSheetCalculator";
- import {TestUtils} from "../../../Util/TestUtils";
- import {SourceMeasure} from "../../../../src/MusicalScore/VoiceData/SourceMeasure";
- import {SourceStaffEntry} from "../../../../src/MusicalScore/VoiceData/SourceStaffEntry";
- import {MusicSheetCalculator} from "../../../../src/MusicalScore/Graphical/MusicSheetCalculator";
- import {EngravingRules} from "../../../../src/MusicalScore/Graphical/EngravingRules";
- describe("VexFlow Measure", () => {
- it("Can create GraphicalMusicSheet", (done: Mocha.Done) => {
- const path: string = "MuzioClementi_SonatinaOpus36No1_Part1.xml";
- const score: Document = TestUtils.getScore(path);
- chai.expect(score).to.not.be.undefined;
- const partwise: Element = TestUtils.getPartWiseElement(score);
- chai.expect(partwise).to.not.be.undefined;
- const reader: MusicSheetReader = new MusicSheetReader();
- const calc: VexFlowMusicSheetCalculator = new VexFlowMusicSheetCalculator(reader.rules);
- const sheet: MusicSheet = reader.createMusicSheet(new IXmlElement(partwise), path);
- const gms: GraphicalMusicSheet = new GraphicalMusicSheet(sheet, calc);
- // console.log(gms);
- chai.expect(gms).to.not.be.undefined; // at least necessary for linter so that variable is not unused
- done();
- });
- it("Can have a single empty Measure", (done: Mocha.Done) => {
- const sheet: MusicSheet = new MusicSheet();
- sheet.Rules = new EngravingRules();
- const measure: SourceMeasure = new SourceMeasure(1, sheet.Rules);
- measure.FirstInstructionsStaffEntries[0] = new SourceStaffEntry(undefined, undefined);
- sheet.addMeasure(measure);
- const calc: MusicSheetCalculator = new VexFlowMusicSheetCalculator(sheet.Rules);
- const gms: GraphicalMusicSheet = new GraphicalMusicSheet(sheet, calc);
- chai.expect(gms.MeasureList.length).to.equal(1);
- chai.expect(gms.MeasureList[0].length).to.equal(1);
- chai.expect(gms.MeasureList[0][0].staffEntries.length).to.equal(0);
- done();
- });
- });
|