forked from 0xfe/vexflow
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtabstave_tests.js
47 lines (39 loc) · 1.37 KB
/
tabstave_tests.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
/**
* VexFlow - TabStave Tests
* Copyright Mohit Muthanna 2010 <[email protected]>
*/
VF.Test.TabStave = (function() {
var TabStave = {
Start: function() {
QUnit.module("TabStave");
VF.Test.runTests("TabStave Draw Test", VF.Test.TabStave.draw);
VF.Test.runTests("Vertical Bar Test", VF.Test.TabStave.drawVerticalBar);
},
draw: function(options, contextBuilder) {
var ctx = new contextBuilder(options.canvas_sel, 400, 160);
var stave = new VF.TabStave(10, 10, 300);
stave.setNumLines(6);
stave.setContext(ctx);
stave.draw();
equal(stave.getYForNote(0), 127, "getYForNote(0)");
equal(stave.getYForLine(5), 127, "getYForLine(5)");
equal(stave.getYForLine(0), 62, "getYForLine(0) - Top Line");
equal(stave.getYForLine(4), 114, "getYForLine(4) - Bottom Line");
ok(true, "all pass");
},
drawVerticalBar: function(options, contextBuilder) {
var ctx = new contextBuilder(options.canvas_sel, 400, 160);
var stave = new VF.TabStave(10, 10, 300);
stave.setNumLines(6);
stave.setContext(ctx);
stave.drawVerticalBar(50, true);
stave.drawVerticalBar(100, true);
stave.drawVerticalBar(150, false);
stave.setEndBarType(VF.Barline.type.END);
stave.draw();
ok(true, "all pass");
}
};
return TabStave;
})();
module.exports = VF.Test.TabStave;