|
| 1 | +using System; |
| 2 | +using System.Collections.Generic; |
| 3 | +using System.Runtime.InteropServices; |
| 4 | +using System.Text; |
| 5 | +using SixLabors.ImageSharp.Drawing.Processing; |
| 6 | +using SixLabors.ImageSharp.PixelFormats; |
| 7 | +using SixLabors.ImageSharp.Processing; |
| 8 | +using Xunit; |
| 9 | + |
| 10 | +namespace SixLabors.ImageSharp.Drawing.Tests.Issues |
| 11 | +{ |
| 12 | + public class Issue_65 |
| 13 | + { |
| 14 | + [Theory] |
| 15 | + [InlineData(-100)] //Crash |
| 16 | + [InlineData(-99)] //Fine |
| 17 | + [InlineData(99)] //Fine |
| 18 | + [InlineData(100)] //Crash |
| 19 | + public void DrawRectactangleOutsideBoundsDrawingArea(int xpos) |
| 20 | + { |
| 21 | + int width = 100; |
| 22 | + int height = 100; |
| 23 | + |
| 24 | + using (var image = new Image<Rgba32>(width, height, Color.Red)) |
| 25 | + { |
| 26 | + var rectangle = new Rectangle(xpos, 0, width, height); |
| 27 | + |
| 28 | + image.Mutate(x => x.Fill(Color.Black, rectangle)); |
| 29 | + } |
| 30 | + } |
| 31 | + |
| 32 | + [Theory] |
| 33 | + [InlineData(-110)] //Crash |
| 34 | + [InlineData(-99)] //Fine |
| 35 | + [InlineData(99)] //Fine |
| 36 | + [InlineData(110)] //Crash |
| 37 | + public void DrawCircleOutsideBoundsDrawingArea(int xpos) |
| 38 | + { |
| 39 | + int width = 100; |
| 40 | + int height = 100; |
| 41 | + |
| 42 | + using (var image = new Image<Rgba32>(width, height, Color.Red)) |
| 43 | + { |
| 44 | + var circle = new EllipsePolygon(xpos, 0, width, height); |
| 45 | + |
| 46 | + image.Mutate(x => x.Fill(Color.Black, circle)); |
| 47 | + } |
| 48 | + } |
| 49 | + } |
| 50 | +} |
0 commit comments