patch by Jeffrey Morlan (mrnobo1024 at yahoo dot com)
authorTimo Kreuzer <timo.kreuzer@reactos.org>
Sat, 31 May 2008 00:04:16 +0000 (00:04 +0000)
committerTimo Kreuzer <timo.kreuzer@reactos.org>
Sat, 31 May 2008 00:04:16 +0000 (00:04 +0000)
Testcase for NtGdiSetDIBitsToDeviceInternal
See issue #3294 for more details.

svn path=/trunk/; revision=33781

rostests/apitests/w32knapi/ntgdi/NtGdiSetDIBitsToDeviceInternal.c [new file with mode: 0644]
rostests/apitests/w32knapi/testlist.c

diff --git a/rostests/apitests/w32knapi/ntgdi/NtGdiSetDIBitsToDeviceInternal.c b/rostests/apitests/w32knapi/ntgdi/NtGdiSetDIBitsToDeviceInternal.c
new file mode 100644 (file)
index 0000000..e172815
--- /dev/null
@@ -0,0 +1,52 @@
+INT
+Test_NtGdiSetDIBitsToDeviceInternal(PTESTINFO pti)
+{
+       static const DWORD InBits[8] = { 0x81, 0x7E, 0x5A, 0x7E, 0x7E, 0x42, 0x7E, 0x81 };
+       DWORD OutBits[8];
+
+       HWND hWnd = CreateWindowW(L"Static", NULL, WS_VISIBLE,
+                                 100, 100, 200, 200,
+                                 NULL, NULL, NULL, NULL);
+       /* This DC has an nonzero origin */
+       HDC hDC = GetDC(hWnd);
+       struct
+       {
+               BITMAPINFOHEADER bmiHeader;
+               RGBQUAD bmiColors[2];
+       } bmi;
+       int x, y;
+
+       bmi.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
+       bmi.bmiHeader.biWidth = 8;
+       bmi.bmiHeader.biHeight = -8;
+       bmi.bmiHeader.biPlanes = 1;
+       bmi.bmiHeader.biBitCount = 1;
+       bmi.bmiHeader.biCompression = 0;
+       bmi.bmiHeader.biSizeImage = 0;
+       bmi.bmiHeader.biXPelsPerMeter = 0;
+       bmi.bmiHeader.biYPelsPerMeter = 0;
+       bmi.bmiHeader.biClrUsed = 0;
+       bmi.bmiHeader.biClrImportant = 0;
+       *(DWORD *)&bmi.bmiColors[0] = 0x000000;
+       *(DWORD *)&bmi.bmiColors[1] = 0xFFFFFF;
+
+       /* The destination coordinates are relative to the DC origin */
+       TEST(NtGdiSetDIBitsToDeviceInternal(hDC, 2, 3, 8, 8, 0, 0, 0, 8,
+                                           (PVOID)InBits, (BITMAPINFO *)&bmi, DIB_RGB_COLORS,
+                                           sizeof(InBits), sizeof(bmi), TRUE, NULL));
+
+       /* Now get the data from the screen, and see if it matches */
+       for (y = 0; y < 8; y++)
+       {
+               DWORD Row = 0;
+               for (x = 0; x < 8; x++)
+                       Row |= (0x80 & GetPixel(hDC, 2 + x, 3 + y)) >> x;
+               OutBits[y] = Row;
+       }
+       TEST(memcmp(InBits, OutBits, sizeof(InBits)) == 0);
+
+       ReleaseDC(hWnd, hDC);
+       DestroyWindow(hWnd);
+
+       return APISTATUS_NORMAL;
+}
index 5d630ff..aff2d37 100644 (file)
@@ -22,6 +22,7 @@
 #include "ntgdi/NtGdiSelectFont.c"\r
 #include "ntgdi/NtGdiSelectPen.c"\r
 #include "ntgdi/NtGdiSetBitmapBits.c"\r
+#include "ntgdi/NtGdiSetDIBitsToDeviceInternal.c"\r
 //#include "ntgdi/NtGdiSTROBJ_vEnumStart.c"\r
 #include "ntgdi/NtGdiGetDIBits.c"\r
 #include "ntgdi/NtGdiGetStockObject.c"\r
@@ -64,6 +65,7 @@ TESTENTRY TestList[] =
        { L"NtGdiGetFontResourceInfoInternalW", Test_NtGdiGetFontResourceInfoInternalW },\r
        { L"NtGdiGetRandomRgn", Test_NtGdiGetRandomRgn },\r
        { L"NtGdiSetBitmapBits", Test_NtGdiSetBitmapBits },\r
+       { L"NtGdiSetDIBitsToDeviceInternal", Test_NtGdiSetDIBitsToDeviceInternal },\r
        { L"NtGdiSelectBitmap", Test_NtGdiSelectBitmap },\r
        { L"NtGdiSelectBrush", Test_NtGdiSelectBrush },\r
        { L"NtGdiSelectFont", Test_NtGdiSelectFont },\r