Author: jgardou Date: Tue Mar 1 20:50:47 2011 New Revision: 50946
URL: http://svn.reactos.org/svn/reactos?rev=50946&view=rev Log: [GDI32_APITEST] - add a basic test for SetDIBits
Added: trunk/rostests/apitests/gdi32/SetDIBits.c (with props) Modified: trunk/rostests/apitests/gdi32/CMakeLists.txt 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.... ============================================================================== --- trunk/rostests/apitests/gdi32/CMakeLists.txt [iso-8859-1] (original) +++ trunk/rostests/apitests/gdi32/CMakeLists.txt [iso-8859-1] Tue Mar 1 20:50:47 2011 @@ -40,6 +40,7 @@ MaskBlt.c SelectObject.c SetDCPenColor.c + SetDIBits.c SetMapMode.c SetSysColors.c SetWindowExtEx.c
Added: trunk/rostests/apitests/gdi32/SetDIBits.c URL: http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/gdi32/SetDIBits.c... ============================================================================== --- trunk/rostests/apitests/gdi32/SetDIBits.c (added) +++ trunk/rostests/apitests/gdi32/SetDIBits.c [iso-8859-1] Tue Mar 1 20:50:47 2011 @@ -1,0 +1,56 @@ +/* + * PROJECT: ReactOS api tests + * LICENSE: GPL - See COPYING in the top level directory + * PURPOSE: Test for SetDIBits + * PROGRAMMERS: Jérôme Gardou + */ + +#include <stdio.h> +#include <wine/test.h> +#include <windows.h> + + +void Test_SetDIBits() +{ + char buffer[sizeof(BITMAPINFOHEADER)+2*sizeof(RGBQUAD)]; + ULONG* dibBuffer; + BITMAPINFO* pBMI = (BITMAPINFO*)buffer; + DWORD bits1bpp[2] = {0, 1}; + HBITMAP hbmp; + int ret; + + ZeroMemory(buffer, sizeof(buffer)); + + pBMI->bmiHeader.biSize=sizeof(BITMAPINFOHEADER); + pBMI->bmiHeader.biWidth=2; + pBMI->bmiHeader.biHeight=1; + pBMI->bmiHeader.biPlanes=1; + pBMI->bmiHeader.biBitCount=32; + pBMI->bmiHeader.biCompression=BI_RGB; + pBMI->bmiHeader.biSizeImage=0; + pBMI->bmiHeader.biXPelsPerMeter=0; + pBMI->bmiHeader.biYPelsPerMeter=0; + pBMI->bmiHeader.biClrUsed=0; + pBMI->bmiHeader.biClrImportant=0; + + hbmp = CreateDIBSection(NULL, pBMI, DIB_RGB_COLORS, (PVOID*)&dibBuffer, NULL, 0); + ok(hbmp!=NULL, "Failed to create a DIB section\n"); + + pBMI->bmiHeader.biBitCount = 1; + pBMI->bmiColors[0].rgbBlue = 0xFF; + pBMI->bmiColors[0].rgbGreen = 0xFF; + pBMI->bmiColors[0].rgbRed = 0xFF; + + ret = SetDIBits(NULL, hbmp, 0, 1, bits1bpp, pBMI, DIB_RGB_COLORS); + ok(ret == 1, "Copied %i scanlines\n", ret); + + ok(dibBuffer[0] = 0xFFFFFF, "Wrong color 0x%08x after SetDIBits\n", (unsigned int)dibBuffer[0]); + ok(dibBuffer[1] = 0xFFFFFF, "Wrong color 0x%08x after SetDIBits\n", (unsigned int)dibBuffer[1]); + + DeleteObject(hbmp); +} + +START_TEST(SetDIBits) +{ + Test_SetDIBits(); +}
Propchange: trunk/rostests/apitests/gdi32/SetDIBits.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_apite... ============================================================================== --- trunk/rostests/apitests/gdi32/gdi32_apitest.rbuild [iso-8859-1] (original) +++ trunk/rostests/apitests/gdi32/gdi32_apitest.rbuild [iso-8859-1] Tue Mar 1 20:50:47 2011 @@ -47,6 +47,7 @@ <file>MaskBlt.c</file> <file>SelectObject.c</file> <file>SetDCPenColor.c</file> + <file>SetDIBits.c</file> <file>SetMapMode.c</file> <file>SetSysColors.c</file> <file>SetWindowExtEx.c</file>
Modified: trunk/rostests/apitests/gdi32/testlist.c URL: http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/gdi32/testlist.c?... ============================================================================== --- trunk/rostests/apitests/gdi32/testlist.c [iso-8859-1] (original) +++ trunk/rostests/apitests/gdi32/testlist.c [iso-8859-1] Tue Mar 1 20:50:47 2011 @@ -43,6 +43,7 @@ extern void func_MaskBlt(void); extern void func_SelectObject(void); extern void func_SetDCPenColor(void); +extern void func_SetDIBits(void); extern void func_SetMapMode(void); extern void func_SetSysColors(void); extern void func_SetWindowExtEx(void); @@ -88,6 +89,7 @@ { "MaskBlt", func_MaskBlt }, { "SelectObject", func_SelectObject }, { "SetDCPenColor", func_SetDCPenColor }, + { "SetDIBits", func_SetDIBits }, { "SetMapMode", func_SetMapMode }, { "SetSysColors", func_SetSysColors }, { "SetWindowExtEx", func_SetWindowExtEx },