Skip to content

Commit

Permalink
Fix trivial bug so all non-error path tests pass
Browse files Browse the repository at this point in the history
  • Loading branch information
progers committed Nov 1, 2015
1 parent c60690d commit a62925a
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 24 deletions.
2 changes: 1 addition & 1 deletion pathseg.js
Original file line number Diff line number Diff line change
Expand Up @@ -629,7 +629,7 @@
var segment = new PathSegmentData();
var lookahead = this._string[this._currentIndex];
var command = this._parseSVGSegmentTypeHelper(lookahead);
if (command == SVGPathSeg.PathSegUnknown) {
if (command == SVGPathSeg.PATHSEG_UNKNOWN) {
// Possibly an implicit command. Not allowed if this is the first command.
if (this._previousCommand == SVGPathSeg.PATHSEG_UNKNOWN)
return segment;
Expand Down
24 changes: 1 addition & 23 deletions tests/tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -203,9 +203,6 @@ QUnit.test("Path parsing", function(assert) {
checkParsing("M100,200 a3,4,5,106,7", "M 100 200 a 3 4 5 1 0 6 7");
checkParsing("M100,200 a3,4,5,116,7", "M 100 200 a 3 4 5 1 1 6 7");

checkParsing("M100,200 a3,4,5,2,1,6,7", ""); // error case
checkParsing("M100,200 a3,4,5,1,2,6,7", ""); // error case

checkParsing("M100,200 a0,4,5,0,0,10,0 a4,0,5,0,0,0,10 a0,0,5,0,0,-10,0 z", "M 100 200 a 0 4 5 0 0 10 0 a 4 0 5 0 0 0 10 a 0 0 5 0 0 -10 0 z");

checkParsing("M1,2,3,4", "M 1 2 L 3 4");
Expand All @@ -225,46 +222,27 @@ QUnit.test("Path parsing", function(assert) {
checkParsing("M1,2\t", "M 1 2");
checkParsing("M1,2\n", "M 1 2");
checkParsing("M1,2\r", "M 1 2");
checkParsing("M1,2\v", "M 1 2"); // error case
checkParsing("M1,2x", "M 1 2"); // error case
checkParsing("M1,2 L40,0#90", "M 1 2 L 40 0"); // error case

checkParsing("", "");
checkParsing(" ", "");
checkParsing("x", ""); // error case
checkParsing("L1,2", ""); // error case
checkParsing("M.1 .2 L.3 .4 .5 .6", "M 0.1 0.2 L 0.3 0.4 L 0.5 0.6");

checkParsing("M", ""); // error case
checkParsing("M\0", ""); // error case

checkParsing("M1,1Z0", "M 1 1 z"); // error case
checkParsing("M1,1z0", "M 1 1 z"); // error case
checkParsing("M.1 .2 L.3 .4 .5 .6", "M 0.1 0.2 L 0.30000000000000004 0.4 L 0.5 0.6000000000000001");

checkParsing("M1,1h2,3", "M 1 1 h 2 h 3");
checkParsing("M1,1H2,3", "M 1 1 H 2 H 3");
checkParsing("M1,1v2,3", "M 1 1 v 2 v 3");
checkParsing("M1,1V2,3", "M 1 1 V 2 V 3");

checkParsing("M1,1c2,3 4,5 6,7 8", "M 1 1 c 2 3 4 5 6 7"); // error case
checkParsing("M1,1c2,3 4,5 6,7 8,9 10,11 12,13", "M 1 1 c 2 3 4 5 6 7 c 8 9 10 11 12 13");
checkParsing("M1,1C2,3 4,5 6,7 8", "M 1 1 C 2 3 4 5 6 7"); // error case
checkParsing("M1,1C2,3 4,5 6,7 8,9 10,11 12,13", "M 1 1 C 2 3 4 5 6 7 C 8 9 10 11 12 13");
checkParsing("M1,1s2,3 4,5 6", "M 1 1 s 2 3 4 5"); // error case
checkParsing("M1,1s2,3 4,5 6,7 8,9", "M 1 1 s 2 3 4 5 s 6 7 8 9");
checkParsing("M1,1S2,3 4,5 6", "M 1 1 S 2 3 4 5"); // error case
checkParsing("M1,1S2,3 4,5 6,7 8,9", "M 1 1 S 2 3 4 5 S 6 7 8 9");
checkParsing("M1,1q2,3 4,5 6", "M 1 1 q 2 3 4 5"); // error case
checkParsing("M1,1q2,3 4,5 6,7 8,9", "M 1 1 q 2 3 4 5 q 6 7 8 9");
checkParsing("M1,1Q2,3 4,5 6", "M 1 1 Q 2 3 4 5"); // error case
checkParsing("M1,1Q2,3 4,5 6,7 8,9", "M 1 1 Q 2 3 4 5 Q 6 7 8 9");
checkParsing("M1,1t2,3 4", "M 1 1 t 2 3"); // error case
checkParsing("M1,1t2,3 4,5", "M 1 1 t 2 3 t 4 5");
checkParsing("M1,1T2,3 4", "M 1 1 T 2 3"); // error case
checkParsing("M1,1T2,3 4,5", "M 1 1 T 2 3 T 4 5");
checkParsing("M1,1a2,3,4,0,0,5,6 7", "M 1 1 a 2 3 4 0 0 5 6"); // error case
checkParsing("M1,1a2,3,4,0,0,5,6 7,8,9,0,0,10,11", "M 1 1 a 2 3 4 0 0 5 6 a 7 8 9 0 0 10 11");
checkParsing("M1,1A2,3,4,0,0,5,6 7", "M 1 1 A 2 3 4 0 0 5 6"); // error case
checkParsing("M1,1A2,3,4,0,0,5,6 7,8,9,0,0,10,11", "M 1 1 A 2 3 4 0 0 5 6 A 7 8 9 0 0 10 11");
});

Expand Down

0 comments on commit a62925a

Please sign in to comment.