mirror of https://github.com/SixLabors/ImageSharp
Browse Source
Former-commit-id: c555dd4321d4c11490aa73f8f0d4509679991282 Former-commit-id: 0072a5aac08319d389358dd2f4d274038240fe0e Former-commit-id: f443d31725e0c4bc2d633ec6df65cb6b513b4b8bpull/17/head
16 changed files with 854 additions and 12 deletions
@ -0,0 +1,4 @@ |
|||
<?xml version="1.0" encoding="utf-8"?> |
|||
<packages> |
|||
<package id="xunit.runner.console" version="2.0.0" /> |
|||
</packages> |
|||
@ -0,0 +1,262 @@ |
|||
// --------------------------------------------------------------------------------------------------------------------
|
|||
// <copyright file="Rectangle.cs" company="James South">
|
|||
// Copyright © James South and contributors.
|
|||
// Licensed under the Apache License, Version 2.0.
|
|||
// </copyright>
|
|||
// <summary>
|
|||
// Stores the location and size of a rectangular region.
|
|||
// </summary>
|
|||
// --------------------------------------------------------------------------------------------------------------------
|
|||
|
|||
namespace ImageProcessor |
|||
{ |
|||
using System; |
|||
using System.ComponentModel; |
|||
using System.Globalization; |
|||
|
|||
/// <summary>
|
|||
/// Stores a set of four integers that represent the location and size of a rectangle.
|
|||
/// </summary>
|
|||
public struct Rectangle : IEquatable<Rectangle> |
|||
{ |
|||
/// <summary>
|
|||
/// Represents a <see cref="Rectangle"/> that has X, Y, Width, and Height values set to zero.
|
|||
/// </summary>
|
|||
public static readonly Rectangle Empty = new Rectangle(); |
|||
|
|||
/// <summary>
|
|||
/// The x-coordinate of this <see cref="Rectangle"/>.
|
|||
/// </summary>
|
|||
public int X; |
|||
|
|||
/// <summary>
|
|||
/// The y-coordinate of this <see cref="Rectangle"/>.
|
|||
/// </summary>
|
|||
public int Y; |
|||
|
|||
/// <summary>
|
|||
/// The width of this <see cref="Rectangle"/>.
|
|||
/// </summary>
|
|||
public int Width; |
|||
|
|||
/// <summary>
|
|||
/// The height of this <see cref="Rectangle"/>.
|
|||
/// </summary>
|
|||
public int Height; |
|||
|
|||
/// <summary>
|
|||
/// Initializes a new instance of the <see cref="Rectangle"/> struct.
|
|||
/// </summary>
|
|||
/// <param name="x">
|
|||
/// The horizontal position of the rectangle.
|
|||
/// </param>
|
|||
/// <param name="y">
|
|||
/// The vertical position of the rectangle.
|
|||
/// </param>
|
|||
/// <param name="width">
|
|||
/// The width of the rectangle.
|
|||
/// </param>
|
|||
/// <param name="height">
|
|||
/// The height of the rectangle.
|
|||
/// </param>
|
|||
public Rectangle(int x, int y, int width, int height) |
|||
{ |
|||
this.X = x; |
|||
this.Y = y; |
|||
this.Width = width; |
|||
this.Height = height; |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Initializes a new instance of the <see cref="Rectangle"/> struct.
|
|||
/// </summary>
|
|||
/// <param name="point">
|
|||
/// The <see cref="Point"/> which specifies the rectangles point in a two-dimensional plane.
|
|||
/// </param>
|
|||
/// <param name="size">
|
|||
/// The <see cref="Size"/> which specifies the rectangles height and width.
|
|||
/// </param>
|
|||
public Rectangle(Point point, Size size) |
|||
{ |
|||
this.X = point.X; |
|||
this.Y = point.Y; |
|||
this.Width = size.Width; |
|||
this.Height = size.Height; |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Gets a value indicating whether this <see cref="Rectangle"/> is empty.
|
|||
/// </summary>
|
|||
[EditorBrowsable(EditorBrowsableState.Never)] |
|||
public bool IsEmpty |
|||
{ |
|||
get |
|||
{ |
|||
return this.X == 0 && this.Y == 0 && this.Width == 0 && this.Height == 0; |
|||
} |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Gets the y-coordinate of the top edge of this <see cref="Rectangle"/>.
|
|||
/// </summary>
|
|||
public int Top |
|||
{ |
|||
get |
|||
{ |
|||
return this.Y; |
|||
} |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Gets the x-coordinate of the right edge of this <see cref="Rectangle"/>.
|
|||
/// </summary>
|
|||
public int Right |
|||
{ |
|||
get |
|||
{ |
|||
return this.X + this.Width; |
|||
} |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Gets the y-coordinate of the bottom edge of this <see cref="Rectangle"/>.
|
|||
/// </summary>
|
|||
public int Bottom |
|||
{ |
|||
get |
|||
{ |
|||
return this.Y + this.Height; |
|||
} |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Gets the x-coordinate of the left edge of this <see cref="Rectangle"/>.
|
|||
/// </summary>
|
|||
public int Left |
|||
{ |
|||
get |
|||
{ |
|||
return this.X; |
|||
} |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Compares two <see cref="Rectangle"/> objects. The result specifies whether the values
|
|||
/// of the <see cref="Rectangle.X"/>, <see cref="Rectangle.Y"/>, <see cref="Rectangle.Width"/>,
|
|||
/// and the <see cref="Rectangle.Height"/>properties of the two
|
|||
/// <see cref="Rectangle"/> objects are equal.
|
|||
/// </summary>
|
|||
/// <param name="left">
|
|||
/// The <see cref="Rectangle"/> on the left side of the operand.
|
|||
/// </param>
|
|||
/// <param name="right">
|
|||
/// The <see cref="Rectangle"/> on the right side of the operand.
|
|||
/// </param>
|
|||
/// <returns>
|
|||
/// True if the current left is equal to the <paramref name="right"/> parameter; otherwise, false.
|
|||
/// </returns>
|
|||
public static bool operator ==(Rectangle left, Rectangle right) |
|||
{ |
|||
return left.Equals(right); |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Compares two <see cref="Rectangle"/> objects. The result specifies whether the values
|
|||
/// of the <see cref="Rectangle.X"/>, <see cref="Rectangle.Y"/>, <see cref="Rectangle.Width"/>,
|
|||
/// and the <see cref="Rectangle.Height"/>properties of the two
|
|||
/// <see cref="Rectangle"/> objects are unequal.
|
|||
/// </summary>
|
|||
/// <param name="left">
|
|||
/// The <see cref="Rectangle"/> on the left side of the operand.
|
|||
/// </param>
|
|||
/// <param name="right">
|
|||
/// The <see cref="Rectangle"/> on the right side of the operand.
|
|||
/// </param>
|
|||
/// <returns>
|
|||
/// True if the current left is unequal to the <paramref name="right"/> parameter; otherwise, false.
|
|||
/// </returns>
|
|||
public static bool operator !=(Rectangle left, Rectangle right) |
|||
{ |
|||
return !left.Equals(right); |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Indicates whether this instance and a specified object are equal.
|
|||
/// </summary>
|
|||
/// <returns>
|
|||
/// True if <paramref name="obj"/> and this instance are the same type and represent the same value; otherwise, false.
|
|||
/// </returns>
|
|||
/// <param name="obj">The object to compare with the current instance. </param>
|
|||
public override bool Equals(object obj) |
|||
{ |
|||
if (!(obj is Rectangle)) |
|||
{ |
|||
return false; |
|||
} |
|||
|
|||
Rectangle other = (Rectangle)obj; |
|||
|
|||
return other.X == this.X && other.Y == this.Y |
|||
&& other.Width == this.Width && other.Height == this.Height; |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Returns the hash code for this instance.
|
|||
/// </summary>
|
|||
/// <returns>
|
|||
/// A 32-bit signed integer that is the hash code for this instance.
|
|||
/// </returns>
|
|||
public override int GetHashCode() |
|||
{ |
|||
return this.GetHashCode(this); |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Returns the fully qualified type name of this instance.
|
|||
/// </summary>
|
|||
/// <returns>
|
|||
/// A <see cref="T:System.String"/> containing a fully qualified type name.
|
|||
/// </returns>
|
|||
public override string ToString() |
|||
{ |
|||
return "{X=" + this.X.ToString(CultureInfo.CurrentCulture) |
|||
+ ",Y=" + this.Y.ToString(CultureInfo.CurrentCulture) |
|||
+ ",Width=" + this.Width.ToString(CultureInfo.CurrentCulture) |
|||
+ ",Height=" + this.Height.ToString(CultureInfo.CurrentCulture) + "}"; |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Indicates whether the current object is equal to another object of the same type.
|
|||
/// </summary>
|
|||
/// <returns>
|
|||
/// True if the current object is equal to the <paramref name="other"/> parameter; otherwise, false.
|
|||
/// </returns>
|
|||
/// <param name="other">An object to compare with this object.</param>
|
|||
public bool Equals(Rectangle other) |
|||
{ |
|||
return this.X.Equals(other.X) && this.Y.Equals(other.Y) |
|||
&& this.Width.Equals(other.Width) && this.Height.Equals(other.Height); |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Returns the hash code for this instance.
|
|||
/// </summary>
|
|||
/// <param name="rectangle">
|
|||
/// The instance of <see cref="Rectangle"/> to return the hash code for.
|
|||
/// </param>
|
|||
/// <returns>
|
|||
/// A 32-bit signed integer that is the hash code for this instance.
|
|||
/// </returns>
|
|||
private int GetHashCode(Rectangle rectangle) |
|||
{ |
|||
unchecked |
|||
{ |
|||
int hashCode = rectangle.X.GetHashCode(); |
|||
hashCode = (hashCode * 397) ^ rectangle.Y.GetHashCode(); |
|||
hashCode = (hashCode * 397) ^ rectangle.Width.GetHashCode(); |
|||
hashCode = (hashCode * 397) ^ rectangle.Height.GetHashCode(); |
|||
return hashCode; |
|||
} |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,175 @@ |
|||
// --------------------------------------------------------------------------------------------------------------------
|
|||
// <copyright file="Size.cs" company="James South">
|
|||
// Copyright © James South and contributors.
|
|||
// Licensed under the Apache License, Version 2.0.
|
|||
// </copyright>
|
|||
// <summary>
|
|||
// Stores an ordered pair of integers, which specify a height and width.
|
|||
// </summary>
|
|||
// --------------------------------------------------------------------------------------------------------------------
|
|||
|
|||
namespace ImageProcessor |
|||
{ |
|||
using System; |
|||
using System.ComponentModel; |
|||
using System.Globalization; |
|||
|
|||
/// <summary>
|
|||
/// Stores an ordered pair of integers, which specify a height and width.
|
|||
/// </summary>
|
|||
public struct Size : IEquatable<Size> |
|||
{ |
|||
/// <summary>
|
|||
/// Represents a <see cref="Size"/> that has Width and Height values set to zero.
|
|||
/// </summary>
|
|||
public static readonly Size Empty = new Size(); |
|||
|
|||
/// <summary>
|
|||
/// The width of this <see cref="Size"/>.
|
|||
/// </summary>
|
|||
public int Width; |
|||
|
|||
/// <summary>
|
|||
/// The height of this <see cref="Size"/>.
|
|||
/// </summary>
|
|||
public int Height; |
|||
|
|||
/// <summary>
|
|||
/// Initializes a new instance of the <see cref="Size"/> struct.
|
|||
/// </summary>
|
|||
/// <param name="width">
|
|||
/// The width of the size.
|
|||
/// </param>
|
|||
/// <param name="height">
|
|||
/// The height of the size.
|
|||
/// </param>
|
|||
public Size(int width, int height) |
|||
{ |
|||
this.Width = width; |
|||
this.Height = height; |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Gets a value indicating whether this <see cref="Size"/> is empty.
|
|||
/// </summary>
|
|||
[EditorBrowsable(EditorBrowsableState.Never)] |
|||
public bool IsEmpty |
|||
{ |
|||
get |
|||
{ |
|||
return this.Width == 0 && this.Height == 0; |
|||
} |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Compares two <see cref="Size"/> objects. The result specifies whether the values
|
|||
/// <see cref="Size.Width"/> and the <see cref="Size.Height"/>properties of the two
|
|||
/// <see cref="Size"/> objects are equal.
|
|||
/// </summary>
|
|||
/// <param name="left">
|
|||
/// The <see cref="Size"/> on the left side of the operand.
|
|||
/// </param>
|
|||
/// <param name="right">
|
|||
/// The <see cref="Size"/> on the right side of the operand.
|
|||
/// </param>
|
|||
/// <returns>
|
|||
/// True if the current left is equal to the <paramref name="right"/> parameter; otherwise, false.
|
|||
/// </returns>
|
|||
public static bool operator ==(Size left, Size right) |
|||
{ |
|||
return left.Equals(right); |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Compares two <see cref="Size"/> objects. The result specifies whether the values
|
|||
/// <see cref="Size.Width"/> and the <see cref="Size.Height"/>properties of the two
|
|||
/// <see cref="Size"/> objects are unequal.
|
|||
/// </summary>
|
|||
/// <param name="left">
|
|||
/// The <see cref="Size"/> on the left side of the operand.
|
|||
/// </param>
|
|||
/// <param name="right">
|
|||
/// The <see cref="Size"/> on the right side of the operand.
|
|||
/// </param>
|
|||
/// <returns>
|
|||
/// True if the current left is unequal to the <paramref name="right"/> parameter; otherwise, false.
|
|||
/// </returns>
|
|||
public static bool operator !=(Size left, Size right) |
|||
{ |
|||
return !left.Equals(right); |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Indicates whether this instance and a specified object are equal.
|
|||
/// </summary>
|
|||
/// <returns>
|
|||
/// True if <paramref name="obj"/> and this instance are the same type and represent the same value; otherwise, false.
|
|||
/// </returns>
|
|||
/// <param name="obj">The object to compare with the current instance. </param>
|
|||
public override bool Equals(object obj) |
|||
{ |
|||
if (!(obj is Size)) |
|||
{ |
|||
return false; |
|||
} |
|||
|
|||
Size other = (Size)obj; |
|||
|
|||
return other.Width == this.Width && other.Height == this.Height; |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Returns the hash code for this instance.
|
|||
/// </summary>
|
|||
/// <returns>
|
|||
/// A 32-bit signed integer that is the hash code for this instance.
|
|||
/// </returns>
|
|||
public override int GetHashCode() |
|||
{ |
|||
return this.GetHashCode(this); |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Returns the fully qualified type name of this instance.
|
|||
/// </summary>
|
|||
/// <returns>
|
|||
/// A <see cref="T:System.String"/> containing a fully qualified type name.
|
|||
/// </returns>
|
|||
public override string ToString() |
|||
{ |
|||
return "{Width=" + this.Width.ToString(CultureInfo.CurrentCulture) |
|||
+ ",Height=" + this.Height.ToString(CultureInfo.CurrentCulture) + "}"; |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Indicates whether the current object is equal to another object of the same type.
|
|||
/// </summary>
|
|||
/// <returns>
|
|||
/// True if the current object is equal to the <paramref name="other"/> parameter; otherwise, false.
|
|||
/// </returns>
|
|||
/// <param name="other">An object to compare with this object.</param>
|
|||
public bool Equals(Size other) |
|||
{ |
|||
return this.Width.Equals(other.Width) && this.Height.Equals(other.Height); |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Returns the hash code for this instance.
|
|||
/// </summary>
|
|||
/// <param name="size">
|
|||
/// The instance of <see cref="Size"/> to return the hash code for.
|
|||
/// </param>
|
|||
/// <returns>
|
|||
/// A 32-bit signed integer that is the hash code for this instance.
|
|||
/// </returns>
|
|||
private int GetHashCode(Size size) |
|||
{ |
|||
unchecked |
|||
{ |
|||
int hashCode = size.Width.GetHashCode(); |
|||
hashCode = (hashCode * 397) ^ size.Height.GetHashCode(); |
|||
return hashCode; |
|||
} |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,110 @@ |
|||
<?xml version="1.0" encoding="utf-8"?> |
|||
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> |
|||
<Import Project="..\..\packages\xunit.core.2.0.0\build\portable-net45+win+wpa81+wp80+monotouch+monoandroid+Xamarin.iOS\xunit.core.props" Condition="Exists('..\..\packages\xunit.core.2.0.0\build\portable-net45+win+wpa81+wp80+monotouch+monoandroid+Xamarin.iOS\xunit.core.props')" /> |
|||
<PropertyGroup> |
|||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> |
|||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> |
|||
<ProjectGuid>{1741DC66-5404-4B15-AE58-B7721F1568A4}</ProjectGuid> |
|||
<OutputType>Library</OutputType> |
|||
<AppDesignerFolder>Properties</AppDesignerFolder> |
|||
<RootNamespace>ImageProcessor.Tests</RootNamespace> |
|||
<AssemblyName>ImageProcessor.Tests</AssemblyName> |
|||
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion> |
|||
<FileAlignment>512</FileAlignment> |
|||
<ProjectTypeGuids>{3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> |
|||
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">10.0</VisualStudioVersion> |
|||
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath> |
|||
<ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\$(VisualStudioVersion)\UITestExtensionPackages</ReferencePath> |
|||
<IsCodedUITest>False</IsCodedUITest> |
|||
<TestProjectType>UnitTest</TestProjectType> |
|||
<NuGetPackageImportStamp>a2e7ca05</NuGetPackageImportStamp> |
|||
</PropertyGroup> |
|||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> |
|||
<DebugSymbols>true</DebugSymbols> |
|||
<DebugType>full</DebugType> |
|||
<Optimize>false</Optimize> |
|||
<OutputPath>bin\Debug\</OutputPath> |
|||
<DefineConstants>DEBUG;TRACE</DefineConstants> |
|||
<ErrorReport>prompt</ErrorReport> |
|||
<WarningLevel>4</WarningLevel> |
|||
</PropertyGroup> |
|||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> |
|||
<DebugType>pdbonly</DebugType> |
|||
<Optimize>true</Optimize> |
|||
<OutputPath>bin\Release\</OutputPath> |
|||
<DefineConstants>TRACE</DefineConstants> |
|||
<ErrorReport>prompt</ErrorReport> |
|||
<WarningLevel>4</WarningLevel> |
|||
</PropertyGroup> |
|||
<ItemGroup> |
|||
<Reference Include="System" /> |
|||
<Reference Include="xunit.abstractions, Version=2.0.0.0, Culture=neutral, PublicKeyToken=8d05b1bb7a6fdb6c, processorArchitecture=MSIL"> |
|||
<HintPath>..\..\packages\xunit.abstractions.2.0.0\lib\net35\xunit.abstractions.dll</HintPath> |
|||
<Private>True</Private> |
|||
</Reference> |
|||
<Reference Include="xunit.assert, Version=2.0.0.2929, Culture=neutral, PublicKeyToken=8d05b1bb7a6fdb6c, processorArchitecture=MSIL"> |
|||
<HintPath>..\..\packages\xunit.assert.2.0.0\lib\portable-net45+win+wpa81+wp80+monotouch+monoandroid+Xamarin.iOS\xunit.assert.dll</HintPath> |
|||
<Private>True</Private> |
|||
</Reference> |
|||
<Reference Include="xunit.core, Version=2.0.0.2929, Culture=neutral, PublicKeyToken=8d05b1bb7a6fdb6c, processorArchitecture=MSIL"> |
|||
<HintPath>..\..\packages\xunit.extensibility.core.2.0.0\lib\portable-net45+win+wpa81+wp80+monotouch+monoandroid+Xamarin.iOS\xunit.core.dll</HintPath> |
|||
<Private>True</Private> |
|||
</Reference> |
|||
</ItemGroup> |
|||
<Choose> |
|||
<When Condition="('$(VisualStudioVersion)' == '10.0' or '$(VisualStudioVersion)' == '') and '$(TargetFrameworkVersion)' == 'v3.5'"> |
|||
<ItemGroup> |
|||
<Reference Include="Microsoft.VisualStudio.QualityTools.UnitTestFramework, Version=10.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" /> |
|||
</ItemGroup> |
|||
</When> |
|||
<Otherwise /> |
|||
</Choose> |
|||
<ItemGroup> |
|||
<Compile Include="Numerics\RectangleTests.cs" /> |
|||
<Compile Include="Numerics\PointTests.cs" /> |
|||
<Compile Include="Numerics\SizeTests.cs" /> |
|||
<Compile Include="Properties\AssemblyInfo.cs" /> |
|||
</ItemGroup> |
|||
<ItemGroup> |
|||
<None Include="packages.config" /> |
|||
</ItemGroup> |
|||
<ItemGroup> |
|||
<ProjectReference Include="..\..\src\ImageProcessor\ImageProcessor.csproj"> |
|||
<Project>{8047C4AC-7097-4DE4-B00D-6D55EBCF1D36}</Project> |
|||
<Name>ImageProcessor</Name> |
|||
</ProjectReference> |
|||
</ItemGroup> |
|||
<Choose> |
|||
<When Condition="'$(VisualStudioVersion)' == '10.0' And '$(IsCodedUITest)' == 'True'"> |
|||
<ItemGroup> |
|||
<Reference Include="Microsoft.VisualStudio.QualityTools.CodedUITestFramework, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL"> |
|||
<Private>False</Private> |
|||
</Reference> |
|||
<Reference Include="Microsoft.VisualStudio.TestTools.UITest.Common, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL"> |
|||
<Private>False</Private> |
|||
</Reference> |
|||
<Reference Include="Microsoft.VisualStudio.TestTools.UITest.Extension, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL"> |
|||
<Private>False</Private> |
|||
</Reference> |
|||
<Reference Include="Microsoft.VisualStudio.TestTools.UITesting, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL"> |
|||
<Private>False</Private> |
|||
</Reference> |
|||
</ItemGroup> |
|||
</When> |
|||
</Choose> |
|||
<Import Project="$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets" Condition="Exists('$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets')" /> |
|||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> |
|||
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild"> |
|||
<PropertyGroup> |
|||
<ErrorText>This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText> |
|||
</PropertyGroup> |
|||
<Error Condition="!Exists('..\..\packages\xunit.core.2.0.0\build\portable-net45+win+wpa81+wp80+monotouch+monoandroid+Xamarin.iOS\xunit.core.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\xunit.core.2.0.0\build\portable-net45+win+wpa81+wp80+monotouch+monoandroid+Xamarin.iOS\xunit.core.props'))" /> |
|||
</Target> |
|||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it. |
|||
Other similar extension points exist, see Microsoft.Common.targets. |
|||
<Target Name="BeforeBuild"> |
|||
</Target> |
|||
<Target Name="AfterBuild"> |
|||
</Target> |
|||
--> |
|||
</Project> |
|||
@ -0,0 +1,2 @@ |
|||
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation"> |
|||
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=numerics/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary> |
|||
@ -0,0 +1,55 @@ |
|||
// --------------------------------------------------------------------------------------------------------------------
|
|||
// <copyright file="PointTests.cs" company="James South">
|
|||
// Copyright © James South and contributors.
|
|||
// Licensed under the Apache License, Version 2.0.
|
|||
// </copyright>
|
|||
// <summary>
|
|||
// Tests the <see cref="Point" /> struct.
|
|||
// </summary>
|
|||
// --------------------------------------------------------------------------------------------------------------------
|
|||
|
|||
namespace ImageProcessor.Tests |
|||
{ |
|||
using Xunit; |
|||
|
|||
/// <summary>
|
|||
/// Tests the <see cref="Point"/> struct.
|
|||
/// </summary>
|
|||
public class PointTests |
|||
{ |
|||
/// <summary>
|
|||
/// Tests the equality operators for equality.
|
|||
/// </summary>
|
|||
[Fact] |
|||
public void AreEqual() |
|||
{ |
|||
Point first = new Point(100, 100); |
|||
Point second = new Point(100, 100); |
|||
|
|||
Assert.Equal(first, second); |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Tests the equality operators for inequality.
|
|||
/// </summary>
|
|||
[Fact] |
|||
public void AreNotEqual() |
|||
{ |
|||
Point first = new Point(0, 100); |
|||
Point second = new Point(100, 100); |
|||
|
|||
Assert.NotEqual(first, second); |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Tests whether the point constructor correctly assign properties.
|
|||
/// </summary>
|
|||
[Fact] |
|||
public void ConstructorAssignsProperties() |
|||
{ |
|||
Point first = new Point(4, 5); |
|||
Assert.Equal(4, first.X); |
|||
Assert.Equal(5, first.Y); |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,71 @@ |
|||
// --------------------------------------------------------------------------------------------------------------------
|
|||
// <copyright file="RectangleTests.cs" company="James South">
|
|||
// Copyright © James South and contributors.
|
|||
// Licensed under the Apache License, Version 2.0.
|
|||
// </copyright>
|
|||
// <summary>
|
|||
// Tests the <see cref="Rectangle" /> struct.
|
|||
// </summary>
|
|||
// --------------------------------------------------------------------------------------------------------------------
|
|||
|
|||
namespace ImageProcessor.Tests |
|||
{ |
|||
using Xunit; |
|||
|
|||
/// <summary>
|
|||
/// Tests the <see cref="Rectangle"/> struct.
|
|||
/// </summary>
|
|||
public class RectangleTests |
|||
{ |
|||
/// <summary>
|
|||
/// Tests the equality operators for equality.
|
|||
/// </summary>
|
|||
[Fact] |
|||
public void AreEqual() |
|||
{ |
|||
Rectangle first = new Rectangle(1, 1, 100, 100); |
|||
Rectangle second = new Rectangle(1, 1, 100, 100); |
|||
|
|||
Assert.Equal(first, second); |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Tests the equality operators for inequality.
|
|||
/// </summary>
|
|||
[Fact] |
|||
public void AreNotEqual() |
|||
{ |
|||
Rectangle first = new Rectangle(1, 1, 0, 100); |
|||
Rectangle second = new Rectangle(1, 1, 100, 100); |
|||
|
|||
Assert.NotEqual(first, second); |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Tests whether the rectangle constructors correctly assign properties.
|
|||
/// </summary>
|
|||
[Fact] |
|||
public void ConstructorAssignsProperties() |
|||
{ |
|||
Rectangle first = new Rectangle(1, 1, 50, 100); |
|||
Assert.Equal(1, first.X); |
|||
Assert.Equal(1, first.Y); |
|||
Assert.Equal(50, first.Width); |
|||
Assert.Equal(100, first.Height); |
|||
Assert.Equal(1, first.Top); |
|||
Assert.Equal(51, first.Right); |
|||
Assert.Equal(101, first.Bottom); |
|||
Assert.Equal(1, first.Left); |
|||
|
|||
Rectangle second = new Rectangle(new Point(1, 1), new Size(50, 100)); |
|||
Assert.Equal(1, second.X); |
|||
Assert.Equal(1, second.Y); |
|||
Assert.Equal(50, second.Width); |
|||
Assert.Equal(100, second.Height); |
|||
Assert.Equal(1, second.Top); |
|||
Assert.Equal(51, second.Right); |
|||
Assert.Equal(101, second.Bottom); |
|||
Assert.Equal(1, second.Left); |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,55 @@ |
|||
// --------------------------------------------------------------------------------------------------------------------
|
|||
// <copyright file="SizeTests.cs" company="James South">
|
|||
// Copyright © James South and contributors.
|
|||
// Licensed under the Apache License, Version 2.0.
|
|||
// </copyright>
|
|||
// <summary>
|
|||
// Tests the <see cref="Size" /> struct.
|
|||
// </summary>
|
|||
// --------------------------------------------------------------------------------------------------------------------
|
|||
|
|||
namespace ImageProcessor.Tests |
|||
{ |
|||
using Xunit; |
|||
|
|||
/// <summary>
|
|||
/// Tests the <see cref="Size"/> struct.
|
|||
/// </summary>
|
|||
public class SizeTests |
|||
{ |
|||
/// <summary>
|
|||
/// Tests the equality operators for equality.
|
|||
/// </summary>
|
|||
[Fact] |
|||
public void AreEqual() |
|||
{ |
|||
Size first = new Size(100, 100); |
|||
Size second = new Size(100, 100); |
|||
|
|||
Assert.Equal(first, second); |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Tests the equality operators for inequality.
|
|||
/// </summary>
|
|||
[Fact] |
|||
public void AreNotEqual() |
|||
{ |
|||
Size first = new Size(0, 100); |
|||
Size second = new Size(100, 100); |
|||
|
|||
Assert.NotEqual(first, second); |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Tests whether the size constructor correctly assign properties.
|
|||
/// </summary>
|
|||
[Fact] |
|||
public void ConstructorAssignsProperties() |
|||
{ |
|||
Size first = new Size(4, 5); |
|||
Assert.Equal(4, first.Width); |
|||
Assert.Equal(5, first.Height); |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,36 @@ |
|||
using System.Reflection; |
|||
using System.Runtime.CompilerServices; |
|||
using System.Runtime.InteropServices; |
|||
|
|||
// General Information about an assembly is controlled through the following
|
|||
// set of attributes. Change these attribute values to modify the information
|
|||
// associated with an assembly.
|
|||
[assembly: AssemblyTitle("ImageProcessor.Tests")] |
|||
[assembly: AssemblyDescription("A library for on-the-fly processing of image files written in C#")] |
|||
[assembly: AssemblyConfiguration("")] |
|||
[assembly: AssemblyCompany("")] |
|||
[assembly: AssemblyProduct("ImageProcessor")] |
|||
[assembly: AssemblyCopyright("Copyright © James South and contributors.")] |
|||
[assembly: AssemblyTrademark("")] |
|||
[assembly: AssemblyCulture("")] |
|||
|
|||
// Setting ComVisible to false makes the types in this assembly not visible
|
|||
// to COM components. If you need to access a type in this assembly from
|
|||
// COM, set the ComVisible attribute to true on that type.
|
|||
[assembly: ComVisible(false)] |
|||
|
|||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
|||
[assembly: Guid("8fea7d87-3f18-465a-b15f-abb1783c95bc")] |
|||
|
|||
// Version information for an assembly consists of the following four values:
|
|||
//
|
|||
// Major Version
|
|||
// Minor Version
|
|||
// Build Number
|
|||
// Revision
|
|||
//
|
|||
// You can specify all the values or you can default the Build and Revision Numbers
|
|||
// by using the '*' as shown below:
|
|||
// [assembly: AssemblyVersion("1.0.*")]
|
|||
[assembly: AssemblyVersion("1.0.0.0")] |
|||
[assembly: AssemblyFileVersion("1.0.0.0")] |
|||
@ -0,0 +1,8 @@ |
|||
<?xml version="1.0" encoding="utf-8"?> |
|||
<packages> |
|||
<package id="xunit" version="2.0.0" targetFramework="net45" /> |
|||
<package id="xunit.abstractions" version="2.0.0" targetFramework="net45" /> |
|||
<package id="xunit.assert" version="2.0.0" targetFramework="net45" /> |
|||
<package id="xunit.core" version="2.0.0" targetFramework="net45" /> |
|||
<package id="xunit.extensibility.core" version="2.0.0" targetFramework="net45" /> |
|||
</packages> |
|||
Loading…
Reference in new issue