Author: spouliot
Date: 2007-03-14 08:10:25 -0500 (Wed, 14 Mar 2007)
New Revision: 74252

Modified:
   trunk/mcs/class/System.Drawing/Test/System.Drawing/ChangeLog
   trunk/mcs/class/System.Drawing/Test/System.Drawing/TestImage.cs
Log:
2007-03-14  Sebastien Pouliot  <[EMAIL PROTECTED]>

        * TestImage.cs: Add test cases for loading invalid files as an Image.



Modified: trunk/mcs/class/System.Drawing/Test/System.Drawing/ChangeLog
===================================================================
--- trunk/mcs/class/System.Drawing/Test/System.Drawing/ChangeLog        
2007-03-14 13:09:40 UTC (rev 74251)
+++ trunk/mcs/class/System.Drawing/Test/System.Drawing/ChangeLog        
2007-03-14 13:10:25 UTC (rev 74252)
@@ -1,3 +1,7 @@
+2007-03-14  Sebastien Pouliot  <[EMAIL PROTECTED]>
+
+       * TestImage.cs: Add test cases for loading invalid files as an Image.
+
 2007-03-09  Sebastien Pouliot  <[EMAIL PROTECTED]>
 
        * GDIPlusTest.cs: Add test cases for GDI+ metafile API.

Modified: trunk/mcs/class/System.Drawing/Test/System.Drawing/TestImage.cs
===================================================================
--- trunk/mcs/class/System.Drawing/Test/System.Drawing/TestImage.cs     
2007-03-14 13:09:40 UTC (rev 74251)
+++ trunk/mcs/class/System.Drawing/Test/System.Drawing/TestImage.cs     
2007-03-14 13:10:25 UTC (rev 74252)
@@ -32,6 +32,7 @@
 using System.Drawing;
 using System.Drawing.Imaging;
 using System.IO;
+using System.Reflection;
 using System.Security.Permissions;
 using System.Xml.Serialization;
 using NUnit.Framework;
@@ -285,5 +286,23 @@
                                }
                        }
                }
+
+               [Test]
+               [ExpectedException (typeof (OutOfMemoryException))]
+               public void FromFile_Invalid ()
+               {
+                       string filename = Assembly.GetExecutingAssembly 
().Location;
+                       Image.FromFile (filename);
+               }
+
+               [Test]
+               [ExpectedException (typeof (ArgumentException))]
+               public void FromStream_Invalid ()
+               {
+                       string filename = Assembly.GetExecutingAssembly 
().Location;
+                       using (FileStream fs = File.OpenRead (filename)) {
+                               Image.FromStream (fs);
+                       }
+               }
        }
 }

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to