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

@@ -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]