Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CoordinateParser should handle NumState.invalid first #640

Merged
merged 9 commits into from
Jan 14, 2020
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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/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
wieslawsoltes marked this conversation as resolved.
Show resolved Hide resolved
__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