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

@@ -1 +1 @@
1d44f318763de5d215b9aaed666c3b779e3f5df9
9674c311abbd4f19156908c4fa3b2d4bc7427100

View File

@@ -325,33 +325,29 @@ namespace MonoTests.System.Drawing.Drawing2D {
}
[Test]
[ExpectedException (typeof (ArgumentException))]
public void InterpolationColors_Colors_InvalidBlend ()
{
// default Blend doesn't allow getting this property
Assert.IsNotNull (default_brush.InterpolationColors.Colors);
Assert.Throws<ArgumentException> (() => { var x = default_brush.InterpolationColors.Colors; });
}
[Test]
[ExpectedException (typeof (ArgumentException))]
public void InterpolationColors_Positions_InvalidBlend ()
{
// default Blend doesn't allow getting this property
Assert.IsNotNull (default_brush.InterpolationColors.Positions);
Assert.Throws<ArgumentException> (() => { var x = default_brush.InterpolationColors.Positions; });
}
[Test]
[ExpectedException (typeof (IndexOutOfRangeException))]
public void LinearColors_Empty ()
{
default_brush.LinearColors = new Color[0];
Assert.Throws<IndexOutOfRangeException> (() => default_brush.LinearColors = new Color[0]);
}
[Test]
[ExpectedException (typeof (IndexOutOfRangeException))]
public void LinearColors_One ()
{
default_brush.LinearColors = new Color[1];
Assert.Throws<IndexOutOfRangeException> (() => default_brush.LinearColors = new Color[1]);
}
[Test]
@@ -400,10 +396,9 @@ namespace MonoTests.System.Drawing.Drawing2D {
}
[Test]
[ExpectedException (typeof (ArgumentNullException))]
public void Transform_Null ()
{
default_brush.Transform = null;
Assert.Throws<ArgumentNullException> (() => default_brush.Transform = null);
}
[Test]
@@ -415,10 +410,9 @@ namespace MonoTests.System.Drawing.Drawing2D {
}
[Test]
[ExpectedException (typeof (ArgumentException))]
public void Transform_NonInvertible ()
{
default_brush.Transform = new Matrix (123, 24, 82, 16, 47, 30);
Assert.Throws<ArgumentException> (() => default_brush.Transform = new Matrix (123, 24, 82, 16, 47, 30));
}
[Test]
@@ -436,17 +430,15 @@ namespace MonoTests.System.Drawing.Drawing2D {
}
[Test]
[ExpectedException (typeof (ArgumentException))]
public void WrapMode_Clamp ()
{
default_brush.WrapMode = WrapMode.Clamp;
Assert.Throws<ArgumentException> (() => default_brush.WrapMode = WrapMode.Clamp);
}
[Test]
[ExpectedException (typeof (InvalidEnumArgumentException))]
public void WrapMode_Invalid ()
{
default_brush.WrapMode = (WrapMode) Int32.MinValue;
Assert.Throws<InvalidEnumArgumentException> (() => default_brush.WrapMode = (WrapMode) Int32.MinValue);
}
@@ -466,17 +458,15 @@ namespace MonoTests.System.Drawing.Drawing2D {
}
[Test]
[ExpectedException (typeof (ArgumentNullException))]
public void MultiplyTransform1_Null ()
{
default_brush.MultiplyTransform (null);
Assert.Throws<ArgumentNullException> (() => default_brush.MultiplyTransform (null));
}
[Test]
[ExpectedException (typeof (ArgumentNullException))]
public void MultiplyTransform2_Null ()
{
default_brush.MultiplyTransform (null, MatrixOrder.Append);
Assert.Throws<ArgumentNullException> (() => default_brush.MultiplyTransform (null, MatrixOrder.Append));
}
[Test]
@@ -486,11 +476,10 @@ namespace MonoTests.System.Drawing.Drawing2D {
}
[Test]
[ExpectedException (typeof (ArgumentException))]
public void MultiplyTransform_NonInvertible ()
{
Matrix noninvertible = new Matrix (123, 24, 82, 16, 47, 30);
default_brush.MultiplyTransform (noninvertible);
Assert.Throws<ArgumentException> (() => default_brush.MultiplyTransform (noninvertible));
}
[Test]
@@ -550,11 +539,10 @@ namespace MonoTests.System.Drawing.Drawing2D {
}
[Test]
[ExpectedException (typeof (ArgumentException))]
public void RotateTransform_InvalidOrder ()
{
LinearGradientBrush lgb = new LinearGradientBrush (pt1, pt2, c1, c2);
lgb.RotateTransform (720, (MatrixOrder) Int32.MinValue);
Assert.Throws<ArgumentException> (() => lgb.RotateTransform (720, (MatrixOrder) Int32.MinValue));
}
[Test]
@@ -603,11 +591,10 @@ namespace MonoTests.System.Drawing.Drawing2D {
}
[Test]
[ExpectedException (typeof (ArgumentException))]
public void ScaleTransform_InvalidOrder ()
{
LinearGradientBrush lgb = new LinearGradientBrush (pt1, pt2, c1, c2);
lgb.ScaleTransform (1, 1, (MatrixOrder) Int32.MinValue);
Assert.Throws<ArgumentException> (() => lgb.ScaleTransform (1, 1, (MatrixOrder) Int32.MinValue));
}
[Test]
@@ -643,31 +630,27 @@ namespace MonoTests.System.Drawing.Drawing2D {
}
[Test]
[ExpectedException (typeof (ArgumentException))]
public void SetBlendTriangularShape_FocusTooSmall ()
{
default_brush.SetBlendTriangularShape (-1);
Assert.Throws<ArgumentException> (() => default_brush.SetBlendTriangularShape (-1));
}
[Test]
[ExpectedException (typeof (ArgumentException))]
public void SetBlendTriangularShape_FocusTooBig ()
{
default_brush.SetBlendTriangularShape (1.01f);
Assert.Throws<ArgumentException> (() => default_brush.SetBlendTriangularShape (1.01f));
}
[Test]
[ExpectedException (typeof (ArgumentException))]
public void SetBlendTriangularShape_ScaleTooSmall ()
{
default_brush.SetBlendTriangularShape (1, -1);
Assert.Throws<ArgumentException> (() => default_brush.SetBlendTriangularShape (1, -1));
}
[Test]
[ExpectedException (typeof (ArgumentException))]
public void SetBlendTriangularShape_ScaleTooBig ()
{
default_brush.SetBlendTriangularShape (1, 1.01f);
Assert.Throws<ArgumentException> (() => default_brush.SetBlendTriangularShape (1, 1.01f));
}
[Test]
@@ -703,31 +686,27 @@ namespace MonoTests.System.Drawing.Drawing2D {
}
[Test]
[ExpectedException (typeof (ArgumentException))]
public void SetSigmaBellShape_FocusTooSmall ()
{
default_brush.SetSigmaBellShape (-1);
Assert.Throws<ArgumentException> (() => default_brush.SetSigmaBellShape (-1));
}
[Test]
[ExpectedException (typeof (ArgumentException))]
public void SetSigmaBellShape_FocusTooBig ()
{
default_brush.SetSigmaBellShape (1.01f);
Assert.Throws<ArgumentException> (() => default_brush.SetSigmaBellShape (1.01f));
}
[Test]
[ExpectedException (typeof (ArgumentException))]
public void SetSigmaBellShape_ScaleTooSmall ()
{
default_brush.SetSigmaBellShape (1, -1);
Assert.Throws<ArgumentException> (() => default_brush.SetSigmaBellShape (1, -1));
}
[Test]
[ExpectedException (typeof (ArgumentException))]
public void SetSigmaBellShape_ScaleTooBig ()
{
default_brush.SetSigmaBellShape (1, 1.01f);
Assert.Throws<ArgumentException> (() => default_brush.SetSigmaBellShape (1, 1.01f));
}
[Test]
@@ -755,11 +734,10 @@ namespace MonoTests.System.Drawing.Drawing2D {
}
[Test]
[ExpectedException (typeof (ArgumentException))]
public void TranslateTransform_InvalidOrder ()
{
LinearGradientBrush lgb = new LinearGradientBrush (pt1, pt2, c1, c2);
lgb.TranslateTransform (1, 1, (MatrixOrder) Int32.MinValue);
Assert.Throws<ArgumentException> (() => lgb.TranslateTransform (1, 1, (MatrixOrder) Int32.MinValue));
}
[Test]
@@ -875,42 +853,37 @@ namespace MonoTests.System.Drawing.Drawing2D {
}
[Test]
[ExpectedException (typeof (NullReferenceException))]
public void LinearColors_Null ()
{
default_brush.LinearColors = null;
Assert.Throws<NullReferenceException> (() => default_brush.LinearColors = null);
}
[Test]
[ExpectedException (typeof (ArgumentException))]
public void InterpolationColors_Null ()
{
default_brush.InterpolationColors = null;
Assert.Throws<ArgumentException> (() => default_brush.InterpolationColors = null);
}
[Test]
[ExpectedException (typeof (NullReferenceException))]
public void Blend_Null ()
{
default_brush.Blend = null;
Assert.Throws<NullReferenceException> (() => default_brush.Blend = null);
}
[Test]
[ExpectedException (typeof (ArgumentException))]
public void ZeroWidthRectangle ()
{
Rectangle r = new Rectangle (10, 10, 0, 10);
Assert.AreEqual (0, r.Width, "Width");
new LinearGradientBrush (r, Color.Red, Color.Blue, LinearGradientMode.Vertical);
Assert.Throws<ArgumentException> (() => new LinearGradientBrush (r, Color.Red, Color.Blue, LinearGradientMode.Vertical));
}
[Test]
[ExpectedException (typeof (ArgumentException))]
public void ZeroHeightRectangleF ()
{
RectangleF r = new RectangleF (10.0f, 10.0f, 10.0f, 0.0f);
Assert.AreEqual (0.0f, r.Height, "Height");
new LinearGradientBrush (r, Color.Red, Color.Blue, LinearGradientMode.Vertical);
Assert.Throws<ArgumentException> (() => new LinearGradientBrush (r, Color.Red, Color.Blue, LinearGradientMode.Vertical));
}
}
}

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);
}
}
}

View File

@@ -96,10 +96,9 @@ namespace MonoTests.System.Drawing.Drawing2D
}
[Test]
[ExpectedException (typeof (OverflowException))]
public void ColorBlend_Negative ()
{
ColorBlend cb = new ColorBlend (-1);
Assert.Throws<OverflowException> (() => new ColorBlend (-1));
}
[Test]

View File

@@ -38,7 +38,6 @@ using NUnit.Framework;
namespace MonoTests.System.Drawing.Drawing2D
{
[TestFixture]
[SecurityPermission (SecurityAction.Deny, UnmanagedCode = true)]
public class HatchBrushTest {
Graphics gr;
Bitmap bmp;

View File

@@ -39,16 +39,6 @@ namespace MonoTests.System.Drawing.Drawing2D
[SecurityPermission (SecurityAction.Deny, UnmanagedCode = true)]
public class MatrixTest {
private Matrix default_matrix;
private Rectangle rect;
private RectangleF rectf;
[TestFixtureSetUp]
public void FixtureSetUp ()
{
default_matrix = new Matrix ();
}
[Test]
public void Constructor_Default ()
{
@@ -83,24 +73,21 @@ namespace MonoTests.System.Drawing.Drawing2D
}
[Test]
[ExpectedException (typeof (ArgumentNullException))]
public void Constructor_Int_Null ()
{
new Matrix (rect, null);
Assert.Throws<ArgumentNullException> (() => new Matrix (default (Rectangle), null));
}
[Test]
[ExpectedException (typeof (ArgumentException))]
public void Constructor_Int_Empty ()
{
new Matrix (rect, new Point[0]);
Assert.Throws<ArgumentException> (() => new Matrix (default (Rectangle), new Point[0]));
}
[Test]
[ExpectedException (typeof (ArgumentException))]
public void Constructor_Int_4Point ()
{
new Matrix (rect, new Point[4]);
Assert.Throws<ArgumentException> (() => new Matrix (default (Rectangle), new Point[4]));
}
[Test]
@@ -118,24 +105,21 @@ namespace MonoTests.System.Drawing.Drawing2D
}
[Test]
[ExpectedException (typeof (ArgumentNullException))]
public void Constructor_Float_Null ()
{
new Matrix (rectf, null);
Assert.Throws<ArgumentNullException> (() => new Matrix (default (RectangleF), null));
}
[Test]
[ExpectedException (typeof (ArgumentException))]
public void Constructor_Float_Empty ()
{
new Matrix (rectf, new PointF[0]);
Assert.Throws<ArgumentException> (() => new Matrix (default (RectangleF), new PointF[0]));
}
[Test]
[ExpectedException (typeof (ArgumentException))]
public void Constructor_Float_2PointF ()
{
new Matrix (rectf, new PointF[2]);
Assert.Throws<ArgumentException> (() => new Matrix (default (RectangleF), new PointF[2]));
}
[Test]
@@ -332,10 +316,9 @@ namespace MonoTests.System.Drawing.Drawing2D
}
[Test]
[ExpectedException (typeof (ArgumentException))]
public void Rotate_InvalidOrder ()
{
new Matrix ().Rotate (180, (MatrixOrder) Int32.MinValue);
Assert.Throws<ArgumentException> (() => new Matrix ().Rotate (180, (MatrixOrder) Int32.MinValue));
}
[Test]
@@ -353,17 +336,15 @@ namespace MonoTests.System.Drawing.Drawing2D
}
[Test]
[ExpectedException (typeof (ArgumentException))]
public void RotateAt_InvalidOrder ()
{
new Matrix ().RotateAt (180, new PointF (10, 10), (MatrixOrder) Int32.MinValue);
Assert.Throws<ArgumentException> (() => new Matrix ().RotateAt (180, new PointF (10, 10), (MatrixOrder) Int32.MinValue));
}
[Test]
[ExpectedException (typeof (ArgumentNullException))]
public void Multiply_Null ()
{
new Matrix (10, 20, 30, 40, 50, 60).Multiply (null);
Assert.Throws<ArgumentNullException> (() => new Matrix (10, 20, 30, 40, 50, 60).Multiply (null));
}
[Test]
@@ -381,10 +362,9 @@ namespace MonoTests.System.Drawing.Drawing2D
}
[Test]
[ExpectedException (typeof (ArgumentNullException))]
public void Multiply_Null_Order ()
{
new Matrix (10, 20, 30, 40, 50, 60).Multiply (null, MatrixOrder.Append);
Assert.Throws<ArgumentNullException> (() => new Matrix (10, 20, 30, 40, 50, 60).Multiply (null, MatrixOrder.Append));
}
[Test]
@@ -416,11 +396,10 @@ namespace MonoTests.System.Drawing.Drawing2D
}
[Test]
[ExpectedException (typeof (ArgumentException))]
public void Multiply_InvalidOrder ()
{
Matrix matrix = new Matrix (10, 20, 30, 40, 50, 60);
matrix.Multiply (new Matrix (10, 20, 30, 40, 50, 60), (MatrixOrder)Int32.MinValue);
Assert.Throws<ArgumentException> (() => matrix.Multiply (new Matrix (10, 20, 30, 40, 50, 60), (MatrixOrder)Int32.MinValue));
}
[Test]
@@ -513,10 +492,9 @@ namespace MonoTests.System.Drawing.Drawing2D
}
[Test]
[ExpectedException (typeof (ArgumentException))]
public void Scale_InvalidOrder ()
{
new Matrix ().Scale (2, 1, (MatrixOrder) Int32.MinValue);
Assert.Throws<ArgumentException> (() => new Matrix ().Scale (2, 1, (MatrixOrder) Int32.MinValue));
}
[Test]
@@ -544,10 +522,9 @@ namespace MonoTests.System.Drawing.Drawing2D
}
[Test]
[ExpectedException (typeof (ArgumentException))]
public void Shear_InvalidOrder ()
{
new Matrix ().Shear (-1, 1, (MatrixOrder) Int32.MinValue);
Assert.Throws<ArgumentException> (() => new Matrix ().Shear (-1, 1, (MatrixOrder) Int32.MinValue));
}
[Test]
@@ -571,31 +548,27 @@ namespace MonoTests.System.Drawing.Drawing2D
}
[Test]
[ExpectedException (typeof (ArgumentNullException))]
public void TransformPoints_Point_Null ()
{
new Matrix ().TransformPoints ((Point[]) null);
Assert.Throws<ArgumentNullException> (() => new Matrix ().TransformPoints ((Point[]) null));
}
[Test]
[ExpectedException (typeof (ArgumentNullException))]
public void TransformPoints_PointF_Null ()
{
new Matrix ().TransformPoints ((PointF[]) null);
Assert.Throws<ArgumentNullException> (() => new Matrix ().TransformPoints ((PointF[]) null));
}
[Test]
[ExpectedException (typeof (ArgumentException))]
public void TransformPoints_Point_Empty ()
{
new Matrix ().TransformPoints (new Point[0]);
Assert.Throws<ArgumentException> (() => new Matrix ().TransformPoints (new Point[0]));
}
[Test]
[ExpectedException (typeof (ArgumentException))]
public void TransformPoints_PointF_Empty ()
{
new Matrix ().TransformPoints (new PointF[0]);
Assert.Throws<ArgumentException> (() => new Matrix ().TransformPoints (new PointF[0]));
}
[Test]
@@ -619,31 +592,27 @@ namespace MonoTests.System.Drawing.Drawing2D
}
[Test]
[ExpectedException (typeof (ArgumentNullException))]
public void TransformVectors_Point_Null ()
{
new Matrix ().TransformVectors ((Point[]) null);
Assert.Throws<ArgumentNullException> (() => new Matrix ().TransformVectors ((Point[]) null));
}
[Test]
[ExpectedException (typeof (ArgumentNullException))]
public void TransformVectors_PointF_Null ()
{
new Matrix ().TransformVectors ((PointF[]) null);
Assert.Throws<ArgumentNullException> (() => new Matrix ().TransformVectors ((PointF[]) null));
}
[Test]
[ExpectedException (typeof (ArgumentException))]
public void TransformVectors_Point_Empty ()
{
new Matrix ().TransformVectors (new Point[0]);
Assert.Throws<ArgumentException> (() => new Matrix ().TransformVectors (new Point[0]));
}
[Test]
[ExpectedException (typeof (ArgumentException))]
public void TransformVectors_PointF_Empty ()
{
new Matrix ().TransformVectors (new PointF[0]);
Assert.Throws<ArgumentException> (() => new Matrix ().TransformVectors (new PointF[0]));
}
[Test]
@@ -661,24 +630,21 @@ namespace MonoTests.System.Drawing.Drawing2D
}
[Test]
[ExpectedException (typeof (ArgumentException))]
public void Translate_InvalidOrder ()
{
new Matrix ().Translate (-1, 1, (MatrixOrder) Int32.MinValue);
Assert.Throws<ArgumentException> (() => new Matrix ().Translate (-1, 1, (MatrixOrder) Int32.MinValue));
}
[Test]
[ExpectedException (typeof (ArgumentNullException))]
public void VectorTransformPoints_Null ()
{
new Matrix ().VectorTransformPoints ((Point[]) null);
Assert.Throws<ArgumentNullException> (() => new Matrix ().VectorTransformPoints ((Point[]) null));
}
[Test]
[ExpectedException (typeof (ArgumentException))]
public void VectorTransformPoints_Empty ()
{
new Matrix ().VectorTransformPoints (new Point[0]);
Assert.Throws<ArgumentException> (() => new Matrix ().VectorTransformPoints (new Point[0]));
}
}
}

View File

@@ -38,7 +38,6 @@ using NUnit.Framework;
namespace MonoTests.System.Drawing.Imaging {
[TestFixture]
[SecurityPermission (SecurityAction.Deny, UnmanagedCode = true)]
public class GifCodecTest {
/* Get suffix to add to the filename */

View File

@@ -1 +1 @@
d8da270c896e548f1c3833281d02759fa8280aa5
31c8341496836d547566eaa10c9ed628d5763137

View File

@@ -38,7 +38,6 @@ using NUnit.Framework;
namespace MonoTests.System.Drawing.Imaging {
[TestFixture]
[SecurityPermission (SecurityAction.Deny, UnmanagedCode = true)]
public class MetafileTest {
public const string Bitmap = "bitmaps/non-inverted.bmp";
@@ -57,32 +56,28 @@ namespace MonoTests.System.Drawing.Imaging {
}
[Test]
[ExpectedException (typeof (ArgumentException))]
public void Metafile_Stream_Null ()
{
new Metafile ((Stream)null);
Assert.Throws<ArgumentException> (() => new Metafile ((Stream)null));
}
[Test]
[ExpectedException (typeof (ArgumentNullException))]
public void Metafile_String_Null ()
{
new Metafile ((string) null);
Assert.Throws<ArgumentNullException> (() => new Metafile ((string) null));
}
[Test]
[ExpectedException (typeof (ArgumentException))]
public void Metafile_String_Empty ()
{
new Metafile (String.Empty);
Assert.Throws<ArgumentException> (() => new Metafile (String.Empty));
}
[Test]
[ExpectedException (typeof (ExternalException))]
public void Metafile_String_FileDoesNotExists ()
{
string filename = getInFile ("telescope_02.wmf");
new Metafile (filename);
Assert.Throws<ExternalException> (() => new Metafile (filename));
}
[Test]
@@ -94,10 +89,9 @@ namespace MonoTests.System.Drawing.Imaging {
}
[Test]
[ExpectedException (typeof (ExternalException))]
public void GetMetafileHeader_Bitmap ()
{
new Metafile (getInFile (Bitmap));
Assert.Throws<ExternalException> (() => new Metafile (getInFile (Bitmap)));
}
static public void Check_MetaHeader_WmfPlaceable (MetaHeader mh)
@@ -284,10 +278,9 @@ namespace MonoTests.System.Drawing.Imaging {
}
[Test]
[ExpectedException (typeof (NullReferenceException))]
public void Static_GetMetafileHeader_Stream_Null ()
{
MetafileHeader header = Metafile.GetMetafileHeader ((Stream)null);
Assert.Throws<NullReferenceException> (() => Metafile.GetMetafileHeader ((Stream)null));
}
[Test]
@@ -301,10 +294,9 @@ namespace MonoTests.System.Drawing.Imaging {
}
[Test]
[ExpectedException (typeof (ArgumentNullException))]
public void Static_GetMetafileHeader_Filename_Null ()
{
MetafileHeader header = Metafile.GetMetafileHeader ((string) null);
Assert.Throws<ArgumentNullException> (() => Metafile.GetMetafileHeader ((string) null));
}
[Test]
@@ -332,14 +324,12 @@ namespace MonoTests.System.Drawing.Imaging {
}
[Test]
[ExpectedException (typeof (ArgumentException))]
public void Static_GetMetafileHeader_IntPtr_Zero ()
{
Metafile.GetMetafileHeader (IntPtr.Zero);
Assert.Throws<ArgumentException> (() => Metafile.GetMetafileHeader (IntPtr.Zero));
}
[Test]
[ExpectedException (typeof (ArgumentException))]
public void Static_GetMetafileHeader_IntPtr ()
{
string filename = MetafileTest.getInFile (MetafileTest.WmfPlaceable);
@@ -348,22 +338,20 @@ namespace MonoTests.System.Drawing.Imaging {
IntPtr hemf = mf.GetHenhmetafile ();
Assert.IsTrue (hemf != IntPtr.Zero, "GetHenhmetafile");
Metafile.GetMetafileHeader (hemf);
Assert.Throws<ArgumentException> (() => Metafile.GetMetafileHeader (hemf));
}
}
[Test]
[ExpectedException (typeof (ArgumentException))]
public void Metafile_IntPtrBool_Zero ()
{
new Metafile (IntPtr.Zero, false);
Assert.Throws<ArgumentException> (() => new Metafile (IntPtr.Zero, false));
}
[Test]
[ExpectedException (typeof (ArgumentException))]
public void Metafile_IntPtrEmfType_Zero ()
{
new Metafile (IntPtr.Zero, EmfType.EmfOnly);
Assert.Throws<ArgumentException> (() => new Metafile (IntPtr.Zero, EmfType.EmfOnly));
}
private void CheckEmptyHeader (Metafile mf, EmfType type)
@@ -407,10 +395,9 @@ namespace MonoTests.System.Drawing.Imaging {
}
[Test]
[ExpectedException (typeof (ArgumentException))]
public void Metafile_IntPtrEmfType_Invalid ()
{
Metafile_IntPtrEmfType ((EmfType)Int32.MinValue);
Assert.Throws<ArgumentException> (() => Metafile_IntPtrEmfType ((EmfType)Int32.MinValue));
}
[Test]
@@ -432,10 +419,9 @@ namespace MonoTests.System.Drawing.Imaging {
}
[Test]
[ExpectedException (typeof (ArgumentException))]
public void Metafile_IntPtrRectangle_Zero ()
{
new Metafile (IntPtr.Zero, new Rectangle (1, 2, 3, 4));
Assert.Throws<ArgumentException> (() => new Metafile (IntPtr.Zero, new Rectangle (1, 2, 3, 4)));
}
[Test]
@@ -456,10 +442,9 @@ namespace MonoTests.System.Drawing.Imaging {
}
[Test]
[ExpectedException (typeof (ArgumentException))]
public void Metafile_IntPtrRectangleF_Zero ()
{
new Metafile (IntPtr.Zero, new RectangleF (1, 2, 3, 4));
Assert.Throws<ArgumentException> (() => new Metafile (IntPtr.Zero, new RectangleF (1, 2, 3, 4)));
}
[Test]
@@ -496,10 +481,9 @@ namespace MonoTests.System.Drawing.Imaging {
}
[Test]
[ExpectedException (typeof (NullReferenceException))]
public void Metafile_StreamIntPtrEmfType_Null ()
{
Metafile_StreamEmfType (null, EmfType.EmfOnly);
Assert.Throws<NullReferenceException> (() => Metafile_StreamEmfType (null, EmfType.EmfOnly));
}
[Test]
@@ -511,11 +495,10 @@ namespace MonoTests.System.Drawing.Imaging {
}
[Test]
[ExpectedException (typeof (ArgumentException))]
public void Metafile_StreamIntPtrEmfType_Invalid ()
{
using (MemoryStream ms = new MemoryStream ()) {
Metafile_StreamEmfType (ms, (EmfType)Int32.MinValue);
Assert.Throws<ArgumentException> (() => Metafile_StreamEmfType (ms, (EmfType)Int32.MinValue));
}
}
@@ -575,24 +558,21 @@ namespace MonoTests.System.Drawing.Imaging {
}
[Test]
[ExpectedException (typeof (OutOfMemoryException))]
public void CreateFilename_MultipleGraphics_EmfOnly ()
{
CreateFilename (EmfType.EmfOnly, false);
Assert.Throws<OutOfMemoryException> (() => CreateFilename (EmfType.EmfOnly, false));
}
[Test]
[ExpectedException (typeof (OutOfMemoryException))]
public void CreateFilename_MultipleGraphics_EmfPlusDual ()
{
CreateFilename (EmfType.EmfPlusDual, false);
Assert.Throws<OutOfMemoryException> (() => CreateFilename (EmfType.EmfPlusDual, false));
}
[Test]
[ExpectedException (typeof (OutOfMemoryException))]
public void CreateFilename_MultipleGraphics_EmfPlusOnly ()
{
CreateFilename (EmfType.EmfPlusOnly, false);
Assert.Throws<OutOfMemoryException> (() => CreateFilename (EmfType.EmfPlusOnly, false));
}
[Test]

View File

@@ -38,7 +38,6 @@ using NUnit.Framework;
namespace MonoTests.System.Drawing.Imaging {
[TestFixture]
[SecurityPermission (SecurityAction.Deny, UnmanagedCode = true)]
public class PngCodecTest {
/* Get suffix to add to the filename */

View File

@@ -40,7 +40,6 @@ using System.Text;
namespace MonoTests.System.Drawing.Imaging {
[TestFixture]
[SecurityPermission (SecurityAction.Deny, UnmanagedCode = true)]
public class BmpCodecTest {
/* Get suffix to add to the filename */

View File

@@ -40,40 +40,36 @@ namespace MonoTests.System.Drawing.Imaging {
public class ColorMatrixTest {
[Test]
[ExpectedException (typeof (NullReferenceException))]
public void Constructor_Null ()
{
new ColorMatrix (null);
Assert.Throws<NullReferenceException> (() => new ColorMatrix (null));
}
[Test]
[ExpectedException (typeof (IndexOutOfRangeException))]
public void Constructor_TooSmallArraySize ()
{
new ColorMatrix (new float[][] { });
Assert.Throws<IndexOutOfRangeException> (() => new ColorMatrix (new float[][] { }));
}
[Test]
[ExpectedException (typeof (IndexOutOfRangeException))]
public void Constructor_TooWideArraySize ()
{
new ColorMatrix (new float[][] {
Assert.Throws<IndexOutOfRangeException> (() => new ColorMatrix (new float[][] {
new float[] { 0.0f, 0.1f, 0.2f, 0.3f, 0.4f, 0.5f }
});
}));
}
[Test]
[ExpectedException (typeof (IndexOutOfRangeException))]
public void Constructor_TooTallArraySize ()
{
new ColorMatrix (new float[][] {
Assert.Throws<IndexOutOfRangeException> (() => new ColorMatrix (new float[][] {
new float[] { 0.0f },
new float[] { 1.0f },
new float[] { 2.0f },
new float[] { 3.0f },
new float[] { 4.0f },
new float[] { 5.0f }
});
}));
}
[Test]
@@ -116,7 +112,6 @@ namespace MonoTests.System.Drawing.Imaging {
}
[Test]
[ExpectedException (typeof (IndexOutOfRangeException))]
public void TooBigItems ()
{
ColorMatrix cm = new ColorMatrix (new float[][] {
@@ -127,7 +122,7 @@ namespace MonoTests.System.Drawing.Imaging {
new float[] { 4.0f, 4.1f, 4.2f, 4.3f, 4.4f, 4.5f },
new float[] { 5.0f, 5.1f, 5.2f, 5.3f, 5.4f, 5.5f }
});
Assert.AreEqual (5.5f, cm[5,5], "out");
Assert.Throws<IndexOutOfRangeException> (() => { var x = cm[5, 5]; });
}
[Test]
@@ -169,10 +164,10 @@ namespace MonoTests.System.Drawing.Imaging {
{
ColorMatrix cm = new ColorMatrix (new float[][] {
new float[] {0.393f, 0.349f, 0.272f, 0, 0},
new float[] {0.769f, 0.686f, 0.534f, 0, 0},
new float[] {0.189f, 0.168f, 0.131f, 0, 0},
new float[] { 0, 0, 0, 1, 0},
new float[] { 0, 0, 0, 0, 1}
new float[] {0.769f, 0.686f, 0.534f, 0, 0},
new float[] {0.189f, 0.168f, 0.131f, 0, 0},
new float[] { 0, 0, 0, 1, 0},
new float[] { 0, 0, 0, 0, 1}
});
Assert.AreEqual (0.393f, cm.Matrix00, "00");

View File

@@ -36,7 +36,6 @@ using NUnit.Framework;
namespace MonoTests.System.Drawing.Imaging {
[TestFixture]
[SecurityPermission (SecurityAction.Deny, UnmanagedCode = true)]
public class ImageAttributesTest {
static ColorMatrix global_color_matrix = new ColorMatrix (new float[][] {
@@ -174,11 +173,10 @@ namespace MonoTests.System.Drawing.Imaging {
}
[Test]
[ExpectedException (typeof (ArgumentException))]
public void SetColorMatrix_Null ()
{
using (ImageAttributes ia = new ImageAttributes ()) {
ia.SetColorMatrix (null);
Assert.Throws<ArgumentException> (() => ia.SetColorMatrix (null));
}
}
@@ -196,92 +194,82 @@ namespace MonoTests.System.Drawing.Imaging {
}
[Test]
[ExpectedException (typeof (ArgumentException))]
public void SetColorMatrix_Default_Any ()
{
using (ImageAttributes ia = new ImageAttributes ()) {
ia.SetColorMatrix (global_color_matrix, ColorMatrixFlag.Default, ColorAdjustType.Any);
Assert.Throws<ArgumentException> (() => ia.SetColorMatrix (global_color_matrix, ColorMatrixFlag.Default, ColorAdjustType.Any));
}
}
[Test]
[ExpectedException (typeof (ArgumentException))]
public void SetColorMatrix_Default_Count ()
{
using (ImageAttributes ia = new ImageAttributes ()) {
ia.SetColorMatrix (global_color_matrix, ColorMatrixFlag.Default, ColorAdjustType.Count);
Assert.Throws<ArgumentException> (() => ia.SetColorMatrix (global_color_matrix, ColorMatrixFlag.Default, ColorAdjustType.Count));
}
}
[Test]
[ExpectedException (typeof (ArgumentException))]
public void SetColorMatrix_AltGrays ()
{
using (ImageAttributes ia = new ImageAttributes ()) {
ia.SetColorMatrix (global_color_matrix, ColorMatrixFlag.AltGrays);
Assert.Throws<ArgumentException> (() => ia.SetColorMatrix (global_color_matrix, ColorMatrixFlag.AltGrays));
}
}
[Test]
[ExpectedException (typeof (ArgumentException))]
public void SetColorMatrix_AltGrays_Any ()
{
using (ImageAttributes ia = new ImageAttributes ()) {
ia.SetColorMatrix (global_color_matrix, ColorMatrixFlag.AltGrays, ColorAdjustType.Any);
Assert.Throws<ArgumentException> (() => ia.SetColorMatrix (global_color_matrix, ColorMatrixFlag.AltGrays, ColorAdjustType.Any));
}
}
[Test]
[ExpectedException (typeof (ArgumentException))]
public void SetColorMatrix_AltGrays_Bitmap ()
{
using (ImageAttributes ia = new ImageAttributes ()) {
ia.SetColorMatrix (global_color_matrix, ColorMatrixFlag.AltGrays, ColorAdjustType.Bitmap);
Assert.Throws<ArgumentException> (() => ia.SetColorMatrix (global_color_matrix, ColorMatrixFlag.AltGrays, ColorAdjustType.Bitmap));
}
}
[Test]
[ExpectedException (typeof (ArgumentException))]
public void SetColorMatrix_AltGrays_Brush ()
{
using (ImageAttributes ia = new ImageAttributes ()) {
ia.SetColorMatrix (global_color_matrix, ColorMatrixFlag.AltGrays, ColorAdjustType.Brush);
Assert.Throws<ArgumentException> (() => ia.SetColorMatrix (global_color_matrix, ColorMatrixFlag.AltGrays, ColorAdjustType.Brush));
}
}
[Test]
[ExpectedException (typeof (ArgumentException))]
public void SetColorMatrix_AltGrays_Count ()
{
using (ImageAttributes ia = new ImageAttributes ()) {
ia.SetColorMatrix (global_color_matrix, ColorMatrixFlag.AltGrays, ColorAdjustType.Count);
Assert.Throws<ArgumentException> (() => ia.SetColorMatrix (global_color_matrix, ColorMatrixFlag.AltGrays, ColorAdjustType.Count));
}
}
[Test]
[ExpectedException (typeof (ArgumentException))]
public void SetColorMatrix_AltGrays_Default ()
{
using (ImageAttributes ia = new ImageAttributes ()) {
ia.SetColorMatrix (global_color_matrix, ColorMatrixFlag.AltGrays, ColorAdjustType.Default);
Assert.Throws<ArgumentException> (() => ia.SetColorMatrix (global_color_matrix, ColorMatrixFlag.AltGrays, ColorAdjustType.Default));
}
}
[Test]
[ExpectedException (typeof (ArgumentException))]
public void SetColorMatrix_AltGrays_Pen ()
{
using (ImageAttributes ia = new ImageAttributes ()) {
ia.SetColorMatrix (global_color_matrix, ColorMatrixFlag.AltGrays, ColorAdjustType.Pen);
Assert.Throws<ArgumentException> (() => ia.SetColorMatrix (global_color_matrix, ColorMatrixFlag.AltGrays, ColorAdjustType.Pen));
}
}
[Test]
[ExpectedException (typeof (ArgumentException))]
public void SetColorMatrix_AltGrays_Text ()
{
using (ImageAttributes ia = new ImageAttributes ()) {
ia.SetColorMatrix (global_color_matrix, ColorMatrixFlag.AltGrays, ColorAdjustType.Text);
Assert.Throws<ArgumentException> (() => ia.SetColorMatrix (global_color_matrix, ColorMatrixFlag.AltGrays, ColorAdjustType.Text));
}
}
@@ -299,47 +287,42 @@ namespace MonoTests.System.Drawing.Imaging {
}
[Test]
[ExpectedException (typeof (ArgumentException))]
public void SetColorMatrix_SkipGrays_Any ()
{
using (ImageAttributes ia = new ImageAttributes ()) {
ia.SetColorMatrix (global_color_matrix, ColorMatrixFlag.SkipGrays, ColorAdjustType.Any);
Assert.Throws<ArgumentException> (() => ia.SetColorMatrix (global_color_matrix, ColorMatrixFlag.SkipGrays, ColorAdjustType.Any));
}
}
[Test]
[ExpectedException (typeof (ArgumentException))]
public void SetColorMatrix_SkipGrays_Count ()
{
using (ImageAttributes ia = new ImageAttributes ()) {
ia.SetColorMatrix (global_color_matrix, ColorMatrixFlag.SkipGrays, ColorAdjustType.Count);
Assert.Throws<ArgumentException> (() => ia.SetColorMatrix (global_color_matrix, ColorMatrixFlag.SkipGrays, ColorAdjustType.Count));
}
}
[Test]
[ExpectedException (typeof (ArgumentException))]
public void SetColorMatrix_InvalidFlag ()
{
using (ImageAttributes ia = new ImageAttributes ()) {
ia.SetColorMatrix (global_color_matrix, (ColorMatrixFlag) Int32.MinValue);
Assert.Throws<ArgumentException> (() => ia.SetColorMatrix (global_color_matrix, (ColorMatrixFlag) Int32.MinValue));
}
}
[Test]
[ExpectedException (typeof (ArgumentException))]
public void SetColorMatrix_InvalidType()
{
using (ImageAttributes ia = new ImageAttributes ()) {
ia.SetColorMatrix (global_color_matrix, ColorMatrixFlag.Default, (ColorAdjustType)Int32.MinValue);
Assert.Throws<ArgumentException> (() => ia.SetColorMatrix (global_color_matrix, ColorMatrixFlag.Default, (ColorAdjustType)Int32.MinValue));
}
}
[Test]
[ExpectedException (typeof (ArgumentException))]
public void SetColorMatrices_Null_ColorMatrix ()
{
using (ImageAttributes ia = new ImageAttributes ()) {
ia.SetColorMatrices (null, global_color_matrix);
Assert.Throws<ArgumentException> (() => ia.SetColorMatrices (null, global_color_matrix));
}
}
@@ -354,11 +337,10 @@ namespace MonoTests.System.Drawing.Imaging {
}
[Test]
[ExpectedException (typeof (ArgumentException))]
public void SetColorMatrices_ColorMatrix_Null_AltGrays ()
{
using (ImageAttributes ia = new ImageAttributes ()) {
ia.SetColorMatrices (global_color_matrix, null, ColorMatrixFlag.AltGrays);
Assert.Throws<ArgumentException> (() => ia.SetColorMatrices (global_color_matrix, null, ColorMatrixFlag.AltGrays));
}
}
@@ -400,20 +382,18 @@ namespace MonoTests.System.Drawing.Imaging {
}
[Test]
[ExpectedException (typeof (ArgumentException))]
public void SetColorMatrices_InvalidFlags ()
{
using (ImageAttributes ia = new ImageAttributes ()) {
ia.SetColorMatrices (global_color_matrix, global_color_matrix, (ColorMatrixFlag) Int32.MinValue);
Assert.Throws<ArgumentException> (() => ia.SetColorMatrices (global_color_matrix, global_color_matrix, (ColorMatrixFlag) Int32.MinValue));
}
}
[Test]
[ExpectedException (typeof (ArgumentException))]
public void SetColorMatrices_InvalidType ()
{
using (ImageAttributes ia = new ImageAttributes ()) {
ia.SetColorMatrices (global_color_matrix, global_color_matrix, ColorMatrixFlag.Default, (ColorAdjustType) Int32.MinValue);
Assert.Throws<ArgumentException> (() => ia.SetColorMatrices (global_color_matrix, global_color_matrix, ColorMatrixFlag.Default, (ColorAdjustType) Int32.MinValue));
}
}

View File

@@ -38,7 +38,6 @@ using System.Security.Permissions;
namespace MonoTests.System.Drawing.Imaging {
[TestFixture]
[SecurityPermission (SecurityAction.Deny, UnmanagedCode = true)]
public class JpegCodecTest {
/* Get suffix to add to the filename */

View File

@@ -38,7 +38,6 @@ using NUnit.Framework;
namespace MonoTests.System.Drawing.Imaging {
[TestFixture]
[SecurityPermission (SecurityAction.Deny, UnmanagedCode = true)]
public class TiffCodecTest {
[TestFixtureSetUp]

View File

@@ -52,31 +52,28 @@ namespace MonoCasTests.System.Drawing.Text {
// TODO - tests for AddFontFile
[Test]
[ExpectedException (typeof (SecurityException))]
[SecurityPermission (SecurityAction.Deny, UnmanagedCode = true)]
public void AddMemoryFont_Deny_UnmanagedCode ()
{
new PrivateFontCollection ().AddMemoryFont (IntPtr.Zero, 1024);
Assert.Throws<SecurityException> (() => new PrivateFontCollection ().AddMemoryFont (IntPtr.Zero, 1024));
}
[Test]
[ExpectedException (typeof (ArgumentException))]
[SecurityPermission (SecurityAction.PermitOnly, UnmanagedCode = true)]
public void AddMemoryFont_PermitOnly_UnmanagedCode ()
{
new PrivateFontCollection ().AddMemoryFont (IntPtr.Zero, 1024);
Assert.Throws<ArgumentException> (() => new PrivateFontCollection ().AddMemoryFont (IntPtr.Zero, 1024));
}
// yes, that fails with FileNotFoundException ;-)
[Test]
[ExpectedException (typeof (FileNotFoundException))]
[SecurityPermission (SecurityAction.PermitOnly, UnmanagedCode = true)]
public void AddMemoryFont_NegativeLength ()
{
IntPtr ptr = Marshal.AllocHGlobal (1024);
try {
new PrivateFontCollection ().AddMemoryFont (ptr, -1024);
Assert.Throws<FileNotFoundException> (() => new PrivateFontCollection ().AddMemoryFont (ptr, -1024));
}
finally {
Marshal.FreeHGlobal (ptr);
@@ -84,13 +81,12 @@ namespace MonoCasTests.System.Drawing.Text {
}
[Test]
[ExpectedException (typeof (FileNotFoundException))]
[SecurityPermission (SecurityAction.PermitOnly, UnmanagedCode = true)]
public void AddMemoryFont_InvalidData ()
{
IntPtr ptr = Marshal.AllocHGlobal (1024);
try {
new PrivateFontCollection ().AddMemoryFont (ptr, 1024);
Assert.Throws<FileNotFoundException> (() => new PrivateFontCollection ().AddMemoryFont (ptr, 1024));
}
finally {
Marshal.FreeHGlobal (ptr);

View File

@@ -38,7 +38,6 @@ using NUnit.Framework;
namespace MonoTests.System.Drawing.Text {
[TestFixture]
[SecurityPermission (SecurityAction.Deny, UnmanagedCode = true)]
public class PrivateFontCollectionTest {
[Test]
@@ -49,40 +48,36 @@ namespace MonoTests.System.Drawing.Text {
}
[Test]
[ExpectedException (typeof (ArgumentNullException))]
public void AddFontFile_Null ()
{
new PrivateFontCollection ().AddFontFile (null);
Assert.Throws<ArgumentNullException> (() => new PrivateFontCollection ().AddFontFile (null));
}
[Test]
[ExpectedException (typeof (ArgumentException))]
public void AddFontFile_Empty ()
{
// badly formetted filename
new PrivateFontCollection ().AddFontFile (String.Empty);
Assert.Throws<ArgumentException> (() => new PrivateFontCollection ().AddFontFile (String.Empty));
}
[Test]
[ExpectedException (typeof (FileNotFoundException))]
[Category ("NotWorking")] // it seems fontconfig doesn't validate on add...
public void AddFontFile_NotAFontFile ()
{
string file = Path.GetTempFileName ();
Assert.IsTrue (File.Exists (file), "Exists");
// even if the file exists....
new PrivateFontCollection ().AddFontFile (file);
Assert.Throws<FileNotFoundException> (() => new PrivateFontCollection ().AddFontFile (file));
}
// tests for AddMemoryFont are available in the CAS unit tests
[Test]
[ExpectedException (typeof (ArgumentException))]
public void Dispose_Family ()
{
PrivateFontCollection pfc = new PrivateFontCollection ();
pfc.Dispose ();
Assert.IsNotNull (pfc.Families);
Assert.Throws<ArgumentException> (() => { var x = pfc.Families; });
// no it's not a ObjectDisposedException
}
}

View File

@@ -36,7 +36,6 @@ using NUnit.Framework;
namespace MonoTests.System.Drawing {
[TestFixture]
[SecurityPermission (SecurityAction.Deny, UnmanagedCode = true)]
public class ColorConverterTest {
Color col;
@@ -167,72 +166,63 @@ namespace MonoTests.System.Drawing {
}
[Test]
[ExpectedException (typeof (ArgumentException))]
public void ConvertFrom_x1 ()
{
colconv.ConvertFrom (null, CultureInfo.InvariantCulture, "10, 20");
Assert.Throws<ArgumentException> (() => colconv.ConvertFrom (null, CultureInfo.InvariantCulture, "10, 20"));
}
[Test]
[ExpectedException (typeof (ArgumentException))]
public void ConvertFrom_x2 ()
{
colconv.ConvertFrom (null, CultureInfo.InvariantCulture, "-10, 20, 30");
Assert.Throws<ArgumentException> (() => colconv.ConvertFrom (null, CultureInfo.InvariantCulture, "-10, 20, 30"));
}
[Test]
[ExpectedException (typeof (ArgumentException))]
public void ConvertFrom_x3 ()
{
colconv.ConvertFrom (null, CultureInfo.InvariantCulture,
"1, 1, 1, 1, 1");
Assert.Throws<ArgumentException> (() => colconv.ConvertFrom (null, CultureInfo.InvariantCulture,
"1, 1, 1, 1, 1"));
}
[Test]
[ExpectedException (typeof (Exception))]
public void ConvertFrom_x4 ()
{
colconv.ConvertFrom (null, CultureInfo.InvariantCulture,
"*1, 1");
Assert.Throws<Exception> (() => colconv.ConvertFrom (null, CultureInfo.InvariantCulture,
"*1, 1"));
}
[Test]
[ExpectedException (typeof (NotSupportedException))]
public void ConvertFrom_x5 ()
{
colconv.ConvertFrom (null, CultureInfo.InvariantCulture,
new Point (10, 10));
Assert.Throws<NotSupportedException> (() => colconv.ConvertFrom (null, CultureInfo.InvariantCulture,
new Point (10, 10)));
}
[Test]
[ExpectedException (typeof (NotSupportedException))]
public void ConvertFrom_x6 ()
{
colconv.ConvertFrom (null, CultureInfo.InvariantCulture,
new PointF (10, 10));
Assert.Throws<NotSupportedException> (() => colconv.ConvertFrom (null, CultureInfo.InvariantCulture,
new PointF (10, 10)));
}
[Test]
[ExpectedException (typeof (NotSupportedException))]
public void ConvertFrom_x7 ()
{
colconv.ConvertFrom (null, CultureInfo.InvariantCulture,
new Size (10, 10));
Assert.Throws<NotSupportedException> (() => colconv.ConvertFrom (null, CultureInfo.InvariantCulture,
new Size (10, 10)));
}
[Test]
[ExpectedException (typeof (NotSupportedException))]
public void ConvertFrom_x8 ()
{
colconv.ConvertFrom (null, CultureInfo.InvariantCulture,
new SizeF (10, 10));
Assert.Throws<NotSupportedException> (() => colconv.ConvertFrom (null, CultureInfo.InvariantCulture,
new SizeF (10, 10)));
}
[Test]
[ExpectedException (typeof (NotSupportedException))]
public void ConvertFrom_x9 ()
{
colconv.ConvertFrom (null, CultureInfo.InvariantCulture, 0x10);
Assert.Throws<NotSupportedException> (() => colconv.ConvertFrom (null, CultureInfo.InvariantCulture, 0x10));
}
[Test]
@@ -264,43 +254,38 @@ namespace MonoTests.System.Drawing {
}
[Test]
[ExpectedException (typeof (NotSupportedException))]
public void ConvertTo_x1 ()
{
colconv.ConvertTo (null, CultureInfo.InvariantCulture, col,
typeof (Color));
Assert.Throws<NotSupportedException> (() => colconv.ConvertTo (null, CultureInfo.InvariantCulture, col,
typeof (Color)));
}
[Test]
[ExpectedException (typeof (NotSupportedException))]
public void ConvertTo_x2 ()
{
colconv.ConvertTo (null, CultureInfo.InvariantCulture, col,
typeof (SizeF));
Assert.Throws<NotSupportedException> (() => colconv.ConvertTo (null, CultureInfo.InvariantCulture, col,
typeof (SizeF)));
}
[Test]
[ExpectedException (typeof (NotSupportedException))]
public void ConvertTo_x3 ()
{
colconv.ConvertTo (null, CultureInfo.InvariantCulture, col,
typeof (Point));
Assert.Throws<NotSupportedException> (() => colconv.ConvertTo (null, CultureInfo.InvariantCulture, col,
typeof (Point)));
}
[Test]
[ExpectedException (typeof (NotSupportedException))]
public void ConvertTo_x4 ()
{
colconv.ConvertTo (null, CultureInfo.InvariantCulture, col,
typeof (PointF));
Assert.Throws<NotSupportedException> (() => colconv.ConvertTo (null, CultureInfo.InvariantCulture, col,
typeof (PointF)));
}
[Test]
[ExpectedException (typeof (NotSupportedException))]
public void ConvertTo_x5 ()
{
colconv.ConvertTo (null, CultureInfo.InvariantCulture, col,
typeof (int));
Assert.Throws<NotSupportedException> (() => colconv.ConvertTo (null, CultureInfo.InvariantCulture, col,
typeof (int)));
}
[Test]
@@ -351,10 +336,9 @@ namespace MonoTests.System.Drawing {
}
[Test]
[ExpectedException (typeof (ArgumentException))]
public void ConvertFromInvariantString_InvalidComponentCount ()
{
colconv.ConvertFromInvariantString ("1, 2, 3, 4, 5");
Assert.Throws<ArgumentException> (() => colconv.ConvertFromInvariantString ("1, 2, 3, 4, 5"));
}
[Test]
@@ -378,12 +362,11 @@ namespace MonoTests.System.Drawing {
}
[Test]
[ExpectedException (typeof (ArgumentException))]
public void ConvertFromString_InvalidComponentCount ()
{
CultureInfo culture = CultureInfo.CurrentCulture;
colconv.ConvertFromString (string.Format (culture,
"1{0} 2{0} 3{0} 4{0} 5", culture.TextInfo.ListSeparator[0]));
Assert.Throws<ArgumentException> (() => colconv.ConvertFromString (string.Format (culture,
"1{0} 2{0} 3{0} 4{0} 5", culture.TextInfo.ListSeparator[0])));
}
[Test]
@@ -428,10 +411,9 @@ namespace MonoTests.System.Drawing {
}
[Test]
[ExpectedException (typeof (Exception))]
public void ConvertFromString_FromHtml_PoundTooLarge ()
{
colconv.ConvertFromString ("#100000000");
Assert.Throws<Exception> (() => colconv.ConvertFromString ("#100000000"));
}
}
}

View File

@@ -84,24 +84,21 @@ namespace MonoTests.System.Drawing {
}
[Test]
[ExpectedException (typeof (Exception))]
public void FromHtml_PoundNegative ()
{
ColorTranslator.FromHtml ("#-1");
Assert.Throws<Exception> (() => ColorTranslator.FromHtml ("#-1"));
}
[Test]
[ExpectedException (typeof (Exception))]
public void FromHtml_PoundTooLarge ()
{
ColorTranslator.FromHtml ("#100000000");
Assert.Throws<Exception> (() => ColorTranslator.FromHtml ("#100000000"));
}
[Test]
[ExpectedException (typeof (Exception))]
public void FromHtml_Unknown ()
{
ColorTranslator.FromHtml ("unknown-color-test");
Assert.Throws<Exception> (() => ColorTranslator.FromHtml ("unknown-color-test"));
}
[Test]

View File

@@ -36,7 +36,6 @@ using NUnit.Framework;
namespace MonoTests.System.Drawing {
[TestFixture]
[SecurityPermission (SecurityAction.Deny, UnmanagedCode = true)]
public class FontFamilyTest {
private Bitmap bitmap;
@@ -59,18 +58,16 @@ namespace MonoTests.System.Drawing {
}
[Test]
[ExpectedException (typeof (ArgumentException))]
public void FontFamily_String_Null ()
{
new FontFamily (null);
Assert.Throws<ArgumentException> (() => new FontFamily (null));
}
[Test]
[ExpectedException (typeof (ArgumentException))]
[Category ("NotWorking")] // libgdiplus/fontconfig always return something
public void FontFamily_String_Empty ()
{
new FontFamily (String.Empty);
Assert.Throws<ArgumentException> (() => new FontFamily (String.Empty));
}
private void CheckMono (FontFamily ff)
@@ -110,10 +107,9 @@ namespace MonoTests.System.Drawing {
}
[Test]
[ExpectedException (typeof (ArgumentException))]
public void FontFamily_String_PrivateFontCollection ()
{
new FontFamily (name, new PrivateFontCollection ());
Assert.Throws<ArgumentException> (() => new FontFamily (name, new PrivateFontCollection ()));
}
[Test]
@@ -179,10 +175,9 @@ namespace MonoTests.System.Drawing {
}
[Test]
[ExpectedException (typeof (ArgumentNullException))]
public void GetFamilies_Null ()
{
FontFamily.GetFamilies (null);
Assert.Throws<ArgumentNullException> (() => FontFamily.GetFamilies (null));
}
[Test]
@@ -201,12 +196,11 @@ namespace MonoTests.System.Drawing {
}
[Test]
[ExpectedException (typeof (ArgumentException))]
public void Dispose_UseAfter ()
{
FontFamily ff = FontFamily.GenericMonospace;
ff.Dispose ();
Assert.AreEqual (name, ff.Name, "Name");
Assert.Throws<ArgumentException> (() => { var x = ff.Name; });
}
}
}

Some files were not shown because too many files have changed in this diff Show More