Module: wine Branch: master Commit: e1006611cddd904e6361e0010a6eb1988afab033 URL: http://source.winehq.org/git/wine.git/?a=commit;h=e1006611cddd904e6361e0010a...
Author: Piotr Caban piotr@codeweavers.com Date: Tue Feb 14 10:24:53 2017 +0100
gdiplus: Add GdipCreateHBITMAPFromBitmap tests when bitmap bits are locked.
Signed-off-by: Piotr Caban piotr@codeweavers.com Signed-off-by: Vincent Povirk vincent@codeweavers.com Signed-off-by: Alexandre Julliard julliard@winehq.org
---
dlls/gdiplus/tests/image.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+)
diff --git a/dlls/gdiplus/tests/image.c b/dlls/gdiplus/tests/image.c index 6abd026..0ef72b2 100644 --- a/dlls/gdiplus/tests/image.c +++ b/dlls/gdiplus/tests/image.c @@ -1666,6 +1666,7 @@ static void test_createhbitmap(void) HDC hdc; COLORREF pixel; BYTE bits[640]; + BitmapData lockeddata;
memset(bits, 0x68, 640);
@@ -1850,6 +1851,30 @@ static void test_createhbitmap(void)
stat = GdipDisposeImage((GpImage*)bitmap); expect(Ok, stat); + + /* create HBITMAP from locked data */ + memset(bits, 0x68, 640); + stat = GdipCreateBitmapFromScan0(10, 20, 32, PixelFormat24bppRGB, bits, &bitmap); + expect(Ok, stat); + + memset(&lockeddata, 0, sizeof(lockeddata)); + stat = GdipBitmapLockBits(bitmap, NULL, ImageLockModeRead | ImageLockModeWrite, + PixelFormat32bppRGB, &lockeddata); + expect(Ok, stat); + ((DWORD*)lockeddata.Scan0)[0] = 0xff242424; + stat = GdipCreateHBITMAPFromBitmap(bitmap, &hbitmap, 0); + expect(Ok, stat); + stat = GdipBitmapUnlockBits(bitmap, &lockeddata); + expect(Ok, stat); + stat = GdipDisposeImage((GpImage*)bitmap); + expect(Ok, stat); + + hdc = CreateCompatibleDC(NULL); + oldhbitmap = SelectObject(hdc, hbitmap); + pixel = GetPixel(hdc, 0, 0); + expect(0x686868, pixel); + SelectObject(hdc, oldhbitmap); + DeleteDC(hdc); }
static void test_getthumbnail(void)