Skip to content

Commit

Permalink
CoordinateParser should handle NumState.invalid first (#640)
Browse files Browse the repository at this point in the history
* CoordinateParser should handle NumState.invalid first
* Added test images
* Update ReleaseNotes.md
* Apply EditorConfig settings
  • Loading branch information
wieslawsoltes authored and mrbean-bremen committed Jan 14, 2020
1 parent f3991b4 commit 2a38deb
Show file tree
Hide file tree
Showing 8 changed files with 37 additions and 5 deletions.
11 changes: 6 additions & 5 deletions Source/Paths/CoordinateParser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,12 @@ public bool TryGetFloat(out float result)
break;
}

if (_newState == NumState.invalid)
{
result = float.MinValue;
return MarkState(false);
}

if (_newState < _currState)
{
result = float.Parse(_coords.Substring(Position, i - Position), NumberStyles.Float, CultureInfo.InvariantCulture);
Expand All @@ -286,11 +292,6 @@ public bool TryGetFloat(out float result)
Position = i;
}

if (_newState == NumState.invalid)
{
result = float.MinValue;
return MarkState(false);
}
_currState = _newState;
++i;
}
Expand Down
2 changes: 2 additions & 0 deletions Tests/Svg.UnitTests/PassingTests.csv
Original file line number Diff line number Diff line change
Expand Up @@ -247,5 +247,7 @@ __pull_request-551-01
__pull_request-564-01
__pull_request-564-02
__pull_request-575-01
__pull_request-640-01
__pull_request-640-02
__Telefunken_FuBK_test_pattern
__title
2 changes: 2 additions & 0 deletions Tests/W3CTestSuite/PassingTests.txt
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,8 @@ __pull_request-551-01.svg
__pull_request-564-01.svg
__pull_request-564-02.svg
__pull_request-575-01.svg
__pull_request-640-01.svg
__pull_request-640-02.svg
__AJ_Digital_Camera.svg
__Telefunken_FuBK_test_pattern.svg
__tiger.svg
Expand Down
Binary file added Tests/W3CTestSuite/png/__pull_request-640-01.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Tests/W3CTestSuite/png/__pull_request-640-02.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 13 additions & 0 deletions Tests/W3CTestSuite/svg/__pull_request-640-01.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 13 additions & 0 deletions Tests/W3CTestSuite/svg/__pull_request-640-02.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions doc/ReleaseNotes.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ The release versions are NuGet releases.
### Fixes
* fixed nested svg tags not rendered properly (see [#622](https://github.com/vvvv/SVG/issues/622))
* added handling of invalid property in parser (see [#632](https://github.com/vvvv/SVG/issues/632))
* fixed CoordinateParser handling of invalid state (see [PR #640](https://github.com/vvvv/SVG/pull/640))

## [Version 3.0.84](https://www.nuget.org/packages/Svg/3.0.84)

Expand Down

0 comments on commit 2a38deb

Please sign in to comment.