Author: spouliot
Date: 2006-08-28 15:32:41 -0400 (Mon, 28 Aug 2006)
New Revision: 64490

Modified:
   trunk/mcs/class/System.Drawing/Test/System.Drawing/ChangeLog
   trunk/mcs/class/System.Drawing/Test/System.Drawing/GDIPlusTest.cs
   trunk/mcs/class/System.Drawing/Test/System.Drawing/TestBitmap.cs
Log:
2006-08-28  Sebastien Pouliot  <[EMAIL PROTECTED]> 

        * GDIPlusTest.cs: Added more parameters checks for TextureBrush calls.
        * TestBitmap.cs: Fix test case for big endian arch (Marshal.ReadInt32)



Modified: trunk/mcs/class/System.Drawing/Test/System.Drawing/ChangeLog
===================================================================
--- trunk/mcs/class/System.Drawing/Test/System.Drawing/ChangeLog        
2006-08-28 19:32:36 UTC (rev 64489)
+++ trunk/mcs/class/System.Drawing/Test/System.Drawing/ChangeLog        
2006-08-28 19:32:41 UTC (rev 64490)
@@ -1,3 +1,8 @@
+2006-08-28  Sebastien Pouliot  <[EMAIL PROTECTED]> 
+
+       * GDIPlusTest.cs: Added more parameters checks for TextureBrush calls.
+       * TestBitmap.cs: Fix test case for big endian arch (Marshal.ReadInt32)
+
 2006-08-27  Sebastien Pouliot  <[EMAIL PROTECTED]> 
 
        * ColorConverter.cs: Add a new test case for a color with a integer 

Modified: trunk/mcs/class/System.Drawing/Test/System.Drawing/GDIPlusTest.cs
===================================================================
--- trunk/mcs/class/System.Drawing/Test/System.Drawing/GDIPlusTest.cs   
2006-08-28 19:32:36 UTC (rev 64489)
+++ trunk/mcs/class/System.Drawing/Test/System.Drawing/GDIPlusTest.cs   
2006-08-28 19:32:41 UTC (rev 64490)
@@ -867,6 +867,10 @@
                        Assert.AreEqual (Status.InvalidParameter, 
GDIPlus.GdipCreateTexture2 (IntPtr.Zero, (WrapMode) Int32.MinValue, 0, 0, 10, 
10, out brush), "GdipCreateTexture2-wrapmode");
                        Assert.AreEqual (Status.OutOfMemory, 
GDIPlus.GdipCreateTexture2 (image, WrapMode.Tile, 0, 0, 0, 10, out brush), 
"GdipCreateTexture2-width");
                        Assert.AreEqual (Status.OutOfMemory, 
GDIPlus.GdipCreateTexture2 (image, WrapMode.Tile, 0, 0, 10, 0, out brush), 
"GdipCreateTexture2-height");
+                       Assert.AreEqual (Status.OutOfMemory, 
GDIPlus.GdipCreateTexture2 (image, WrapMode.Tile, -1, 0, 0, 10, out brush), 
"GdipCreateTexture2-x");
+                       Assert.AreEqual (Status.OutOfMemory, 
GDIPlus.GdipCreateTexture2 (image, WrapMode.Tile, 0, -1, 10, 0, out brush), 
"GdipCreateTexture2-y");
+                       Assert.AreEqual (Status.OutOfMemory, 
GDIPlus.GdipCreateTexture2 (image, WrapMode.Tile, 1, 0, 10, 10, out brush), 
"GdipCreateTexture2-too-wide");
+                       Assert.AreEqual (Status.OutOfMemory, 
GDIPlus.GdipCreateTexture2 (image, WrapMode.Tile, 0, 1, 10, 10, out brush), 
"GdipCreateTexture2-too-tall");
                        Assert.AreEqual (Status.Ok, GDIPlus.GdipCreateTexture2 
(image, WrapMode.Tile, 0, 0, 10, 10, out brush), "GdipCreateTexture2");
 
                        WrapMode wm;
@@ -898,6 +902,10 @@
                        Assert.AreEqual (Status.InvalidParameter, 
GDIPlus.GdipCreateTextureIA (IntPtr.Zero, IntPtr.Zero, 0, 0, 10, 10, out 
brush), "GdipCreateTexture2-image");
                        Assert.AreEqual (Status.OutOfMemory, 
GDIPlus.GdipCreateTextureIA (image, IntPtr.Zero, 0, 0, 0, 10, out brush), 
"GdipCreateTexture2-width");
                        Assert.AreEqual (Status.OutOfMemory, 
GDIPlus.GdipCreateTextureIA (image, IntPtr.Zero, 0, 0, 10, 0, out brush), 
"GdipCreateTexture2-height");
+                       Assert.AreEqual (Status.OutOfMemory, 
GDIPlus.GdipCreateTextureIA (image, IntPtr.Zero, -1, 0, 10, 10, out brush), 
"GdipCreateTexture2-x");
+                       Assert.AreEqual (Status.OutOfMemory, 
GDIPlus.GdipCreateTextureIA (image, IntPtr.Zero, 0, -1, 10, 10, out brush), 
"GdipCreateTexture2-y");
+                       Assert.AreEqual (Status.OutOfMemory, 
GDIPlus.GdipCreateTextureIA (image, IntPtr.Zero, 1, 0, 10, 10, out brush), 
"GdipCreateTexture2-too-wide");
+                       Assert.AreEqual (Status.OutOfMemory, 
GDIPlus.GdipCreateTextureIA (image, IntPtr.Zero, 0, 1, 10, 10, out brush), 
"GdipCreateTexture2-too-tall");
                        Assert.AreEqual (Status.Ok, GDIPlus.GdipCreateTextureIA 
(image, IntPtr.Zero, 0, 0, 10, 10, out brush), "GdipCreateTexture2");
 
                        // TODO - handle ImageAttribute in the tests

Modified: trunk/mcs/class/System.Drawing/Test/System.Drawing/TestBitmap.cs
===================================================================
--- trunk/mcs/class/System.Drawing/Test/System.Drawing/TestBitmap.cs    
2006-08-28 19:32:36 UTC (rev 64489)
+++ trunk/mcs/class/System.Drawing/Test/System.Drawing/TestBitmap.cs    
2006-08-28 19:32:41 UTC (rev 64490)
@@ -476,14 +476,23 @@
                        Color red  = Color.FromArgb (Color.Red.A,  Color.Red.R, 
 Color.Red.G,  Color.Red.B);
                        Color blue = Color.FromArgb (Color.Blue.A, 
Color.Blue.R, Color.Blue.G, Color.Blue.B);
 
-                       using (Bitmap bmp = new Bitmap (1, 1, 
PixelFormat.Format24bppRgb))
+                       using (Bitmap bmp = new Bitmap (1, 1, 
PixelFormat.Format32bppRgb))
                        {
                                bmp.SetPixel (0, 0, red);
                                pixel_colour = bmp.GetPixel (0, 0);
                                Assert.AreEqual (red, pixel_colour, 
"Set/Get-Red");
 
                                data = bmp.LockBits (new Rectangle (0, 0, 1, 
1), ImageLockMode.ReadOnly, PixelFormat.Format32bppArgb);
-                               pixel_value = Marshal.ReadInt32 (data.Scan0);
+
+                               // Marshal follows CPU endianess
+                               if (BitConverter.IsLittleEndian) {
+                                       pixel_value = Marshal.ReadInt32 
(data.Scan0);
+                               } else {
+                                       pixel_value = Marshal.ReadByte 
(data.Scan0, 0);
+                                       pixel_value |= Marshal.ReadByte 
(data.Scan0, 1) << 8;
+                                       pixel_value |= Marshal.ReadByte 
(data.Scan0, 2) << 16;
+                                       pixel_value |= Marshal.ReadByte 
(data.Scan0, 3) << 24;
+                               }
                                pixel_colour = Color.FromArgb (pixel_value);
 
                                // Disregard alpha information in the test

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

Reply via email to