import { MusicSheetReader } from "../../../src/MusicalScore/ScoreIO/MusicSheetReader" ; import { MusicSheet } from "../../../src/MusicalScore/MusicSheet" ; import { IXmlElement } from "../../../src/Common/FileIO/Xml" ; describe ( "Music Sheet Reader" , ( ) => { const path = "test/data/MuzioClementi_SonatinaOpus36No1_Part1.xml" ; const reader = new MusicSheetReader ( ) ; let score ; let sheet ; function getSheet ( filename ) { return ( ( window as any ) . __xml__ ) [ filename ] ; } before ( ( ) : void => { const doc = getSheet ( path ) ; chai . expect ( doc ) . to . not . be . undefined ; score = new IXmlElement ( doc . getElementsByTagName ( "score-partwise" ) [ 0 ] ) ; sheet = reader . createMusicSheet ( score , path ) ; } ) ; it ( "checks XML" , ( done ) => { done ( ) ; } ) ; it ( "reads title and composer" , ( done ) => { chai . expect ( sheet . TitleString ) . to . equal ( "Sonatina Op.36 No 1 Teil 1 Allegro" ) ; chai . expect ( sheet . ComposerString ) . to . equal ( "Muzio Clementi" ) ; done ( ) ; } ) ; it ( "reads measures" , ( done ) => { chai . expect ( sheet . SourceMeasures . length ) . to . equal ( 38 ) ; done ( ) ; } ) ; it ( "reads instruments" , ( done ) => { chai . expect ( reader . CompleteNumberOfStaves ) . to . equal ( 2 ) ; chai . expect ( sheet . Instruments . length ) . to . equal ( 2 ) ; chai . expect ( sheet . InstrumentalGroups . length ) . to . equal ( 2 ) ; chai . expect ( sheet . Instruments [ 0 ] . Name ) . to . equal ( "Piano (right)" ) ; chai . expect ( sheet . Instruments [ 1 ] . Name ) . to . equal ( "Piano (left)" ) ; done ( ) ; } ) ; it ( "reads notes" , ( done ) => { done ( ) ; } ) ; } ) ;