|
@@ -1,5 +1,8 @@
|
|
import chai = require("chai");
|
|
import chai = require("chai");
|
|
|
|
+import {Instrument} from "../../../src/MusicalScore/Instrument";
|
|
|
|
+import {Note} from "../../../src/MusicalScore/VoiceData/Note";
|
|
import {OpenSheetMusicDisplay} from "../../../src/OpenSheetMusicDisplay/OpenSheetMusicDisplay";
|
|
import {OpenSheetMusicDisplay} from "../../../src/OpenSheetMusicDisplay/OpenSheetMusicDisplay";
|
|
|
|
+import {VoiceEntry} from "../../../src/MusicalScore/VoiceData/VoiceEntry";
|
|
import {TestUtils} from "../../Util/TestUtils";
|
|
import {TestUtils} from "../../Util/TestUtils";
|
|
|
|
|
|
describe("OpenSheetMusicDisplay Main Export", () => {
|
|
describe("OpenSheetMusicDisplay Main Export", () => {
|
|
@@ -192,4 +195,54 @@ describe("OpenSheetMusicDisplay Main Export", () => {
|
|
done
|
|
done
|
|
).catch(done);
|
|
).catch(done);
|
|
});
|
|
});
|
|
|
|
+
|
|
|
|
+ describe("cursor", () => {
|
|
|
|
+ let opensheetmusicdisplay: OpenSheetMusicDisplay;
|
|
|
|
+ beforeEach((done: MochaDone) => {
|
|
|
|
+ const div: HTMLElement = container1;
|
|
|
|
+ opensheetmusicdisplay = TestUtils.createOpenSheetMusicDisplay(div);
|
|
|
|
+ const score: Document = TestUtils.getScore("MuzioClementi_SonatinaOpus36No1_Part1.xml");
|
|
|
|
+ opensheetmusicdisplay.load(score).then(
|
|
|
|
+ (_: {}) => {
|
|
|
|
+ opensheetmusicdisplay.render();
|
|
|
|
+ opensheetmusicdisplay.cursor.show();
|
|
|
|
+ done();
|
|
|
|
+ },
|
|
|
|
+ done
|
|
|
|
+ ).catch(done);
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+ describe("get AllVoicesUnderCursor", () => {
|
|
|
|
+ it("retreives all voices under cursor", () => {
|
|
|
|
+ const voiceEntries: VoiceEntry[] = opensheetmusicdisplay.cursor.AllVoicesUnderCursor;
|
|
|
|
+ chai.expect(voiceEntries.length).to.equal(2);
|
|
|
|
+ });
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+ describe("VoicesUnderCursor", () => {
|
|
|
|
+ it("retreives voices for a specific instrument under cursor", () => {
|
|
|
|
+ const voiceEntries: VoiceEntry[] = opensheetmusicdisplay.cursor.VoicesUnderCursor();
|
|
|
|
+ chai.expect(voiceEntries.length).to.equal(2);
|
|
|
|
+ });
|
|
|
|
+ it("retreives all voices under cursor when instrument not specified", () => {
|
|
|
|
+ const instrument: Instrument = opensheetmusicdisplay.Sheet.Instruments[1];
|
|
|
|
+ const voiceEntries: VoiceEntry[] = opensheetmusicdisplay.cursor.VoicesUnderCursor(instrument);
|
|
|
|
+ chai.expect(voiceEntries.length).to.equal(1);
|
|
|
|
+ });
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+ describe("NotesUnderCursor", () => {
|
|
|
|
+ it("gets notes for a specific instrument under cursor", () => {
|
|
|
|
+ const instrument: Instrument = opensheetmusicdisplay.Sheet.Instruments[0];
|
|
|
|
+ const notes: Note[] = opensheetmusicdisplay.cursor.NotesUnderCursor(instrument);
|
|
|
|
+ chai.expect(notes.length).to.equal(1);
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+ it("gets all notes under cursor when instrument unspecified", () => {
|
|
|
|
+ const notes: Note[] = opensheetmusicdisplay.cursor.NotesUnderCursor();
|
|
|
|
+ chai.expect(notes.length).to.equal(2);
|
|
|
|
+ });
|
|
|
|
+ });
|
|
|
|
+ });
|
|
|
|
+
|
|
});
|
|
});
|