Author: gedmurphy
Date: Mon Sep 24 19:02:20 2007
New Revision: 29190
URL:
http://svn.reactos.org/svn/reactos?rev=29190&view=rev
Log:
Add basic tests for GetDIBits
Added:
trunk/rostests/apitests/gdi32api/tests/GetDIBits.c
Modified:
trunk/rostests/apitests/gdi32api/testlist.c
Modified: trunk/rostests/apitests/gdi32api/testlist.c
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/gdi32api/testlis…
==============================================================================
--- trunk/rostests/apitests/gdi32api/testlist.c (original)
+++ trunk/rostests/apitests/gdi32api/testlist.c Mon Sep 24 19:02:20 2007
@@ -13,6 +13,7 @@
#include "tests/GetClipRgn.c"
#include "tests/GetObject.c"
#include "tests/GetStockObject.c"
+#include "tests/GetDIBits.c"
#include "tests/SelectObject.c"
#include "tests/SetDCPenColor.c"
#include "tests/SetSysColors.c"
@@ -30,6 +31,7 @@
{ L"GetClipRgn", Test_GetClipRgn },
{ L"GetObject", Test_GetObject },
{ L"GetStockObject", Test_GetStockObject },
+ { L"GetDIBits", Test_GetDIBits },
{ L"SetSysColors", Test_SetSysColors },
{ L"SelectObject", Test_SelectObject },
{ L"SetDCPenColor", Test_SetDCPenColor },
Added: trunk/rostests/apitests/gdi32api/tests/GetDIBits.c
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/gdi32api/tests/G…
==============================================================================
--- trunk/rostests/apitests/gdi32api/tests/GetDIBits.c (added)
+++ trunk/rostests/apitests/gdi32api/tests/GetDIBits.c Mon Sep 24 19:02:20 2007
@@ -1,0 +1,49 @@
+INT
+Test_GetDIBits(PTESTINFO pti)
+{
+ HDC hDCScreen;
+ HBITMAP hBitmap;
+ BITMAPINFO bi;
+ INT ScreenBpp;
+
+ hDCScreen = GetDC(NULL);
+ if (hDCScreen == NULL)
+ {
+ return FALSE;
+ }
+
+ hBitmap = CreateCompatibleBitmap(hDCScreen, 16, 16);
+ RTEST(hBitmap != NULL);
+
+ SetLastError(ERROR_SUCCESS);
+ RTEST(GetDIBits(0, 0, 0, 0, NULL, NULL, 0) == 0);
+ RTEST(GetLastError() == ERROR_INVALID_PARAMETER);
+
+ SetLastError(ERROR_SUCCESS);
+ RTEST(GetDIBits((HDC)2345, 0, 0, 0, NULL, NULL, 0) == 0);
+ RTEST(GetLastError() == ERROR_INVALID_PARAMETER);
+
+ SetLastError(ERROR_SUCCESS);
+ RTEST(GetDIBits((HDC)2345, hBitmap, 0, 0, NULL, NULL, 0) == 0);
+ RTEST(GetLastError() == ERROR_INVALID_PARAMETER);
+
+ SetLastError(ERROR_SUCCESS);
+ RTEST(GetDIBits((HDC)2345, hBitmap, 0, 15, NULL, &bi, 0) == 0);
+ RTEST(GetLastError() == ERROR_INVALID_PARAMETER);
+
+ SetLastError(ERROR_SUCCESS);
+ ZeroMemory(&bi, sizeof(BITMAPINFO));
+ bi.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
+ RTEST(GetDIBits(hDCScreen, hBitmap, 0, 15, NULL, &bi, DIB_RGB_COLORS) > 0);
+ RTEST(GetLastError() == ERROR_SUCCESS);
+
+ ScreenBpp = GetDeviceCaps(hDCScreen, BITSPIXEL);
+ RTEST(bi.bmiHeader.biWidth == 16);
+ RTEST(bi.bmiHeader.biHeight == 16);
+ RTEST(bi.bmiHeader.biBitCount == ScreenBpp);
+ RTEST(bi.bmiHeader.biSizeImage == (16 * 16) * (ScreenBpp / 8));
+
+ DeleteObject(hBitmap);
+ ReleaseDC(NULL, hDCScreen);
+ return APISTATUS_NORMAL;
+}