Skip to content

Commit

Permalink
Fix a test case that permanently modified Vex.Flow.STAVE_LINE_THICKNESS.
Browse files Browse the repository at this point in the history
This results in visual diffs in the stave lines in test cases that were run after StaveConnectorTests.Start();

The reference images were wrong because they do not render the stave lines correctly.
Fixes #1109
  • Loading branch information
ronyeh committed Aug 20, 2021
1 parent 6296dd3 commit 77587f0
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions tests/staveconnector_tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const StaveConnectorTests = {
const run = VexFlowTests.runTests;
test('VF.* API', this.VF_Prefix);
run('Single Draw Test', this.drawSingle);
run('Single Draw Test, 1px Stave Line Thickness', this.drawSingle1pxBarlines);
run('Single Draw Test, 4px Stave Line Thickness', this.drawSingle4pxStaveLines);
run('Single Both Sides Test', this.drawSingleBoth);
run('Double Draw Test', this.drawDouble);
run('Bold Double Line Left Draw Test', this.drawRepeatBegin);
Expand Down Expand Up @@ -54,8 +54,9 @@ const StaveConnectorTests = {
ok(true, 'all pass');
},

drawSingle1pxBarlines(options: TestOptions, contextBuilder: ContextBuilder): void {
VF.STAVE_LINE_THICKNESS = 1;
drawSingle4pxStaveLines(options: TestOptions, contextBuilder: ContextBuilder): void {
const oldThickness = VF.STAVE_LINE_THICKNESS;
VF.STAVE_LINE_THICKNESS = 4;
const ctx = contextBuilder(options.elementId, 400, 300);
const stave = new Stave(25, 10, 300);
const stave2 = new Stave(25, 120, 300);
Expand All @@ -67,7 +68,7 @@ const StaveConnectorTests = {
stave.draw();
stave2.draw();
connector.draw();
VF.STAVE_LINE_THICKNESS = 2;
VF.STAVE_LINE_THICKNESS = oldThickness;

ok(true, 'all pass');
},
Expand Down

0 comments on commit 77587f0

Please sign in to comment.