Imported Upstream version 5.2.0.175

Former-commit-id: bb0468d0f257ff100aa895eb5fe583fb5dfbf900
This commit is contained in:
Xamarin Public Jenkins (auto-signing)
2017-06-07 13:16:24 +00:00
parent 4bdbaf4a88
commit 966bba02bb
8776 changed files with 346420 additions and 149650 deletions

View File

@ -36,7 +36,6 @@ using NUnit.Framework;
namespace MonoTests.System.Drawing.Drawing2D {
[TestFixture]
[SecurityPermission (SecurityAction.Deny, UnmanagedCode = true)]
public class PathGradientBrushTest {
private Point[] pts_2i;
@ -91,30 +90,27 @@ namespace MonoTests.System.Drawing.Drawing2D {
}
[Test]
[ExpectedException (typeof (ArgumentNullException))]
public void Constructor_GraphicsPath_Null ()
{
GraphicsPath gp = null;
new PathGradientBrush (gp);
Assert.Throws<ArgumentNullException> (() => new PathGradientBrush (gp));
}
[Test]
[ExpectedException (typeof (OutOfMemoryException))]
public void Constructor_GraphicsPath_Empty ()
{
using (GraphicsPath gp = new GraphicsPath ()) {
new PathGradientBrush (gp);
Assert.Throws<OutOfMemoryException> (() => new PathGradientBrush (gp));
}
}
[Test]
[ExpectedException (typeof (OutOfMemoryException))]
public void Constructor_GraphicsPath_SinglePoint ()
{
using (GraphicsPath gp = new GraphicsPath ()) {
gp.AddLines (new Point[1] { new Point (1, 1) });
// Special case - a line with a single point is valid
new PathGradientBrush (gp);
Assert.Throws<OutOfMemoryException> (() => new PathGradientBrush (gp));
}
}
@ -131,27 +127,24 @@ namespace MonoTests.System.Drawing.Drawing2D {
}
[Test]
[ExpectedException (typeof (ArgumentNullException))]
public void Constructor_Point_Null ()
{
Point[] pts = null;
new PathGradientBrush (pts);
Assert.Throws<ArgumentNullException> (() => new PathGradientBrush (pts));
}
[Test]
[ExpectedException (typeof (OutOfMemoryException))]
public void Constructor_Point_Empty ()
{
Point[] pts = new Point [0];
new PathGradientBrush (pts);
Assert.Throws<OutOfMemoryException> (() => new PathGradientBrush (pts));
}
[Test]
[ExpectedException (typeof (OutOfMemoryException))]
public void Constructor_Point_One ()
{
Point[] pts = new Point[1] { new Point (1, 1) };
new PathGradientBrush (pts);
Assert.Throws<OutOfMemoryException> (() => new PathGradientBrush (pts));
}
[Test]
@ -209,27 +202,24 @@ namespace MonoTests.System.Drawing.Drawing2D {
}
[Test]
[ExpectedException (typeof (ArgumentNullException))]
public void Constructor_PointF_Null ()
{
PointF[] pts = null;
new PathGradientBrush (pts);
Assert.Throws<ArgumentNullException> (() => new PathGradientBrush (pts));
}
[Test]
[ExpectedException (typeof (OutOfMemoryException))]
public void Constructor_PointF_Empty ()
{
PointF[] pts = new PointF[0];
new PathGradientBrush (pts);
Assert.Throws<OutOfMemoryException> (() => new PathGradientBrush (pts));
}
[Test]
[ExpectedException (typeof (OutOfMemoryException))]
public void Constructor_PointF_One ()
{
PointF[] pts = new PointF[1] { new PointF (1, 1) };
new PathGradientBrush (pts);
Assert.Throws<OutOfMemoryException> (() => new PathGradientBrush (pts));
}
[Test]
@ -242,10 +232,9 @@ namespace MonoTests.System.Drawing.Drawing2D {
}
[Test]
[ExpectedException (typeof (InvalidEnumArgumentException))]
public void Constructor_PointF_WrapMode_Invalid ()
{
PathGradientBrush pgb = new PathGradientBrush (pts_2f, (WrapMode)Int32.MinValue);
Assert.Throws<InvalidEnumArgumentException> (() => new PathGradientBrush (pts_2f, (WrapMode)Int32.MinValue));
}
[Test]
@ -398,11 +387,10 @@ namespace MonoTests.System.Drawing.Drawing2D {
}
[Test]
[ExpectedException (typeof (ArgumentException))]
public void SurroundColors_Empty ()
{
using (PathGradientBrush pgb = new PathGradientBrush (pts_2f, WrapMode.TileFlipXY)) {
pgb.SurroundColors = new Color[0];
Assert.Throws<ArgumentException> (() => pgb.SurroundColors = new Color[0]);
}
}
@ -448,10 +436,9 @@ namespace MonoTests.System.Drawing.Drawing2D {
}
[Test]
[ExpectedException (typeof (ArgumentNullException))]
public void Transform_Null ()
{
new PathGradientBrush (pts_2f, WrapMode.Clamp).Transform = null;
Assert.Throws<ArgumentNullException> (() => new PathGradientBrush (pts_2f, WrapMode.Clamp).Transform = null);
}
[Test]
@ -464,11 +451,10 @@ namespace MonoTests.System.Drawing.Drawing2D {
}
[Test]
[ExpectedException (typeof (ArgumentException))]
public void Transform_NonInvertible ()
{
using (PathGradientBrush pgb = new PathGradientBrush (pts_2f, WrapMode.Clamp)) {
pgb.Transform = new Matrix (123, 24, 82, 16, 47, 30);
Assert.Throws<ArgumentException> (() => pgb.Transform = new Matrix (123, 24, 82, 16, 47, 30));
}
}
@ -484,11 +470,10 @@ namespace MonoTests.System.Drawing.Drawing2D {
}
[Test]
[ExpectedException (typeof (InvalidEnumArgumentException))]
public void WrapMode_Invalid ()
{
using (PathGradientBrush pgb = new PathGradientBrush (pts_2f, WrapMode.Clamp)) {
pgb.WrapMode = (WrapMode) Int32.MinValue;
Assert.Throws<InvalidEnumArgumentException> (() => pgb.WrapMode = (WrapMode) Int32.MinValue);
}
}
@ -507,20 +492,18 @@ namespace MonoTests.System.Drawing.Drawing2D {
}
[Test]
[ExpectedException (typeof (ArgumentNullException))]
public void MultiplyTransform1_Null ()
{
using (PathGradientBrush pgb = new PathGradientBrush (pts_2f, WrapMode.Clamp)) {
pgb.MultiplyTransform (null);
Assert.Throws<ArgumentNullException> (() => pgb.MultiplyTransform (null));
}
}
[Test]
[ExpectedException (typeof (ArgumentNullException))]
public void MultiplyTransform2_Null ()
{
using (PathGradientBrush pgb = new PathGradientBrush (pts_2f, WrapMode.Clamp)) {
pgb.MultiplyTransform (null, MatrixOrder.Append);
Assert.Throws<ArgumentNullException> (() => pgb.MultiplyTransform (null, MatrixOrder.Append));
}
}
@ -533,12 +516,11 @@ namespace MonoTests.System.Drawing.Drawing2D {
}
[Test]
[ExpectedException (typeof (ArgumentException))]
public void MultiplyTransform_NonInvertible ()
{
using (Matrix noninvertible = new Matrix (123, 24, 82, 16, 47, 30)) {
using (PathGradientBrush pgb = new PathGradientBrush (pts_2f, WrapMode.Clamp)) {
pgb.MultiplyTransform (noninvertible);
Assert.Throws<ArgumentException> (() => pgb.MultiplyTransform (noninvertible));
}
}
}
@ -607,11 +589,10 @@ namespace MonoTests.System.Drawing.Drawing2D {
}
[Test]
[ExpectedException (typeof (ArgumentException))]
public void RotateTransform_InvalidOrder ()
{
using (PathGradientBrush pgb = new PathGradientBrush (pts_2f, WrapMode.Clamp)) {
pgb.RotateTransform (720, (MatrixOrder) Int32.MinValue);
Assert.Throws<ArgumentException> (() => pgb.RotateTransform (720, (MatrixOrder) Int32.MinValue));
}
}
@ -649,11 +630,10 @@ namespace MonoTests.System.Drawing.Drawing2D {
}
[Test]
[ExpectedException (typeof (ArgumentException))]
public void ScaleTransform_InvalidOrder ()
{
using (PathGradientBrush pgb = new PathGradientBrush (pts_2f, WrapMode.Clamp)) {
pgb.ScaleTransform (1, 1, (MatrixOrder) Int32.MinValue);
Assert.Throws<ArgumentException> (() => pgb.ScaleTransform (1, 1, (MatrixOrder) Int32.MinValue));
}
}
@ -692,38 +672,34 @@ namespace MonoTests.System.Drawing.Drawing2D {
}
[Test]
[ExpectedException (typeof (ArgumentException))]
public void SetBlendTriangularShape_FocusTooSmall ()
{
using (PathGradientBrush pgb = new PathGradientBrush (pts_2f, WrapMode.Clamp)) {
pgb.SetBlendTriangularShape (-1);
Assert.Throws<ArgumentException> (() => pgb.SetBlendTriangularShape (-1));
}
}
[Test]
[ExpectedException (typeof (ArgumentException))]
public void SetBlendTriangularShape_FocusTooBig ()
{
using (PathGradientBrush pgb = new PathGradientBrush (pts_2f, WrapMode.Clamp)) {
pgb.SetBlendTriangularShape (1.01f);
Assert.Throws<ArgumentException> (() => pgb.SetBlendTriangularShape (1.01f));
}
}
[Test]
[ExpectedException (typeof (ArgumentException))]
public void SetBlendTriangularShape_ScaleTooSmall ()
{
using (PathGradientBrush pgb = new PathGradientBrush (pts_2f, WrapMode.Clamp)) {
pgb.SetBlendTriangularShape (1, -1);
Assert.Throws<ArgumentException> (() => pgb.SetBlendTriangularShape (1, -1));
}
}
[Test]
[ExpectedException (typeof (ArgumentException))]
public void SetBlendTriangularShape_ScaleTooBig ()
{
using (PathGradientBrush pgb = new PathGradientBrush (pts_2f, WrapMode.Clamp)) {
pgb.SetBlendTriangularShape (1, 1.01f);
Assert.Throws<ArgumentException> (() => pgb.SetBlendTriangularShape (1, 1.01f));
}
}
@ -762,38 +738,34 @@ namespace MonoTests.System.Drawing.Drawing2D {
}
[Test]
[ExpectedException (typeof (ArgumentException))]
public void SetSigmaBellShape_FocusTooSmall ()
{
using (PathGradientBrush pgb = new PathGradientBrush (pts_2f, WrapMode.Clamp)) {
pgb.SetSigmaBellShape (-1);
Assert.Throws<ArgumentException> (() => pgb.SetSigmaBellShape (-1));
}
}
[Test]
[ExpectedException (typeof (ArgumentException))]
public void SetSigmaBellShape_FocusTooBig ()
{
using (PathGradientBrush pgb = new PathGradientBrush (pts_2f, WrapMode.Clamp)) {
pgb.SetSigmaBellShape (1.01f);
Assert.Throws<ArgumentException> (() => pgb.SetSigmaBellShape (1.01f));
}
}
[Test]
[ExpectedException (typeof (ArgumentException))]
public void SetSigmaBellShape_ScaleTooSmall ()
{
using (PathGradientBrush pgb = new PathGradientBrush (pts_2f, WrapMode.Clamp)) {
pgb.SetSigmaBellShape (1, -1);
Assert.Throws<ArgumentException> (() => pgb.SetSigmaBellShape (1, -1));
}
}
[Test]
[ExpectedException (typeof (ArgumentException))]
public void SetSigmaBellShape_ScaleTooBig ()
{
using (PathGradientBrush pgb = new PathGradientBrush (pts_2f, WrapMode.Clamp)) {
pgb.SetSigmaBellShape (1, 1.01f);
Assert.Throws<ArgumentException> (() => pgb.SetSigmaBellShape (1, 1.01f));
}
}
@ -823,11 +795,10 @@ namespace MonoTests.System.Drawing.Drawing2D {
}
[Test]
[ExpectedException (typeof (ArgumentException))]
public void TranslateTransform_InvalidOrder ()
{
using (PathGradientBrush pgb = new PathGradientBrush (pts_2f, WrapMode.Clamp)) {
pgb.TranslateTransform (1, 1, (MatrixOrder) Int32.MinValue);
Assert.Throws<ArgumentException> (() => pgb.TranslateTransform (1, 1, (MatrixOrder) Int32.MinValue));
}
}
@ -877,37 +848,34 @@ namespace MonoTests.System.Drawing.Drawing2D {
}
[Test]
[ExpectedException (typeof (NullReferenceException))]
public void Blend_Null ()
{
using (GraphicsPath gp = new GraphicsPath ()) {
gp.AddLines (pts_2f);
using (PathGradientBrush pgb = new PathGradientBrush (gp)) {
pgb.Blend = null;
Assert.Throws<NullReferenceException> (() => pgb.Blend = null);
}
}
}
[Test]
[ExpectedException (typeof (NullReferenceException))]
public void InterpolationColors_Null ()
{
using (GraphicsPath gp = new GraphicsPath ()) {
gp.AddLines (pts_2f);
using (PathGradientBrush pgb = new PathGradientBrush (gp)) {
pgb.InterpolationColors = null;
Assert.Throws<NullReferenceException> (() => pgb.InterpolationColors = null);
}
}
}
[Test]
[ExpectedException (typeof (NullReferenceException))]
public void SurroundColors_Null ()
{
using (GraphicsPath gp = new GraphicsPath ()) {
gp.AddLines (pts_2f);
using (PathGradientBrush pgb = new PathGradientBrush (gp)) {
pgb.SurroundColors = null;
Assert.Throws<NullReferenceException> (() => pgb.SurroundColors = null);
}
}
}