Browse Source
Merge branch 'master' into support-slide-for-popups
pull/6629/head
Tako
4 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with
31 additions and
2 deletions
-
src/Avalonia.Visuals/Media/PathMarkupParser.cs
-
tests/Avalonia.Visuals.UnitTests/Media/PathMarkupParserTests.cs
|
|
|
@ -496,12 +496,18 @@ namespace Avalonia.Media |
|
|
|
|
|
|
|
private bool ReadBool(ref ReadOnlySpan<char> span) |
|
|
|
{ |
|
|
|
if (!ReadArgument(ref span, out var boolValue) || boolValue.Length != 1) |
|
|
|
span = SkipWhitespace(span); |
|
|
|
|
|
|
|
if (span.IsEmpty) |
|
|
|
{ |
|
|
|
throw new InvalidDataException("Invalid bool rule."); |
|
|
|
} |
|
|
|
|
|
|
|
switch (boolValue[0]) |
|
|
|
var c = span[0]; |
|
|
|
|
|
|
|
span = span.Slice(1); |
|
|
|
|
|
|
|
switch (c) |
|
|
|
{ |
|
|
|
case '0': |
|
|
|
return false; |
|
|
|
|
|
|
|
@ -297,5 +297,28 @@ namespace Avalonia.Visuals.UnitTests.Media |
|
|
|
Assert.Equal(new Point(20, 20), figure.StartPoint); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
[Fact] |
|
|
|
public void Should_Parse_Flags_Without_Separator() |
|
|
|
{ |
|
|
|
var pathGeometry = new PathGeometry(); |
|
|
|
using (var context = new PathGeometryContext(pathGeometry)) |
|
|
|
using (var parser = new PathMarkupParser(context)) |
|
|
|
{ |
|
|
|
parser.Parse("a.898.898 0 01.27.188"); |
|
|
|
|
|
|
|
var figure = pathGeometry.Figures[0]; |
|
|
|
|
|
|
|
var segments = figure.Segments; |
|
|
|
|
|
|
|
Assert.NotNull(segments); |
|
|
|
|
|
|
|
Assert.Equal(1, segments.Count); |
|
|
|
|
|
|
|
var arcSegment = segments[0]; |
|
|
|
|
|
|
|
Assert.IsType<ArcSegment>(arcSegment); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|