Skip to content

Commit 0422bc8

Browse files
committed
svg path tests
1 parent 43874c3 commit 0422bc8

9 files changed

Lines changed: 26 additions & 7 deletions

src/ImageSharp.Drawing/Shapes/Path.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ public static bool TryParseSvgPath(ReadOnlySpan<char> data, out IPath value)
244244
data = FindPoint(data, out point1, relative, c);
245245
data = FindPoint(data, out point2, relative, c);
246246
builder.QuadraticBezierTo(point1, point2);
247-
lastc = point2;
247+
lastc = point1;
248248
c = point2;
249249
break;
250250
case 'T':

tests/ImageSharp.Drawing.Tests/Shapes/SvgPath.cs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
11
// Copyright (c) Six Labors.
22
// Licensed under the Apache License, Version 2.0.
33

4-
using System;
5-
using System.Collections.Generic;
6-
using System.Linq;
7-
using System.Numerics;
84
using SixLabors.ImageSharp.Drawing.Processing;
95
using SixLabors.ImageSharp.PixelFormats;
106
using Xunit;
@@ -14,11 +10,13 @@ namespace SixLabors.ImageSharp.Drawing.Tests.Shapes
1410
public class SvgPath
1511
{
1612
[Theory]
17-
[WithBlankImage(200, 100, PixelTypes.Rgba32, "M20,30 L40,5 L60,30 L80, 55 L100, 30", "zag")]
18-
[WithBlankImage(200, 100, PixelTypes.Rgba32, "M20,30 Q40,5 60,30 T100,30", "wave")]
13+
[WithBlankImage(110, 70, PixelTypes.Rgba32, "M20,30 L40,5 L60,30 L80, 55 L100, 30", "zag")]
14+
[WithBlankImage(110, 50, PixelTypes.Rgba32, "M20,30 Q40,5 60,30 T100,30", "wave")]
1915
[WithBlankImage(500, 400, PixelTypes.Rgba32, @"M10,350 l 50,-25 a25,25 -30 0,1 50,-25 l 50,-25 a25,50 -30 0,1 50,-25 l 50,-25 a25,75 -30 0,1 50,-25 l 50,-25 a25,100 -30 0,1 50,-25 l 50,-25", "bumpy")]
2016
[WithBlankImage(500, 400, PixelTypes.Rgba32, @"M300,200 h-150 a150,150 0 1,0 150,-150 z", "pie_small")]
2117
[WithBlankImage(500, 400, PixelTypes.Rgba32, @"M275,175 v-150 a150,150 0 0,0 -150,150 z", "pie_big")]
18+
[WithBlankImage(100, 100, PixelTypes.Rgba32, @"M50,50 L50,20 L80,50 z M40,60 L40,90 L10,60 z", "arrows")]
19+
[WithBlankImage(500, 400, PixelTypes.Rgba32, @"M 10 315 L 110 215 A 30 50 0 0 1 162.55 162.45 L 172.55 152.45 A 30 50 -45 0 1 215.1 109.9 L 315 10", "chopped_oval")]
2220
public void RenderSvgPath<TPixel>(TestImageProvider<TPixel> provider, string svgPath, string exampleImageKey)
2321
where TPixel : unmanaged, IPixel<TPixel>
2422
{
Lines changed: 3 additions & 0 deletions
Loading
Lines changed: 3 additions & 0 deletions
Loading
Lines changed: 3 additions & 0 deletions
Loading
Lines changed: 3 additions & 0 deletions
Loading
Lines changed: 3 additions & 0 deletions
Loading
Lines changed: 3 additions & 0 deletions
Loading
Lines changed: 3 additions & 0 deletions
Loading

0 commit comments

Comments
 (0)