import { VexFlowMusicSheetDrawer } from "../../../../src/MusicalScore/Graphical/VexFlow/VexFlowMusicSheetDrawer" ; import { GraphicalMusicSheet } from "../../../../src/MusicalScore/Graphical/GraphicalMusicSheet" ; 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 { IXmlElement } from "../../../../src/Common/FileIO/Xml" ; import { VexFlowBackend } from "../../../../src/MusicalScore/Graphical/VexFlow/VexFlowBackend" ; import { CanvasVexFlowBackend } from "../../../../src/MusicalScore/Graphical/VexFlow/CanvasVexFlowBackend" ; describe ( "VexFlow Music Sheet Drawer" , ( ) => { it ( "draws sheet \"Clementi pt. 1\"" , ( done ) => { const score = TestUtils . getScore ( "MuzioClementi_SonatinaOpus36No1_Part1.xml" ) ; 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 ) , "** missing path **" ) ; const gms = new GraphicalMusicSheet ( sheet , calc ) ; const canvas = document . createElement ( "canvas" ) ; const backend = new CanvasVexFlowBackend ( sheet . Rules ) ; backend . initialize ( canvas , 1.0 ) ; const drawer = new VexFlowMusicSheetDrawer ( ) ; drawer . Backends . push ( backend ) ; drawer . drawSheet ( gms ) ; done ( ) ; } ) ; } ) ;