[ros-diffs] [tkreuzer] 56492: [GDI32_APITEST] - Add tests for GetDIBColorTable and SetPixel, - Add more tests for CreateBitmap, GetPixel, PatBlt

tkreuzer at svn.reactos.org tkreuzer at svn.reactos.org
Fri May 4 11:40:37 UTC 2012


Author: tkreuzer
Date: Fri May  4 11:40:36 2012
New Revision: 56492

URL: http://svn.reactos.org/svn/reactos?rev=56492&view=rev
Log:
[GDI32_APITEST]
- Add tests for GetDIBColorTable and SetPixel, 
- Add more tests for CreateBitmap, GetPixel, PatBlt

Added:
    trunk/rostests/apitests/gdi32/GetDIBColorTable.c   (with props)
    trunk/rostests/apitests/gdi32/SetPixel.c   (with props)
Modified:
    trunk/rostests/apitests/gdi32/CMakeLists.txt
    trunk/rostests/apitests/gdi32/CreateBitmap.c
    trunk/rostests/apitests/gdi32/GetPixel.c
    trunk/rostests/apitests/gdi32/PatBlt.c
    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=56492&r1=56491&r2=56492&view=diff
==============================================================================
--- trunk/rostests/apitests/gdi32/CMakeLists.txt [iso-8859-1] (original)
+++ trunk/rostests/apitests/gdi32/CMakeLists.txt [iso-8859-1] Fri May  4 11:40:36 2012
@@ -37,6 +37,7 @@
     GdiSetAttrs.c
     GetClipRgn.c
     GetCurrentObject.c
+    GetDIBColorTable.c
     GetDIBits.c
     GetObject.c
     GetRandomRgn.c
@@ -48,9 +49,11 @@
     PatBlt.c
     Rectangle.c
     SelectObject.c
+    SetBrushOrgEx.c
     SetDCPenColor.c
     SetDIBits.c
     SetMapMode.c
+    SetPixel.c
     SetSysColors.c
     SetWindowExtEx.c
     SetWorldTransform.c

Modified: trunk/rostests/apitests/gdi32/CreateBitmap.c
URL: http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/gdi32/CreateBitmap.c?rev=56492&r1=56491&r2=56492&view=diff
==============================================================================
--- trunk/rostests/apitests/gdi32/CreateBitmap.c [iso-8859-1] (original)
+++ trunk/rostests/apitests/gdi32/CreateBitmap.c [iso-8859-1] Fri May  4 11:40:36 2012
@@ -11,6 +11,85 @@
 
 #define DEFAULT_BITMAP 21
 
+void Test_CreateBitmap_Params()
+{
+    HBITMAP hbmp;
+
+    /* All of these should get us the default bitmap */
+    hbmp = CreateBitmap(0, 0, 0, 0, NULL);
+    ok(hbmp == GetStockObject(21), "should get the default bitmap\n");
+    hbmp = CreateBitmap(1, 0, 0, 0, NULL);
+    ok(hbmp == GetStockObject(21), "should get the default bitmap\n");
+    hbmp = CreateBitmap(0, 1, 0, 0, NULL);
+    ok(hbmp == GetStockObject(21), "should get the default bitmap\n");
+    hbmp = CreateBitmap(0, 1, 1, 0, NULL);
+    ok(hbmp == GetStockObject(21), "should get the default bitmap\n");
+    hbmp = CreateBitmap(0, 1, 63, 33, NULL);
+    ok(hbmp == GetStockObject(21), "should get the default bitmap\n");
+    hbmp = CreateBitmap(0, -4, -32, 233, NULL);
+    ok(hbmp == GetStockObject(21), "should get the default bitmap\n");
+
+    SetLastError(0);
+    hbmp = CreateBitmap(1, -1, 1, 0, NULL);
+    ok(hbmp == 0, "\n");
+    ok_err(ERROR_INVALID_PARAMETER);
+
+    SetLastError(0);
+    hbmp = CreateBitmap(-1, 1, 1, 0, NULL);
+    ok(hbmp == 0, "\n");
+    ok_err(ERROR_INVALID_PARAMETER);
+
+    SetLastError(0);
+    hbmp = CreateBitmap(-1, 1, 1, 1, NULL);
+    ok(hbmp == 0, "\n");
+    ok_err(ERROR_INVALID_PARAMETER);
+
+    SetLastError(0);
+    hbmp = CreateBitmap(1, -1, 1, 1, NULL);
+    ok(hbmp == 0, "\n");
+    ok_err(ERROR_INVALID_PARAMETER);
+
+    /* Check if an overflow in cPlanes * cBitsPixel is handled */
+    SetLastError(0);
+    hbmp = CreateBitmap(1, 1, 2, 0x80000004, NULL);
+    ok(hbmp == 0, "\n");
+    ok_err(ERROR_INVALID_PARAMETER);
+
+    /* Check for maximum width */
+    hbmp = CreateBitmap(0x7FFFFFF, 1, 1, 1, NULL);
+    ok(hbmp != 0, "\n");
+    DeleteObject(hbmp);
+    SetLastError(0);
+    hbmp = CreateBitmap(0x8000000, 1, 1, 1, NULL);
+    ok(hbmp == 0, "\n");
+    ok_err(ERROR_INVALID_PARAMETER);
+
+    /* Check for maximum height */
+    hbmp = CreateBitmap(1, 0x1FFFFF00, 1, 1, NULL);
+    ok(hbmp != 0, "\n");
+    DeleteObject(hbmp);
+    SetLastError(0);
+    hbmp = CreateBitmap(1, 0x1FFFFFFF, 1, 1, NULL);
+    ok(hbmp == 0, "\n");
+    ok_err(0);
+
+    /* Check for overflow in width * height */
+    hbmp = CreateBitmap(0x20000, 0x1FFFF, 1, 1, NULL);
+    ok(hbmp != 0, "\n");
+    DeleteObject(hbmp);
+    SetLastError(0);
+    hbmp = CreateBitmap(0x20000, 0x20000, 1, 1, NULL);
+    ok(hbmp == 0, "\n");
+    ok_err(0);
+
+    /* Check huge allocation */
+    SetLastError(0);
+    hbmp = CreateBitmap(0x2000, 0x20000, 32, 1, NULL);
+    ok(hbmp == 0, "\n");
+    ok_err(ERROR_INVALID_PARAMETER);
+
+}
+
 void Test_CreateBitmap()
 {
     HBITMAP hbmp;
@@ -20,10 +99,8 @@
     hbmp = CreateBitmap(0, 0, 0, 0, NULL);
     ok(hbmp != 0, "should get a 1x1 bitmap\n");
     ok(hbmp == GetStockObject(DEFAULT_BITMAP), "\n");
-
     result = GetObject(hbmp, sizeof(bitmap), &bitmap);
     ok(result > 0, "result = %d\n", result);
-
     ok(bitmap.bmType == 0, "bmType = %ld\n", bitmap.bmType);
     ok(bitmap.bmWidth == 1, "bmWidth = %ld\n", bitmap.bmWidth);
     ok(bitmap.bmHeight == 1, "bmHeight = %ld\n", bitmap.bmHeight);
@@ -31,19 +108,27 @@
     ok(bitmap.bmPlanes == 1, "bmPlanes = %d\n", bitmap.bmPlanes);
     ok(bitmap.bmBitsPixel == 1, "bmBitsPixel = %d\n", bitmap.bmBitsPixel);
     ok(bitmap.bmBits == 0, "bmBits = %p\n", bitmap.bmBits);
-
     DeleteObject(hbmp);
 
-    hbmp = CreateBitmap(1, -1, 1, 0, NULL);
-    ok(hbmp == 0, "\n");
+    hbmp = CreateBitmap(1, 2, 1, 1, NULL);
+    ok(hbmp != 0, "should get a 1x2 bitmap\n");
+    result = GetObject(hbmp, sizeof(bitmap), &bitmap);
+    ok(result > 0, "result = %d\n", result);
+    ok(bitmap.bmType == 0, "bmType = %ld\n", bitmap.bmType);
+    ok(bitmap.bmWidth == 1, "bmWidth = %ld\n", bitmap.bmWidth);
+    ok(bitmap.bmHeight == 2, "bmHeight = %ld\n", bitmap.bmHeight);
+    ok(bitmap.bmWidthBytes == 2, "bmWidthBytes = %ld\n", bitmap.bmWidthBytes);
+    ok(bitmap.bmPlanes == 1, "bmPlanes = %d\n", bitmap.bmPlanes);
+    ok(bitmap.bmBitsPixel == 1, "bmBitsPixel = %d\n", bitmap.bmBitsPixel);
+    ok(bitmap.bmBits == 0, "bmBits = %p\n", bitmap.bmBits);
+    DeleteObject(hbmp);
 
-    hbmp = CreateBitmap(-1, 1, 1, 0, NULL);
-    ok(hbmp == 0, "\n");
 
 }
 
 START_TEST(CreateBitmap)
 {
+    Test_CreateBitmap_Params();
     Test_CreateBitmap();
 }
 

Added: trunk/rostests/apitests/gdi32/GetDIBColorTable.c
URL: http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/gdi32/GetDIBColorTable.c?rev=56492&view=auto
==============================================================================
--- trunk/rostests/apitests/gdi32/GetDIBColorTable.c (added)
+++ trunk/rostests/apitests/gdi32/GetDIBColorTable.c [iso-8859-1] Fri May  4 11:40:36 2012
@@ -1,0 +1,105 @@
+/*
+ * PROJECT:         ReactOS api tests
+ * LICENSE:         GPL - See COPYING in the top level directory
+ * PURPOSE:         Test for ...
+ * PROGRAMMERS:     Timo Kreuzer
+ */
+
+#include <stdio.h>
+#include <wine/test.h>
+#include <windows.h>
+
+void Test_GetDIBColorTable()
+{
+    struct
+    {
+        BITMAPINFOHEADER bmiHeader;
+        ULONG bmiColors[8];
+    } bmibuffer;
+    BITMAPINFO *pbmi = (PVOID)&bmibuffer;
+    HBITMAP hbmp, hbmpOld;
+    HDC hdc;
+    PBYTE pjBits;
+    UINT cColors;
+    ULONG aulColors[257];
+
+    hdc = CreateCompatibleDC(0);
+    ok(hdc != 0, "failed\n");
+
+    SetLastError(0);
+    cColors = GetDIBColorTable(hdc, 0, 257, (RGBQUAD*)aulColors);
+    ok_long(cColors, 2);
+    ok_err(0);
+
+    hbmp = CreateBitmap(1, 1, 1, 1, NULL);
+    ok(hbmp != 0, "\n");
+    hbmpOld = SelectObject(hdc, hbmp);
+    ok(hbmpOld != 0, "Failed to select bitmap\n");
+    cColors = GetDIBColorTable(hdc, 0, 257, (RGBQUAD*)aulColors);
+    ok_long(cColors, 2);
+    ok_err(0);
+    SelectObject(hdc, hbmpOld);
+    DeleteObject(hbmp);
+
+    /* Initialize a BITMAPINFO */
+    pbmi->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
+    pbmi->bmiHeader.biWidth = 2;
+    pbmi->bmiHeader.biHeight = 2;
+    pbmi->bmiHeader.biPlanes = 1;
+    pbmi->bmiHeader.biBitCount = 8;
+    pbmi->bmiHeader.biCompression = BI_RGB;
+    pbmi->bmiHeader.biSizeImage = 0;
+    pbmi->bmiHeader.biXPelsPerMeter = 1;
+    pbmi->bmiHeader.biYPelsPerMeter = 1;
+    pbmi->bmiHeader.biClrUsed = 3;
+    pbmi->bmiHeader.biClrImportant = 0;
+    bmibuffer.bmiColors[0] = 0xff0000;
+    bmibuffer.bmiColors[1] = 0x00ff00;
+    bmibuffer.bmiColors[2] = 0x0000ff;
+
+    hbmp = CreateDIBSection(hdc, pbmi, DIB_RGB_COLORS, (PVOID*)&pjBits, 0, 0 );
+    ok( hbmp != NULL, "error=%ld\n", GetLastError() );
+    SelectObject(hdc, hbmp);
+
+    cColors = GetDIBColorTable(hdc, 0, 257, (RGBQUAD*)aulColors);
+    ok_long(cColors, 256);
+    ok_long(aulColors[0], 0xff0000);
+    ok_long(aulColors[1], 0x00ff00);
+    ok_long(aulColors[2], 0x0000ff);
+    ok_long(aulColors[3], 0x000000);
+
+
+    cColors = SetDIBColorTable(hdc, 0, 4, (RGBQUAD*)aulColors);
+    ok_long(cColors, 4);
+
+    aulColors[3] = 0x000F0F;
+    cColors = SetDIBColorTable(hdc, 0, 4, (RGBQUAD*)aulColors);
+    ok_long(cColors, 4);
+
+    cColors = GetDIBColorTable(hdc, 0, 257, (RGBQUAD*)aulColors);
+    ok_long(cColors, 256);
+    ok_long(aulColors[0], 0xff0000);
+    ok_long(aulColors[1], 0x00ff00);
+    ok_long(aulColors[2], 0x0000ff);
+    ok_long(aulColors[3], 0x000F0F);
+
+
+    SelectObject(hdc, GetStockObject(21));
+    DeleteObject(hbmp);
+
+    bmibuffer.bmiColors[0] = 1;
+    bmibuffer.bmiColors[1] = 2;
+    bmibuffer.bmiColors[2] = 3;
+
+    hbmp = CreateDIBSection(hdc, pbmi, DIB_PAL_COLORS, (PVOID*)&pjBits, 0, 0 );
+    ok( hbmp != NULL, "error=%ld\n", GetLastError() );
+    SelectObject(hdc, hbmp);
+
+
+}
+
+START_TEST(GetDIBColorTable)
+{
+    Test_GetDIBColorTable();
+}
+

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

Modified: trunk/rostests/apitests/gdi32/GetPixel.c
URL: http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/gdi32/GetPixel.c?rev=56492&r1=56491&r2=56492&view=diff
==============================================================================
--- trunk/rostests/apitests/gdi32/GetPixel.c [iso-8859-1] (original)
+++ trunk/rostests/apitests/gdi32/GetPixel.c [iso-8859-1] Fri May  4 11:40:36 2012
@@ -28,6 +28,13 @@
     color = GetPixel(hdc, 1, 0);
     ok(color == 0, "Wrong color at 1,0 : 0x%08x\n", (UINT)color);
 
+    SetBkColor(hdc, 0x0000FF);
+    SetTextColor(hdc, 0x00FF00);
+    color = GetPixel(hdc, 0, 0);
+    ok(color == 0xFFFFFF, "Wrong color at 0,0 : 0x%08x\n", (UINT)color);
+    color = GetPixel(hdc, 1, 0);
+    ok(color == 0, "Wrong color at 1,0 : 0x%08x\n", (UINT)color);
+
     SetBkColor(hdc, 0x12345678);
     SetTextColor(hdc, 0x87654321);
     color = GetPixel(hdc, 0, 0);

Modified: trunk/rostests/apitests/gdi32/PatBlt.c
URL: http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/gdi32/PatBlt.c?rev=56492&r1=56491&r2=56492&view=diff
==============================================================================
--- trunk/rostests/apitests/gdi32/PatBlt.c [iso-8859-1] (original)
+++ trunk/rostests/apitests/gdi32/PatBlt.c [iso-8859-1] Fri May  4 11:40:36 2012
@@ -12,6 +12,68 @@
 HBITMAP ghbmpTarget;
 PULONG gpulTargetBits;
 HDC hdcTarget;
+
+void Test_PatBlt_Params()
+{
+    BOOL ret;
+    ULONG i, rop;
+    HDC hdc;
+
+    /* Test a rop that contains only the operation index */
+    ret = PatBlt(hdcTarget, 0, 0, 1, 1, PATCOPY & 0x00FF0000);
+    ok_long(ret, 1);
+
+    /* Test an invalid rop  */
+    SetLastError(0);
+    ok_long(PatBlt(hdcTarget, 0, 0, 1, 1, SRCCOPY) , 0);
+    ok_err(0);
+
+    /* Test all rops */
+    for (i = 0; i < 256; i++)
+    {
+        rop = i << 16;
+        ret = PatBlt(hdcTarget, 0, 0, 1, 1, rop);
+
+        /* Only these should succeed (they use no source) */
+        if ((i == 0) || (i == 5) || (i == 10) || (i == 15) || (i == 80) ||
+            (i == 85) || (i == 90) || (i == 95) || (i == 160) || (i == 165) ||
+            (i == 170) || (i == 175) || (i == 240) || (i == 245) ||
+            (i == 250) || (i == 255))
+        {
+            ok(ret == 1, "index %ld failed, but should succeed\n", i);
+        }
+        else
+        {
+            ok(ret == 0, "index %ld succeeded, but should fail\n", i);
+        }
+    }
+
+    /* Test quaternary rop, the background part is simply ignored */
+    ret = PatBlt(hdcTarget, 0, 0, 1, 1, MAKEROP4(PATCOPY, PATINVERT));
+    ok_long(ret, 1);
+    ret = PatBlt(hdcTarget, 0, 0, 1, 1, MAKEROP4(PATCOPY, SRCCOPY));
+    ok_long(ret, 1);
+    ret = PatBlt(hdcTarget, 0, 0, 1, 1, MAKEROP4(SRCCOPY, PATCOPY));
+    ok_long(ret, 0);
+
+    /* Test an info DC */
+    hdc = CreateICA("DISPLAY", NULL, NULL, NULL);
+    ok(hdc != 0, "\n");
+    SetLastError(0);
+    ok_long(PatBlt(hdc, 0, 0, 1, 1, PATCOPY), 1);
+    ok_err(0);
+    DeleteDC(hdc);
+
+    /* Test a mem DC without selecting a bitmap */
+    hdc = CreateCompatibleDC(NULL);
+    ok(hdc != 0, "\n");
+    ok_long(PatBlt(hdc, 0, 0, 1, 1, PATCOPY), 1);
+    ok_err(0);
+    DeleteDC(hdc);
+
+
+
+}
 
 void Test_BrushOrigin()
 {
@@ -100,6 +162,10 @@
         return;
     }
 
+    Test_PatBlt_Params();
+
     Test_BrushOrigin();
+
+
 }
 

Added: trunk/rostests/apitests/gdi32/SetPixel.c
URL: http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/gdi32/SetPixel.c?rev=56492&view=auto
==============================================================================
--- trunk/rostests/apitests/gdi32/SetPixel.c (added)
+++ trunk/rostests/apitests/gdi32/SetPixel.c [iso-8859-1] Fri May  4 11:40:36 2012
@@ -1,0 +1,187 @@
+/*
+ * PROJECT:         ReactOS api tests
+ * LICENSE:         GPL - See COPYING in the top level directory
+ * PURPOSE:         Test for SetPixel
+ * PROGRAMMERS:     Timo Kreuzer
+ */
+
+#include <stdio.h>
+#include <wine/test.h>
+#include <windows.h>
+
+static struct
+{
+    WORD palVersion;
+    WORD palNumEntries;
+    PALETTEENTRY logpalettedata[8];
+} gpal =
+{
+    0x300, 8,
+    {
+        { 0x10, 0x20, 0x30, PC_NOCOLLAPSE },
+        { 0x20, 0x30, 0x40, PC_NOCOLLAPSE },
+        { 0x30, 0x40, 0x50, PC_NOCOLLAPSE },
+        { 0x40, 0x50, 0x60, PC_NOCOLLAPSE },
+        { 0x50, 0x60, 0x70, PC_NOCOLLAPSE },
+        { 0x60, 0x70, 0x80, PC_NOCOLLAPSE },
+        { 0x70, 0x80, 0x90, PC_NOCOLLAPSE },
+        { 0x80, 0x90, 0xA0, PC_NOCOLLAPSE },
+    }
+};
+
+void Test_SetPixel_Params()
+{
+    HDC hdc;
+
+    SetLastError(0);
+    ok_long(SetPixel(0, 0, 0, RGB(255,255,255)), -1);
+    ok_err(ERROR_INVALID_HANDLE);
+
+    /* Test an info DC */
+    hdc = CreateICA("DISPLAY", NULL, NULL, NULL);
+    ok(hdc != 0, "\n");
+    SetLastError(0);
+    ok_long(SetPixel(hdc, 0, 0, 0), -1);
+    ok_long(SetPixel(hdc, 0, 0, RGB(255,255,255)), -1);
+    ok_err(0);
+    DeleteDC(hdc);
+
+    /* Test a mem DC without selecting a bitmap */
+    hdc = CreateCompatibleDC(NULL);
+    ok(hdc != 0, "\n");
+    SetLastError(0);
+    ok_long(SetPixel(hdc, 0, 0, 0), -1);
+    ok_err(0);
+    DeleteDC(hdc);
+
+    /* Test deleted DC */
+    ok_long(SetPixel(hdc, 0, 0, 0), -1);
+
+}
+
+void Test_SetPixel_PAL()
+{
+    struct
+    {
+        BITMAPINFOHEADER bmiHeader;
+        WORD bmiColors[8];
+    } bmibuffer;
+    BITMAPINFO *pbmi = (PVOID)&bmibuffer;
+    HBITMAP hbmp;
+    HDC hdc;
+    HPALETTE hpal, hpalOld;
+    PULONG pulBits;
+    ULONG i;
+
+    /* Initialize the BITMAPINFO */
+    pbmi->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
+    pbmi->bmiHeader.biWidth = 1;
+    pbmi->bmiHeader.biHeight = 1;
+    pbmi->bmiHeader.biPlanes = 1;
+    pbmi->bmiHeader.biBitCount = 8;
+    pbmi->bmiHeader.biCompression = BI_RGB;
+    pbmi->bmiHeader.biSizeImage = 0;
+    pbmi->bmiHeader.biXPelsPerMeter = 1;
+    pbmi->bmiHeader.biYPelsPerMeter = 1;
+    pbmi->bmiHeader.biClrUsed = 8;
+    pbmi->bmiHeader.biClrImportant = 0;
+    for( i = 0; i < 8; i++ )
+    {
+        bmibuffer.bmiColors[i] = i + 1;
+    }
+
+    /* Create a memory DC */
+    hdc = CreateCompatibleDC(0);
+    ok(hdc != 0, "failed\n");
+
+    /* Create a DIB section and select it */
+    hbmp = CreateDIBSection(hdc, pbmi, DIB_PAL_COLORS, (PVOID*)&pulBits, 0, 0 );
+    ok(hbmp != NULL, "CreateDIBSection failed with error %ld\n", GetLastError());
+    ok(SelectObject(hdc, hbmp) != 0, "SelectObject failed\n");
+
+    ok_long(SetPixel(hdc, 0, 0, 0), 0);
+    ok_long(pulBits[0], 8);
+    ok_long(SetPixel(hdc, 0, 0, 1), 0);
+    ok_long(pulBits[0], 8);
+    ok_long(SetPixel(hdc, 0, 0, RGB(255,255,255)), 0xc0dcc0);
+    ok_long(pulBits[0], 7);
+
+    ok_long(SetPixel(hdc, 0, 0, RGB(255,0,0)), 0x80);
+    ok_long(pulBits[0], 0);
+
+    /* Test DIBINDEX */
+    ok_long(SetPixel(hdc, 0, 0, DIBINDEX(0)), 0x80);
+    ok_long(pulBits[0], 0);
+    ok_long(SetPixel(hdc, 0, 0, DIBINDEX(1)), 0x8000);
+    ok_long(pulBits[0], 1);
+    ok_long(SetPixel(hdc, 0, 0, DIBINDEX(7)), 0xc0dcc0);
+    ok_long(pulBits[0], 7);
+    ok_long(SetPixel(hdc, 0, 0, DIBINDEX(8)), 0);
+    ok_long(pulBits[0], 8);
+    ok_long(SetPixel(hdc, 0, 0, DIBINDEX(126)), 0);
+    ok_long(pulBits[0], 126);
+    ok_long(SetPixel(hdc, 0, 0, DIBINDEX(0x123456)), 0);
+    ok_long(pulBits[0], 0x56);
+
+    /* Test PALETTEINDEX */
+    ok_long(SetPixel(hdc, 0, 0, PALETTEINDEX(0)), 0);
+    ok_long(pulBits[0], 8);
+    ok_long(SetPixel(hdc, 0, 0, PALETTEINDEX(1)), 0x80);
+    ok_long(pulBits[0], 0);
+    ok_long(SetPixel(hdc, 0, 0, PALETTEINDEX(2)), 0x8000);
+    ok_long(pulBits[0], 1);
+
+    /* Delete the DIB section */
+    DeleteObject(hbmp);
+
+
+    /* Initialize the logical palette and select it */
+    hpal = CreatePalette((LOGPALETTE*)&gpal);
+    hpalOld = SelectPalette(hdc, hpal, FALSE);
+    ok(hpalOld != NULL, "error=%ld\n", GetLastError());
+
+
+    /* Create a DIB section and select it */
+    hbmp = CreateDIBSection(hdc, pbmi, DIB_PAL_COLORS, (PVOID*)&pulBits, 0, 0 );
+    ok(hbmp != NULL, "CreateDIBSection failed with error %ld\n", GetLastError());
+    ok(SelectObject(hdc, hbmp) != 0, "SelectObject failed\n");
+
+    ok_long(SetPixel(hdc, 0, 0, 0), 0);
+    ok_long(pulBits[0], 8);
+
+    ok_long(SetPixel(hdc, 0, 0, RGB(255,0,0)), 0x605040);
+    ok_long(pulBits[0], 2);
+
+    /* Test DIBINDEX */
+    ok_long(SetPixel(hdc, 0, 0, DIBINDEX(0)), 0x403020);
+    ok_long(pulBits[0], 0);
+    ok_long(SetPixel(hdc, 0, 0, DIBINDEX(1)), 0x504030);
+    ok_long(pulBits[0], 1);
+    ok_long(SetPixel(hdc, 0, 0, DIBINDEX(7)), 0x302010);
+    ok_long(pulBits[0], 7);
+    ok_long(SetPixel(hdc, 0, 0, DIBINDEX(8)), 0);
+    ok_long(pulBits[0], 8);
+    ok_long(SetPixel(hdc, 0, 0, DIBINDEX(126)), 0);
+    ok_long(pulBits[0], 126);
+    ok_long(SetPixel(hdc, 0, 0, DIBINDEX(0x123456)), 0);
+    ok_long(pulBits[0], 0x56);
+
+    /* Test PALETTEINDEX */
+    ok_long(SetPixel(hdc, 0, 0, PALETTEINDEX(0)), 0x302010);
+    ok_long(pulBits[0], 7);
+    ok_long(SetPixel(hdc, 0, 0, PALETTEINDEX(1)), 0x403020);
+    ok_long(pulBits[0], 0);
+    ok_long(SetPixel(hdc, 0, 0, PALETTEINDEX(253)), 0x302010);
+    ok_long(pulBits[0], 7);
+    ok_long(SetPixel(hdc, 0, 0, PALETTEINDEX(254)), 0x302010);
+    ok_long(pulBits[0], 7);
+
+
+}
+
+START_TEST(SetPixel)
+{
+    Test_SetPixel_Params();
+    Test_SetPixel_PAL();
+}
+

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

Modified: trunk/rostests/apitests/gdi32/testlist.c
URL: http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/gdi32/testlist.c?rev=56492&r1=56491&r2=56492&view=diff
==============================================================================
--- trunk/rostests/apitests/gdi32/testlist.c [iso-8859-1] (original)
+++ trunk/rostests/apitests/gdi32/testlist.c [iso-8859-1] Fri May  4 11:40:36 2012
@@ -39,6 +39,7 @@
 extern void func_GdiSetAttrs(void);
 extern void func_GetClipRgn(void);
 extern void func_GetCurrentObject(void);
+extern void func_GetDIBColorTable(void);
 extern void func_GetDIBits(void);
 extern void func_GetPixel(void);
 extern void func_GetObject(void);
@@ -50,9 +51,11 @@
 extern void func_PatBlt(void);
 extern void func_Rectangle(void);
 extern void func_SelectObject(void);
+extern void func_SetBrushOrgEx(void);
 extern void func_SetDCPenColor(void);
 extern void func_SetDIBits(void);
 extern void func_SetMapMode(void);
+extern void func_SetPixel(void);
 extern void func_SetSysColors(void);
 extern void func_SetWindowExtEx(void);
 extern void func_SetWorldTransform(void);
@@ -93,6 +96,7 @@
     { "GdiSetAttrs", func_GdiSetAttrs },
     { "GetClipRgn", func_GetClipRgn },
     { "GetCurrentObject", func_GetCurrentObject },
+    { "GetDIBColorTable", func_GetDIBColorTable },
     { "GetDIBits", func_GetDIBits },
     { "GetPixel", func_GetPixel },
     { "GetObject", func_GetObject },
@@ -104,9 +108,11 @@
     { "PatBlt", func_PatBlt },
     { "Rectangle", func_Rectangle },
     { "SelectObject", func_SelectObject },
+    { "SetBrushOrgEx", func_SetBrushOrgEx },
     { "SetDCPenColor", func_SetDCPenColor },
     { "SetDIBits", func_SetDIBits },
     { "SetMapMode", func_SetMapMode },
+    { "SetPixel", func_SetPixel },
     { "SetSysColors", func_SetSysColors },
     { "SetWindowExtEx", func_SetWindowExtEx },
     { "SetWorldTransform", func_SetWorldTransform },




More information about the Ros-diffs mailing list