[ros-diffs] [jgardou] 51018: [GDI32_APITEST] - Test Rectangle function. Don't laugh, ROS fails those tests and fixing this breaks the GUI.

jgardou at svn.reactos.org jgardou at svn.reactos.org
Fri Mar 11 15:32:54 UTC 2011


Author: jgardou
Date: Fri Mar 11 15:32:54 2011
New Revision: 51018

URL: http://svn.reactos.org/svn/reactos?rev=51018&view=rev
Log:
[GDI32_APITEST]
  - Test Rectangle function.
Don't laugh, ROS fails those tests and fixing this breaks the GUI.

Added:
    trunk/rostests/apitests/gdi32/Rectangle.c   (with props)
Modified:
    trunk/rostests/apitests/gdi32/CMakeLists.txt
    trunk/rostests/apitests/gdi32/GetPixel.c
    trunk/rostests/apitests/gdi32/gdi32_apitest.rbuild
    trunk/rostests/apitests/gdi32/testlist.c

Modified: trunk/rostests/apitests/gdi32/CMakeLists.txt
URL: http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/gdi32/CMakeLists.txt?rev=51018&r1=51017&r2=51018&view=diff
==============================================================================
--- trunk/rostests/apitests/gdi32/CMakeLists.txt [iso-8859-1] (original)
+++ trunk/rostests/apitests/gdi32/CMakeLists.txt [iso-8859-1] Fri Mar 11 15:32:54 2011
@@ -39,6 +39,7 @@
     GetTextExtentExPoint.c
     GetTextFace.c
     MaskBlt.c
+    Rectangle.c
     SelectObject.c
     SetDCPenColor.c
     SetDIBits.c

Modified: trunk/rostests/apitests/gdi32/GetPixel.c
URL: http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/gdi32/GetPixel.c?rev=51018&r1=51017&r2=51018&view=diff
==============================================================================
--- trunk/rostests/apitests/gdi32/GetPixel.c [iso-8859-1] (original)
+++ trunk/rostests/apitests/gdi32/GetPixel.c [iso-8859-1] Fri Mar 11 15:32:54 2011
@@ -1,7 +1,7 @@
 /*
  * PROJECT:         ReactOS api tests
  * LICENSE:         GPL - See COPYING in the top level directory
- * PURPOSE:         Test for SetDIBits
+ * PURPOSE:         Test for GetPixel
  * PROGRAMMERS:     Jérôme Gardou
  */
 

Added: trunk/rostests/apitests/gdi32/Rectangle.c
URL: http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/gdi32/Rectangle.c?rev=51018&view=auto
==============================================================================
--- trunk/rostests/apitests/gdi32/Rectangle.c (added)
+++ trunk/rostests/apitests/gdi32/Rectangle.c [iso-8859-1] Fri Mar 11 15:32:54 2011
@@ -1,0 +1,115 @@
+/*
+ * PROJECT:         ReactOS api tests
+ * LICENSE:         GPL - See COPYING in the top level directory
+ * PURPOSE:         Test for Rectangle
+ * PROGRAMMERS:     Jérôme Gardou
+ */
+
+#include <stdio.h>
+#include <wine/test.h>
+#include <windows.h>
+
+void Test_Rectangle(void)
+{
+    HDC hdc;
+    HBITMAP hBmp;
+    BOOL ret;
+    HBRUSH hBrush;
+    COLORREF color;
+    
+    hdc = CreateCompatibleDC(NULL);
+    ok(hdc != NULL, "Failed to create the DC!\n");
+    hBmp = CreateCompatibleBitmap(hdc, 4, 4);
+    ok(hBmp != NULL, "Failed to create the Bitmap!\n");
+    hBmp = SelectObject(hdc, hBmp);
+    ok(hBmp != NULL, "Failed to select the Bitmap!\n");
+    
+    hBrush = CreateSolidBrush(RGB(0, 0, 0));
+    ok(hBrush != NULL, "Failed to create a solid brush!\n");
+    hBrush = SelectObject(hdc, hBrush);
+    ok(hBrush != NULL, "Failed to select the brush!\n");
+    
+    /* Blank the bitmap */
+    ret = BitBlt(hdc, 0, 0, 4, 4, NULL, 0, 0, WHITENESS);
+    ok(ret, "BitBlt failed to blank the bitmap!\n");
+    
+    /* Try inverted rectangle coordinates */
+    ret = Rectangle(hdc, 0, 2, 2, 0);
+    ok(ret, "Rectangle failed!");
+    color = GetPixel(hdc, 0, 0);
+    ok( color == RGB(0, 0, 0), "Expected 0, got 0x%08x\n", (UINT)color);
+    color = GetPixel(hdc, 2, 2);
+    ok( color == RGB(255, 255, 255), "Expected 0x00FFFFFF, got 0x%08x\n", (UINT)color);
+    color = GetPixel(hdc, 0, 2);
+    ok( color == RGB(255, 255, 255), "Expected 0x00FFFFFF, got 0x%08x\n", (UINT)color);
+    color = GetPixel(hdc, 2, 0);
+    ok( color == RGB(255, 255, 255), "Expected 0x00FFFFFF, got 0x%08x\n", (UINT)color);
+    color = GetPixel(hdc, 1, 1);
+    ok( color == RGB(0, 0, 0), "Expected 0, got 0x%08x\n", (UINT)color);
+
+    ret = BitBlt(hdc, 0, 0, 4, 4, NULL, 0, 0, WHITENESS);
+    ok(ret, "BitBlt failed to blank the bitmap!\n");    
+    /* Try well ordered rectangle coordinates */
+    ret = Rectangle(hdc, 0, 0, 2, 2);
+    ok(ret, "Rectangle failed!");
+    color = GetPixel(hdc, 0, 0);
+    ok( color == RGB(0, 0, 0), "Expected 0, got 0x%08x\n", (UINT)color);
+    color = GetPixel(hdc, 2, 2);
+    ok( color == RGB(255, 255, 255), "Expected 0x00FFFFFF, got 0x%08x\n", (UINT)color);
+    color = GetPixel(hdc, 0, 2);
+    ok( color == RGB(255, 255, 255), "Expected 0x00FFFFFF, got 0x%08x\n", (UINT)color);
+    color = GetPixel(hdc, 2, 0);
+    ok( color == RGB(255, 255, 255), "Expected 0x00FFFFFF, got 0x%08x\n", (UINT)color);
+    color = GetPixel(hdc, 1, 1);
+    ok( color == RGB(0, 0, 0), "Expected 0, got 0x%08x\n", (UINT)color);
+    
+    /* Same tests with GM_ADVANCED */
+    ok(SetGraphicsMode(hdc, GM_ADVANCED) == GM_COMPATIBLE, "Default mode for the DC is not GM_COMPATIBLE.\n");
+    
+    /* Blank the bitmap */
+    ret = BitBlt(hdc, 0, 0, 4, 4, NULL, 0, 0, WHITENESS);
+    ok(ret, "BitBlt failed to blank the bitmap!\n");
+    
+    /* Try inverted rectangle coordinates */
+    ret = Rectangle(hdc, 0, 2, 2, 0);
+    ok(ret, "Rectangle failed!");
+    color = GetPixel(hdc, 0, 0);
+    ok( color == RGB(0, 0, 0), "Expected 0, got 0x%08x\n", (UINT)color);
+    color = GetPixel(hdc, 2, 2);
+    ok( color == RGB(0, 0, 0), "Expected 0, got 0x%08x\n", (UINT)color);
+    color = GetPixel(hdc, 0, 2);
+    ok( color == RGB(0, 0, 0), "Expected 0, got 0x%08x\n", (UINT)color);
+    color = GetPixel(hdc, 2, 0);
+    ok( color == RGB(0, 0, 0), "Expected 0, got 0x%08x\n", (UINT)color);
+    color = GetPixel(hdc, 1, 1);
+    ok( color == RGB(0, 0, 0), "Expected 0, got 0x%08x\n", (UINT)color);
+
+    ret = BitBlt(hdc, 0, 0, 4, 4, NULL, 0, 0, WHITENESS);
+    ok(ret, "BitBlt failed to blank the bitmap!\n");    
+    /* Try well ordered rectangle coordinates */
+    ret = Rectangle(hdc, 0, 0, 2, 2);
+    ok(ret, "Rectangle failed!");
+    color = GetPixel(hdc, 0, 0);
+    ok( color == RGB(0, 0, 0), "Expected 0, got 0x%08x\n", (UINT)color);
+    color = GetPixel(hdc, 2, 2);
+    ok( color == RGB(0, 0, 0), "Expected 0, got 0x%08x\n", (UINT)color);
+    color = GetPixel(hdc, 0, 2);
+    ok( color == RGB(0, 0, 0), "Expected 0, got 0x%08x\n", (UINT)color);
+    color = GetPixel(hdc, 2, 0);
+    ok( color == RGB(0, 0, 0), "Expected 0, got 0x%08x\n", (UINT)color);
+    color = GetPixel(hdc, 1, 1);
+    ok( color == RGB(0, 0, 0), "Expected 0, got 0x%08x\n", (UINT)color);
+    
+    
+    hBmp = SelectObject(hdc, hBmp);
+    hBrush = SelectObject(hdc, hBrush);
+    DeleteObject(hBmp);
+    DeleteObject(hBrush);
+    DeleteDC(hdc);
+}
+    
+
+START_TEST(Rectangle)
+{
+    Test_Rectangle();
+}

Propchange: trunk/rostests/apitests/gdi32/Rectangle.c
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: trunk/rostests/apitests/gdi32/gdi32_apitest.rbuild
URL: http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/gdi32/gdi32_apitest.rbuild?rev=51018&r1=51017&r2=51018&view=diff
==============================================================================
--- trunk/rostests/apitests/gdi32/gdi32_apitest.rbuild [iso-8859-1] (original)
+++ trunk/rostests/apitests/gdi32/gdi32_apitest.rbuild [iso-8859-1] Fri Mar 11 15:32:54 2011
@@ -46,6 +46,7 @@
 	<file>GetTextExtentExPoint.c</file>
 	<file>GetTextFace.c</file>
 	<file>MaskBlt.c</file>
+    <file>Rectangle.c</file>
 	<file>SelectObject.c</file>
 	<file>SetDCPenColor.c</file>
 	<file>SetDIBits.c</file>

Modified: trunk/rostests/apitests/gdi32/testlist.c
URL: http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/gdi32/testlist.c?rev=51018&r1=51017&r2=51018&view=diff
==============================================================================
--- trunk/rostests/apitests/gdi32/testlist.c [iso-8859-1] (original)
+++ trunk/rostests/apitests/gdi32/testlist.c [iso-8859-1] Fri Mar 11 15:32:54 2011
@@ -42,6 +42,7 @@
 extern void func_GetTextExtentExPoint(void);
 extern void func_GetTextFace(void);
 extern void func_MaskBlt(void);
+extern void func_Rectangle(void);
 extern void func_SelectObject(void);
 extern void func_SetDCPenColor(void);
 extern void func_SetDIBits(void);
@@ -89,6 +90,7 @@
     { "GetTextExtentExPoint", func_GetTextExtentExPoint },
     { "GetTextFace", func_GetTextFace },
     { "MaskBlt", func_MaskBlt },
+    { "Rectangle", func_Rectangle },
     { "SelectObject", func_SelectObject },
     { "SetDCPenColor", func_SetDCPenColor },
     { "SetDIBits", func_SetDIBits },




More information about the Ros-diffs mailing list