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