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 ) => { const path = "MuzioClementi_SonatinaOpus36No1_Part1.xml" ; const score = TestUtils . getScore ( path ) ; chai . expect ( score ) . to . not . be . undefined ; const partwise = TestUtils . getPartWiseElement ( score ) ; chai . expect ( partwise ) . to . not . be . undefined ; const reader = new MusicSheetReader ( ) ; const calc = new VexFlowMusicSheetCalculator ( reader . rules ) ; const sheet = reader . createMusicSheet ( new IXmlElement ( partwise ) , path ) ; const gms = new GraphicalMusicSheet ( sheet , calc ) ; chai . expect ( gms ) . to . not . be . undefined ; done ( ) ; } ) ; it ( "Can have a single empty Measure" , ( done ) => { const sheet = new MusicSheet ( ) ; sheet . Rules = new EngravingRules ( ) ; const measure = new SourceMeasure ( 1 , sheet . Rules ) ; measure . FirstInstructionsStaffEntries [ 0 ] = new SourceStaffEntry ( undefined , undefined ) ; sheet . addMeasure ( measure ) ; const calc = new VexFlowMusicSheetCalculator ( sheet . Rules ) ; const gms = 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 ( ) ; } ) ; } ) ;