Jeremy White : gdi32:
Added a test for the case where lpvBits in GetDIBits is NULL and the
bitcount is 0 .
Alexandre Julliard
julliard at wine.codeweavers.com
Mon Jul 16 08:23:36 CDT 2007
Module: wine
Branch: master
Commit: a2c2b602923b62b8e67281e8f7c8aa08a11185a6
URL: http://source.winehq.org/git/wine.git/?a=commit;h=a2c2b602923b62b8e67281e8f7c8aa08a11185a6
Author: Jeremy White <jwhite at codeweavers.com>
Date: Fri Jul 13 11:32:10 2007 -0500
gdi32: Added a test for the case where lpvBits in GetDIBits is NULL and the bitcount is 0.
---
dlls/gdi32/tests/bitmap.c | 41 +++++++++++++++++++++++++++++++++++++++++
1 files changed, 41 insertions(+), 0 deletions(-)
diff --git a/dlls/gdi32/tests/bitmap.c b/dlls/gdi32/tests/bitmap.c
index 019bb35..566545d 100644
--- a/dlls/gdi32/tests/bitmap.c
+++ b/dlls/gdi32/tests/bitmap.c
@@ -1791,6 +1791,46 @@ static void test_bitmapinfoheadersize(void)
ReleaseDC(0, hdc);
}
+static void test_get16dibits(void)
+{
+ BYTE bits[4 * (16 / sizeof(BYTE))];
+ HBITMAP hbmp;
+ HDC screen_dc = GetDC(NULL);
+ int ret;
+ BITMAPINFO * info;
+ int info_len = sizeof(BITMAPINFOHEADER) + 1024;
+ BYTE *p;
+ int overwritten_bytes = 0;
+
+ memset(bits, 0, sizeof(bits));
+ hbmp = CreateBitmap(2, 2, 1, 16, bits);
+ ok(hbmp != NULL, "CreateBitmap failed\n");
+
+ info = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, info_len);
+ assert(info);
+
+ memset(info, '!', info_len);
+ memset(info, 0, sizeof(info->bmiHeader));
+
+ info->bmiHeader.biSize = sizeof(info->bmiHeader);
+ info->bmiHeader.biWidth = 2;
+ info->bmiHeader.biHeight = 2;
+ info->bmiHeader.biPlanes = 1;
+ info->bmiHeader.biCompression = BI_RGB;
+
+ ret = GetDIBits(screen_dc, hbmp, 0, 0, NULL, info, 0);
+ ok(ret != 0, "GetDIBits failed\n");
+
+ for (p = ((BYTE *) info) + sizeof(info->bmiHeader); (p - ((BYTE *) info)) < info_len; p++)
+ if (*p != '!')
+ overwritten_bytes++;
+ ok(overwritten_bytes == 0, "GetDIBits wrote past the buffer given\n");
+
+ DeleteObject(hbmp);
+ ReleaseDC(NULL, screen_dc);
+}
+
+
START_TEST(bitmap)
{
is_win9x = GetWindowLongPtrW(GetDesktopWindow(), GWLP_WNDPROC) == 0;
@@ -1809,4 +1849,5 @@ START_TEST(bitmap)
test_select_object();
test_CreateBitmap();
test_bitmapinfoheadersize();
+ test_get16dibits();
}
More information about the wine-cvs
mailing list