Browse Source

fix test names & vars

pull/98/head
Scott Williams 9 years ago
parent
commit
eef8263be7
  1. 71
      tests/ImageSharp.Tests/Drawing/Helpers/BezierPolygon.cs
  2. 71
      tests/ImageSharp.Tests/Drawing/Helpers/LinearPolygon.cs
  3. 32
      tests/ImageSharp.Tests/Drawing/LineComplexPolygonTests.cs
  4. 72
      tests/ImageSharp.Tests/Drawing/Paths/DrawBeziersTests.cs
  5. 72
      tests/ImageSharp.Tests/Drawing/Paths/DrawLinesTests.cs
  6. 48
      tests/ImageSharp.Tests/Drawing/Paths/DrawPath.cs
  7. 72
      tests/ImageSharp.Tests/Drawing/Paths/DrawPolygon.cs
  8. 60
      tests/ImageSharp.Tests/Drawing/Paths/DrawRectangle.cs
  9. 48
      tests/ImageSharp.Tests/Drawing/Paths/DrawShape.cs
  10. 52
      tests/ImageSharp.Tests/Drawing/Paths/FillPath.cs
  11. 45
      tests/ImageSharp.Tests/Drawing/Paths/FillPolygon.cs
  12. 37
      tests/ImageSharp.Tests/Drawing/Paths/FillRectangle.cs
  13. 31
      tests/ImageSharp.Tests/Drawing/Paths/FillShape.cs
  14. 4
      tests/ImageSharp.Tests/Drawing/Paths/ProcessorWatchingImage.cs
  15. 2
      tests/ImageSharp.Tests/Drawing/Paths/ShapePathTests.cs
  16. 4
      tests/ImageSharp.Tests/Drawing/Paths/ShapeRegionTests.cs
  17. 4
      tests/ImageSharp.Tests/Drawing/SolidBezierTests.cs
  18. 24
      tests/ImageSharp.Tests/Drawing/SolidComplexPolygonTests.cs

71
tests/ImageSharp.Tests/Drawing/Helpers/BezierPolygon.cs

@ -1,71 +0,0 @@
// <copyright file="BezierPolygon.cs" company="James Jackson-South">
// Copyright (c) James Jackson-South and contributors.
// Licensed under the Apache License, Version 2.0.
// </copyright>
namespace SixLabors.Shapes
{
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Numerics;
using SixLabors.Shapes;
public class BezierPolygon : IShape
{
private Polygon polygon;
public BezierPolygon(params Vector2[] points)
{
this.polygon = new Polygon(new BezierLineSegment(points));
}
public float Distance(Vector2 point)
{
return this.polygon.Distance(point);
}
public bool Contains(Vector2 point)
{
return this.polygon.Contains(point);
}
public int FindIntersections(Vector2 start, Vector2 end, Vector2[] buffer, int count, int offset)
{
return this.polygon.FindIntersections(start, end, buffer, count, offset);
}
public IEnumerable<Vector2> FindIntersections(Vector2 start, Vector2 end)
{
return this.polygon.FindIntersections(start, end);
}
public IShape Transform(Matrix3x2 matrix)
{
return ((IShape)this.polygon).Transform(matrix);
}
public Rectangle Bounds
{
get
{
return this.polygon.Bounds;
}
}
public ImmutableArray<IPath> Paths
{
get
{
return this.polygon.Paths;
}
}
public int MaxIntersections
{
get
{
return this.polygon.MaxIntersections;
}
}
}
}

71
tests/ImageSharp.Tests/Drawing/Helpers/LinearPolygon.cs

@ -1,71 +0,0 @@
// <copyright file="LinearPolygon.cs" company="James Jackson-South">
// Copyright (c) James Jackson-South and contributors.
// Licensed under the Apache License, Version 2.0.
// </copyright>
namespace SixLabors.Shapes
{
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Numerics;
using SixLabors.Shapes;
public class LinearPolygon : IShape
{
private Polygon polygon;
public LinearPolygon(params Vector2[] points)
{
this.polygon = new Polygon(new LinearLineSegment(points));
}
public float Distance(Vector2 point)
{
return this.polygon.Distance(point);
}
public bool Contains(Vector2 point)
{
return this.polygon.Contains(point);
}
public int FindIntersections(Vector2 start, Vector2 end, Vector2[] buffer, int count, int offset)
{
return this.polygon.FindIntersections(start, end, buffer, count, offset);
}
public IEnumerable<Vector2> FindIntersections(Vector2 start, Vector2 end)
{
return this.polygon.FindIntersections(start, end);
}
public IShape Transform(Matrix3x2 matrix)
{
return ((IShape)this.polygon).Transform(matrix);
}
public Rectangle Bounds
{
get
{
return this.polygon.Bounds;
}
}
public ImmutableArray<IPath> Paths
{
get
{
return this.polygon.Paths;
}
}
public int MaxIntersections
{
get
{
return this.polygon.MaxIntersections;
}
}
}
}

32
tests/ImageSharp.Tests/Drawing/LineComplexPolygonTests.cs

@ -71,15 +71,15 @@ namespace ImageSharp.Tests.Drawing
public void ImageShouldBeOverlayedByPolygonOutlineNoOverlapping()
{
string path = this.CreateOutputDirectory("Drawing", "LineComplexPolygon");
LinearPolygon simplePath = new LinearPolygon(
Polygon simplePath = new Polygon(new LinearLineSegment(
new Vector2(10, 10),
new Vector2(200, 150),
new Vector2(50, 300));
new Vector2(50, 300)));
LinearPolygon hole1 = new LinearPolygon(
Polygon hole1 = new Polygon(new LinearLineSegment(
new Vector2(207, 25),
new Vector2(263, 25),
new Vector2(235, 57));
new Vector2(235, 57)));
using (Image image = new Image(500, 500))
{
@ -122,15 +122,15 @@ namespace ImageSharp.Tests.Drawing
public void ImageShouldBeOverlayedByPolygonOutlineOverlapping()
{
string path = this.CreateOutputDirectory("Drawing", "LineComplexPolygon");
LinearPolygon simplePath = new LinearPolygon(
Polygon simplePath = new Polygon(new LinearLineSegment(
new Vector2(10, 10),
new Vector2(200, 150),
new Vector2(50, 300));
new Vector2(50, 300)));
LinearPolygon hole1 = new LinearPolygon(
Polygon hole1 = new Polygon(new LinearLineSegment(
new Vector2(37, 85),
new Vector2(130, 40),
new Vector2(65, 137));
new Vector2(65, 137)));
using (Image image = new Image(500, 500))
@ -169,15 +169,15 @@ namespace ImageSharp.Tests.Drawing
public void ImageShouldBeOverlayedByPolygonOutlineDashed()
{
string path = this.CreateOutputDirectory("Drawing", "LineComplexPolygon");
LinearPolygon simplePath = new LinearPolygon(
Polygon simplePath = new Polygon(new LinearLineSegment(
new Vector2(10, 10),
new Vector2(200, 150),
new Vector2(50, 300));
new Vector2(50, 300)));
LinearPolygon hole1 = new LinearPolygon(
Polygon hole1 = new Polygon(new LinearLineSegment(
new Vector2(37, 85),
new Vector2(93, 85),
new Vector2(65, 137));
new Vector2(65, 137)));
using (Image image = new Image(500, 500))
{
@ -196,15 +196,15 @@ namespace ImageSharp.Tests.Drawing
public void ImageShouldBeOverlayedPolygonOutlineWithOpacity()
{
string path = this.CreateOutputDirectory("Drawing", "LineComplexPolygon");
LinearPolygon simplePath = new LinearPolygon(
Polygon simplePath = new Polygon(new LinearLineSegment(
new Vector2(10, 10),
new Vector2(200, 150),
new Vector2(50, 300));
new Vector2(50, 300)));
LinearPolygon hole1 = new LinearPolygon(
Polygon hole1 = new Polygon(new LinearLineSegment(
new Vector2(37, 85),
new Vector2(93, 85),
new Vector2(65, 137));
new Vector2(65, 137)));
Color color = new Color(Color.HotPink.R, Color.HotPink.G, Color.HotPink.B, 150);
using (Image image = new Image(500, 500))

72
tests/ImageSharp.Tests/Drawing/Paths/DrawBeziersTests.cs

@ -40,127 +40,127 @@ namespace ImageSharp.Tests.Drawing.Paths
}
[Fact]
public void Brush_Thickness_points()
public void CorrectlySetsBrushThicknessAndPoints()
{
img.DrawBeziers(brush, thickness, points);
Assert.NotEmpty(img.ProcessorApplications);
var processor = Assert.IsType<DrawPathProcessor<Color>>(img.ProcessorApplications[0].processor);
DrawPathProcessor<Color> processor = Assert.IsType<DrawPathProcessor<Color>>(img.ProcessorApplications[0].processor);
Assert.Equal(GraphicsOptions.Default, processor.Options);
var path = Assert.IsType<ShapePath>(processor.Path);
ShapePath path = Assert.IsType<ShapePath>(processor.Path);
Assert.NotEmpty(path.Paths);
var vector = Assert.IsType<SixLabors.Shapes.Path>(path.Paths[0]);
var segment = Assert.IsType<BezierLineSegment>(vector.LineSegments[0]);
SixLabors.Shapes.Path vector = Assert.IsType<SixLabors.Shapes.Path>(path.Paths[0]);
BezierLineSegment segment = Assert.IsType<BezierLineSegment>(vector.LineSegments[0]);
var pen = Assert.IsType<Pen<Color>>(processor.Pen);
Pen<Color> pen = Assert.IsType<Pen<Color>>(processor.Pen);
Assert.Equal(brush, pen.Brush);
Assert.Equal(thickness, pen.Width);
}
[Fact]
public void Brush_Thickness_points_options()
public void CorrectlySetsBrushThicknessPointsAndOptions()
{
img.DrawBeziers(brush, thickness, points, noneDefault);
Assert.NotEmpty(img.ProcessorApplications);
var processor = Assert.IsType<DrawPathProcessor<Color>>(img.ProcessorApplications[0].processor);
DrawPathProcessor<Color> processor = Assert.IsType<DrawPathProcessor<Color>>(img.ProcessorApplications[0].processor);
Assert.Equal(noneDefault, processor.Options);
var path = Assert.IsType<ShapePath>(processor.Path);
ShapePath path = Assert.IsType<ShapePath>(processor.Path);
Assert.NotEmpty(path.Paths);
var vector = Assert.IsType<SixLabors.Shapes.Path>(path.Paths[0]);
var segment = Assert.IsType<BezierLineSegment>(vector.LineSegments[0]);
SixLabors.Shapes.Path vector = Assert.IsType<SixLabors.Shapes.Path>(path.Paths[0]);
BezierLineSegment segment = Assert.IsType<BezierLineSegment>(vector.LineSegments[0]);
var pen = Assert.IsType<Pen<Color>>(processor.Pen);
Pen<Color> pen = Assert.IsType<Pen<Color>>(processor.Pen);
Assert.Equal(brush, pen.Brush);
Assert.Equal(thickness, pen.Width);
}
[Fact]
public void color_Thickness_points()
public void CorrectlySetsColorThicknessAndPoints()
{
img.DrawBeziers(color, thickness, points);
Assert.NotEmpty(img.ProcessorApplications);
var processor = Assert.IsType<DrawPathProcessor<Color>>(img.ProcessorApplications[0].processor);
DrawPathProcessor<Color> processor = Assert.IsType<DrawPathProcessor<Color>>(img.ProcessorApplications[0].processor);
Assert.Equal(GraphicsOptions.Default, processor.Options);
var path = Assert.IsType<ShapePath>(processor.Path);
ShapePath path = Assert.IsType<ShapePath>(processor.Path);
Assert.NotEmpty(path.Paths);
var vector = Assert.IsType<SixLabors.Shapes.Path>(path.Paths[0]);
var segment = Assert.IsType<BezierLineSegment>(vector.LineSegments[0]);
SixLabors.Shapes.Path vector = Assert.IsType<SixLabors.Shapes.Path>(path.Paths[0]);
BezierLineSegment segment = Assert.IsType<BezierLineSegment>(vector.LineSegments[0]);
var pen = Assert.IsType<Pen<Color>>(processor.Pen);
Pen<Color> pen = Assert.IsType<Pen<Color>>(processor.Pen);
Assert.Equal(thickness, pen.Width);
var brush = Assert.IsType<SolidBrush<Color>>(pen.Brush);
SolidBrush<Color> brush = Assert.IsType<SolidBrush<Color>>(pen.Brush);
Assert.Equal(color, brush.Color);
}
[Fact]
public void color_Thickness_points_options()
public void CorrectlySetsColorThicknessPointsAndOptions()
{
img.DrawBeziers(color, thickness, points, noneDefault);
Assert.NotEmpty(img.ProcessorApplications);
var processor = Assert.IsType<DrawPathProcessor<Color>>(img.ProcessorApplications[0].processor);
DrawPathProcessor<Color> processor = Assert.IsType<DrawPathProcessor<Color>>(img.ProcessorApplications[0].processor);
Assert.Equal(noneDefault, processor.Options);
var path = Assert.IsType<ShapePath>(processor.Path);
ShapePath path = Assert.IsType<ShapePath>(processor.Path);
Assert.NotEmpty(path.Paths);
var vector = Assert.IsType<SixLabors.Shapes.Path>(path.Paths[0]);
var segment = Assert.IsType<BezierLineSegment>(vector.LineSegments[0]);
SixLabors.Shapes.Path vector = Assert.IsType<SixLabors.Shapes.Path>(path.Paths[0]);
BezierLineSegment segment = Assert.IsType<BezierLineSegment>(vector.LineSegments[0]);
var pen = Assert.IsType<Pen<Color>>(processor.Pen);
Pen<Color> pen = Assert.IsType<Pen<Color>>(processor.Pen);
Assert.Equal(thickness, pen.Width);
var brush = Assert.IsType<SolidBrush<Color>>(pen.Brush);
SolidBrush<Color> brush = Assert.IsType<SolidBrush<Color>>(pen.Brush);
Assert.Equal(color, brush.Color);
}
[Fact]
public void pen_points()
public void CorrectlySetsPenAndPoints()
{
img.DrawBeziers(pen, points);
Assert.NotEmpty(img.ProcessorApplications);
var processor = Assert.IsType<DrawPathProcessor<Color>>(img.ProcessorApplications[0].processor);
DrawPathProcessor<Color> processor = Assert.IsType<DrawPathProcessor<Color>>(img.ProcessorApplications[0].processor);
Assert.Equal(GraphicsOptions.Default, processor.Options);
var path = Assert.IsType<ShapePath>(processor.Path);
ShapePath path = Assert.IsType<ShapePath>(processor.Path);
Assert.NotEmpty(path.Paths);
var vector = Assert.IsType<SixLabors.Shapes.Path>(path.Paths[0]);
var segment = Assert.IsType<BezierLineSegment>(vector.LineSegments[0]);
SixLabors.Shapes.Path vector = Assert.IsType<SixLabors.Shapes.Path>(path.Paths[0]);
BezierLineSegment segment = Assert.IsType<BezierLineSegment>(vector.LineSegments[0]);
Assert.Equal(pen, processor.Pen);
}
[Fact]
public void pen_points_options()
public void CorrectlySetsPenPointsAndOptions()
{
img.DrawBeziers(pen, points, noneDefault);
Assert.NotEmpty(img.ProcessorApplications);
var processor = Assert.IsType<DrawPathProcessor<Color>>(img.ProcessorApplications[0].processor);
DrawPathProcessor<Color> processor = Assert.IsType<DrawPathProcessor<Color>>(img.ProcessorApplications[0].processor);
Assert.Equal(noneDefault, processor.Options);
var path = Assert.IsType<ShapePath>(processor.Path);
ShapePath path = Assert.IsType<ShapePath>(processor.Path);
Assert.NotEmpty(path.Paths);
var vector = Assert.IsType<SixLabors.Shapes.Path>(path.Paths[0]);
var segment = Assert.IsType<BezierLineSegment>(vector.LineSegments[0]);
SixLabors.Shapes.Path vector = Assert.IsType<SixLabors.Shapes.Path>(path.Paths[0]);
BezierLineSegment segment = Assert.IsType<BezierLineSegment>(vector.LineSegments[0]);
Assert.Equal(pen, processor.Pen);
}

72
tests/ImageSharp.Tests/Drawing/Paths/DrawLinesTests.cs

@ -40,127 +40,127 @@ namespace ImageSharp.Tests.Drawing.Paths
}
[Fact]
public void Brush_Thickness_points()
public void CorrectlySetsBrushThicknessAndPoints()
{
img.DrawLines(brush, thickness, points);
Assert.NotEmpty(img.ProcessorApplications);
var processor = Assert.IsType<DrawPathProcessor<Color>>(img.ProcessorApplications[0].processor);
DrawPathProcessor<Color> processor = Assert.IsType<DrawPathProcessor<Color>>(img.ProcessorApplications[0].processor);
Assert.Equal(GraphicsOptions.Default, processor.Options);
var path = Assert.IsType<ShapePath>(processor.Path);
ShapePath path = Assert.IsType<ShapePath>(processor.Path);
Assert.NotEmpty(path.Paths);
var vector = Assert.IsType<SixLabors.Shapes.Path>(path.Paths[0]);
var segment = Assert.IsType<LinearLineSegment>(vector.LineSegments[0]);
SixLabors.Shapes.Path vector = Assert.IsType<SixLabors.Shapes.Path>(path.Paths[0]);
LinearLineSegment segment = Assert.IsType<LinearLineSegment>(vector.LineSegments[0]);
var pen = Assert.IsType<Pen<Color>>(processor.Pen);
Pen<Color> pen = Assert.IsType<Pen<Color>>(processor.Pen);
Assert.Equal(brush, pen.Brush);
Assert.Equal(thickness, pen.Width);
}
[Fact]
public void Brush_Thickness_points_options()
public void CorrectlySetsBrushThicknessPointsAndOptions()
{
img.DrawLines(brush, thickness, points, noneDefault);
Assert.NotEmpty(img.ProcessorApplications);
var processor = Assert.IsType<DrawPathProcessor<Color>>(img.ProcessorApplications[0].processor);
DrawPathProcessor<Color> processor = Assert.IsType<DrawPathProcessor<Color>>(img.ProcessorApplications[0].processor);
Assert.Equal(noneDefault, processor.Options);
var path = Assert.IsType<ShapePath>(processor.Path);
ShapePath path = Assert.IsType<ShapePath>(processor.Path);
Assert.NotEmpty(path.Paths);
var vector = Assert.IsType<SixLabors.Shapes.Path>(path.Paths[0]);
var segment = Assert.IsType<LinearLineSegment>(vector.LineSegments[0]);
SixLabors.Shapes.Path vector = Assert.IsType<SixLabors.Shapes.Path>(path.Paths[0]);
LinearLineSegment segment = Assert.IsType<LinearLineSegment>(vector.LineSegments[0]);
var pen = Assert.IsType<Pen<Color>>(processor.Pen);
Pen<Color> pen = Assert.IsType<Pen<Color>>(processor.Pen);
Assert.Equal(brush, pen.Brush);
Assert.Equal(thickness, pen.Width);
}
[Fact]
public void color_Thickness_points()
public void CorrectlySetsColorThicknessAndPoints()
{
img.DrawLines(color, thickness, points);
Assert.NotEmpty(img.ProcessorApplications);
var processor = Assert.IsType<DrawPathProcessor<Color>>(img.ProcessorApplications[0].processor);
DrawPathProcessor<Color> processor = Assert.IsType<DrawPathProcessor<Color>>(img.ProcessorApplications[0].processor);
Assert.Equal(GraphicsOptions.Default, processor.Options);
var path = Assert.IsType<ShapePath>(processor.Path);
ShapePath path = Assert.IsType<ShapePath>(processor.Path);
Assert.NotEmpty(path.Paths);
var vector = Assert.IsType<SixLabors.Shapes.Path>(path.Paths[0]);
var segment = Assert.IsType<LinearLineSegment>(vector.LineSegments[0]);
SixLabors.Shapes.Path vector = Assert.IsType<SixLabors.Shapes.Path>(path.Paths[0]);
LinearLineSegment segment = Assert.IsType<LinearLineSegment>(vector.LineSegments[0]);
var pen = Assert.IsType<Pen<Color>>(processor.Pen);
Pen<Color> pen = Assert.IsType<Pen<Color>>(processor.Pen);
Assert.Equal(thickness, pen.Width);
var brush = Assert.IsType<SolidBrush<Color>>(pen.Brush);
SolidBrush<Color> brush = Assert.IsType<SolidBrush<Color>>(pen.Brush);
Assert.Equal(color, brush.Color);
}
[Fact]
public void color_Thickness_points_options()
public void CorrectlySetsColorThicknessPointsAndOptions()
{
img.DrawLines(color, thickness, points, noneDefault);
Assert.NotEmpty(img.ProcessorApplications);
var processor = Assert.IsType<DrawPathProcessor<Color>>(img.ProcessorApplications[0].processor);
DrawPathProcessor<Color> processor = Assert.IsType<DrawPathProcessor<Color>>(img.ProcessorApplications[0].processor);
Assert.Equal(noneDefault, processor.Options);
var path = Assert.IsType<ShapePath>(processor.Path);
ShapePath path = Assert.IsType<ShapePath>(processor.Path);
Assert.NotEmpty(path.Paths);
var vector = Assert.IsType<SixLabors.Shapes.Path>(path.Paths[0]);
var segment = Assert.IsType<LinearLineSegment>(vector.LineSegments[0]);
SixLabors.Shapes.Path vector = Assert.IsType<SixLabors.Shapes.Path>(path.Paths[0]);
LinearLineSegment segment = Assert.IsType<LinearLineSegment>(vector.LineSegments[0]);
var pen = Assert.IsType<Pen<Color>>(processor.Pen);
Pen<Color> pen = Assert.IsType<Pen<Color>>(processor.Pen);
Assert.Equal(thickness, pen.Width);
var brush = Assert.IsType<SolidBrush<Color>>(pen.Brush);
SolidBrush<Color> brush = Assert.IsType<SolidBrush<Color>>(pen.Brush);
Assert.Equal(color, brush.Color);
}
[Fact]
public void pen_points()
public void CorrectlySetsPenAndPoints()
{
img.DrawLines(pen, points);
Assert.NotEmpty(img.ProcessorApplications);
var processor = Assert.IsType<DrawPathProcessor<Color>>(img.ProcessorApplications[0].processor);
DrawPathProcessor<Color> processor = Assert.IsType<DrawPathProcessor<Color>>(img.ProcessorApplications[0].processor);
Assert.Equal(GraphicsOptions.Default, processor.Options);
var path = Assert.IsType<ShapePath>(processor.Path);
ShapePath path = Assert.IsType<ShapePath>(processor.Path);
Assert.NotEmpty(path.Paths);
var vector = Assert.IsType<SixLabors.Shapes.Path>(path.Paths[0]);
var segment = Assert.IsType<LinearLineSegment>(vector.LineSegments[0]);
SixLabors.Shapes.Path vector = Assert.IsType<SixLabors.Shapes.Path>(path.Paths[0]);
LinearLineSegment segment = Assert.IsType<LinearLineSegment>(vector.LineSegments[0]);
Assert.Equal(pen, processor.Pen);
}
[Fact]
public void pen_points_options()
public void CorrectlySetsPenPointsAndOptions()
{
img.DrawLines(pen, points, noneDefault);
Assert.NotEmpty(img.ProcessorApplications);
var processor = Assert.IsType<DrawPathProcessor<Color>>(img.ProcessorApplications[0].processor);
DrawPathProcessor<Color> processor = Assert.IsType<DrawPathProcessor<Color>>(img.ProcessorApplications[0].processor);
Assert.Equal(noneDefault, processor.Options);
var path = Assert.IsType<ShapePath>(processor.Path);
ShapePath path = Assert.IsType<ShapePath>(processor.Path);
Assert.NotEmpty(path.Paths);
var vector = Assert.IsType<SixLabors.Shapes.Path>(path.Paths[0]);
var segment = Assert.IsType<LinearLineSegment>(vector.LineSegments[0]);
SixLabors.Shapes.Path vector = Assert.IsType<SixLabors.Shapes.Path>(path.Paths[0]);
LinearLineSegment segment = Assert.IsType<LinearLineSegment>(vector.LineSegments[0]);
Assert.Equal(pen, processor.Pen);
}

48
tests/ImageSharp.Tests/Drawing/Paths/DrawPath.cs

@ -40,96 +40,96 @@ namespace ImageSharp.Tests.Drawing.Paths
}
[Fact]
public void Brush_Thickness_path()
public void CorrectlySetsBrushThicknessAndPath()
{
img.Draw(brush, thickness, path);
Assert.NotEmpty(img.ProcessorApplications);
var processor = Assert.IsType<DrawPathProcessor<Color>>(img.ProcessorApplications[0].processor);
DrawPathProcessor<Color> processor = Assert.IsType<DrawPathProcessor<Color>>(img.ProcessorApplications[0].processor);
Assert.Equal(GraphicsOptions.Default, processor.Options);
var shapepath = Assert.IsType<ShapePath>(processor.Path);
ShapePath shapepath = Assert.IsType<ShapePath>(processor.Path);
Assert.NotEmpty(shapepath.Paths);
Assert.Equal(path, shapepath.Paths[0]);
var pen = Assert.IsType<Pen<Color>>(processor.Pen);
Pen<Color> pen = Assert.IsType<Pen<Color>>(processor.Pen);
Assert.Equal(brush, pen.Brush);
Assert.Equal(thickness, pen.Width);
}
[Fact]
public void Brush_Thickness_path_options()
public void CorrectlySetsBrushThicknessPathAndOptions()
{
img.Draw(brush, thickness, path, noneDefault);
Assert.NotEmpty(img.ProcessorApplications);
var processor = Assert.IsType<DrawPathProcessor<Color>>(img.ProcessorApplications[0].processor);
DrawPathProcessor<Color> processor = Assert.IsType<DrawPathProcessor<Color>>(img.ProcessorApplications[0].processor);
Assert.Equal(noneDefault, processor.Options);
var shapepath = Assert.IsType<ShapePath>(processor.Path);
ShapePath shapepath = Assert.IsType<ShapePath>(processor.Path);
Assert.NotEmpty(shapepath.Paths);
Assert.Equal(path, shapepath.Paths[0]);
var pen = Assert.IsType<Pen<Color>>(processor.Pen);
Pen<Color> pen = Assert.IsType<Pen<Color>>(processor.Pen);
Assert.Equal(brush, pen.Brush);
Assert.Equal(thickness, pen.Width);
}
[Fact]
public void color_Thickness_path()
public void CorrectlySetsColorThicknessAndPath()
{
img.Draw(color, thickness, path);
Assert.NotEmpty(img.ProcessorApplications);
var processor = Assert.IsType<DrawPathProcessor<Color>>(img.ProcessorApplications[0].processor);
DrawPathProcessor<Color> processor = Assert.IsType<DrawPathProcessor<Color>>(img.ProcessorApplications[0].processor);
Assert.Equal(GraphicsOptions.Default, processor.Options);
var shapepath = Assert.IsType<ShapePath>(processor.Path);
ShapePath shapepath = Assert.IsType<ShapePath>(processor.Path);
Assert.NotEmpty(shapepath.Paths);
Assert.Equal(path, shapepath.Paths[0]);
var pen = Assert.IsType<Pen<Color>>(processor.Pen);
Pen<Color> pen = Assert.IsType<Pen<Color>>(processor.Pen);
Assert.Equal(thickness, pen.Width);
var brush = Assert.IsType<SolidBrush<Color>>(pen.Brush);
SolidBrush<Color> brush = Assert.IsType<SolidBrush<Color>>(pen.Brush);
Assert.Equal(color, brush.Color);
}
[Fact]
public void color_Thickness_path_options()
public void CorrectlySetsColorThicknessPathAndOptions()
{
img.Draw(color, thickness, path, noneDefault);
Assert.NotEmpty(img.ProcessorApplications);
var processor = Assert.IsType<DrawPathProcessor<Color>>(img.ProcessorApplications[0].processor);
DrawPathProcessor<Color> processor = Assert.IsType<DrawPathProcessor<Color>>(img.ProcessorApplications[0].processor);
Assert.Equal(noneDefault, processor.Options);
var shapepath = Assert.IsType<ShapePath>(processor.Path);
ShapePath shapepath = Assert.IsType<ShapePath>(processor.Path);
Assert.NotEmpty(shapepath.Paths);
Assert.Equal(path, shapepath.Paths[0]);
var pen = Assert.IsType<Pen<Color>>(processor.Pen);
Pen<Color> pen = Assert.IsType<Pen<Color>>(processor.Pen);
Assert.Equal(thickness, pen.Width);
var brush = Assert.IsType<SolidBrush<Color>>(pen.Brush);
SolidBrush<Color> brush = Assert.IsType<SolidBrush<Color>>(pen.Brush);
Assert.Equal(color, brush.Color);
}
[Fact]
public void pen_path()
public void CorrectlySetsPenAndPath()
{
img.Draw(pen, path);
Assert.NotEmpty(img.ProcessorApplications);
var processor = Assert.IsType<DrawPathProcessor<Color>>(img.ProcessorApplications[0].processor);
DrawPathProcessor<Color> processor = Assert.IsType<DrawPathProcessor<Color>>(img.ProcessorApplications[0].processor);
Assert.Equal(GraphicsOptions.Default, processor.Options);
var shapepath = Assert.IsType<ShapePath>(processor.Path);
ShapePath shapepath = Assert.IsType<ShapePath>(processor.Path);
Assert.NotEmpty(shapepath.Paths);
Assert.Equal(path, shapepath.Paths[0]);
@ -137,16 +137,16 @@ namespace ImageSharp.Tests.Drawing.Paths
}
[Fact]
public void pen_path_options()
public void CorrectlySetsPenPathAndOptions()
{
img.Draw(pen, path, noneDefault);
Assert.NotEmpty(img.ProcessorApplications);
var processor = Assert.IsType<DrawPathProcessor<Color>>(img.ProcessorApplications[0].processor);
DrawPathProcessor<Color> processor = Assert.IsType<DrawPathProcessor<Color>>(img.ProcessorApplications[0].processor);
Assert.Equal(noneDefault, processor.Options);
var shapepath = Assert.IsType<ShapePath>(processor.Path);
ShapePath shapepath = Assert.IsType<ShapePath>(processor.Path);
Assert.NotEmpty(shapepath.Paths);
Assert.Equal(path, shapepath.Paths[0]);

72
tests/ImageSharp.Tests/Drawing/Paths/DrawPolygon.cs

@ -40,127 +40,127 @@ namespace ImageSharp.Tests.Drawing.Paths
}
[Fact]
public void Brush_Thickness_points()
public void CorrectlySetsBrushThicknessAndPoints()
{
img.DrawPolygon(brush, thickness, points);
Assert.NotEmpty(img.ProcessorApplications);
var processor = Assert.IsType<DrawPathProcessor<Color>>(img.ProcessorApplications[0].processor);
DrawPathProcessor<Color> processor = Assert.IsType<DrawPathProcessor<Color>>(img.ProcessorApplications[0].processor);
Assert.Equal(GraphicsOptions.Default, processor.Options);
var path = Assert.IsType<ShapePath>(processor.Path);
ShapePath path = Assert.IsType<ShapePath>(processor.Path);
Assert.NotEmpty(path.Paths);
var vector = Assert.IsType<SixLabors.Shapes.Polygon>(path.Paths[0].AsShape());
var segment = Assert.IsType<LinearLineSegment>(vector.LineSegments[0]);
Polygon vector = Assert.IsType<SixLabors.Shapes.Polygon>(path.Paths[0].AsShape());
LinearLineSegment segment = Assert.IsType<LinearLineSegment>(vector.LineSegments[0]);
var pen = Assert.IsType<Pen<Color>>(processor.Pen);
Pen<Color> pen = Assert.IsType<Pen<Color>>(processor.Pen);
Assert.Equal(brush, pen.Brush);
Assert.Equal(thickness, pen.Width);
}
[Fact]
public void Brush_Thickness_points_options()
public void CorrectlySetsBrushThicknessPointsAndOptions()
{
img.DrawPolygon(brush, thickness, points, noneDefault);
Assert.NotEmpty(img.ProcessorApplications);
var processor = Assert.IsType<DrawPathProcessor<Color>>(img.ProcessorApplications[0].processor);
DrawPathProcessor<Color> processor = Assert.IsType<DrawPathProcessor<Color>>(img.ProcessorApplications[0].processor);
Assert.Equal(noneDefault, processor.Options);
var path = Assert.IsType<ShapePath>(processor.Path);
ShapePath path = Assert.IsType<ShapePath>(processor.Path);
Assert.NotEmpty(path.Paths);
var vector = Assert.IsType<SixLabors.Shapes.Polygon>(path.Paths[0].AsShape());
var segment = Assert.IsType<LinearLineSegment>(vector.LineSegments[0]);
Polygon vector = Assert.IsType<SixLabors.Shapes.Polygon>(path.Paths[0].AsShape());
LinearLineSegment segment = Assert.IsType<LinearLineSegment>(vector.LineSegments[0]);
var pen = Assert.IsType<Pen<Color>>(processor.Pen);
Pen<Color> pen = Assert.IsType<Pen<Color>>(processor.Pen);
Assert.Equal(brush, pen.Brush);
Assert.Equal(thickness, pen.Width);
}
[Fact]
public void color_Thickness_points()
public void CorrectlySetsColorThicknessAndPoints()
{
img.DrawPolygon(color, thickness, points);
Assert.NotEmpty(img.ProcessorApplications);
var processor = Assert.IsType<DrawPathProcessor<Color>>(img.ProcessorApplications[0].processor);
DrawPathProcessor<Color> processor = Assert.IsType<DrawPathProcessor<Color>>(img.ProcessorApplications[0].processor);
Assert.Equal(GraphicsOptions.Default, processor.Options);
var path = Assert.IsType<ShapePath>(processor.Path);
ShapePath path = Assert.IsType<ShapePath>(processor.Path);
Assert.NotEmpty(path.Paths);
var vector = Assert.IsType<SixLabors.Shapes.Polygon>(path.Paths[0].AsShape());
var segment = Assert.IsType<LinearLineSegment>(vector.LineSegments[0]);
Polygon vector = Assert.IsType<SixLabors.Shapes.Polygon>(path.Paths[0].AsShape());
LinearLineSegment segment = Assert.IsType<LinearLineSegment>(vector.LineSegments[0]);
var pen = Assert.IsType<Pen<Color>>(processor.Pen);
Pen<Color> pen = Assert.IsType<Pen<Color>>(processor.Pen);
Assert.Equal(thickness, pen.Width);
var brush = Assert.IsType<SolidBrush<Color>>(pen.Brush);
SolidBrush<Color> brush = Assert.IsType<SolidBrush<Color>>(pen.Brush);
Assert.Equal(color, brush.Color);
}
[Fact]
public void color_Thickness_points_options()
public void CorrectlySetsColorThicknessPointsAndOptions()
{
img.DrawPolygon(color, thickness, points, noneDefault);
Assert.NotEmpty(img.ProcessorApplications);
var processor = Assert.IsType<DrawPathProcessor<Color>>(img.ProcessorApplications[0].processor);
DrawPathProcessor<Color> processor = Assert.IsType<DrawPathProcessor<Color>>(img.ProcessorApplications[0].processor);
Assert.Equal(noneDefault, processor.Options);
var path = Assert.IsType<ShapePath>(processor.Path);
ShapePath path = Assert.IsType<ShapePath>(processor.Path);
Assert.NotEmpty(path.Paths);
var vector = Assert.IsType<SixLabors.Shapes.Polygon>(path.Paths[0].AsShape());
var segment = Assert.IsType<LinearLineSegment>(vector.LineSegments[0]);
Polygon vector = Assert.IsType<SixLabors.Shapes.Polygon>(path.Paths[0].AsShape());
LinearLineSegment segment = Assert.IsType<LinearLineSegment>(vector.LineSegments[0]);
var pen = Assert.IsType<Pen<Color>>(processor.Pen);
Pen<Color> pen = Assert.IsType<Pen<Color>>(processor.Pen);
Assert.Equal(thickness, pen.Width);
var brush = Assert.IsType<SolidBrush<Color>>(pen.Brush);
SolidBrush<Color> brush = Assert.IsType<SolidBrush<Color>>(pen.Brush);
Assert.Equal(color, brush.Color);
}
[Fact]
public void pen_points()
public void CorrectlySetsPenAndPoints()
{
img.DrawPolygon(pen, points);
Assert.NotEmpty(img.ProcessorApplications);
var processor = Assert.IsType<DrawPathProcessor<Color>>(img.ProcessorApplications[0].processor);
DrawPathProcessor<Color> processor = Assert.IsType<DrawPathProcessor<Color>>(img.ProcessorApplications[0].processor);
Assert.Equal(GraphicsOptions.Default, processor.Options);
var path = Assert.IsType<ShapePath>(processor.Path);
ShapePath path = Assert.IsType<ShapePath>(processor.Path);
Assert.NotEmpty(path.Paths);
var vector = Assert.IsType<SixLabors.Shapes.Polygon>(path.Paths[0].AsShape());
var segment = Assert.IsType<LinearLineSegment>(vector.LineSegments[0]);
Polygon vector = Assert.IsType<SixLabors.Shapes.Polygon>(path.Paths[0].AsShape());
LinearLineSegment segment = Assert.IsType<LinearLineSegment>(vector.LineSegments[0]);
Assert.Equal(pen, processor.Pen);
}
[Fact]
public void pen_points_options()
public void CorrectlySetsPenPointsAndOptions()
{
img.DrawPolygon(pen, points, noneDefault);
Assert.NotEmpty(img.ProcessorApplications);
var processor = Assert.IsType<DrawPathProcessor<Color>>(img.ProcessorApplications[0].processor);
DrawPathProcessor<Color> processor = Assert.IsType<DrawPathProcessor<Color>>(img.ProcessorApplications[0].processor);
Assert.Equal(noneDefault, processor.Options);
var path = Assert.IsType<ShapePath>(processor.Path);
ShapePath path = Assert.IsType<ShapePath>(processor.Path);
Assert.NotEmpty(path.Paths);
var vector = Assert.IsType<SixLabors.Shapes.Polygon>(path.Paths[0].AsShape());
var segment = Assert.IsType<LinearLineSegment>(vector.LineSegments[0]);
Polygon vector = Assert.IsType<SixLabors.Shapes.Polygon>(path.Paths[0].AsShape());
LinearLineSegment segment = Assert.IsType<LinearLineSegment>(vector.LineSegments[0]);
Assert.Equal(pen, processor.Pen);
}

60
tests/ImageSharp.Tests/Drawing/Paths/DrawRectangle.cs

@ -36,122 +36,122 @@ namespace ImageSharp.Tests.Drawing.Paths
}
[Fact]
public void Brush_Thickness_rectangle()
public void CorrectlySetsBrushThicknessAndRectangle()
{
img.Draw(brush, thickness, rectangle);
Assert.NotEmpty(img.ProcessorApplications);
var processor = Assert.IsType<DrawPathProcessor<Color>>(img.ProcessorApplications[0].processor);
DrawPathProcessor<Color> processor = Assert.IsType<DrawPathProcessor<Color>>(img.ProcessorApplications[0].processor);
Assert.Equal(GraphicsOptions.Default, processor.Options);
var shapepath = Assert.IsType<ShapePath>(processor.Path);
ShapePath shapepath = Assert.IsType<ShapePath>(processor.Path);
Assert.NotEmpty(shapepath.Paths);
var rect = Assert.IsType<SixLabors.Shapes.Rectangle>(shapepath.Paths[0].AsShape());
SixLabors.Shapes.Rectangle rect = Assert.IsType<SixLabors.Shapes.Rectangle>(shapepath.Paths[0].AsShape());
Assert.Equal(rect.Location.X, rectangle.X);
Assert.Equal(rect.Location.Y, rectangle.Y);
Assert.Equal(rect.Size.Width, rectangle.Width);
Assert.Equal(rect.Size.Height, rectangle.Height);
var pen = Assert.IsType<Pen<Color>>(processor.Pen);
Pen<Color> pen = Assert.IsType<Pen<Color>>(processor.Pen);
Assert.Equal(brush, pen.Brush);
Assert.Equal(thickness, pen.Width);
}
[Fact]
public void Brush_Thickness_rectangle_options()
public void CorrectlySetsBrushThicknessRectangleAndOptions()
{
img.Draw(brush, thickness, rectangle, noneDefault);
Assert.NotEmpty(img.ProcessorApplications);
var processor = Assert.IsType<DrawPathProcessor<Color>>(img.ProcessorApplications[0].processor);
DrawPathProcessor<Color> processor = Assert.IsType<DrawPathProcessor<Color>>(img.ProcessorApplications[0].processor);
Assert.Equal(noneDefault, processor.Options);
var shapepath = Assert.IsType<ShapePath>(processor.Path);
ShapePath shapepath = Assert.IsType<ShapePath>(processor.Path);
Assert.NotEmpty(shapepath.Paths);
var rect = Assert.IsType<SixLabors.Shapes.Rectangle>(shapepath.Paths[0].AsShape());
SixLabors.Shapes.Rectangle rect = Assert.IsType<SixLabors.Shapes.Rectangle>(shapepath.Paths[0].AsShape());
Assert.Equal(rect.Location.X, rectangle.X);
Assert.Equal(rect.Location.Y, rectangle.Y);
Assert.Equal(rect.Size.Width, rectangle.Width);
Assert.Equal(rect.Size.Height, rectangle.Height);
var pen = Assert.IsType<Pen<Color>>(processor.Pen);
Pen<Color> pen = Assert.IsType<Pen<Color>>(processor.Pen);
Assert.Equal(brush, pen.Brush);
Assert.Equal(thickness, pen.Width);
}
[Fact]
public void color_Thickness_rectangle()
public void CorrectlySetsColorThicknessAndRectangle()
{
img.Draw(color, thickness, rectangle);
Assert.NotEmpty(img.ProcessorApplications);
var processor = Assert.IsType<DrawPathProcessor<Color>>(img.ProcessorApplications[0].processor);
DrawPathProcessor<Color> processor = Assert.IsType<DrawPathProcessor<Color>>(img.ProcessorApplications[0].processor);
Assert.Equal(GraphicsOptions.Default, processor.Options);
var shapepath = Assert.IsType<ShapePath>(processor.Path);
ShapePath shapepath = Assert.IsType<ShapePath>(processor.Path);
Assert.NotEmpty(shapepath.Paths);
var rect = Assert.IsType<SixLabors.Shapes.Rectangle>(shapepath.Paths[0].AsShape());
SixLabors.Shapes.Rectangle rect = Assert.IsType<SixLabors.Shapes.Rectangle>(shapepath.Paths[0].AsShape());
Assert.Equal(rect.Location.X, rectangle.X);
Assert.Equal(rect.Location.Y, rectangle.Y);
Assert.Equal(rect.Size.Width, rectangle.Width);
Assert.Equal(rect.Size.Height, rectangle.Height);
var pen = Assert.IsType<Pen<Color>>(processor.Pen);
Pen<Color> pen = Assert.IsType<Pen<Color>>(processor.Pen);
Assert.Equal(thickness, pen.Width);
var brush = Assert.IsType<SolidBrush<Color>>(pen.Brush);
SolidBrush<Color> brush = Assert.IsType<SolidBrush<Color>>(pen.Brush);
Assert.Equal(color, brush.Color);
}
[Fact]
public void color_Thickness_rectangle_options()
public void CorrectlySetsColorThicknessRectangleAndOptions()
{
img.Draw(color, thickness, rectangle, noneDefault);
Assert.NotEmpty(img.ProcessorApplications);
var processor = Assert.IsType<DrawPathProcessor<Color>>(img.ProcessorApplications[0].processor);
DrawPathProcessor<Color> processor = Assert.IsType<DrawPathProcessor<Color>>(img.ProcessorApplications[0].processor);
Assert.Equal(noneDefault, processor.Options);
var shapepath = Assert.IsType<ShapePath>(processor.Path);
ShapePath shapepath = Assert.IsType<ShapePath>(processor.Path);
Assert.NotEmpty(shapepath.Paths);
var rect = Assert.IsType<SixLabors.Shapes.Rectangle>(shapepath.Paths[0].AsShape());
SixLabors.Shapes.Rectangle rect = Assert.IsType<SixLabors.Shapes.Rectangle>(shapepath.Paths[0].AsShape());
Assert.Equal(rect.Location.X, rectangle.X);
Assert.Equal(rect.Location.Y, rectangle.Y);
Assert.Equal(rect.Size.Width, rectangle.Width);
Assert.Equal(rect.Size.Height, rectangle.Height);
var pen = Assert.IsType<Pen<Color>>(processor.Pen);
Pen<Color> pen = Assert.IsType<Pen<Color>>(processor.Pen);
Assert.Equal(thickness, pen.Width);
var brush = Assert.IsType<SolidBrush<Color>>(pen.Brush);
SolidBrush<Color> brush = Assert.IsType<SolidBrush<Color>>(pen.Brush);
Assert.Equal(color, brush.Color);
}
[Fact]
public void pen_rectangle()
public void CorrectlySetsPenAndRectangle()
{
img.Draw(pen, rectangle);
Assert.NotEmpty(img.ProcessorApplications);
var processor = Assert.IsType<DrawPathProcessor<Color>>(img.ProcessorApplications[0].processor);
DrawPathProcessor<Color> processor = Assert.IsType<DrawPathProcessor<Color>>(img.ProcessorApplications[0].processor);
Assert.Equal(GraphicsOptions.Default, processor.Options);
var shapepath = Assert.IsType<ShapePath>(processor.Path);
ShapePath shapepath = Assert.IsType<ShapePath>(processor.Path);
Assert.NotEmpty(shapepath.Paths);
var rect = Assert.IsType<SixLabors.Shapes.Rectangle>(shapepath.Paths[0].AsShape());
SixLabors.Shapes.Rectangle rect = Assert.IsType<SixLabors.Shapes.Rectangle>(shapepath.Paths[0].AsShape());
Assert.Equal(rect.Location.X, rectangle.X);
Assert.Equal(rect.Location.Y, rectangle.Y);
@ -162,19 +162,19 @@ namespace ImageSharp.Tests.Drawing.Paths
}
[Fact]
public void pen_rectangle_options()
public void CorrectlySetsPenRectangleAndOptions()
{
img.Draw(pen, rectangle, noneDefault);
Assert.NotEmpty(img.ProcessorApplications);
var processor = Assert.IsType<DrawPathProcessor<Color>>(img.ProcessorApplications[0].processor);
DrawPathProcessor<Color> processor = Assert.IsType<DrawPathProcessor<Color>>(img.ProcessorApplications[0].processor);
Assert.Equal(noneDefault, processor.Options);
var shapepath = Assert.IsType<ShapePath>(processor.Path);
ShapePath shapepath = Assert.IsType<ShapePath>(processor.Path);
Assert.NotEmpty(shapepath.Paths);
var rect = Assert.IsType<SixLabors.Shapes.Rectangle>(shapepath.Paths[0].AsShape());
SixLabors.Shapes.Rectangle rect = Assert.IsType<SixLabors.Shapes.Rectangle>(shapepath.Paths[0].AsShape());
Assert.Equal(rect.Location.X, rectangle.X);
Assert.Equal(rect.Location.Y, rectangle.Y);

48
tests/ImageSharp.Tests/Drawing/Paths/DrawShape.cs

@ -40,96 +40,96 @@ namespace ImageSharp.Tests.Drawing.Paths
}
[Fact]
public void Brush_Thickness_shape()
public void CorrectlySetsBrushThicknessAndShape()
{
img.Draw(brush, thickness, shape);
Assert.NotEmpty(img.ProcessorApplications);
var processor = Assert.IsType<DrawPathProcessor<Color>>(img.ProcessorApplications[0].processor);
DrawPathProcessor<Color> processor = Assert.IsType<DrawPathProcessor<Color>>(img.ProcessorApplications[0].processor);
Assert.Equal(GraphicsOptions.Default, processor.Options);
var shapepath = Assert.IsType<ShapePath>(processor.Path);
ShapePath shapepath = Assert.IsType<ShapePath>(processor.Path);
Assert.NotEmpty(shapepath.Paths);
Assert.Equal(shape, shapepath.Paths[0].AsShape());
var pen = Assert.IsType<Pen<Color>>(processor.Pen);
Pen<Color> pen = Assert.IsType<Pen<Color>>(processor.Pen);
Assert.Equal(brush, pen.Brush);
Assert.Equal(thickness, pen.Width);
}
[Fact]
public void Brush_Thickness_shape_options()
public void CorrectlySetsBrushThicknessShapeAndOptions()
{
img.Draw(brush, thickness, shape, noneDefault);
Assert.NotEmpty(img.ProcessorApplications);
var processor = Assert.IsType<DrawPathProcessor<Color>>(img.ProcessorApplications[0].processor);
DrawPathProcessor<Color> processor = Assert.IsType<DrawPathProcessor<Color>>(img.ProcessorApplications[0].processor);
Assert.Equal(noneDefault, processor.Options);
var shapepath = Assert.IsType<ShapePath>(processor.Path);
ShapePath shapepath = Assert.IsType<ShapePath>(processor.Path);
Assert.NotEmpty(shapepath.Paths);
Assert.Equal(shape, shapepath.Paths[0].AsShape());
var pen = Assert.IsType<Pen<Color>>(processor.Pen);
Pen<Color> pen = Assert.IsType<Pen<Color>>(processor.Pen);
Assert.Equal(brush, pen.Brush);
Assert.Equal(thickness, pen.Width);
}
[Fact]
public void color_Thickness_shape()
public void CorrectlySetsColorThicknessAndShape()
{
img.Draw(color, thickness, shape);
Assert.NotEmpty(img.ProcessorApplications);
var processor = Assert.IsType<DrawPathProcessor<Color>>(img.ProcessorApplications[0].processor);
DrawPathProcessor<Color> processor = Assert.IsType<DrawPathProcessor<Color>>(img.ProcessorApplications[0].processor);
Assert.Equal(GraphicsOptions.Default, processor.Options);
var shapepath = Assert.IsType<ShapePath>(processor.Path);
ShapePath shapepath = Assert.IsType<ShapePath>(processor.Path);
Assert.NotEmpty(shapepath.Paths);
Assert.Equal(shape, shapepath.Paths[0].AsShape());
var pen = Assert.IsType<Pen<Color>>(processor.Pen);
Pen<Color> pen = Assert.IsType<Pen<Color>>(processor.Pen);
Assert.Equal(thickness, pen.Width);
var brush = Assert.IsType<SolidBrush<Color>>(pen.Brush);
SolidBrush<Color> brush = Assert.IsType<SolidBrush<Color>>(pen.Brush);
Assert.Equal(color, brush.Color);
}
[Fact]
public void color_Thickness_shape_options()
public void CorrectlySetsColorThicknessShapeAndOptions()
{
img.Draw(color, thickness, shape, noneDefault);
Assert.NotEmpty(img.ProcessorApplications);
var processor = Assert.IsType<DrawPathProcessor<Color>>(img.ProcessorApplications[0].processor);
DrawPathProcessor<Color> processor = Assert.IsType<DrawPathProcessor<Color>>(img.ProcessorApplications[0].processor);
Assert.Equal(noneDefault, processor.Options);
var shapepath = Assert.IsType<ShapePath>(processor.Path);
ShapePath shapepath = Assert.IsType<ShapePath>(processor.Path);
Assert.NotEmpty(shapepath.Paths);
Assert.Equal(shape, shapepath.Paths[0].AsShape());
var pen = Assert.IsType<Pen<Color>>(processor.Pen);
Pen<Color> pen = Assert.IsType<Pen<Color>>(processor.Pen);
Assert.Equal(thickness, pen.Width);
var brush = Assert.IsType<SolidBrush<Color>>(pen.Brush);
SolidBrush<Color> brush = Assert.IsType<SolidBrush<Color>>(pen.Brush);
Assert.Equal(color, brush.Color);
}
[Fact]
public void pen_shape()
public void CorrectlySetsPenAndShape()
{
img.Draw(pen, shape);
Assert.NotEmpty(img.ProcessorApplications);
var processor = Assert.IsType<DrawPathProcessor<Color>>(img.ProcessorApplications[0].processor);
DrawPathProcessor<Color> processor = Assert.IsType<DrawPathProcessor<Color>>(img.ProcessorApplications[0].processor);
Assert.Equal(GraphicsOptions.Default, processor.Options);
var shapepath = Assert.IsType<ShapePath>(processor.Path);
ShapePath shapepath = Assert.IsType<ShapePath>(processor.Path);
Assert.NotEmpty(shapepath.Paths);
Assert.Equal(shape, shapepath.Paths[0].AsShape());
@ -137,16 +137,16 @@ namespace ImageSharp.Tests.Drawing.Paths
}
[Fact]
public void pen_path_options()
public void CorrectlySetsPenShapeAndOptions()
{
img.Draw(pen, shape, noneDefault);
Assert.NotEmpty(img.ProcessorApplications);
var processor = Assert.IsType<DrawPathProcessor<Color>>(img.ProcessorApplications[0].processor);
DrawPathProcessor<Color> processor = Assert.IsType<DrawPathProcessor<Color>>(img.ProcessorApplications[0].processor);
Assert.Equal(noneDefault, processor.Options);
var shapepath = Assert.IsType<ShapePath>(processor.Path);
ShapePath shapepath = Assert.IsType<ShapePath>(processor.Path);
Assert.NotEmpty(shapepath.Paths);
Assert.Equal(shape, shapepath.Paths[0].AsShape());

52
tests/ImageSharp.Tests/Drawing/Paths/FillPath.cs

@ -29,7 +29,7 @@ namespace ImageSharp.Tests.Drawing.Paths
public FillPath()
{
this.img = new Paths.ProcessorWatchingImage(10, 10);
this.img = new ProcessorWatchingImage(10, 10);
}
public void Dispose()
@ -38,75 +38,75 @@ namespace ImageSharp.Tests.Drawing.Paths
}
[Fact]
public void Brush_path()
public void CorrectlySetsBrushAndPath()
{
img.Fill(brush, path);
Assert.NotEmpty(img.ProcessorApplications);
var processor = Assert.IsType<FillRegionProcessor<Color>>(img.ProcessorApplications[0].processor);
FillRegionProcessor<Color> processor = Assert.IsType<FillRegionProcessor<Color>>(img.ProcessorApplications[0].processor);
Assert.Equal(GraphicsOptions.Default, processor.Options);
var region = Assert.IsType<ShapeRegion>(processor.Region);
var polygon = Assert.IsType<Polygon>(region.Shape);
var segments = Assert.IsType<LinearLineSegment>(polygon.LineSegments[0]);
ShapeRegion region = Assert.IsType<ShapeRegion>(processor.Region);
// path is converted to a polygon before filling
Polygon polygon = Assert.IsType<Polygon>(region.Shape);
LinearLineSegment segments = Assert.IsType<LinearLineSegment>(polygon.LineSegments[0]);
Assert.Equal(brush, processor.Brush);
}
[Fact]
public void Brush_path_options()
public void CorrectlySetsBrushPathOptions()
{
img.Fill(brush, path, noneDefault);
Assert.NotEmpty(img.ProcessorApplications);
var processor = Assert.IsType<FillRegionProcessor<Color>>(img.ProcessorApplications[0].processor);
FillRegionProcessor<Color> processor = Assert.IsType<FillRegionProcessor<Color>>(img.ProcessorApplications[0].processor);
Assert.Equal(noneDefault, processor.Options);
var region = Assert.IsType<ShapeRegion>(processor.Region);
var polygon = Assert.IsType<Polygon>(region.Shape);
var segments = Assert.IsType<LinearLineSegment>(polygon.LineSegments[0]);
ShapeRegion region = Assert.IsType<ShapeRegion>(processor.Region);
Polygon polygon = Assert.IsType<Polygon>(region.Shape);
LinearLineSegment segments = Assert.IsType<LinearLineSegment>(polygon.LineSegments[0]);
Assert.Equal(brush, processor.Brush);
}
[Fact]
public void color_path()
public void CorrectlySetsColorAndPath()
{
img.Fill(color, path);
Assert.NotEmpty(img.ProcessorApplications);
var processor = Assert.IsType<FillRegionProcessor<Color>>(img.ProcessorApplications[0].processor);
FillRegionProcessor<Color> processor = Assert.IsType<FillRegionProcessor<Color>>(img.ProcessorApplications[0].processor);
Assert.Equal(GraphicsOptions.Default, processor.Options);
var region = Assert.IsType<ShapeRegion>(processor.Region);
var polygon = Assert.IsType<Polygon>(region.Shape);
var segments = Assert.IsType<LinearLineSegment>(polygon.LineSegments[0]);
ShapeRegion region = Assert.IsType<ShapeRegion>(processor.Region);
Polygon polygon = Assert.IsType<Polygon>(region.Shape);
LinearLineSegment segments = Assert.IsType<LinearLineSegment>(polygon.LineSegments[0]);
var brush = Assert.IsType<SolidBrush<Color>>(processor.Brush);
SolidBrush<Color> brush = Assert.IsType<SolidBrush<Color>>(processor.Brush);
Assert.Equal(color, brush.Color);
}
[Fact]
public void color_path_options()
public void CorrectlySetsColorPathAndOptions()
{
img.Fill(color, path, noneDefault);
Assert.NotEmpty(img.ProcessorApplications);
var processor = Assert.IsType<FillRegionProcessor<Color>>(img.ProcessorApplications[0].processor);
FillRegionProcessor<Color> processor = Assert.IsType<FillRegionProcessor<Color>>(img.ProcessorApplications[0].processor);
Assert.Equal(noneDefault, processor.Options);
var region = Assert.IsType<ShapeRegion>(processor.Region);
var polygon = Assert.IsType<Polygon>(region.Shape);
var segments = Assert.IsType<LinearLineSegment>(polygon.LineSegments[0]);
ShapeRegion region = Assert.IsType<ShapeRegion>(processor.Region);
Polygon polygon = Assert.IsType<Polygon>(region.Shape);
LinearLineSegment segments = Assert.IsType<LinearLineSegment>(polygon.LineSegments[0]);
var brush = Assert.IsType<SolidBrush<Color>>(processor.Brush);
SolidBrush<Color> brush = Assert.IsType<SolidBrush<Color>>(processor.Brush);
Assert.Equal(color, brush.Color);
}
}
}

45
tests/ImageSharp.Tests/Drawing/Paths/FillPolygon.cs

@ -38,73 +38,72 @@ namespace ImageSharp.Tests.Drawing.Paths
}
[Fact]
public void Brush_path()
public void CorrectlySetsBrushAndPath()
{
img.FillPolygon(brush, path);
Assert.NotEmpty(img.ProcessorApplications);
var processor = Assert.IsType<FillRegionProcessor<Color>>(img.ProcessorApplications[0].processor);
FillRegionProcessor<Color> processor = Assert.IsType<FillRegionProcessor<Color>>(img.ProcessorApplications[0].processor);
Assert.Equal(GraphicsOptions.Default, processor.Options);
var region = Assert.IsType<ShapeRegion>(processor.Region);
var polygon = Assert.IsType<Polygon>(region.Shape);
var segemnt = Assert.IsType<LinearLineSegment>(polygon.LineSegments[0]);
ShapeRegion region = Assert.IsType<ShapeRegion>(processor.Region);
Polygon polygon = Assert.IsType<Polygon>(region.Shape);
LinearLineSegment segemnt = Assert.IsType<LinearLineSegment>(polygon.LineSegments[0]);
Assert.Equal(brush, processor.Brush);
}
[Fact]
public void Brush_path_options()
public void CorrectlySetsBrushPathAndOptions()
{
img.FillPolygon(brush, path, noneDefault);
Assert.NotEmpty(img.ProcessorApplications);
var processor = Assert.IsType<FillRegionProcessor<Color>>(img.ProcessorApplications[0].processor);
FillRegionProcessor<Color> processor = Assert.IsType<FillRegionProcessor<Color>>(img.ProcessorApplications[0].processor);
Assert.Equal(noneDefault, processor.Options);
var region = Assert.IsType<ShapeRegion>(processor.Region);
var polygon = Assert.IsType<Polygon>(region.Shape);
var segemnt = Assert.IsType<LinearLineSegment>(polygon.LineSegments[0]);
ShapeRegion region = Assert.IsType<ShapeRegion>(processor.Region);
Polygon polygon = Assert.IsType<Polygon>(region.Shape);
LinearLineSegment segemnt = Assert.IsType<LinearLineSegment>(polygon.LineSegments[0]);
Assert.Equal(brush, processor.Brush);
}
[Fact]
public void color_path()
public void CorrectlySetsColorAndPath()
{
img.FillPolygon(color, path);
Assert.NotEmpty(img.ProcessorApplications);
var processor = Assert.IsType<FillRegionProcessor<Color>>(img.ProcessorApplications[0].processor);
FillRegionProcessor<Color> processor = Assert.IsType<FillRegionProcessor<Color>>(img.ProcessorApplications[0].processor);
Assert.Equal(GraphicsOptions.Default, processor.Options);
var region = Assert.IsType<ShapeRegion>(processor.Region);
var polygon = Assert.IsType<Polygon>(region.Shape);
var segemnt = Assert.IsType<LinearLineSegment>(polygon.LineSegments[0]);
ShapeRegion region = Assert.IsType<ShapeRegion>(processor.Region);
Polygon polygon = Assert.IsType<Polygon>(region.Shape);
LinearLineSegment segemnt = Assert.IsType<LinearLineSegment>(polygon.LineSegments[0]);
var brush = Assert.IsType<SolidBrush<Color>>(processor.Brush);
SolidBrush<Color> brush = Assert.IsType<SolidBrush<Color>>(processor.Brush);
Assert.Equal(color, brush.Color);
}
[Fact]
public void color_path_options()
public void CorrectlySetsColorPathAndOptions()
{
img.FillPolygon(color, path, noneDefault);
Assert.NotEmpty(img.ProcessorApplications);
var processor = Assert.IsType<FillRegionProcessor<Color>>(img.ProcessorApplications[0].processor);
FillRegionProcessor<Color> processor = Assert.IsType<FillRegionProcessor<Color>>(img.ProcessorApplications[0].processor);
Assert.Equal(noneDefault, processor.Options);
var region = Assert.IsType<ShapeRegion>(processor.Region);
var polygon = Assert.IsType<Polygon>(region.Shape);
var segemnt = Assert.IsType<LinearLineSegment>(polygon.LineSegments[0]);
ShapeRegion region = Assert.IsType<ShapeRegion>(processor.Region);
Polygon polygon = Assert.IsType<Polygon>(region.Shape);
LinearLineSegment segemnt = Assert.IsType<LinearLineSegment>(polygon.LineSegments[0]);
var brush = Assert.IsType<SolidBrush<Color>>(processor.Brush);
SolidBrush<Color> brush = Assert.IsType<SolidBrush<Color>>(processor.Brush);
Assert.Equal(color, brush.Color);
}
}

37
tests/ImageSharp.Tests/Drawing/Paths/FillRectangle.cs

@ -34,17 +34,17 @@ namespace ImageSharp.Tests.Drawing.Paths
}
[Fact]
public void Brush_path()
public void CorrectlySetsBrushAndRectangle()
{
img.Fill(brush, rectangle);
Assert.NotEmpty(img.ProcessorApplications);
var processor = Assert.IsType<FillRegionProcessor<Color>>(img.ProcessorApplications[0].processor);
FillRegionProcessor<Color> processor = Assert.IsType<FillRegionProcessor<Color>>(img.ProcessorApplications[0].processor);
Assert.Equal(GraphicsOptions.Default, processor.Options);
var region = Assert.IsType<ShapeRegion>(processor.Region);
var rect = Assert.IsType<SixLabors.Shapes.Rectangle>(region.Shape);
ShapeRegion region = Assert.IsType<ShapeRegion>(processor.Region);
SixLabors.Shapes.Rectangle rect = Assert.IsType<SixLabors.Shapes.Rectangle>(region.Shape);
Assert.Equal(rect.Location.X, rectangle.X);
Assert.Equal(rect.Location.Y, rectangle.Y);
Assert.Equal(rect.Size.Width, rectangle.Width);
@ -54,17 +54,17 @@ namespace ImageSharp.Tests.Drawing.Paths
}
[Fact]
public void Brush_path_options()
public void CorrectlySetsBrushRectangleAndOptions()
{
img.Fill(brush, rectangle, noneDefault);
Assert.NotEmpty(img.ProcessorApplications);
var processor = Assert.IsType<FillRegionProcessor<Color>>(img.ProcessorApplications[0].processor);
FillRegionProcessor<Color> processor = Assert.IsType<FillRegionProcessor<Color>>(img.ProcessorApplications[0].processor);
Assert.Equal(noneDefault, processor.Options);
var region = Assert.IsType<ShapeRegion>(processor.Region);
var rect = Assert.IsType<SixLabors.Shapes.Rectangle>(region.Shape);
ShapeRegion region = Assert.IsType<ShapeRegion>(processor.Region);
SixLabors.Shapes.Rectangle rect = Assert.IsType<SixLabors.Shapes.Rectangle>(region.Shape);
Assert.Equal(rect.Location.X, rectangle.X);
Assert.Equal(rect.Location.Y, rectangle.Y);
Assert.Equal(rect.Size.Width, rectangle.Width);
@ -74,45 +74,44 @@ namespace ImageSharp.Tests.Drawing.Paths
}
[Fact]
public void color_path()
public void CorrectlySetsColorAndRectangle()
{
img.Fill(color, rectangle);
Assert.NotEmpty(img.ProcessorApplications);
var processor = Assert.IsType<FillRegionProcessor<Color>>(img.ProcessorApplications[0].processor);
FillRegionProcessor<Color> processor = Assert.IsType<FillRegionProcessor<Color>>(img.ProcessorApplications[0].processor);
Assert.Equal(GraphicsOptions.Default, processor.Options);
var region = Assert.IsType<ShapeRegion>(processor.Region);
var rect = Assert.IsType<SixLabors.Shapes.Rectangle>(region.Shape);
ShapeRegion region = Assert.IsType<ShapeRegion>(processor.Region);
SixLabors.Shapes.Rectangle rect = Assert.IsType<SixLabors.Shapes.Rectangle>(region.Shape);
Assert.Equal(rect.Location.X, rectangle.X);
Assert.Equal(rect.Location.Y, rectangle.Y);
Assert.Equal(rect.Size.Width, rectangle.Width);
Assert.Equal(rect.Size.Height, rectangle.Height);
var brush = Assert.IsType<SolidBrush<Color>>(processor.Brush);
SolidBrush<Color> brush = Assert.IsType<SolidBrush<Color>>(processor.Brush);
Assert.Equal(color, brush.Color);
}
[Fact]
public void color_path_options()
public void CorrectlySetsColorRectangleAndOptions()
{
img.Fill(color, rectangle, noneDefault);
Assert.NotEmpty(img.ProcessorApplications);
var processor = Assert.IsType<FillRegionProcessor<Color>>(img.ProcessorApplications[0].processor);
FillRegionProcessor<Color> processor = Assert.IsType<FillRegionProcessor<Color>>(img.ProcessorApplications[0].processor);
Assert.Equal(noneDefault, processor.Options);
var region = Assert.IsType<ShapeRegion>(processor.Region);
var rect = Assert.IsType<SixLabors.Shapes.Rectangle>(region.Shape);
ShapeRegion region = Assert.IsType<ShapeRegion>(processor.Region);
SixLabors.Shapes.Rectangle rect = Assert.IsType<SixLabors.Shapes.Rectangle>(region.Shape);
Assert.Equal(rect.Location.X, rectangle.X);
Assert.Equal(rect.Location.Y, rectangle.Y);
Assert.Equal(rect.Size.Width, rectangle.Width);
Assert.Equal(rect.Size.Height, rectangle.Height);
var brush = Assert.IsType<SolidBrush<Color>>(processor.Brush);
SolidBrush<Color> brush = Assert.IsType<SolidBrush<Color>>(processor.Brush);
Assert.Equal(color, brush.Color);
}
}

31
tests/ImageSharp.Tests/Drawing/Paths/FillShape.cs

@ -19,7 +19,7 @@ namespace ImageSharp.Tests.Drawing.Paths
GraphicsOptions noneDefault = new GraphicsOptions();
Color color = Color.HotPink;
SolidBrush brush = Brushes.Solid(Color.HotPink);
IShape shape = new SixLabors.Shapes.Polygon(new LinearLineSegment(new Vector2[] {
IShape shape = new Polygon(new LinearLineSegment(new Vector2[] {
new Vector2(10,10),
new Vector2(20,10),
new Vector2(20,10),
@ -38,69 +38,68 @@ namespace ImageSharp.Tests.Drawing.Paths
}
[Fact]
public void Brush_shape()
public void CorrectlySetsBrushAndShape()
{
img.Fill(brush, shape);
Assert.NotEmpty(img.ProcessorApplications);
var processor = Assert.IsType<FillRegionProcessor<Color>>(img.ProcessorApplications[0].processor);
FillRegionProcessor<Color> processor = Assert.IsType<FillRegionProcessor<Color>>(img.ProcessorApplications[0].processor);
Assert.Equal(GraphicsOptions.Default, processor.Options);
var region = Assert.IsType<ShapeRegion>(processor.Region);
ShapeRegion region = Assert.IsType<ShapeRegion>(processor.Region);
Assert.Equal(shape, region.Shape);
Assert.Equal(brush, processor.Brush);
}
[Fact]
public void Brush_shape_options()
public void CorrectlySetsBrushShapeAndOptions()
{
img.Fill(brush, shape, noneDefault);
Assert.NotEmpty(img.ProcessorApplications);
var processor = Assert.IsType<FillRegionProcessor<Color>>(img.ProcessorApplications[0].processor);
FillRegionProcessor<Color> processor = Assert.IsType<FillRegionProcessor<Color>>(img.ProcessorApplications[0].processor);
Assert.Equal(noneDefault, processor.Options);
var region = Assert.IsType<ShapeRegion>(processor.Region);
ShapeRegion region = Assert.IsType<ShapeRegion>(processor.Region);
Assert.Equal(shape, region.Shape);
Assert.Equal(brush, processor.Brush);
}
[Fact]
public void color_shape()
public void CorrectlySetsColorAndShape()
{
img.Fill(color, shape);
Assert.NotEmpty(img.ProcessorApplications);
var processor = Assert.IsType<FillRegionProcessor<Color>>(img.ProcessorApplications[0].processor);
FillRegionProcessor<Color> processor = Assert.IsType<FillRegionProcessor<Color>>(img.ProcessorApplications[0].processor);
Assert.Equal(GraphicsOptions.Default, processor.Options);
var region = Assert.IsType<ShapeRegion>(processor.Region);
ShapeRegion region = Assert.IsType<ShapeRegion>(processor.Region);
Assert.Equal(shape, region.Shape);
var brush = Assert.IsType<SolidBrush<Color>>(processor.Brush);
SolidBrush<Color> brush = Assert.IsType<SolidBrush<Color>>(processor.Brush);
Assert.Equal(color, brush.Color);
}
[Fact]
public void color_shape_options()
public void CorrectlySetsColorShapeAndOptions()
{
img.Fill(color, shape, noneDefault);
Assert.NotEmpty(img.ProcessorApplications);
var processor = Assert.IsType<FillRegionProcessor<Color>>(img.ProcessorApplications[0].processor);
FillRegionProcessor<Color> processor = Assert.IsType<FillRegionProcessor<Color>>(img.ProcessorApplications[0].processor);
Assert.Equal(noneDefault, processor.Options);
var region = Assert.IsType<ShapeRegion>(processor.Region);
ShapeRegion region = Assert.IsType<ShapeRegion>(processor.Region);
Assert.Equal(shape, region.Shape);
var brush = Assert.IsType<SolidBrush<Color>>(processor.Brush);
SolidBrush<Color> brush = Assert.IsType<SolidBrush<Color>>(processor.Brush);
Assert.Equal(color, brush.Color);
}

4
tests/ImageSharp.Tests/Drawing/Paths/ProcessorWatchingImage.cs

@ -27,6 +27,10 @@ namespace ImageSharp.Tests.Drawing.Paths
processor = processor,
rectangle = rectangle
});
// doesn't really apply the processor to the fake images as this is supposed
// to be just used to test which processor was finally applied and to interogate
// its settings
}
public struct ProcessorDetails

2
tests/ImageSharp.Tests/Drawing/Paths/ShapePathTests.cs

@ -39,7 +39,7 @@ namespace ImageSharp.Tests.Drawing.Paths
}
[Fact]
public void ShapePathWithPath_CallsAsShape()
public void ShapePathWithPathCallsAsShape()
{
new ShapePath(pathMock1.Object);

4
tests/ImageSharp.Tests/Drawing/Paths/ShapeRegionTests.cs

@ -35,7 +35,7 @@ namespace ImageSharp.Tests.Drawing.Paths
}
[Fact]
public void ShapeRegionWithPath_CallsAsShape()
public void ShapeRegionWithPathCallsAsShape()
{
new ShapeRegion(pathMock.Object);
@ -43,7 +43,7 @@ namespace ImageSharp.Tests.Drawing.Paths
}
[Fact]
public void ShapeRegionWithPath_RetainsShape()
public void ShapeRegionWithPathRetainsShape()
{
ShapeRegion region = new ShapeRegion(pathMock.Object);

4
tests/ImageSharp.Tests/Drawing/SolidBezierTests.cs

@ -30,7 +30,7 @@ namespace ImageSharp.Tests.Drawing
{
image
.BackgroundColor(Color.Blue)
.Fill(Color.HotPink,new BezierPolygon(simplePath))
.Fill(Color.HotPink, new Polygon(new BezierLineSegment(simplePath)))
.Save(output);
}
@ -71,7 +71,7 @@ namespace ImageSharp.Tests.Drawing
{
image
.BackgroundColor(Color.Blue)
.Fill(color, new BezierPolygon(simplePath))
.Fill(color, new Polygon(new BezierLineSegment(simplePath)))
.Save(output);
}

24
tests/ImageSharp.Tests/Drawing/SolidComplexPolygonTests.cs

@ -19,15 +19,15 @@ namespace ImageSharp.Tests.Drawing
public void ImageShouldBeOverlayedByPolygonOutline()
{
string path = this.CreateOutputDirectory("Drawing", "ComplexPolygon");
LinearPolygon simplePath = new LinearPolygon(
Polygon simplePath = new Polygon(new LinearLineSegment(
new Vector2(10, 10),
new Vector2(200, 150),
new Vector2(50, 300));
new Vector2(50, 300)));
LinearPolygon hole1 = new LinearPolygon(
Polygon hole1 = new Polygon(new LinearLineSegment(
new Vector2(37, 85),
new Vector2(93, 85),
new Vector2(65, 137));
new Vector2(65, 137)));
using (Image image = new Image(500, 500))
{
@ -62,15 +62,15 @@ namespace ImageSharp.Tests.Drawing
public void ImageShouldBeOverlayedPolygonOutlineWithOverlap()
{
string path = this.CreateOutputDirectory("Drawing", "ComplexPolygon");
LinearPolygon simplePath = new LinearPolygon(
Polygon simplePath = new Polygon(new LinearLineSegment(
new Vector2(10, 10),
new Vector2(200, 150),
new Vector2(50, 300));
new Vector2(50, 300)));
LinearPolygon hole1 = new LinearPolygon(
Polygon hole1 = new Polygon(new LinearLineSegment(
new Vector2(37, 85),
new Vector2(130, 40),
new Vector2(65, 137));
new Vector2(65, 137)));
using (Image image = new Image(500, 500))
{
@ -104,15 +104,15 @@ namespace ImageSharp.Tests.Drawing
public void ImageShouldBeOverlayedPolygonOutlineWithOpacity()
{
string path = this.CreateOutputDirectory("Drawing", "ComplexPolygon");
LinearPolygon simplePath = new LinearPolygon(
Polygon simplePath = new Polygon(new LinearLineSegment(
new Vector2(10, 10),
new Vector2(200, 150),
new Vector2(50, 300));
new Vector2(50, 300)));
LinearPolygon hole1 = new LinearPolygon(
Polygon hole1 = new Polygon(new LinearLineSegment(
new Vector2(37, 85),
new Vector2(93, 85),
new Vector2(65, 137));
new Vector2(65, 137)));
Color color = new Color(Color.HotPink.R, Color.HotPink.G, Color.HotPink.B, 150);
using (Image image = new Image(500, 500))

Loading…
Cancel
Save