Przeglądaj źródła

2005-09-21 Jordi Mas i Hernandez <[email protected]>

	* Graphics.cs: Fixes exception type at FromImage method


svn path=/trunk/mcs/; revision=50363
Jordi Mas i Hernandez 20 lat temu
rodzic
commit
6d777d52a9

+ 4 - 0
mcs/class/System.Drawing/System.Drawing/ChangeLog

@@ -1,3 +1,7 @@
+2005-09-21 Jordi Mas i Hernandez <[email protected]> 
+
+	* Graphics.cs: Fixes exception type at FromImage method
+
 2005-09-20 Vladimir Krasnov <[email protected]>
 
 	* Graphics.jvm.cs: bitmap resolution fix in DrawImage

+ 2 - 1
mcs/class/System.Drawing/System.Drawing/Graphics.cs

@@ -1291,7 +1291,8 @@ namespace System.Drawing
 		{
 			IntPtr graphics;
 
-			if (image == null) throw new ArgumentException ();
+			if (image == null) 
+				throw new ArgumentNullException ();
 
 			Status status = GDIPlus.GdipGetImageGraphicsContext (image.nativeObject, out graphics);
 			GDIPlus.CheckStatus (status);

+ 7 - 1
mcs/class/System.Drawing/Test/System.Drawing/TestGraphics.cs

@@ -287,7 +287,6 @@ namespace MonoTests.System.Drawing
 			g.Dispose ();			
 		}
 
-
 		[Test]
 		public void LoadIndexed ()
 		{
@@ -299,6 +298,13 @@ namespace MonoTests.System.Drawing
 			Image x = Image.FromStream (str);
 			Graphics g = Graphics.FromImage (x);
 		}
+		
+		[Test]
+		[ExpectedException (typeof (ArgumentNullException))]
+		public void FromImage ()
+		{
+			Graphics g = Graphics.FromImage (null);
+		}		
 	}
 }