Author: gedmurphy
Date: Tue Sep 25 17:20:46 2007
New Revision: 29199
URL:
http://svn.reactos.org/svn/reactos?rev=29199&view=rev
Log:
add more checks for GetDIBits
Modified:
trunk/rostests/apitests/gdi32api/tests/GetDIBits.c
Modified: 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 (original)
+++ trunk/rostests/apitests/gdi32api/tests/GetDIBits.c Tue Sep 25 17:20:46 2007
@@ -15,6 +15,7 @@
hBitmap = CreateCompatibleBitmap(hDCScreen, 16, 16);
RTEST(hBitmap != NULL);
+ /* misc */
SetLastError(ERROR_SUCCESS);
RTEST(GetDIBits(0, 0, 0, 0, NULL, NULL, 0) == 0);
RTEST(GetLastError() == ERROR_INVALID_PARAMETER);
@@ -31,12 +32,51 @@
RTEST(GetDIBits((HDC)2345, hBitmap, 0, 15, NULL, &bi, 0) == 0);
RTEST(GetLastError() == ERROR_INVALID_PARAMETER);
+
+
+ /* null hdc */
SetLastError(ERROR_SUCCESS);
- ZeroMemory(&bi, sizeof(BITMAPINFO));
- bi.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
+ ZeroMemory(&bi, sizeof(BITMAPINFO));
+ bi.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
+ RTEST(GetDIBits(NULL, hBitmap, 0, 15, NULL, &bi, DIB_RGB_COLORS) == 0);
+ RTEST(GetLastError() == ERROR_INVALID_PARAMETER);
+
+ /* null bitmap */
+ SetLastError(ERROR_SUCCESS);
+ ZeroMemory(&bi, sizeof(BITMAPINFO));
+ bi.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
+ RTEST(GetDIBits(hDCScreen, NULL, 0, 15, NULL, &bi, DIB_RGB_COLORS) == 0);
+ RTEST(GetLastError() == ERROR_SUCCESS);
+
+ /* 0 scan lines */
+ SetLastError(ERROR_SUCCESS);
+ ZeroMemory(&bi, sizeof(BITMAPINFO));
+ bi.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
+ RTEST(GetDIBits(hDCScreen, hBitmap, 0, 0, NULL, &bi, DIB_RGB_COLORS) > 0);
+ RTEST(GetLastError() == ERROR_SUCCESS);
+
+ /* null bitmap info - crashes XP*/
+ //SetLastError(ERROR_SUCCESS);
+ //RTEST(GetDIBits(hDCScreen, NULL, 0, 15, NULL, NULL, DIB_RGB_COLORS) == 0);
+ //RTEST(GetLastError() == ERROR_INVALID_PARAMETER);
+
+ /* bad bmi colours (uUsage) */
+ SetLastError(ERROR_SUCCESS);
+ ZeroMemory(&bi, sizeof(BITMAPINFO));
+ bi.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
+ RTEST(GetDIBits(hDCScreen, hBitmap, 0, 15, NULL, &bi, 100) == 0);
+ RTEST(GetLastError() == ERROR_SUCCESS);
+ RTEST(bi.bmiHeader.biWidth == 0);
+ RTEST(bi.bmiHeader.biHeight == 0);
+ RTEST(bi.bmiHeader.biBitCount == 0);
+ RTEST(bi.bmiHeader.biSizeImage == 0);
+
+ /* basic call */
+ 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);