Bläddra i källkod

Configured test for MusicSheetReader

Andrea Condoluci 9 år sedan
förälder
incheckning
be2e8918ad

+ 5 - 26
Gruntfile.js

@@ -72,42 +72,21 @@ module.exports = function (grunt) {
             ci: {
                 configFile: 'karma.conf.js',
                 options: {
-                    browsers: ['PhantomJS'],
-                    files: [
-                        '<%= browserify.debug.dest %>'
-                    ]
+                    browsers: ['PhantomJS']
                 }
             },
             debugWithFirefox: {
                 configFile: 'karma.conf.js',
                 options: {
                     singleRun: false,
-                    browsers: ['Firefox'],
-                    files: [
-                        '<%= browserify.debug.dest %>', {
-                            pattern: 'src/**/*.ts',
-                            included: false
-                        }, {
-                            pattern: 'test/**/*.ts',
-                            included: false
-                        }
-                    ]
+                    browsers: ['Firefox']
                 }
             },
             debugWithChrome: {
                 configFile: 'karma.conf.js',
                 options: {
                     singleRun: false,
-                    browsers: ['Chrome'],
-                    files: [
-                        '<%= browserify.debug.dest %>', {
-                            pattern: 'src/**/*.ts',
-                            included: false
-                        }, {
-                            pattern: 'test/**/*.ts',
-                            included: false
-                        }
-                    ]
+                    browsers: ['Chrome']
                 }
             }
         },
@@ -122,7 +101,7 @@ module.exports = function (grunt) {
         },
         // JsHint setup
         jshint: {
-            all: ['Gruntfile.js']
+            all: ['Gruntfile.js', 'karma.conf.js']
         },
         // TypeScript Type Definitions
         typings: {
@@ -169,7 +148,7 @@ module.exports = function (grunt) {
     grunt.registerTask('rebuild', ['clean', 'default']);
     grunt.registerTask('publish', ['clean', 'browserify:dist', 'docco']);
 
-    grunt.registerTask('lint',    ['tslint', 'jshint']);
+    grunt.registerTask('lint',    ['jshint', 'tslint']);
     // Fix these in the future:
     // grunt.registerTask('test debug Firefox', ['browserify:debug', 'karma:debugWithFirefox']);
     // grunt.registerTask('test debug Chrome', ['browserify:debug', 'karma:debugWithChrome']);

+ 2 - 1
README.md

@@ -2,9 +2,10 @@
   <img alt="OSMD logo" src="http://opensheetmusicdisplay.org/wp-content/uploads/2015/03/OSMD_3_icon.png" width="200"/>
 </p>
 
-# Open Sheet Music Display library
+# Open Sheet Music Display
 
 [![Build Status](https://travis-ci.org/opensheetmusicdisplay/opensheetmusicdisplay.svg?branch=master)](https://travis-ci.org/opensheetmusicdisplay/opensheetmusicdisplay)
+[![Dependency Status](https://david-dm.org/opensheetmusicdisplay/opensheetmusicdisplay.png)](https://david-dm.org/opensheetmusicdisplay/opensheetmusicdisplay)
 
 * Website: [opensheetmusicdisplay.org](http://opensheetmusicdisplay.org)
 * How to build: [wiki/Build-Instructions](https://github.com/opensheetmusicdisplay/opensheetmusicdisplay/wiki/Build-Instructions)

+ 21 - 10
karma.conf.js

@@ -1,7 +1,8 @@
 // Karma configuration
 // Generated on Fri Feb 05 2016 12:36:08 GMT+0100 (CET)
-
-module.exports = function(config) {
+/*globals module*/
+module.exports = function (config) {
+    'use strict';
     config.set({
 
         // base path that will be used to resolve all patterns (eg. files, exclude)
@@ -9,20 +10,30 @@ module.exports = function(config) {
 
         // frameworks to use
         // available frameworks: https://npmjs.org/browse/keyword/karma-adapter
-        frameworks: ['mocha', 'chai'],
-
-        // list of files / patterns to load in the browser
-        files: [
-          'build/**/*.js'
-        ],
+        frameworks: ['mocha', 'chai', 'fixture'],
 
         // list of files to exclude
-        exclude: [
-        ],
+        exclude: [],
+
+        files: [{
+            pattern: 'build/osmd-debug.js'
+        }, {
+            pattern: 'src/**/*.ts',
+            included: false
+        }, {
+            pattern: 'test/**/*.ts',
+            included: false
+        }, {
+            pattern: 'test/data/*.xml',
+            included: true//,
+            //served: true,
+            //watched: true
+        }],
 
         // preprocess matching files before serving them to the browser
         // available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
         preprocessors: {
+            'test/data/*.xml': ['html2js']
         },
 
         // test results reporter to use

+ 6 - 4
package.json

@@ -24,6 +24,9 @@
     },
     "homepage": "http://opensheetmusicdisplay.org",
     "dependencies": {
+        "fft": "0.2.1",
+        "vexflow": "",
+
         "chai": "",
         "mocha": "",
         "tsify": "",
@@ -46,13 +49,12 @@
         "karma": "",
         "karma-chai": "",
         "karma-mocha": "",
+        "karma-fixture": "",
         "karma-mocha-reporter": "",
         "karma-chrome-launcher": "",
         "karma-firefox-launcher": "",
         "karma-phantomjs-launcher": "",
-
-        "vexflow": "",
-
-        "fft": "0.2.1"
+        "karma-html2js-preprocessor": "",
+        "karma-json-fixtures-preprocessor": ""
     }
 }

+ 6 - 3
src/Common/FileIO/Xml.ts

@@ -51,12 +51,15 @@ export class IXmlElement {
   public elements(nodeName?: string): IXmlElement[] {
     let nodes: NodeList = this.elem.childNodes;
     let ret: IXmlElement[] = [];
-    let nameUnset: boolean = typeof nodeName === "undefined"; // FIXME check
+    let nameUnset: boolean = nodeName === undefined;
+    if (!nameUnset) {
+      nodeName = nodeName.toUpperCase();
+    }
     for (let i: number = 0; i < nodes.length; i += 1) {
       let node: Node = nodes[i];
       if (node.nodeType === Node.ELEMENT_NODE &&
-        (nameUnset || node.nodeName === nodeName)) {
-          ret.push(new IXmlElement(<Element> node));
+        (nameUnset || node.nodeName.toUpperCase() === nodeName)) {
+          ret.push(new IXmlElement(node as Element));
         }
     }
     return ret;

+ 191 - 190
src/MusicalScore/ScoreIO/MusicSheetReader.ts

@@ -16,6 +16,7 @@ import {InstrumentalGroup} from "../InstrumentalGroup";
 import {SubInstrument} from "../SubInstrument";
 import {MidiInstrument} from "../VoiceData/Instructions/ClefInstruction";
 import {AbstractNotationInstruction} from "../VoiceData/Instructions/AbstractNotationInstruction";
+import {Label} from "../Label";
 
 type RepetitionInstructionReader = any;
 
@@ -101,7 +102,7 @@ export class MusicSheetReader /*implements IMusicSheetReader*/ {
     this.musicSheet.Path = path;
     try {
       if (root !== undefined) {
-        // this.pushSheetLabels(root, path); // FIXME Andrea
+        this.pushSheetLabels(root, path);
         let partlistNode: IXmlElement = root.element("part-list");
         if (partlistNode !== undefined) {
           let partInst: IXmlElement[] = root.elements("part");
@@ -169,9 +170,9 @@ export class MusicSheetReader /*implements IMusicSheetReader*/ {
   }
 
   // Trim from a string also newlines
-  //private trimString(str: string): string {
-  //  return str.replace(/^\s+|\s+$/g, "");
-  //}
+  private trimString(str: string): string {
+    return str.replace(/^\s+|\s+$/g, "");
+  }
 
   private _lastElement<T>(list: T[]): T {
     return list[list.length - 1];
@@ -420,196 +421,196 @@ export class MusicSheetReader /*implements IMusicSheetReader*/ {
       }
     }
   }
-  //private addSheetLabels(root: IXmlElement, filePath: string): void {
-  //  this.readComposer(root);
-  //  this.readTitle(root);
-  //  if (this.musicSheet.Title === undefined || this.musicSheet.Composer === undefined) {
-  //    this.readTitleAndComposerFromCredits(root);
-  //  }
-  //  if (this.musicSheet.Title === undefined) {
-  //    try {
-  //      let bar_i: number = Math.max(
-  //        0, filePath.lastIndexOf("/"), filePath.lastIndexOf("\\")
-  //      );
-  //      let filename: string = filePath.substr(bar_i);
-  //      let filenameSplits: string[] = filename.split(".", 1);
-  //      this.musicSheet.Title = new Label(filenameSplits[0]);
-  //    } catch (ex) {
-  //      logging.log("MusicSheetReader.pushSheetLabels: ", ex);
-  //    }
-  //
-  //  }
-  //}
+  private pushSheetLabels(root: IXmlElement, filePath: string): void {
+    this.readComposer(root);
+    this.readTitle(root);
+    if (this.musicSheet.Title === undefined || this.musicSheet.Composer === undefined) {
+      this.readTitleAndComposerFromCredits(root);
+    }
+    if (this.musicSheet.Title === undefined) {
+      try {
+        let barI: number = Math.max(
+          0, filePath.lastIndexOf("/"), filePath.lastIndexOf("\\")
+        );
+        let filename: string = filePath.substr(barI);
+        let filenameSplits: string[] = filename.split(".", 1);
+        this.musicSheet.Title = new Label(filenameSplits[0]);
+      } catch (ex) {
+        Logging.log("MusicSheetReader.pushSheetLabels: ", ex);
+      }
+
+    }
+  }
   // Checks whether _elem_ has an attribute with value _val_.
-  //private presentAttrsWithValue(elem: IXmlElement, val: string): boolean {
-  //  for (let attr of elem.attributes()) {
-  //    if (attr.value === val) { return true; }
-  //  }
-  //  return false;
-  //}
+  private presentAttrsWithValue(elem: IXmlElement, val: string): boolean {
+    for (let attr of elem.attributes()) {
+      if (attr.value === val) { return true; }
+    }
+    return false;
+  }
 
-  //private readComposer(root: IXmlElement): void {
-  //  let identificationNode: IXmlElement = root.element("identification");
-  //  if (identificationNode !== undefined) {
-  //    let creators: IXmlElement[] = identificationNode.elements("creator");
-  //    for (let idx: number = 0, len: number = creators.length; idx < len; ++idx) {
-  //      let creator: IXmlElement = creators[idx];
-  //      if (creator.hasAttributes) {
-  //        if (this.presentAttrsWithValue(creator, "composer")) {
-  //          this.musicSheet.Composer = new Label(this.trimString(creator.value));
-  //          continue;
-  //        }
-  //        if (this.presentAttrsWithValue(creator, "lyricist") || this.presentAttrsWithValue(creator, "poet")) {
-  //          this.musicSheet.Lyricist = new Label(this.trimString(creator.value));
-  //        }
-  //      }
-  //    }
-  //  }
-  //}
+  private readComposer(root: IXmlElement): void {
+    let identificationNode: IXmlElement = root.element("identification");
+    if (identificationNode !== undefined) {
+      let creators: IXmlElement[] = identificationNode.elements("creator");
+      for (let idx: number = 0, len: number = creators.length; idx < len; ++idx) {
+        let creator: IXmlElement = creators[idx];
+        if (creator.hasAttributes) {
+          if (this.presentAttrsWithValue(creator, "composer")) {
+            this.musicSheet.Composer = new Label(this.trimString(creator.value));
+            continue;
+          }
+          if (this.presentAttrsWithValue(creator, "lyricist") || this.presentAttrsWithValue(creator, "poet")) {
+            this.musicSheet.Lyricist = new Label(this.trimString(creator.value));
+          }
+        }
+      }
+    }
+  }
 
-  //private readTitleAndComposerFromCredits(root: IXmlElement): void {
-  //  let systemYCoordinates: number = this.computeSystemYCoordinates(root);
-  //  if (systemYCoordinates === 0) { return; }
-  //  let largestTitleCreditSize: number = 1;
-  //  let finalTitle: string = undefined;
-  //  let largestCreditYInfo: number = 0;
-  //  let finalSubtitle: string = undefined;
-  //  let possibleTitle: string = undefined;
-  //  let creditElements: IXmlElement[] = root.elements("credit");
-  //  for (let idx: number = 0, len: number = creditElements.length; idx < len; ++idx) {
-  //    let credit: IXmlElement = creditElements[idx];
-  //    if (credit.attribute("page") === undefined) { return; }
-  //    if (credit.attribute("page").value === "1") {
-  //      let creditChild: IXmlElement = undefined;
-  //      if (credit !== undefined) {
-  //        creditChild = credit.element("credit-words");
-  //        if (creditChild.attribute("justify") === undefined) {
-  //          break;
-  //        }
-  //        let creditJustify: string = creditChild.attribute("justify").value;
-  //        let creditY: string = creditChild.attribute("default-y").value;
-  //        let creditYInfo: number = parseFloat(creditY);
-  //        if (creditYInfo > systemYCoordinates) {
-  //          if (this.musicSheet.Title === undefined) {
-  //            let creditSize: string = creditChild.attribute("font-size").value;
-  //            let titleCreditSizeInt: number = parseFloat(creditSize);
-  //            if (largestTitleCreditSize < titleCreditSizeInt) {
-  //              largestTitleCreditSize = titleCreditSizeInt;
-  //              finalTitle = creditChild.value;
-  //            }
-  //          }
-  //          if (this.musicSheet.Subtitle === undefined) {
-  //            if (creditJustify !== "right" && creditJustify !== "left") {
-  //              if (largestCreditYInfo < creditYInfo) {
-  //                largestCreditYInfo = creditYInfo;
-  //                if (possibleTitle) {
-  //                  finalSubtitle = possibleTitle;
-  //                  possibleTitle = creditChild.value;
-  //                } else {
-  //                  possibleTitle = creditChild.value;
-  //                }
-  //              }
-  //            }
-  //          }
-  //          if (!(this.musicSheet.Composer !== undefined && this.musicSheet.Lyricist !== undefined)) {
-  //            switch (creditJustify) {
-  //              case "right":
-  //                this.musicSheet.Composer = new Label(this.trimString(creditChild.value));
-  //                break;
-  //              case "left":
-  //                this.musicSheet.Lyricist = new Label(this.trimString(creditChild.value));
-  //                break;
-  //              default: break;
-  //            }
-  //          }
-  //        }
-  //      }
-  //    }
-  //  }
-  //  if (this.musicSheet.Title === undefined && finalTitle) {
-  //    this.musicSheet.Title = new Label(this.trimString(finalTitle));
-  //  }
-  //  if (this.musicSheet.Subtitle === undefined && finalSubtitle) {
-  //    this.musicSheet.Subtitle = new Label(this.trimString(finalSubtitle));
-  //  }
-  //}
+  private readTitleAndComposerFromCredits(root: IXmlElement): void {
+    let systemYCoordinates: number = this.computeSystemYCoordinates(root);
+    if (systemYCoordinates === 0) { return; }
+    let largestTitleCreditSize: number = 1;
+    let finalTitle: string = undefined;
+    let largestCreditYInfo: number = 0;
+    let finalSubtitle: string = undefined;
+    let possibleTitle: string = undefined;
+    let creditElements: IXmlElement[] = root.elements("credit");
+    for (let idx: number = 0, len: number = creditElements.length; idx < len; ++idx) {
+      let credit: IXmlElement = creditElements[idx];
+      if (credit.attribute("page") === undefined) { return; }
+      if (credit.attribute("page").value === "1") {
+        let creditChild: IXmlElement = undefined;
+        if (credit !== undefined) {
+          creditChild = credit.element("credit-words");
+          if (creditChild.attribute("justify") === undefined) {
+            break;
+          }
+          let creditJustify: string = creditChild.attribute("justify").value;
+          let creditY: string = creditChild.attribute("default-y").value;
+          let creditYInfo: number = parseFloat(creditY);
+          if (creditYInfo > systemYCoordinates) {
+            if (this.musicSheet.Title === undefined) {
+              let creditSize: string = creditChild.attribute("font-size").value;
+              let titleCreditSizeInt: number = parseFloat(creditSize);
+              if (largestTitleCreditSize < titleCreditSizeInt) {
+                largestTitleCreditSize = titleCreditSizeInt;
+                finalTitle = creditChild.value;
+              }
+            }
+            if (this.musicSheet.Subtitle === undefined) {
+              if (creditJustify !== "right" && creditJustify !== "left") {
+                if (largestCreditYInfo < creditYInfo) {
+                  largestCreditYInfo = creditYInfo;
+                  if (possibleTitle) {
+                    finalSubtitle = possibleTitle;
+                    possibleTitle = creditChild.value;
+                  } else {
+                    possibleTitle = creditChild.value;
+                  }
+                }
+              }
+            }
+            if (!(this.musicSheet.Composer !== undefined && this.musicSheet.Lyricist !== undefined)) {
+              switch (creditJustify) {
+                case "right":
+                  this.musicSheet.Composer = new Label(this.trimString(creditChild.value));
+                  break;
+                case "left":
+                  this.musicSheet.Lyricist = new Label(this.trimString(creditChild.value));
+                  break;
+                default: break;
+              }
+            }
+          }
+        }
+      }
+    }
+    if (this.musicSheet.Title === undefined && finalTitle) {
+      this.musicSheet.Title = new Label(this.trimString(finalTitle));
+    }
+    if (this.musicSheet.Subtitle === undefined && finalSubtitle) {
+      this.musicSheet.Subtitle = new Label(this.trimString(finalSubtitle));
+    }
+  }
 
-  //private computeSystemYCoordinates(root: IXmlElement): number {
-  //  if (root.element("defaults") === undefined) {
-  //    return 0;
-  //  }
-  //  let paperHeight: number = 0;
-  //  let topSystemDistance: number = 0;
-  //  let defi: string = root.element("defaults").element("page-layout").element("page-height").value;
-  //  paperHeight = parseFloat(defi);
-  //  let found: boolean = false;
-  //  let parts: IXmlElement[] = root.elements("part");
-  //  for (let idx: number = 0, len: number = parts.length; idx < len; ++idx) {
-  //    let measures: IXmlElement[] = parts[idx].elements("measure");
-  //    for (let idx2: number = 0, len2: number = measures.length; idx2 < len2; ++idx2) {
-  //      let measure: IXmlElement = measures[idx2];
-  //      if (measure.element("print") !== undefined) {
-  //        let systemLayouts: IXmlElement[] = measure.element("print").elements("system-layout");
-  //        for (let idx3: number = 0, len3: number = systemLayouts.length; idx3 < len3; ++idx3) {
-  //          let syslab: IXmlElement = systemLayouts[idx3];
-  //          if (syslab.element("top-system-distance") !== undefined) {
-  //            let topSystemDistanceString: string = syslab.element("top-system-distance").value;
-  //            topSystemDistance = parseFloat(topSystemDistanceString);
-  //            found = true;
-  //            break;
-  //          }
-  //        }
-  //        break;
-  //      }
-  //    }
-  //    if (found) { break; }
-  //  }
-  //  if (root.element("defaults").element("system-layout") !== undefined) {
-  //    let syslay: IXmlElement = root.element("defaults").element("system-layout");
-  //    if (syslay.element("top-system-distance") !== undefined) {
-  //      let topSystemDistanceString: string = root.element("defaults").element("system-layout").element("top-system-distance").value;
-  //      topSystemDistance = parseFloat(topSystemDistanceString);
-  //    }
-  //  }
-  //  if (topSystemDistance === 0) { return 0; }
-  //  return paperHeight - topSystemDistance;
-  //}
-  //private readTitle(root: IXmlElement): void {
-  //  let titleNode: IXmlElement = root.element("work");
-  //  let titleNodeChild: IXmlElement = undefined;
-  //  if (titleNode !== undefined) {
-  //    titleNodeChild = titleNode.element("work-title");
-  //    if (titleNodeChild !== undefined && titleNodeChild.value) {
-  //      this.musicSheet.Title = new Label(this.trimString(titleNodeChild.value));
-  //    }
-  //  }
-  //  let movementNode: IXmlElement = root.element("movement-title");
-  //  let finalSubTitle: string = "";
-  //  if (movementNode !== undefined) {
-  //    if (this.musicSheet.Title === undefined) {
-  //      this.musicSheet.Title = new Label(this.trimString(movementNode.value));
-  //    } else {
-  //      finalSubTitle = this.trimString(movementNode.value);
-  //    }
-  //  }
-  //  if (titleNode !== undefined) {
-  //    let subtitleNodeChild: IXmlElement = titleNode.element("work-number");
-  //    if (subtitleNodeChild !== undefined) {
-  //      let workNumber: string = subtitleNodeChild.value;
-  //      if (workNumber) {
-  //        if (finalSubTitle) {
-  //          finalSubTitle = workNumber;
-  //        } else {
-  //          finalSubTitle = finalSubTitle + ", " + workNumber;
-  //        }
-  //      }
-  //    }
-  //  }
-  //  if (finalSubTitle
-  //  ) {
-  //    this.musicSheet.Subtitle = new Label(finalSubTitle);
-  //  }
-  //}
+  private computeSystemYCoordinates(root: IXmlElement): number {
+    if (root.element("defaults") === undefined) {
+      return 0;
+    }
+    let paperHeight: number = 0;
+    let topSystemDistance: number = 0;
+    let defi: string = root.element("defaults").element("page-layout").element("page-height").value;
+    paperHeight = parseFloat(defi);
+    let found: boolean = false;
+    let parts: IXmlElement[] = root.elements("part");
+    for (let idx: number = 0, len: number = parts.length; idx < len; ++idx) {
+      let measures: IXmlElement[] = parts[idx].elements("measure");
+      for (let idx2: number = 0, len2: number = measures.length; idx2 < len2; ++idx2) {
+        let measure: IXmlElement = measures[idx2];
+        if (measure.element("print") !== undefined) {
+          let systemLayouts: IXmlElement[] = measure.element("print").elements("system-layout");
+          for (let idx3: number = 0, len3: number = systemLayouts.length; idx3 < len3; ++idx3) {
+            let syslab: IXmlElement = systemLayouts[idx3];
+            if (syslab.element("top-system-distance") !== undefined) {
+              let topSystemDistanceString: string = syslab.element("top-system-distance").value;
+              topSystemDistance = parseFloat(topSystemDistanceString);
+              found = true;
+              break;
+            }
+          }
+          break;
+        }
+      }
+      if (found) { break; }
+    }
+    if (root.element("defaults").element("system-layout") !== undefined) {
+      let syslay: IXmlElement = root.element("defaults").element("system-layout");
+      if (syslay.element("top-system-distance") !== undefined) {
+        let topSystemDistanceString: string = root.element("defaults").element("system-layout").element("top-system-distance").value;
+        topSystemDistance = parseFloat(topSystemDistanceString);
+      }
+    }
+    if (topSystemDistance === 0) { return 0; }
+    return paperHeight - topSystemDistance;
+  }
+  private readTitle(root: IXmlElement): void {
+    let titleNode: IXmlElement = root.element("work");
+    let titleNodeChild: IXmlElement = undefined;
+    if (titleNode !== undefined) {
+      titleNodeChild = titleNode.element("work-title");
+      if (titleNodeChild !== undefined && titleNodeChild.value) {
+        this.musicSheet.Title = new Label(this.trimString(titleNodeChild.value));
+      }
+    }
+    let movementNode: IXmlElement = root.element("movement-title");
+    let finalSubTitle: string = "";
+    if (movementNode !== undefined) {
+      if (this.musicSheet.Title === undefined) {
+        this.musicSheet.Title = new Label(this.trimString(movementNode.value));
+      } else {
+        finalSubTitle = this.trimString(movementNode.value);
+      }
+    }
+    if (titleNode !== undefined) {
+      let subtitleNodeChild: IXmlElement = titleNode.element("work-number");
+      if (subtitleNodeChild !== undefined) {
+        let workNumber: string = subtitleNodeChild.value;
+        if (workNumber) {
+          if (finalSubTitle) {
+            finalSubTitle = workNumber;
+          } else {
+            finalSubTitle = finalSubTitle + ", " + workNumber;
+          }
+        }
+      }
+    }
+    if (finalSubTitle
+    ) {
+      this.musicSheet.Subtitle = new Label(finalSubTitle);
+    }
+  }
   private createInstrumentGroups(entryList: IXmlElement[]): { [_: string]: Instrument; } {
     let instrumentId: number = 0;
     let instrumentDict: { [_: string]: Instrument; } = {};

+ 37 - 0
test/MusicalScore/ScoreIO/MusicSheetReader.ts

@@ -0,0 +1,37 @@
+import {MusicSheetReader} from "../../../src/MusicalScore/ScoreIO/MusicSheetReader";
+import {MusicSheet} from "../../../src/MusicalScore/MusicSheet";
+import {IXmlElement} from "../../../src/Common/FileIO/Xml";
+
+declare var fixture: any;
+
+describe("Music Sheet Reader Tests", () => {
+    // Initialization
+    let path: string = "/test/data/MuzioClementi_SonatinaOpus36No1_Part1.xml";
+    let reader: MusicSheetReader = new MusicSheetReader();
+
+    before((): void => {
+        fixture.setBase("base");
+    });
+
+    beforeEach((): void => {
+      this.result = fixture.load(path);
+    });
+
+    afterEach((): void => {
+      fixture.cleanup();
+    });
+
+    it("Test Sonatina Op.36 No. 1 - Pt. 1", (done: MochaDone) => {
+        let container: Element = document.getElementById("fixture_container");
+        let documentElement: IXmlElement = new IXmlElement(container);
+        chai.expect(documentElement.elements("score-partwise").length).to.equal(1);
+        let root: IXmlElement = documentElement.element("score-partwise");
+        chai.expect(root).to.not.be.undefined;
+        let sheet: MusicSheet = reader.createMusicSheet(root, path);
+        chai.expect(sheet.TitleString).to.equal("Sonatina Op.36 No 1 Teil 1 Allegro");
+        chai.expect(sheet.ComposerString).to.equal("Muzio Clementi");
+        console.log("Sheet Object:", sheet);
+        done();
+    });
+
+});