Author: spouliot
Date: 2006-12-19 11:34:32 -0500 (Tue, 19 Dec 2006)
New Revision: 69755
Modified:
trunk/mcs/class/System.Drawing/Test/System.Drawing/ChangeLog
trunk/mcs/class/System.Drawing/Test/System.Drawing/TestIcon.cs
Log:
2006-12-19 Sebastien Pouliot <[EMAIL PROTECTED]>
* TestIcon.cs: Add test cases for 2.0 ExtractAssociatedIcon method.
Modified: trunk/mcs/class/System.Drawing/Test/System.Drawing/ChangeLog
===================================================================
--- trunk/mcs/class/System.Drawing/Test/System.Drawing/ChangeLog
2006-12-19 16:31:42 UTC (rev 69754)
+++ trunk/mcs/class/System.Drawing/Test/System.Drawing/ChangeLog
2006-12-19 16:34:32 UTC (rev 69755)
@@ -1,3 +1,7 @@
+2006-12-19 Sebastien Pouliot <[EMAIL PROTECTED]>
+
+ * TestIcon.cs: Add test cases for 2.0 ExtractAssociatedIcon method.
+
2006-12-03 Sebastien Pouliot <[EMAIL PROTECTED]>
* SystemIconsTest.cs: New. Unit tests for SystemIcons. Note that the
Modified: trunk/mcs/class/System.Drawing/Test/System.Drawing/TestIcon.cs
===================================================================
--- trunk/mcs/class/System.Drawing/Test/System.Drawing/TestIcon.cs
2006-12-19 16:31:42 UTC (rev 69754)
+++ trunk/mcs/class/System.Drawing/Test/System.Drawing/TestIcon.cs
2006-12-19 16:34:32 UTC (rev 69755)
@@ -1,14 +1,12 @@
//
// Icon class testing unit
//
-// Author:
+// Authors:
+// Sanjay Gupta <[EMAIL PROTECTED]>
+// Sebastien Pouliot <[EMAIL PROTECTED]>
//
-// Sanjay Gupta <[EMAIL PROTECTED]>
+// Copyright (C) 2004,2006 Novell, Inc (http://www.novell.com)
//
-
-//
-// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
-//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
@@ -31,20 +29,29 @@
using System;
using System.Drawing;
-using NUnit.Framework;
using System.IO;
+using System.Reflection;
using System.Security.Permissions;
+using NUnit.Framework;
-namespace MonoTests.System.Drawing{
+namespace MonoTests.System.Drawing {
[TestFixture]
[SecurityPermission (SecurityAction.Deny, UnmanagedCode = true)]
- public class TestIcon {
+ public class IconTest {
Icon icon;
Icon newIcon;
FileStream fs;
FileStream fs1;
+
+ static string filename_dll;
+
+ // static ctor are executed outside the Deny
+ static IconTest ()
+ {
+ filename_dll = Assembly.GetExecutingAssembly
().Location;
+ }
[SetUp]
public void SetUp ()
@@ -54,6 +61,18 @@
fs1 = new FileStream (path, FileMode.Open);
}
+ [TearDown]
+ public void TearDown ()
+ {
+ if (fs != null)
+ fs.Close ();
+ if (fs1 != null)
+ fs1.Close ();
+ if (File.Exists ("newIcon.ico"))
+ File.Delete ("newIcon.ico");
+ }
+
+
[Test]
#if TARGET_JVM
[Category ("NotWorking")]
@@ -106,16 +125,39 @@
Assert.AreEqual (fs1.Length, fs.Length, "M#3");
}
+#if NET_2_0
+ [Test]
+ [ExpectedException (typeof (ArgumentException))]
+ public void ExtractAssociatedIcon_Null ()
+ {
+ Icon.ExtractAssociatedIcon (null);
+ }
- [TearDown]
- public void TearDown ()
+ [Test]
+ [ExpectedException (typeof (ArgumentException))]
+ public void ExtractAssociatedIcon_Empty ()
{
- if (fs != null)
- fs.Close();
- if (fs1 != null)
- fs1.Close();
- if (File.Exists ("newIcon.ico"))
- File.Delete("newIcon.ico");
+ Icon.ExtractAssociatedIcon (String.Empty);
}
+
+ [Test]
+ [ExpectedException (typeof (FileNotFoundException))]
+ public void ExtractAssociatedIcon_DoesNotExists ()
+ {
+ Icon.ExtractAssociatedIcon ("does-not-exists.png");
+ }
+#endif
}
+
+ [TestFixture]
+ public class IconFullTrustTest {
+#if NET_2_0
+ [Test]
+ public void ExtractAssociatedIcon ()
+ {
+ string filename_dll = Assembly.GetExecutingAssembly
().Location;
+ Assert.IsNotNull (Icon.ExtractAssociatedIcon
(filename_dll), "dll");
+ }
+#endif
+ }
}
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches