2 // Icon class testing unit
6 // Sanjay Gupta <gsanjay@novell.com>
8 // (C) 2004 Novell, Inc. http://www.novell.com
12 using NUnit.Framework;
15 namespace MonoTests.System.Drawing{
18 public class TestIcon {
28 String path = TestBitmap.getInFile ("bitmaps/smiley.ico");
29 icon = new Icon (path);
30 fs1 = new FileStream (path, FileMode.Open);
34 public void TestConstructors ()
36 newIcon = new Icon (fs1, 48, 48);
37 Assert.AreEqual (48, newIcon.Height, "C#1a");
38 Assert.AreEqual (48, newIcon.Width, "C#1b");
40 newIcon = new Icon (icon, 16, 16);
41 Assert.AreEqual (16, newIcon.Height, "C#2a");
42 Assert.AreEqual (16, newIcon.Width, "C#2b");
46 public void TestProperties ()
48 Assert.AreEqual (32, icon.Height, "P#1");
49 Assert.AreEqual (32, icon.Width, "P#2");
50 Assert.AreEqual (32, icon.Size.Width, "P#3");
51 Assert.AreEqual (32, icon.Size.Height, "P#4");
56 public void TestMethods ()
58 newIcon = (Icon) icon.Clone ();
59 Assert.AreEqual (32, newIcon.Height, "M#1a");
60 Assert.AreEqual (32, newIcon.Width, "M#1b");
62 Bitmap bmp = icon.ToBitmap();
63 Assert.AreEqual (32, bmp.Height, "M#2a");
64 Assert.AreEqual (32, bmp.Width, "M#2b");
66 fs = new FileStream ("newIcon.ico", FileMode.Create);
69 Assert.AreEqual (fs1.Length, fs.Length, "M#3");
73 public void TearDown ()
79 if (File.Exists ("newIcon.ico"))
80 File.Delete("newIcon.ico");