From eef8263be7f334f22dc344207134daa0acb098c5 Mon Sep 17 00:00:00 2001 From: Scott Williams Date: Fri, 3 Feb 2017 09:17:52 +0000 Subject: [PATCH] fix test names & vars --- .../Drawing/Helpers/BezierPolygon.cs | 71 ------------------ .../Drawing/Helpers/LinearPolygon.cs | 71 ------------------ .../Drawing/LineComplexPolygonTests.cs | 32 ++++----- .../Drawing/Paths/DrawBeziersTests.cs | 72 +++++++++---------- .../Drawing/Paths/DrawLinesTests.cs | 72 +++++++++---------- .../Drawing/Paths/DrawPath.cs | 48 ++++++------- .../Drawing/Paths/DrawPolygon.cs | 72 +++++++++---------- .../Drawing/Paths/DrawRectangle.cs | 60 ++++++++-------- .../Drawing/Paths/DrawShape.cs | 48 ++++++------- .../Drawing/Paths/FillPath.cs | 52 +++++++------- .../Drawing/Paths/FillPolygon.cs | 45 ++++++------ .../Drawing/Paths/FillRectangle.cs | 37 +++++----- .../Drawing/Paths/FillShape.cs | 31 ++++---- .../Drawing/Paths/ProcessorWatchingImage.cs | 4 ++ .../Drawing/Paths/ShapePathTests.cs | 2 +- .../Drawing/Paths/ShapeRegionTests.cs | 4 +- .../Drawing/SolidBezierTests.cs | 4 +- .../Drawing/SolidComplexPolygonTests.cs | 24 +++---- 18 files changed, 304 insertions(+), 445 deletions(-) delete mode 100644 tests/ImageSharp.Tests/Drawing/Helpers/BezierPolygon.cs delete mode 100644 tests/ImageSharp.Tests/Drawing/Helpers/LinearPolygon.cs diff --git a/tests/ImageSharp.Tests/Drawing/Helpers/BezierPolygon.cs b/tests/ImageSharp.Tests/Drawing/Helpers/BezierPolygon.cs deleted file mode 100644 index 070e55501..000000000 --- a/tests/ImageSharp.Tests/Drawing/Helpers/BezierPolygon.cs +++ /dev/null @@ -1,71 +0,0 @@ -// -// Copyright (c) James Jackson-South and contributors. -// Licensed under the Apache License, Version 2.0. -// - -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 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 Paths - { - get - { - return this.polygon.Paths; - } - } - - public int MaxIntersections - { - get - { - return this.polygon.MaxIntersections; - } - } - } -} diff --git a/tests/ImageSharp.Tests/Drawing/Helpers/LinearPolygon.cs b/tests/ImageSharp.Tests/Drawing/Helpers/LinearPolygon.cs deleted file mode 100644 index fa9488266..000000000 --- a/tests/ImageSharp.Tests/Drawing/Helpers/LinearPolygon.cs +++ /dev/null @@ -1,71 +0,0 @@ -// -// Copyright (c) James Jackson-South and contributors. -// Licensed under the Apache License, Version 2.0. -// - -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 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 Paths - { - get - { - return this.polygon.Paths; - } - } - - public int MaxIntersections - { - get - { - return this.polygon.MaxIntersections; - } - } - } -} diff --git a/tests/ImageSharp.Tests/Drawing/LineComplexPolygonTests.cs b/tests/ImageSharp.Tests/Drawing/LineComplexPolygonTests.cs index 03ec5d0c8..0a4f2c4a0 100644 --- a/tests/ImageSharp.Tests/Drawing/LineComplexPolygonTests.cs +++ b/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)) diff --git a/tests/ImageSharp.Tests/Drawing/Paths/DrawBeziersTests.cs b/tests/ImageSharp.Tests/Drawing/Paths/DrawBeziersTests.cs index 967cd1970..0d3b46981 100644 --- a/tests/ImageSharp.Tests/Drawing/Paths/DrawBeziersTests.cs +++ b/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>(img.ProcessorApplications[0].processor); + DrawPathProcessor processor = Assert.IsType>(img.ProcessorApplications[0].processor); Assert.Equal(GraphicsOptions.Default, processor.Options); - var path = Assert.IsType(processor.Path); + ShapePath path = Assert.IsType(processor.Path); Assert.NotEmpty(path.Paths); - var vector = Assert.IsType(path.Paths[0]); - var segment = Assert.IsType(vector.LineSegments[0]); + SixLabors.Shapes.Path vector = Assert.IsType(path.Paths[0]); + BezierLineSegment segment = Assert.IsType(vector.LineSegments[0]); - var pen = Assert.IsType>(processor.Pen); + Pen pen = Assert.IsType>(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>(img.ProcessorApplications[0].processor); + DrawPathProcessor processor = Assert.IsType>(img.ProcessorApplications[0].processor); Assert.Equal(noneDefault, processor.Options); - var path = Assert.IsType(processor.Path); + ShapePath path = Assert.IsType(processor.Path); Assert.NotEmpty(path.Paths); - var vector = Assert.IsType(path.Paths[0]); - var segment = Assert.IsType(vector.LineSegments[0]); + SixLabors.Shapes.Path vector = Assert.IsType(path.Paths[0]); + BezierLineSegment segment = Assert.IsType(vector.LineSegments[0]); - var pen = Assert.IsType>(processor.Pen); + Pen pen = Assert.IsType>(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>(img.ProcessorApplications[0].processor); + DrawPathProcessor processor = Assert.IsType>(img.ProcessorApplications[0].processor); Assert.Equal(GraphicsOptions.Default, processor.Options); - var path = Assert.IsType(processor.Path); + ShapePath path = Assert.IsType(processor.Path); Assert.NotEmpty(path.Paths); - var vector = Assert.IsType(path.Paths[0]); - var segment = Assert.IsType(vector.LineSegments[0]); + SixLabors.Shapes.Path vector = Assert.IsType(path.Paths[0]); + BezierLineSegment segment = Assert.IsType(vector.LineSegments[0]); - var pen = Assert.IsType>(processor.Pen); + Pen pen = Assert.IsType>(processor.Pen); Assert.Equal(thickness, pen.Width); - var brush = Assert.IsType>(pen.Brush); + SolidBrush brush = Assert.IsType>(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>(img.ProcessorApplications[0].processor); + DrawPathProcessor processor = Assert.IsType>(img.ProcessorApplications[0].processor); Assert.Equal(noneDefault, processor.Options); - var path = Assert.IsType(processor.Path); + ShapePath path = Assert.IsType(processor.Path); Assert.NotEmpty(path.Paths); - var vector = Assert.IsType(path.Paths[0]); - var segment = Assert.IsType(vector.LineSegments[0]); + SixLabors.Shapes.Path vector = Assert.IsType(path.Paths[0]); + BezierLineSegment segment = Assert.IsType(vector.LineSegments[0]); - var pen = Assert.IsType>(processor.Pen); + Pen pen = Assert.IsType>(processor.Pen); Assert.Equal(thickness, pen.Width); - var brush = Assert.IsType>(pen.Brush); + SolidBrush brush = Assert.IsType>(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>(img.ProcessorApplications[0].processor); + DrawPathProcessor processor = Assert.IsType>(img.ProcessorApplications[0].processor); Assert.Equal(GraphicsOptions.Default, processor.Options); - var path = Assert.IsType(processor.Path); + ShapePath path = Assert.IsType(processor.Path); Assert.NotEmpty(path.Paths); - var vector = Assert.IsType(path.Paths[0]); - var segment = Assert.IsType(vector.LineSegments[0]); + SixLabors.Shapes.Path vector = Assert.IsType(path.Paths[0]); + BezierLineSegment segment = Assert.IsType(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>(img.ProcessorApplications[0].processor); + DrawPathProcessor processor = Assert.IsType>(img.ProcessorApplications[0].processor); Assert.Equal(noneDefault, processor.Options); - var path = Assert.IsType(processor.Path); + ShapePath path = Assert.IsType(processor.Path); Assert.NotEmpty(path.Paths); - var vector = Assert.IsType(path.Paths[0]); - var segment = Assert.IsType(vector.LineSegments[0]); + SixLabors.Shapes.Path vector = Assert.IsType(path.Paths[0]); + BezierLineSegment segment = Assert.IsType(vector.LineSegments[0]); Assert.Equal(pen, processor.Pen); } diff --git a/tests/ImageSharp.Tests/Drawing/Paths/DrawLinesTests.cs b/tests/ImageSharp.Tests/Drawing/Paths/DrawLinesTests.cs index 3b203cdd8..bbed3cae6 100644 --- a/tests/ImageSharp.Tests/Drawing/Paths/DrawLinesTests.cs +++ b/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>(img.ProcessorApplications[0].processor); + DrawPathProcessor processor = Assert.IsType>(img.ProcessorApplications[0].processor); Assert.Equal(GraphicsOptions.Default, processor.Options); - var path = Assert.IsType(processor.Path); + ShapePath path = Assert.IsType(processor.Path); Assert.NotEmpty(path.Paths); - var vector = Assert.IsType(path.Paths[0]); - var segment = Assert.IsType(vector.LineSegments[0]); + SixLabors.Shapes.Path vector = Assert.IsType(path.Paths[0]); + LinearLineSegment segment = Assert.IsType(vector.LineSegments[0]); - var pen = Assert.IsType>(processor.Pen); + Pen pen = Assert.IsType>(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>(img.ProcessorApplications[0].processor); + DrawPathProcessor processor = Assert.IsType>(img.ProcessorApplications[0].processor); Assert.Equal(noneDefault, processor.Options); - var path = Assert.IsType(processor.Path); + ShapePath path = Assert.IsType(processor.Path); Assert.NotEmpty(path.Paths); - var vector = Assert.IsType(path.Paths[0]); - var segment = Assert.IsType(vector.LineSegments[0]); + SixLabors.Shapes.Path vector = Assert.IsType(path.Paths[0]); + LinearLineSegment segment = Assert.IsType(vector.LineSegments[0]); - var pen = Assert.IsType>(processor.Pen); + Pen pen = Assert.IsType>(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>(img.ProcessorApplications[0].processor); + DrawPathProcessor processor = Assert.IsType>(img.ProcessorApplications[0].processor); Assert.Equal(GraphicsOptions.Default, processor.Options); - var path = Assert.IsType(processor.Path); + ShapePath path = Assert.IsType(processor.Path); Assert.NotEmpty(path.Paths); - var vector = Assert.IsType(path.Paths[0]); - var segment = Assert.IsType(vector.LineSegments[0]); + SixLabors.Shapes.Path vector = Assert.IsType(path.Paths[0]); + LinearLineSegment segment = Assert.IsType(vector.LineSegments[0]); - var pen = Assert.IsType>(processor.Pen); + Pen pen = Assert.IsType>(processor.Pen); Assert.Equal(thickness, pen.Width); - var brush = Assert.IsType>(pen.Brush); + SolidBrush brush = Assert.IsType>(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>(img.ProcessorApplications[0].processor); + DrawPathProcessor processor = Assert.IsType>(img.ProcessorApplications[0].processor); Assert.Equal(noneDefault, processor.Options); - var path = Assert.IsType(processor.Path); + ShapePath path = Assert.IsType(processor.Path); Assert.NotEmpty(path.Paths); - var vector = Assert.IsType(path.Paths[0]); - var segment = Assert.IsType(vector.LineSegments[0]); + SixLabors.Shapes.Path vector = Assert.IsType(path.Paths[0]); + LinearLineSegment segment = Assert.IsType(vector.LineSegments[0]); - var pen = Assert.IsType>(processor.Pen); + Pen pen = Assert.IsType>(processor.Pen); Assert.Equal(thickness, pen.Width); - var brush = Assert.IsType>(pen.Brush); + SolidBrush brush = Assert.IsType>(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>(img.ProcessorApplications[0].processor); + DrawPathProcessor processor = Assert.IsType>(img.ProcessorApplications[0].processor); Assert.Equal(GraphicsOptions.Default, processor.Options); - var path = Assert.IsType(processor.Path); + ShapePath path = Assert.IsType(processor.Path); Assert.NotEmpty(path.Paths); - var vector = Assert.IsType(path.Paths[0]); - var segment = Assert.IsType(vector.LineSegments[0]); + SixLabors.Shapes.Path vector = Assert.IsType(path.Paths[0]); + LinearLineSegment segment = Assert.IsType(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>(img.ProcessorApplications[0].processor); + DrawPathProcessor processor = Assert.IsType>(img.ProcessorApplications[0].processor); Assert.Equal(noneDefault, processor.Options); - var path = Assert.IsType(processor.Path); + ShapePath path = Assert.IsType(processor.Path); Assert.NotEmpty(path.Paths); - var vector = Assert.IsType(path.Paths[0]); - var segment = Assert.IsType(vector.LineSegments[0]); + SixLabors.Shapes.Path vector = Assert.IsType(path.Paths[0]); + LinearLineSegment segment = Assert.IsType(vector.LineSegments[0]); Assert.Equal(pen, processor.Pen); } diff --git a/tests/ImageSharp.Tests/Drawing/Paths/DrawPath.cs b/tests/ImageSharp.Tests/Drawing/Paths/DrawPath.cs index 8ce7dcba2..531546370 100644 --- a/tests/ImageSharp.Tests/Drawing/Paths/DrawPath.cs +++ b/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>(img.ProcessorApplications[0].processor); + DrawPathProcessor processor = Assert.IsType>(img.ProcessorApplications[0].processor); Assert.Equal(GraphicsOptions.Default, processor.Options); - var shapepath = Assert.IsType(processor.Path); + ShapePath shapepath = Assert.IsType(processor.Path); Assert.NotEmpty(shapepath.Paths); Assert.Equal(path, shapepath.Paths[0]); - var pen = Assert.IsType>(processor.Pen); + Pen pen = Assert.IsType>(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>(img.ProcessorApplications[0].processor); + DrawPathProcessor processor = Assert.IsType>(img.ProcessorApplications[0].processor); Assert.Equal(noneDefault, processor.Options); - var shapepath = Assert.IsType(processor.Path); + ShapePath shapepath = Assert.IsType(processor.Path); Assert.NotEmpty(shapepath.Paths); Assert.Equal(path, shapepath.Paths[0]); - var pen = Assert.IsType>(processor.Pen); + Pen pen = Assert.IsType>(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>(img.ProcessorApplications[0].processor); + DrawPathProcessor processor = Assert.IsType>(img.ProcessorApplications[0].processor); Assert.Equal(GraphicsOptions.Default, processor.Options); - var shapepath = Assert.IsType(processor.Path); + ShapePath shapepath = Assert.IsType(processor.Path); Assert.NotEmpty(shapepath.Paths); Assert.Equal(path, shapepath.Paths[0]); - var pen = Assert.IsType>(processor.Pen); + Pen pen = Assert.IsType>(processor.Pen); Assert.Equal(thickness, pen.Width); - var brush = Assert.IsType>(pen.Brush); + SolidBrush brush = Assert.IsType>(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>(img.ProcessorApplications[0].processor); + DrawPathProcessor processor = Assert.IsType>(img.ProcessorApplications[0].processor); Assert.Equal(noneDefault, processor.Options); - var shapepath = Assert.IsType(processor.Path); + ShapePath shapepath = Assert.IsType(processor.Path); Assert.NotEmpty(shapepath.Paths); Assert.Equal(path, shapepath.Paths[0]); - var pen = Assert.IsType>(processor.Pen); + Pen pen = Assert.IsType>(processor.Pen); Assert.Equal(thickness, pen.Width); - var brush = Assert.IsType>(pen.Brush); + SolidBrush brush = Assert.IsType>(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>(img.ProcessorApplications[0].processor); + DrawPathProcessor processor = Assert.IsType>(img.ProcessorApplications[0].processor); Assert.Equal(GraphicsOptions.Default, processor.Options); - var shapepath = Assert.IsType(processor.Path); + ShapePath shapepath = Assert.IsType(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>(img.ProcessorApplications[0].processor); + DrawPathProcessor processor = Assert.IsType>(img.ProcessorApplications[0].processor); Assert.Equal(noneDefault, processor.Options); - var shapepath = Assert.IsType(processor.Path); + ShapePath shapepath = Assert.IsType(processor.Path); Assert.NotEmpty(shapepath.Paths); Assert.Equal(path, shapepath.Paths[0]); diff --git a/tests/ImageSharp.Tests/Drawing/Paths/DrawPolygon.cs b/tests/ImageSharp.Tests/Drawing/Paths/DrawPolygon.cs index 9a931470d..399e79dae 100644 --- a/tests/ImageSharp.Tests/Drawing/Paths/DrawPolygon.cs +++ b/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>(img.ProcessorApplications[0].processor); + DrawPathProcessor processor = Assert.IsType>(img.ProcessorApplications[0].processor); Assert.Equal(GraphicsOptions.Default, processor.Options); - var path = Assert.IsType(processor.Path); + ShapePath path = Assert.IsType(processor.Path); Assert.NotEmpty(path.Paths); - var vector = Assert.IsType(path.Paths[0].AsShape()); - var segment = Assert.IsType(vector.LineSegments[0]); + Polygon vector = Assert.IsType(path.Paths[0].AsShape()); + LinearLineSegment segment = Assert.IsType(vector.LineSegments[0]); - var pen = Assert.IsType>(processor.Pen); + Pen pen = Assert.IsType>(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>(img.ProcessorApplications[0].processor); + DrawPathProcessor processor = Assert.IsType>(img.ProcessorApplications[0].processor); Assert.Equal(noneDefault, processor.Options); - var path = Assert.IsType(processor.Path); + ShapePath path = Assert.IsType(processor.Path); Assert.NotEmpty(path.Paths); - var vector = Assert.IsType(path.Paths[0].AsShape()); - var segment = Assert.IsType(vector.LineSegments[0]); + Polygon vector = Assert.IsType(path.Paths[0].AsShape()); + LinearLineSegment segment = Assert.IsType(vector.LineSegments[0]); - var pen = Assert.IsType>(processor.Pen); + Pen pen = Assert.IsType>(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>(img.ProcessorApplications[0].processor); + DrawPathProcessor processor = Assert.IsType>(img.ProcessorApplications[0].processor); Assert.Equal(GraphicsOptions.Default, processor.Options); - var path = Assert.IsType(processor.Path); + ShapePath path = Assert.IsType(processor.Path); Assert.NotEmpty(path.Paths); - var vector = Assert.IsType(path.Paths[0].AsShape()); - var segment = Assert.IsType(vector.LineSegments[0]); + Polygon vector = Assert.IsType(path.Paths[0].AsShape()); + LinearLineSegment segment = Assert.IsType(vector.LineSegments[0]); - var pen = Assert.IsType>(processor.Pen); + Pen pen = Assert.IsType>(processor.Pen); Assert.Equal(thickness, pen.Width); - var brush = Assert.IsType>(pen.Brush); + SolidBrush brush = Assert.IsType>(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>(img.ProcessorApplications[0].processor); + DrawPathProcessor processor = Assert.IsType>(img.ProcessorApplications[0].processor); Assert.Equal(noneDefault, processor.Options); - var path = Assert.IsType(processor.Path); + ShapePath path = Assert.IsType(processor.Path); Assert.NotEmpty(path.Paths); - var vector = Assert.IsType(path.Paths[0].AsShape()); - var segment = Assert.IsType(vector.LineSegments[0]); + Polygon vector = Assert.IsType(path.Paths[0].AsShape()); + LinearLineSegment segment = Assert.IsType(vector.LineSegments[0]); - var pen = Assert.IsType>(processor.Pen); + Pen pen = Assert.IsType>(processor.Pen); Assert.Equal(thickness, pen.Width); - var brush = Assert.IsType>(pen.Brush); + SolidBrush brush = Assert.IsType>(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>(img.ProcessorApplications[0].processor); + DrawPathProcessor processor = Assert.IsType>(img.ProcessorApplications[0].processor); Assert.Equal(GraphicsOptions.Default, processor.Options); - var path = Assert.IsType(processor.Path); + ShapePath path = Assert.IsType(processor.Path); Assert.NotEmpty(path.Paths); - var vector = Assert.IsType(path.Paths[0].AsShape()); - var segment = Assert.IsType(vector.LineSegments[0]); + Polygon vector = Assert.IsType(path.Paths[0].AsShape()); + LinearLineSegment segment = Assert.IsType(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>(img.ProcessorApplications[0].processor); + DrawPathProcessor processor = Assert.IsType>(img.ProcessorApplications[0].processor); Assert.Equal(noneDefault, processor.Options); - var path = Assert.IsType(processor.Path); + ShapePath path = Assert.IsType(processor.Path); Assert.NotEmpty(path.Paths); - var vector = Assert.IsType(path.Paths[0].AsShape()); - var segment = Assert.IsType(vector.LineSegments[0]); + Polygon vector = Assert.IsType(path.Paths[0].AsShape()); + LinearLineSegment segment = Assert.IsType(vector.LineSegments[0]); Assert.Equal(pen, processor.Pen); } diff --git a/tests/ImageSharp.Tests/Drawing/Paths/DrawRectangle.cs b/tests/ImageSharp.Tests/Drawing/Paths/DrawRectangle.cs index f6680bc9c..3842063b3 100644 --- a/tests/ImageSharp.Tests/Drawing/Paths/DrawRectangle.cs +++ b/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>(img.ProcessorApplications[0].processor); + DrawPathProcessor processor = Assert.IsType>(img.ProcessorApplications[0].processor); Assert.Equal(GraphicsOptions.Default, processor.Options); - var shapepath = Assert.IsType(processor.Path); + ShapePath shapepath = Assert.IsType(processor.Path); Assert.NotEmpty(shapepath.Paths); - var rect = Assert.IsType(shapepath.Paths[0].AsShape()); + SixLabors.Shapes.Rectangle rect = Assert.IsType(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>(processor.Pen); + Pen pen = Assert.IsType>(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>(img.ProcessorApplications[0].processor); + DrawPathProcessor processor = Assert.IsType>(img.ProcessorApplications[0].processor); Assert.Equal(noneDefault, processor.Options); - var shapepath = Assert.IsType(processor.Path); + ShapePath shapepath = Assert.IsType(processor.Path); Assert.NotEmpty(shapepath.Paths); - var rect = Assert.IsType(shapepath.Paths[0].AsShape()); + SixLabors.Shapes.Rectangle rect = Assert.IsType(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>(processor.Pen); + Pen pen = Assert.IsType>(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>(img.ProcessorApplications[0].processor); + DrawPathProcessor processor = Assert.IsType>(img.ProcessorApplications[0].processor); Assert.Equal(GraphicsOptions.Default, processor.Options); - var shapepath = Assert.IsType(processor.Path); + ShapePath shapepath = Assert.IsType(processor.Path); Assert.NotEmpty(shapepath.Paths); - var rect = Assert.IsType(shapepath.Paths[0].AsShape()); + SixLabors.Shapes.Rectangle rect = Assert.IsType(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>(processor.Pen); + Pen pen = Assert.IsType>(processor.Pen); Assert.Equal(thickness, pen.Width); - var brush = Assert.IsType>(pen.Brush); + SolidBrush brush = Assert.IsType>(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>(img.ProcessorApplications[0].processor); + DrawPathProcessor processor = Assert.IsType>(img.ProcessorApplications[0].processor); Assert.Equal(noneDefault, processor.Options); - var shapepath = Assert.IsType(processor.Path); + ShapePath shapepath = Assert.IsType(processor.Path); Assert.NotEmpty(shapepath.Paths); - var rect = Assert.IsType(shapepath.Paths[0].AsShape()); + SixLabors.Shapes.Rectangle rect = Assert.IsType(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>(processor.Pen); + Pen pen = Assert.IsType>(processor.Pen); Assert.Equal(thickness, pen.Width); - var brush = Assert.IsType>(pen.Brush); + SolidBrush brush = Assert.IsType>(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>(img.ProcessorApplications[0].processor); + DrawPathProcessor processor = Assert.IsType>(img.ProcessorApplications[0].processor); Assert.Equal(GraphicsOptions.Default, processor.Options); - var shapepath = Assert.IsType(processor.Path); + ShapePath shapepath = Assert.IsType(processor.Path); Assert.NotEmpty(shapepath.Paths); - var rect = Assert.IsType(shapepath.Paths[0].AsShape()); + SixLabors.Shapes.Rectangle rect = Assert.IsType(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>(img.ProcessorApplications[0].processor); + DrawPathProcessor processor = Assert.IsType>(img.ProcessorApplications[0].processor); Assert.Equal(noneDefault, processor.Options); - var shapepath = Assert.IsType(processor.Path); + ShapePath shapepath = Assert.IsType(processor.Path); Assert.NotEmpty(shapepath.Paths); - var rect = Assert.IsType(shapepath.Paths[0].AsShape()); + SixLabors.Shapes.Rectangle rect = Assert.IsType(shapepath.Paths[0].AsShape()); Assert.Equal(rect.Location.X, rectangle.X); Assert.Equal(rect.Location.Y, rectangle.Y); diff --git a/tests/ImageSharp.Tests/Drawing/Paths/DrawShape.cs b/tests/ImageSharp.Tests/Drawing/Paths/DrawShape.cs index 8572099db..30a6646f4 100644 --- a/tests/ImageSharp.Tests/Drawing/Paths/DrawShape.cs +++ b/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>(img.ProcessorApplications[0].processor); + DrawPathProcessor processor = Assert.IsType>(img.ProcessorApplications[0].processor); Assert.Equal(GraphicsOptions.Default, processor.Options); - var shapepath = Assert.IsType(processor.Path); + ShapePath shapepath = Assert.IsType(processor.Path); Assert.NotEmpty(shapepath.Paths); Assert.Equal(shape, shapepath.Paths[0].AsShape()); - var pen = Assert.IsType>(processor.Pen); + Pen pen = Assert.IsType>(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>(img.ProcessorApplications[0].processor); + DrawPathProcessor processor = Assert.IsType>(img.ProcessorApplications[0].processor); Assert.Equal(noneDefault, processor.Options); - var shapepath = Assert.IsType(processor.Path); + ShapePath shapepath = Assert.IsType(processor.Path); Assert.NotEmpty(shapepath.Paths); Assert.Equal(shape, shapepath.Paths[0].AsShape()); - var pen = Assert.IsType>(processor.Pen); + Pen pen = Assert.IsType>(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>(img.ProcessorApplications[0].processor); + DrawPathProcessor processor = Assert.IsType>(img.ProcessorApplications[0].processor); Assert.Equal(GraphicsOptions.Default, processor.Options); - var shapepath = Assert.IsType(processor.Path); + ShapePath shapepath = Assert.IsType(processor.Path); Assert.NotEmpty(shapepath.Paths); Assert.Equal(shape, shapepath.Paths[0].AsShape()); - var pen = Assert.IsType>(processor.Pen); + Pen pen = Assert.IsType>(processor.Pen); Assert.Equal(thickness, pen.Width); - var brush = Assert.IsType>(pen.Brush); + SolidBrush brush = Assert.IsType>(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>(img.ProcessorApplications[0].processor); + DrawPathProcessor processor = Assert.IsType>(img.ProcessorApplications[0].processor); Assert.Equal(noneDefault, processor.Options); - var shapepath = Assert.IsType(processor.Path); + ShapePath shapepath = Assert.IsType(processor.Path); Assert.NotEmpty(shapepath.Paths); Assert.Equal(shape, shapepath.Paths[0].AsShape()); - var pen = Assert.IsType>(processor.Pen); + Pen pen = Assert.IsType>(processor.Pen); Assert.Equal(thickness, pen.Width); - var brush = Assert.IsType>(pen.Brush); + SolidBrush brush = Assert.IsType>(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>(img.ProcessorApplications[0].processor); + DrawPathProcessor processor = Assert.IsType>(img.ProcessorApplications[0].processor); Assert.Equal(GraphicsOptions.Default, processor.Options); - var shapepath = Assert.IsType(processor.Path); + ShapePath shapepath = Assert.IsType(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>(img.ProcessorApplications[0].processor); + DrawPathProcessor processor = Assert.IsType>(img.ProcessorApplications[0].processor); Assert.Equal(noneDefault, processor.Options); - var shapepath = Assert.IsType(processor.Path); + ShapePath shapepath = Assert.IsType(processor.Path); Assert.NotEmpty(shapepath.Paths); Assert.Equal(shape, shapepath.Paths[0].AsShape()); diff --git a/tests/ImageSharp.Tests/Drawing/Paths/FillPath.cs b/tests/ImageSharp.Tests/Drawing/Paths/FillPath.cs index 04a2a82ab..5ba6580bd 100644 --- a/tests/ImageSharp.Tests/Drawing/Paths/FillPath.cs +++ b/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>(img.ProcessorApplications[0].processor); + FillRegionProcessor processor = Assert.IsType>(img.ProcessorApplications[0].processor); Assert.Equal(GraphicsOptions.Default, processor.Options); - var region = Assert.IsType(processor.Region); - var polygon = Assert.IsType(region.Shape); - var segments = Assert.IsType(polygon.LineSegments[0]); + ShapeRegion region = Assert.IsType(processor.Region); + + // path is converted to a polygon before filling + Polygon polygon = Assert.IsType(region.Shape); + LinearLineSegment segments = Assert.IsType(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>(img.ProcessorApplications[0].processor); + FillRegionProcessor processor = Assert.IsType>(img.ProcessorApplications[0].processor); Assert.Equal(noneDefault, processor.Options); - var region = Assert.IsType(processor.Region); - var polygon = Assert.IsType(region.Shape); - var segments = Assert.IsType(polygon.LineSegments[0]); + ShapeRegion region = Assert.IsType(processor.Region); + Polygon polygon = Assert.IsType(region.Shape); + LinearLineSegment segments = Assert.IsType(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>(img.ProcessorApplications[0].processor); + FillRegionProcessor processor = Assert.IsType>(img.ProcessorApplications[0].processor); Assert.Equal(GraphicsOptions.Default, processor.Options); - var region = Assert.IsType(processor.Region); - var polygon = Assert.IsType(region.Shape); - var segments = Assert.IsType(polygon.LineSegments[0]); + ShapeRegion region = Assert.IsType(processor.Region); + Polygon polygon = Assert.IsType(region.Shape); + LinearLineSegment segments = Assert.IsType(polygon.LineSegments[0]); - var brush = Assert.IsType>(processor.Brush); + SolidBrush brush = Assert.IsType>(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>(img.ProcessorApplications[0].processor); + FillRegionProcessor processor = Assert.IsType>(img.ProcessorApplications[0].processor); Assert.Equal(noneDefault, processor.Options); - var region = Assert.IsType(processor.Region); - var polygon = Assert.IsType(region.Shape); - var segments = Assert.IsType(polygon.LineSegments[0]); + ShapeRegion region = Assert.IsType(processor.Region); + Polygon polygon = Assert.IsType(region.Shape); + LinearLineSegment segments = Assert.IsType(polygon.LineSegments[0]); - var brush = Assert.IsType>(processor.Brush); + SolidBrush brush = Assert.IsType>(processor.Brush); Assert.Equal(color, brush.Color); - } } } diff --git a/tests/ImageSharp.Tests/Drawing/Paths/FillPolygon.cs b/tests/ImageSharp.Tests/Drawing/Paths/FillPolygon.cs index 2c95eb209..ad72d4c4e 100644 --- a/tests/ImageSharp.Tests/Drawing/Paths/FillPolygon.cs +++ b/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>(img.ProcessorApplications[0].processor); + FillRegionProcessor processor = Assert.IsType>(img.ProcessorApplications[0].processor); Assert.Equal(GraphicsOptions.Default, processor.Options); - var region = Assert.IsType(processor.Region); - var polygon = Assert.IsType(region.Shape); - var segemnt = Assert.IsType(polygon.LineSegments[0]); + ShapeRegion region = Assert.IsType(processor.Region); + Polygon polygon = Assert.IsType(region.Shape); + LinearLineSegment segemnt = Assert.IsType(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>(img.ProcessorApplications[0].processor); + FillRegionProcessor processor = Assert.IsType>(img.ProcessorApplications[0].processor); Assert.Equal(noneDefault, processor.Options); - var region = Assert.IsType(processor.Region); - var polygon = Assert.IsType(region.Shape); - var segemnt = Assert.IsType(polygon.LineSegments[0]); + ShapeRegion region = Assert.IsType(processor.Region); + Polygon polygon = Assert.IsType(region.Shape); + LinearLineSegment segemnt = Assert.IsType(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>(img.ProcessorApplications[0].processor); + FillRegionProcessor processor = Assert.IsType>(img.ProcessorApplications[0].processor); Assert.Equal(GraphicsOptions.Default, processor.Options); - var region = Assert.IsType(processor.Region); - var polygon = Assert.IsType(region.Shape); - var segemnt = Assert.IsType(polygon.LineSegments[0]); + ShapeRegion region = Assert.IsType(processor.Region); + Polygon polygon = Assert.IsType(region.Shape); + LinearLineSegment segemnt = Assert.IsType(polygon.LineSegments[0]); - var brush = Assert.IsType>(processor.Brush); + SolidBrush brush = Assert.IsType>(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>(img.ProcessorApplications[0].processor); + FillRegionProcessor processor = Assert.IsType>(img.ProcessorApplications[0].processor); Assert.Equal(noneDefault, processor.Options); - var region = Assert.IsType(processor.Region); - var polygon = Assert.IsType(region.Shape); - var segemnt = Assert.IsType(polygon.LineSegments[0]); + ShapeRegion region = Assert.IsType(processor.Region); + Polygon polygon = Assert.IsType(region.Shape); + LinearLineSegment segemnt = Assert.IsType(polygon.LineSegments[0]); - var brush = Assert.IsType>(processor.Brush); + SolidBrush brush = Assert.IsType>(processor.Brush); Assert.Equal(color, brush.Color); } } diff --git a/tests/ImageSharp.Tests/Drawing/Paths/FillRectangle.cs b/tests/ImageSharp.Tests/Drawing/Paths/FillRectangle.cs index 520b107b9..f6b1c4ade 100644 --- a/tests/ImageSharp.Tests/Drawing/Paths/FillRectangle.cs +++ b/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>(img.ProcessorApplications[0].processor); + FillRegionProcessor processor = Assert.IsType>(img.ProcessorApplications[0].processor); Assert.Equal(GraphicsOptions.Default, processor.Options); - var region = Assert.IsType(processor.Region); - var rect = Assert.IsType(region.Shape); + ShapeRegion region = Assert.IsType(processor.Region); + SixLabors.Shapes.Rectangle rect = Assert.IsType(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>(img.ProcessorApplications[0].processor); + FillRegionProcessor processor = Assert.IsType>(img.ProcessorApplications[0].processor); Assert.Equal(noneDefault, processor.Options); - var region = Assert.IsType(processor.Region); - var rect = Assert.IsType(region.Shape); + ShapeRegion region = Assert.IsType(processor.Region); + SixLabors.Shapes.Rectangle rect = Assert.IsType(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>(img.ProcessorApplications[0].processor); + FillRegionProcessor processor = Assert.IsType>(img.ProcessorApplications[0].processor); Assert.Equal(GraphicsOptions.Default, processor.Options); - var region = Assert.IsType(processor.Region); - var rect = Assert.IsType(region.Shape); + ShapeRegion region = Assert.IsType(processor.Region); + SixLabors.Shapes.Rectangle rect = Assert.IsType(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>(processor.Brush); + SolidBrush brush = Assert.IsType>(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>(img.ProcessorApplications[0].processor); + FillRegionProcessor processor = Assert.IsType>(img.ProcessorApplications[0].processor); Assert.Equal(noneDefault, processor.Options); - var region = Assert.IsType(processor.Region); - var rect = Assert.IsType(region.Shape); + ShapeRegion region = Assert.IsType(processor.Region); + SixLabors.Shapes.Rectangle rect = Assert.IsType(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>(processor.Brush); + SolidBrush brush = Assert.IsType>(processor.Brush); Assert.Equal(color, brush.Color); } } diff --git a/tests/ImageSharp.Tests/Drawing/Paths/FillShape.cs b/tests/ImageSharp.Tests/Drawing/Paths/FillShape.cs index 26bf61b5c..140870a3c 100644 --- a/tests/ImageSharp.Tests/Drawing/Paths/FillShape.cs +++ b/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>(img.ProcessorApplications[0].processor); + FillRegionProcessor processor = Assert.IsType>(img.ProcessorApplications[0].processor); Assert.Equal(GraphicsOptions.Default, processor.Options); - var region = Assert.IsType(processor.Region); + ShapeRegion region = Assert.IsType(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>(img.ProcessorApplications[0].processor); + FillRegionProcessor processor = Assert.IsType>(img.ProcessorApplications[0].processor); Assert.Equal(noneDefault, processor.Options); - var region = Assert.IsType(processor.Region); + ShapeRegion region = Assert.IsType(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>(img.ProcessorApplications[0].processor); + FillRegionProcessor processor = Assert.IsType>(img.ProcessorApplications[0].processor); Assert.Equal(GraphicsOptions.Default, processor.Options); - var region = Assert.IsType(processor.Region); + ShapeRegion region = Assert.IsType(processor.Region); Assert.Equal(shape, region.Shape); - var brush = Assert.IsType>(processor.Brush); + SolidBrush brush = Assert.IsType>(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>(img.ProcessorApplications[0].processor); + FillRegionProcessor processor = Assert.IsType>(img.ProcessorApplications[0].processor); Assert.Equal(noneDefault, processor.Options); - var region = Assert.IsType(processor.Region); + ShapeRegion region = Assert.IsType(processor.Region); Assert.Equal(shape, region.Shape); - var brush = Assert.IsType>(processor.Brush); + SolidBrush brush = Assert.IsType>(processor.Brush); Assert.Equal(color, brush.Color); } diff --git a/tests/ImageSharp.Tests/Drawing/Paths/ProcessorWatchingImage.cs b/tests/ImageSharp.Tests/Drawing/Paths/ProcessorWatchingImage.cs index ad3d41bc6..3bb3b3e77 100644 --- a/tests/ImageSharp.Tests/Drawing/Paths/ProcessorWatchingImage.cs +++ b/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 diff --git a/tests/ImageSharp.Tests/Drawing/Paths/ShapePathTests.cs b/tests/ImageSharp.Tests/Drawing/Paths/ShapePathTests.cs index 24e921ccb..5fc967846 100644 --- a/tests/ImageSharp.Tests/Drawing/Paths/ShapePathTests.cs +++ b/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); diff --git a/tests/ImageSharp.Tests/Drawing/Paths/ShapeRegionTests.cs b/tests/ImageSharp.Tests/Drawing/Paths/ShapeRegionTests.cs index e983dce66..675494951 100644 --- a/tests/ImageSharp.Tests/Drawing/Paths/ShapeRegionTests.cs +++ b/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); diff --git a/tests/ImageSharp.Tests/Drawing/SolidBezierTests.cs b/tests/ImageSharp.Tests/Drawing/SolidBezierTests.cs index f63d90aa6..80713468d 100644 --- a/tests/ImageSharp.Tests/Drawing/SolidBezierTests.cs +++ b/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); } diff --git a/tests/ImageSharp.Tests/Drawing/SolidComplexPolygonTests.cs b/tests/ImageSharp.Tests/Drawing/SolidComplexPolygonTests.cs index a1973a280..45ee59d66 100644 --- a/tests/ImageSharp.Tests/Drawing/SolidComplexPolygonTests.cs +++ b/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))