Author: tkreuzer
Date: Mon Oct 28 20:39:26 2013
New Revision: 60787
URL:
http://svn.reactos.org/svn/reactos?rev=60787&view=rev
Log:
[GDI32_APITEST]
- Add more tests for CreateDIBitmap and SetDIBitsToDevice
Modified:
trunk/rostests/apitests/gdi32/CreateDIBitmap.c
trunk/rostests/apitests/gdi32/SetDIBitsToDevice.c
Modified: trunk/rostests/apitests/gdi32/CreateDIBitmap.c
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/gdi32/CreateDIBi…
==============================================================================
--- trunk/rostests/apitests/gdi32/CreateDIBitmap.c [iso-8859-1] (original)
+++ trunk/rostests/apitests/gdi32/CreateDIBitmap.c [iso-8859-1] Mon Oct 28 20:39:26 2013
@@ -65,7 +65,7 @@
return FALSE;
}
- if ((fdwInit & CBM_INIT))
+ if (fdwInit & CBM_INIT)
{
if (!lpbInit || (lpbInit == (PVOID)0xC0000000)) return FALSE;
}
@@ -74,26 +74,26 @@
{
return FALSE;
}
-
- return TRUE;
- }
-
- if ((lpbmih == NULL) ||
- (lpbmih == (PVOID)0xC0000000) ||
- (lpbmih->biSize == 0))
- {
- return FALSE;
- }
-
- if (hdc == (HDC)-1)
- {
- *pdwError = ERROR_INVALID_PARAMETER;
- return FALSE;
- }
-
-
- if (lpbmi == (PVOID)0xc0000000) return FALSE;
-
+ }
+ else
+ {
+
+ if ((lpbmih == NULL) ||
+ (lpbmih == (PVOID)0xC0000000) ||
+ (lpbmih->biSize == 0))
+ {
+ return FALSE;
+ }
+
+ if (hdc == (HDC)-1)
+ {
+ *pdwError = ERROR_INVALID_PARAMETER;
+ return FALSE;
+ }
+
+
+ if (lpbmi == (PVOID)0xc0000000) return FALSE;
+ }
return TRUE;
}
@@ -400,7 +400,7 @@
PackedDIB.bmiHeader.biSizeImage = 0;
hbmp = CreateDIBitmap(hdc, &PackedDIB.bmiHeader, CBM_INIT,
&PackedDIB.ajBuffer, (PVOID)&PackedDIB, DIB_PAL_COLORS);
- ok(hbmp == 0, "CreateDIBitmap succeeded, expeted failure\n");
+ ok(hbmp == 0, "CreateDIBitmap succeeded, expected failure\n");
ok_err(0xbadbad00);
/* Test a line that is too long */
@@ -420,14 +420,33 @@
HBITMAP hbmp, hbmpOld;
HDC hdc;
BITMAPINFO bmi =
- {{sizeof(BITMAPINFOHEADER), 4, 4, 1, 8, BI_RGB, 0, 1, 1, 1, 0}, {{0,0,0,0}}};
- BYTE ajBits[10];
+ {{sizeof(BITMAPINFOHEADER), 4, 4, 1, 8, BI_RGB, 0, 1, 1, 1, 0}, {{0,1,2,3}}};
+ BYTE ajBits[10] = {0,1,2,3,4,5,6,7,8,9};
BITMAP bitmap;
+ struct
+ {
+ BITMAPINFOHEADER bmiHeader;
+ WORD wColors[4];
+ } bmiRLE =
+ {
+ {sizeof(BITMAPINFOHEADER), 8, 2, 1, 8, BI_RLE8, 20, 1, 1, 4, 0},
+ {0, 1, 2, 7}
+ };
+ BYTE ajBitsRLE[] = {4,0, 0,2,0,1,0,2,3,1, 2,1, 2,2, 1,3,1,0,1,2, };
hdc = CreateCompatibleDC(0);
- ok(hdc != 0, "failed\n");
-
- hbmp = CreateDIBitmap(hdc, &bmi.bmiHeader, CBM_CREATDIB, ajBits, &bmi,
DIB_PAL_COLORS);
+ if (hdc == NULL)
+ {
+ ok(0, "CreateCompatibleDC failed. Skipping tests!\n");
+ return;
+ }
+
+ SetLastError(0xbadbad00);
+ hbmp = CreateDIBitmap(hdc, NULL, CBM_CREATDIB, ajBits, NULL, DIB_RGB_COLORS);
+ ok(hbmp == 0, "CreateDIBitmap should fail.\n");
+ ok_int(GetLastError(), 0xbadbad00);
+
+ hbmp = CreateDIBitmap(hdc, NULL, CBM_CREATDIB, ajBits, &bmi, DIB_RGB_COLORS);
ok(hbmp != 0, "CreateDIBitmap failed.\n");
ok_long(GetObject(hbmp, sizeof(DIBSECTION), &bitmap), sizeof(BITMAP));
@@ -441,8 +460,72 @@
hbmpOld = SelectObject(hdc, hbmp);
ok(hbmpOld != NULL, "Couldn't select the bitmap.\n");
+
+ /* Copy it on a dib section */
+ memset(pulDIB32Bits, 0x77, 64);
+ ok_long(BitBlt(ghdcDIB32, 0, 0, 4, 4, hdc, 0, 0, SRCCOPY), 1);
+ ok_long(pulDIB32Bits[0], 0x20100);
+ ok_long(pulDIB32Bits[1], 0x20100);
+ ok_long(pulDIB32Bits[2], 0x20100);
+ ok_long(pulDIB32Bits[3], 0x20100);
+
SelectObject(hdc, hbmpOld);
DeleteObject(hbmp);
+
+ hbmp = CreateDIBitmap(hdc, NULL, CBM_CREATDIB | CBM_INIT, ajBits, &bmi,
DIB_PAL_COLORS);
+ ok(hbmp != 0, "CreateDIBitmap failed.\n");
+
+ ok_long(GetObject(hbmp, sizeof(DIBSECTION), &bitmap), sizeof(BITMAP));
+ ok_int(bitmap.bmType, 0);
+ ok_int(bitmap.bmWidth, 4);
+ ok_int(bitmap.bmHeight, 4);
+ ok_int(bitmap.bmWidthBytes, 4);
+ ok_int(bitmap.bmPlanes, 1);
+ ok_int(bitmap.bmBitsPixel, 8);
+ ok_ptr(bitmap.bmBits, 0);
+
+ /* Even with CBM_INIT and lpbmih != 0, pbmi is used for the dimensions */
+ hbmp = CreateDIBitmap(hdc, &bmiRLE.bmiHeader, CBM_CREATDIB | CBM_INIT, ajBits,
&bmi, DIB_PAL_COLORS);
+ ok(hbmp != 0, "CreateDIBitmap failed.\n");
+
+ ok_long(GetObject(hbmp, sizeof(DIBSECTION), &bitmap), sizeof(BITMAP));
+ ok_int(bitmap.bmType, 0);
+ ok_int(bitmap.bmWidth, 4);
+ ok_int(bitmap.bmHeight, 4);
+ ok_int(bitmap.bmWidthBytes, 4);
+ ok_int(bitmap.bmPlanes, 1);
+ ok_int(bitmap.bmBitsPixel, 8);
+ ok_ptr(bitmap.bmBits, 0);
+
+ hbmpOld = SelectObject(hdc, hbmp);
+ ok(hbmpOld != NULL, "Couldn't select the bitmap.\n");
+
+ /* Copy it on a dib section */
+ memset(pulDIB32Bits, 0x77, 64);
+ ok_long(BitBlt(ghdcDIB32, 0, 0, 4, 4, hdc, 0, 0, SRCCOPY), 1);
+ ok_long(pulDIB32Bits[0], 0);
+ ok_long(pulDIB32Bits[1], 0);
+ ok_long(pulDIB32Bits[2], 0);
+ ok_long(pulDIB32Bits[3], 0);
+
+ SelectObject(hdc, hbmpOld);
+ DeleteObject(hbmp);
+
+ hbmp = CreateDIBitmap(hdc, NULL, CBM_CREATDIB, ajBitsRLE, (PVOID)&bmiRLE,
DIB_PAL_COLORS);
+ ok(hbmp == 0, "CreateDIBitmap should fail.\n");
+ hbmp = CreateDIBitmap(hdc, NULL, CBM_INIT | CBM_CREATDIB, ajBitsRLE,
(PVOID)&bmiRLE, DIB_PAL_COLORS);
+ ok(hbmp == 0, "CreateDIBitmap should fail.\n");
+
+ /* Check if a 0 pixel bitmap results in the DEFAULT_BITMAP being returned */
+ bmi.bmiHeader.biWidth = 0;
+ bmi.bmiHeader.biHeight = 4;
+ hbmp = CreateDIBitmap(hdc, &bmi.bmiHeader, CBM_CREATDIB, ajBits, &bmi,
DIB_PAL_COLORS);
+ ok(hbmp == GetStockObject(21), "CreateDIBitmap didn't return the default
bitmap.\n");
+ bmi.bmiHeader.biWidth = 23;
+ bmi.bmiHeader.biHeight = 0;
+ hbmp = CreateDIBitmap(hdc, &bmi.bmiHeader, CBM_CREATDIB, ajBits, &bmi,
DIB_PAL_COLORS);
+ ok(hbmp == GetStockObject(21), "CreateDIBitmap didn't return the default
bitmap.\n");
+
DeleteDC(hdc);
}
Modified: trunk/rostests/apitests/gdi32/SetDIBitsToDevice.c
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/gdi32/SetDIBitsT…
==============================================================================
--- trunk/rostests/apitests/gdi32/SetDIBitsToDevice.c [iso-8859-1] (original)
+++ trunk/rostests/apitests/gdi32/SetDIBitsToDevice.c [iso-8859-1] Mon Oct 28 20:39:26
2013
@@ -12,6 +12,444 @@
static void
Test_SetDIBitsToDevice_Params()
+{
+ UCHAR ajBmiBuffer[sizeof(BITMAPINFO) + 4];
+ PBITMAPINFO pbmi = (PBITMAPINFO)ajBmiBuffer;
+ ULONG aulBits[16];
+ INT ret;
+
+ /* Setup the bitmap info */
+ pbmi->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
+ pbmi->bmiHeader.biWidth = 2;
+ pbmi->bmiHeader.biHeight = -4;
+ 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;
+
+ /* Test a normal operation */
+ SetLastError(0xdeadc0de);
+ ret = SetDIBitsToDevice(ghdcDIB32,
+ 0, // XDest,
+ 0, // YDest,
+ 2, // dwWidth,
+ 2, // dwHeight,
+ 0, // XSrc,
+ 0, // YSrc,
+ 0, // uStartScan,
+ 2, // cScanLines,
+ aulBits, // lpvBits,
+ pbmi,
+ DIB_RGB_COLORS);
+ ok_dec(ret, 2);
+ ok_err(0xdeadc0de);
+
+ /* Test hdc == NULL */
+ SetLastError(0xdeadc0de);
+ ret = SetDIBitsToDevice(NULL,
+ 0, // XDest,
+ 0, // YDest,
+ 2, // dwWidth,
+ 2, // dwHeight,
+ 0, // XSrc,
+ 0, // YSrc,
+ 0, // uStartScan,
+ 2, // cScanLines,
+ aulBits, // lpvBits,
+ pbmi,
+ DIB_RGB_COLORS);
+ ok_dec(ret, 0);
+ ok_err(ERROR_INVALID_HANDLE);
+
+ /* Test truncated hdc */
+ SetLastError(0xdeadc0de);
+ ret = SetDIBitsToDevice((HDC)((ULONG_PTR)ghdcDIB32 & 0xFFFF),
+ 0, // XDest,
+ 0, // YDest,
+ 2, // dwWidth,
+ 2, // dwHeight,
+ 0, // XSrc,
+ 0, // YSrc,
+ 0, // uStartScan,
+ 2, // cScanLines,
+ aulBits, // lpvBits,
+ pbmi,
+ DIB_RGB_COLORS);
+ ok_dec(ret, 0);
+ ok_err(ERROR_INVALID_HANDLE);
+
+ /* Test invalid ColorUse */
+ SetLastError(0xdeadc0de);
+ ret = SetDIBitsToDevice(ghdcDIB32,
+ 0, // XDest,
+ 0, // YDest,
+ 2, // dwWidth,
+ 2, // dwHeight,
+ 0, // XSrc,
+ 0, // YSrc,
+ 0, // uStartScan,
+ 2, // cScanLines,
+ aulBits, // lpvBits,
+ pbmi,
+ 7);
+ ok_dec(ret, 0);
+ ok_err(0xdeadc0de);
+
+ /* test unaligned buffer */
+ SetLastError(0xdeadc0de);
+ ret = SetDIBitsToDevice(ghdcDIB32,
+ 0, // XDest,
+ 0, // YDest,
+ 2, // dwWidth,
+ 2, // dwHeight,
+ 0, // XSrc,
+ 0, // YSrc,
+ 0, // uStartScan,
+ 2, // cScanLines,
+ (BYTE*)aulBits + 1, // lpvBits,
+ pbmi,
+ DIB_RGB_COLORS);
+ ok_dec(ret, 2);
+ ok_err(0xdeadc0de);
+
+ /* test unaligned and huge scanline buffer */
+ SetLastError(0xdeadc0de);
+ ret = SetDIBitsToDevice(ghdcDIB32,
+ 0, // XDest,
+ 0, // YDest,
+ 2, // dwWidth,
+ 2, // dwHeight,
+ 0, // XSrc,
+ 0, // YSrc,
+ 0, // uStartScan,
+ 20000000, // cScanLines,
+ (BYTE*)aulBits + 1, // lpvBits,
+ pbmi,
+ DIB_RGB_COLORS);
+ todo_ros ok_dec(ret, 0);
+ ok_err(0xdeadc0de);
+
+ /* test unaligned illegal buffer */
+ SetLastError(0xdeadc0de);
+ ret = SetDIBitsToDevice(ghdcDIB32,
+ 0, // XDest,
+ 0, // YDest,
+ 2, // dwWidth,
+ 2, // dwHeight,
+ 0, // XSrc,
+ 0, // YSrc,
+ 0, // uStartScan,
+ 2, // cScanLines,
+ (BYTE*)0x7fffffff, // lpvBits,
+ pbmi,
+ DIB_RGB_COLORS);
+ todo_ros ok_dec(ret, 0);
+ ok_err(0xdeadc0de);
+
+ /* Test negative XDest */
+ SetLastError(0xdeadc0de);
+ ret = SetDIBitsToDevice(ghdcDIB32,
+ -100, // XDest,
+ 0, // YDest,
+ 2, // dwWidth,
+ 2, // dwHeight,
+ 0, // XSrc,
+ 0, // YSrc,
+ 0, // uStartScan,
+ 2, // cScanLines,
+ aulBits, // lpvBits,
+ pbmi,
+ DIB_RGB_COLORS);
+ ok_dec(ret, 2);
+ ok_err(0xdeadc0de);
+
+ /* Test huge XDest */
+ SetLastError(0xdeadc0de);
+ ret = SetDIBitsToDevice(ghdcDIB32,
+ LONG_MAX, // XDest,
+ 0, // YDest,
+ 2, // dwWidth,
+ 2, // dwHeight,
+ 0, // XSrc,
+ 0, // YSrc,
+ 0, // uStartScan,
+ 2, // cScanLines,
+ aulBits, // lpvBits,
+ pbmi,
+ DIB_RGB_COLORS);
+ ok_dec(ret, 2);
+ ok_err(0xdeadc0de);
+
+ /* Test XSrc outside of the DIB */
+ SetLastError(0xdeadc0de);
+ ret = SetDIBitsToDevice(ghdcDIB32,
+ 0, // XDest,
+ 0, // YDest,
+ 2, // dwWidth,
+ 2, // dwHeight,
+ 100, // XSrc,
+ 0, // YSrc,
+ 0, // uStartScan,
+ 2, // cScanLines,
+ aulBits, // lpvBits,
+ pbmi,
+ DIB_RGB_COLORS);
+ ok_dec(ret, 2);
+ ok_err(0xdeadc0de);
+
+ /* Test YSrc outside of the DIB */
+ SetLastError(0xdeadc0de);
+ ret = SetDIBitsToDevice(ghdcDIB32,
+ 0, // XDest,
+ 0, // YDest,
+ 2, // dwWidth,
+ 2, // dwHeight,
+ 0, // XSrc,
+ 100, // YSrc,
+ 0, // uStartScan,
+ 2, // cScanLines,
+ aulBits, // lpvBits,
+ pbmi,
+ DIB_RGB_COLORS);
+ ok_dec(ret, 2);
+ ok_err(0xdeadc0de);
+
+ /* Test uStartScan outside of the DIB */
+ SetLastError(0xdeadc0de);
+ ret = SetDIBitsToDevice(ghdcDIB32,
+ 0, // XDest,
+ 0, // YDest,
+ 2, // dwWidth,
+ 2, // dwHeight,
+ 0, // XSrc,
+ 0, // YSrc,
+ 100, // uStartScan,
+ 5, // cScanLines,
+ aulBits, // lpvBits,
+ pbmi,
+ DIB_RGB_COLORS);
+ ok_dec(ret, 5);
+ ok_err(0xdeadc0de);
+
+ /* Test cScanLines larger than the DIB */
+ SetLastError(0xdeadc0de);
+ ret = SetDIBitsToDevice(ghdcDIB32,
+ 0, // XDest,
+ 0, // YDest,
+ 2, // dwWidth,
+ 2, // dwHeight,
+ 0, // XSrc,
+ 0, // YSrc,
+ 0, // uStartScan,
+ 7, // cScanLines,
+ aulBits, // lpvBits,
+ pbmi,
+ DIB_RGB_COLORS);
+ todo_ros ok_dec(ret, 7);
+ ok_err(0xdeadc0de);
+
+ /* Test large cScanlines */
+ SetLastError(0xdeadc0de);
+ ret = SetDIBitsToDevice(ghdcDIB32,
+ 0, // XDest,
+ 0, // YDest,
+ 2, // dwWidth,
+ 2, // dwHeight,
+ 0, // XSrc,
+ 0, // YSrc,
+ 0, // uStartScan,
+ 2000, // cScanLines,
+ aulBits, // lpvBits,
+ pbmi,
+ DIB_RGB_COLORS);
+ todo_ros ok_dec(ret, 0);
+ ok_err(0xdeadc0de);
+
+ /* Test uStartScan and cScanLines larger than the DIB */
+ SetLastError(0xdeadc0de);
+ ret = SetDIBitsToDevice(ghdcDIB32,
+ 0, // XDest,
+ 0, // YDest,
+ 2, // dwWidth,
+ 2, // dwHeight,
+ 0, // XSrc,
+ 0, // YSrc,
+ 100, // uStartScan,
+ 7, // cScanLines,
+ aulBits, // lpvBits,
+ pbmi,
+ DIB_RGB_COLORS);
+ ok_dec(ret, 7);
+ ok_err(0xdeadc0de);
+
+ /* Test lpvBits == NULL */
+ SetLastError(0xdeadc0de);
+ ret = SetDIBitsToDevice(ghdcDIB32,
+ 0, // XDest,
+ 0, // YDest,
+ 2, // dwWidth,
+ 2, // dwHeight,
+ 0, // XSrc,
+ 0, // YSrc,
+ 0, // uStartScan,
+ 2, // cScanLines,
+ NULL, // lpvBits,
+ pbmi,
+ DIB_RGB_COLORS);
+ ok_dec(ret, 0);
+ ok_err(0xdeadc0de);
+
+ /* Test pbmi == NULL */
+ SetLastError(0xdeadc0de);
+ ret = SetDIBitsToDevice(ghdcDIB32,
+ 0, // XDest,
+ 0, // YDest,
+ 2, // dwWidth,
+ 2, // dwHeight,
+ 0, // XSrc,
+ 0, // YSrc,
+ 0, // uStartScan,
+ 2, // cScanLines,
+ aulBits, // lpvBits,
+ NULL,
+ DIB_RGB_COLORS);
+ ok_dec(ret, 0);
+ ok_err(0xdeadc0de);
+
+ /* Test huge positive DIB height, result is limited to dwHeight */
+ pbmi->bmiHeader.biHeight = 10000;
+ SetLastError(0xdeadc0de);
+ ret = SetDIBitsToDevice(ghdcDIB32,
+ 0, // XDest,
+ 1, // YDest,
+ 2, // dwWidth,
+ 3, // dwHeight,
+ 0, // XSrc,
+ 1, // YSrc,
+ 0, // uStartScan,
+ 7, // cScanLines,
+ aulBits, // lpvBits,
+ pbmi,
+ DIB_RGB_COLORS);
+ ok_dec(ret, 4);
+ ok_err(0xdeadc0de);
+
+ /* Test huge negative DIB height */
+ pbmi->bmiHeader.biHeight = -10000;
+ SetLastError(0xdeadc0de);
+ ret = SetDIBitsToDevice(ghdcDIB32,
+ 0, // XDest,
+ 0, // YDest,
+ 2, // dwWidth,
+ 2, // dwHeight,
+ 0, // XSrc,
+ 0, // YSrc,
+ 0, // uStartScan,
+ 7, // cScanLines,
+ aulBits, // lpvBits,
+ pbmi,
+ DIB_RGB_COLORS);
+ ok_dec(ret, 7);
+ ok_err(0xdeadc0de);
+
+ /* Test what happens when we cause an integer overflow */
+ pbmi->bmiHeader.biHeight = LONG_MIN;
+ SetLastError(0xdeadc0de);
+ ret = SetDIBitsToDevice(ghdcDIB32,
+ 0, // XDest,
+ 0, // YDest,
+ 2, // dwWidth,
+ 2, // dwHeight,
+ 0, // XSrc,
+ 0, // YSrc,
+ 0, // uStartScan,
+ 2, // cScanLines,
+ aulBits, // lpvBits,
+ pbmi,
+ DIB_RGB_COLORS);
+ ok_dec(ret, 2);
+ ok_err(0xdeadc0de);
+
+ /* Now also test a huge value of uStartScan */
+ SetLastError(0xdeadc0de);
+ ret = SetDIBitsToDevice(ghdcDIB32,
+ 0, // XDest,
+ 0, // YDest,
+ 2, // dwWidth,
+ 2, // dwHeight,
+ 0, // XSrc,
+ 0, // YSrc,
+ abs(pbmi->bmiHeader.biHeight) - 3, // uStartScan,
+ 9, // cScanLines,
+ aulBits, // lpvBits,
+ pbmi,
+ DIB_RGB_COLORS);
+ ok_dec(ret, 3);
+ ok_err(0xdeadc0de);
+
+ /* Now also test a huge value of uStartScan */
+ pbmi->bmiHeader.biHeight = LONG_MIN + 1;
+ SetLastError(0xdeadc0de);
+ ret = SetDIBitsToDevice(ghdcDIB32,
+ 0, // XDest,
+ 0, // YDest,
+ 2, // dwWidth,
+ 2, // dwHeight,
+ 0, // XSrc,
+ 0, // YSrc,
+ abs(pbmi->bmiHeader.biHeight) - 3, // uStartScan,
+ 9, // cScanLines,
+ aulBits, // lpvBits,
+ pbmi,
+ DIB_RGB_COLORS);
+ ok_dec(ret, 5);
+ ok_err(0xdeadc0de);
+
+ /* Now also test a huge value of uStartScan */
+ pbmi->bmiHeader.biHeight = LONG_MIN + 7;
+ SetLastError(0xdeadc0de);
+ ret = SetDIBitsToDevice(ghdcDIB32,
+ 0, // XDest,
+ 0, // YDest,
+ 2, // dwWidth,
+ 2, // dwHeight,
+ 0, // XSrc,
+ 0, // YSrc,
+ abs(pbmi->bmiHeader.biHeight) - 3, // uStartScan,
+ 32, // cScanLines,
+ aulBits, // lpvBits,
+ pbmi,
+ DIB_RGB_COLORS);
+ ok_dec(ret, 17);
+ ok_err(0xdeadc0de);
+
+ /* Test invalid bitmap info header */
+ pbmi->bmiHeader.biSize = 0;
+ SetLastError(0xdeadc0de);
+ ret = SetDIBitsToDevice(ghdcDIB32,
+ 0, // XDest,
+ 0, // YDest,
+ 2, // dwWidth,
+ 2, // dwHeight,
+ 0, // XSrc,
+ 0, // YSrc,
+ 0, // uStartScan,
+ 2, // cScanLines,
+ aulBits, // lpvBits,
+ pbmi,
+ DIB_RGB_COLORS);
+ ok_dec(ret, 0);
+ ok_err(0xdeadc0de);
+
+}
+
+
+static void
+Test_SetDIBitsToDevice()
{
UCHAR ajBmiBuffer[sizeof(BITMAPINFO) + 4];
PBITMAPINFO pbmi = (PBITMAPINFO)ajBmiBuffer;
@@ -31,260 +469,6 @@
pbmi->bmiHeader.biClrUsed = 0;
pbmi->bmiHeader.biClrImportant = 0;
- SetLastError(0xdeadc0de);
- ret = SetDIBitsToDevice(ghdcDIB32,
- 0, // XDest,
- 0, // YDest,
- 2, // dwWidth,
- 2, // dwHeight,
- 0, // XSrc,
- 0, // YSrc,
- 0, // uStartScan,
- 2, // cScanLines,
- aulBits, // lpvBits,
- pbmi,
- DIB_RGB_COLORS);
- ok_dec(ret, 2);
- ok_err(0xdeadc0de);
-
- SetLastError(0xdeadc0de);
- ret = SetDIBitsToDevice(ghdcDIB32,
- 0, // XDest,
- 0, // YDest,
- 2, // dwWidth,
- 2, // dwHeight,
- 0, // XSrc,
- 0, // YSrc,
- 0, // uStartScan,
- 2, // cScanLines,
- NULL, // lpvBits,
- pbmi,
- DIB_RGB_COLORS);
- ok_dec(ret, 0);
- ok_err(0xdeadc0de);
-
- /* test unaligned buffer */
- SetLastError(0xdeadc0de);
- ret = SetDIBitsToDevice(ghdcDIB32,
- 0, // XDest,
- 0, // YDest,
- 2, // dwWidth,
- 2, // dwHeight,
- 0, // XSrc,
- 0, // YSrc,
- 0, // uStartScan,
- 2, // cScanLines,
- (BYTE*)aulBits + 1, // lpvBits,
- pbmi,
- DIB_RGB_COLORS);
- ok_dec(ret, 2);
- ok_err(0xdeadc0de);
-
- /* test unaligned and huge scanline buffer */
- SetLastError(0xdeadc0de);
- ret = SetDIBitsToDevice(ghdcDIB32,
- 0, // XDest,
- 0, // YDest,
- 2, // dwWidth,
- 2, // dwHeight,
- 0, // XSrc,
- 0, // YSrc,
- 0, // uStartScan,
- 2000000, // cScanLines,
- (BYTE*)aulBits + 1, // lpvBits,
- pbmi,
- DIB_RGB_COLORS);
- ok_dec(ret, 0);
- ok_err(0xdeadc0de);
-
- /* test unaligned illegal buffer */
- SetLastError(0xdeadc0de);
- ret = SetDIBitsToDevice(ghdcDIB32,
- 0, // XDest,
- 0, // YDest,
- 2, // dwWidth,
- 2, // dwHeight,
- 0, // XSrc,
- 0, // YSrc,
- 0, // uStartScan,
- 2, // cScanLines,
- (BYTE*)0x7fffffff, // lpvBits,
- pbmi,
- DIB_RGB_COLORS);
- ok_dec(ret, 0);
- ok_err(0xdeadc0de);
-
- SetLastError(0xdeadc0de);
- ret = SetDIBitsToDevice(ghdcDIB32,
- -100, // XDest,
- 0, // YDest,
- 2, // dwWidth,
- 2, // dwHeight,
- 0, // XSrc,
- 0, // YSrc,
- 0, // uStartScan,
- 2, // cScanLines,
- aulBits, // lpvBits,
- pbmi,
- DIB_RGB_COLORS);
- ok_dec(ret, 2);
- ok_err(0xdeadc0de);
-
- SetLastError(0xdeadc0de);
- ret = SetDIBitsToDevice(ghdcDIB32,
- LONG_MAX, // XDest,
- 0, // YDest,
- 2, // dwWidth,
- 2, // dwHeight,
- 0, // XSrc,
- 0, // YSrc,
- 0, // uStartScan,
- 2, // cScanLines,
- aulBits, // lpvBits,
- pbmi,
- DIB_RGB_COLORS);
- ok_dec(ret, 2);
- ok_err(0xdeadc0de);
-
- SetLastError(0xdeadc0de);
- ret = SetDIBitsToDevice(ghdcDIB32,
- 0, // XDest,
- 0, // YDest,
- 2, // dwWidth,
- 2, // dwHeight,
- 100, // XSrc,
- 0, // YSrc,
- 0, // uStartScan,
- 2, // cScanLines,
- aulBits, // lpvBits,
- pbmi,
- DIB_RGB_COLORS);
- ok_dec(ret, 2);
- ok_err(0xdeadc0de);
-
- SetLastError(0xdeadc0de);
- ret = SetDIBitsToDevice(ghdcDIB32,
- 0, // XDest,
- 0, // YDest,
- 2, // dwWidth,
- 2, // dwHeight,
- 0, // XSrc,
- 100, // YSrc,
- 0, // uStartScan,
- 2, // cScanLines,
- aulBits, // lpvBits,
- pbmi,
- DIB_RGB_COLORS);
- ok_dec(ret, 2);
- ok_err(0xdeadc0de);
-
- SetLastError(0xdeadc0de);
- ret = SetDIBitsToDevice(ghdcDIB32,
- 0, // XDest,
- 0, // YDest,
- 2, // dwWidth,
- 2, // dwHeight,
- 0, // XSrc,
- 0, // YSrc,
- 0, // uStartScan,
- 66, // cScanLines,
- aulBits, // lpvBits,
- pbmi,
- DIB_RGB_COLORS);
- ok_dec(ret, 66);
- ok_err(0xdeadc0de);
-
- SetLastError(0xdeadc0de);
- ret = SetDIBitsToDevice(ghdcDIB32,
- 0, // XDest,
- 0, // YDest,
- 2, // dwWidth,
- 2, // dwHeight,
- 0, // XSrc,
- 0, // YSrc,
- 0, // uStartScan,
- 200, // cScanLines,
- aulBits, // lpvBits,
- pbmi,
- DIB_RGB_COLORS);
- ok_dec(ret, 0);
- ok_err(0xdeadc0de);
-
- SetLastError(0xdeadc0de);
- ret = SetDIBitsToDevice(ghdcDIB32,
- 0, // XDest,
- 0, // YDest,
- 2, // dwWidth,
- 2, // dwHeight,
- 0, // XSrc,
- 0, // YSrc,
- 2000, // uStartScan,
- 66, // cScanLines,
- aulBits, // lpvBits,
- pbmi,
- DIB_RGB_COLORS);
- ok_dec(ret, 66);
- ok_err(0xdeadc0de);
-
- /* Test pbmi == NULL */
- SetLastError(0xdeadc0de);
- ret = SetDIBitsToDevice(ghdcDIB32,
- 0, // XDest,
- 0, // YDest,
- 2, // dwWidth,
- 2, // dwHeight,
- 0, // XSrc,
- 0, // YSrc,
- 0, // uStartScan,
- 2, // cScanLines,
- aulBits, // lpvBits,
- NULL,
- DIB_RGB_COLORS);
- ok_dec(ret, 0);
- ok_err(0xdeadc0de);
-
- /* Test illegal bitmap info */
- pbmi->bmiHeader.biSize = 0;
- SetLastError(0xdeadc0de);
- ret = SetDIBitsToDevice(ghdcDIB32,
- 0, // XDest,
- 0, // YDest,
- 2, // dwWidth,
- 2, // dwHeight,
- 0, // XSrc,
- 0, // YSrc,
- 0, // uStartScan,
- 2, // cScanLines,
- aulBits, // lpvBits,
- pbmi,
- DIB_RGB_COLORS);
- ok_dec(ret, 0);
- ok_err(0xdeadc0de);
-
-}
-
-
-static void
-Test_SetDIBitsToDevice()
-{
- UCHAR ajBmiBuffer[sizeof(BITMAPINFO) + 4];
- PBITMAPINFO pbmi = (PBITMAPINFO)ajBmiBuffer;
- ULONG aulBits[16];
- INT ret;
-
- /* Setup the bitmap info */
- pbmi->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
- pbmi->bmiHeader.biWidth = 2;
- pbmi->bmiHeader.biHeight = -2;
- 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;
-
/* Set pixels */
aulBits[0] = 0x11000000;
aulBits[1] = 0x00000011;
@@ -359,12 +543,12 @@
DIB_RGB_COLORS);
ok_dec(ret, 1);
- ok_hex(pulDIB32Bits[0], 0x00000000);
- ok_hex(pulDIB32Bits[1], 0x00000000);
- ok_hex(pulDIB32Bits[2], 0x00000000);
- ok_hex(pulDIB32Bits[3], 0x00000000);
- ok_hex(pulDIB32Bits[4], 0x11000000);
- ok_hex(pulDIB32Bits[5], 0x00000011);
+ todo_ros ok_hex(pulDIB32Bits[0], 0x00000000);
+ todo_ros ok_hex(pulDIB32Bits[1], 0x00000000);
+ ok_hex(pulDIB32Bits[2], 0x00000000);
+ ok_hex(pulDIB32Bits[3], 0x00000000);
+ todo_ros ok_hex(pulDIB32Bits[4], 0x11000000);
+ todo_ros ok_hex(pulDIB32Bits[5], 0x00000011);
ok_hex(pulDIB32Bits[6], 0x00000000);
ok_hex(pulDIB32Bits[7], 0x00000000);
@@ -384,12 +568,12 @@
DIB_RGB_COLORS);
ok_dec(ret, 1);
- ok_hex(pulDIB32Bits[0], 0x11000000);
- ok_hex(pulDIB32Bits[1], 0x00000011);
- ok_hex(pulDIB32Bits[2], 0x00000000);
- ok_hex(pulDIB32Bits[3], 0x00000000);
- ok_hex(pulDIB32Bits[4], 0x00000000);
- ok_hex(pulDIB32Bits[5], 0x00000000);
+ todo_ros ok_hex(pulDIB32Bits[0], 0x11000000);
+ todo_ros ok_hex(pulDIB32Bits[1], 0x00000011);
+ ok_hex(pulDIB32Bits[2], 0x00000000);
+ ok_hex(pulDIB32Bits[3], 0x00000000);
+ todo_ros ok_hex(pulDIB32Bits[4], 0x00000000);
+ todo_ros ok_hex(pulDIB32Bits[5], 0x00000000);
ok_hex(pulDIB32Bits[6], 0x00000000);
ok_hex(pulDIB32Bits[7], 0x00000000);
@@ -465,12 +649,12 @@
DIB_RGB_COLORS);
ok_dec(ret, 1);
- ok_hex(pulDIB32Bits[0], 0x00000000);
- ok_hex(pulDIB32Bits[1], 0x00000000);
- ok_hex(pulDIB32Bits[2], 0x00000000);
- ok_hex(pulDIB32Bits[3], 0x00000000);
- ok_hex(pulDIB32Bits[4], 0x11000000);
- ok_hex(pulDIB32Bits[5], 0x00000011);
+ todo_ros ok_hex(pulDIB32Bits[0], 0x00000000);
+ todo_ros ok_hex(pulDIB32Bits[1], 0x00000000);
+ ok_hex(pulDIB32Bits[2], 0x00000000);
+ ok_hex(pulDIB32Bits[3], 0x00000000);
+ todo_ros ok_hex(pulDIB32Bits[4], 0x11000000);
+ todo_ros ok_hex(pulDIB32Bits[5], 0x00000011);
ok_hex(pulDIB32Bits[6], 0x00000000);
ok_hex(pulDIB32Bits[7], 0x00000000);
@@ -490,12 +674,12 @@
DIB_RGB_COLORS);
ok_dec(ret, 1);
- ok_hex(pulDIB32Bits[0], 0x11000000);
- ok_hex(pulDIB32Bits[1], 0x00000011);
- ok_hex(pulDIB32Bits[2], 0x00000000);
- ok_hex(pulDIB32Bits[3], 0x00000000);
- ok_hex(pulDIB32Bits[4], 0x00000000);
- ok_hex(pulDIB32Bits[5], 0x00000000);
+ todo_ros ok_hex(pulDIB32Bits[0], 0x11000000);
+ todo_ros ok_hex(pulDIB32Bits[1], 0x00000011);
+ ok_hex(pulDIB32Bits[2], 0x00000000);
+ ok_hex(pulDIB32Bits[3], 0x00000000);
+ todo_ros ok_hex(pulDIB32Bits[4], 0x00000000);
+ todo_ros ok_hex(pulDIB32Bits[5], 0x00000000);
ok_hex(pulDIB32Bits[6], 0x00000000);
ok_hex(pulDIB32Bits[7], 0x00000000);