2 using System.Drawing;
\r
3 using System.Drawing.Drawing2D;
\r
4 using NUnit.Framework;
\r
5 using DrawingTestHelper;
\r
7 namespace Test.Sys.Drawing
\r
10 /// Summary description for Bitmap.
\r
13 public class BitmapFixture {
\r
17 public void SetUp () {
\r
18 t = DrawingTest.Create (64, 64);
\r
19 Bitmap b = new Bitmap (@"..\..\..\Test\Bitmap1.png");
\r
20 t.Graphics.DrawImageUnscaled (b, 0, 0);
\r
23 public void CloneTest () {
\r
24 Bitmap b1 = (Bitmap) t.Bitmap.Clone ();
\r
25 Assert.IsFalse (Object.ReferenceEquals (t.Bitmap, b1));
\r
26 Assert.AreEqual (DrawingTest.CalculateNorm (t.Bitmap),
\r
27 DrawingTest.CalculateNorm (b1));
\r
28 t.Graphics.FillRectangle (Brushes.Black, 0, 0, 64, 64);
\r
29 Assert.IsFalse (DrawingTest.CalculateNorm (t.Bitmap) ==
\r
30 DrawingTest.CalculateNorm (b1));
\r
33 public void GetPixel () {
\r
34 Assert.AreEqual (Color.FromArgb (255, Color.White),
\r
35 t.Bitmap.GetPixel (0, 0));
\r
36 t.Graphics.FillRectangle (Brushes.Black, 30, 30, 30, 30);
\r
37 Assert.AreEqual (Color.FromArgb (255, Color.Black),
\r
38 t.Bitmap.GetPixel (31, 31));
\r
41 public void MakeTransparent () {
\r
43 Bitmap b = (Bitmap) t.Bitmap.Clone ();
\r
44 b.MakeTransparent (Color.White);
\r
45 t.Graphics.FillRectangle (Brushes.Black, 0, 0, 64, 64);
\r
46 t.Graphics.DrawImageUnscaled (b, 0, 0);
\r
48 Assert.IsTrue (t.Compare (10));
\r