From e4d0d5d9adbcf6b886e1d595fa683d4fedf8017b Mon Sep 17 00:00:00 2001 From: Vincent Povirk Date: Mon, 16 Aug 2010 15:34:43 -0500 Subject: [PATCH] gdiplus: Add tests for the HDC's we get from bitmap objects. --- dlls/gdiplus/tests/graphics.c | 46 +++++++++++++++++++++++++++++++++++++++++ 1 files changed, 46 insertions(+), 0 deletions(-) diff --git a/dlls/gdiplus/tests/graphics.c b/dlls/gdiplus/tests/graphics.c index 609f426..9fae06c 100644 --- a/dlls/gdiplus/tests/graphics.c +++ b/dlls/gdiplus/tests/graphics.c @@ -2157,6 +2157,8 @@ static void test_fromMemoryBitmap(void) GpGraphics *graphics = NULL; GpBitmap *bitmap = NULL; BYTE bits[48] = {0}; + HDC hdc=NULL; + COLORREF color; status = GdipCreateBitmapFromScan0(4, 4, 12, PixelFormat24bppRGB, bits, &bitmap); expect(Ok, status); @@ -2172,6 +2174,50 @@ static void test_fromMemoryBitmap(void) /* drawing writes to the memory provided */ todo_wine expect(0x68, bits[10]); + status = GdipGetImageGraphicsContext((GpImage*)bitmap, &graphics); + expect(Ok, status); + + status = GdipGetDC(graphics, &hdc); + expect(Ok, status); + ok(hdc != NULL, "got NULL hdc\n"); + + color = GetPixel(hdc, 0, 0); + /* The HDC is write-only, and native fills with a solid color to figure out + * which pixels have changed. */ + todo_wine expect(0x0c0b0d, color); + + SetPixel(hdc, 0, 0, 0x797979); + SetPixel(hdc, 1, 0, 0x0c0b0d); + + status = GdipReleaseDC(graphics, hdc); + expect(Ok, status); + + GdipDeleteGraphics(graphics); + + todo_wine expect(0x79, bits[0]); + todo_wine expect(0x68, bits[3]); + + GdipDisposeImage((GpImage*)bitmap); + + /* We get the same kind of write-only HDC for a "normal" bitmap */ + status = GdipCreateBitmapFromScan0(4, 4, 12, PixelFormat24bppRGB, NULL, &bitmap); + expect(Ok, status); + + status = GdipGetImageGraphicsContext((GpImage*)bitmap, &graphics); + expect(Ok, status); + + status = GdipGetDC(graphics, &hdc); + expect(Ok, status); + ok(hdc != NULL, "got NULL hdc\n"); + + color = GetPixel(hdc, 0, 0); + todo_wine expect(0x0c0b0d, color); + + status = GdipReleaseDC(graphics, hdc); + expect(Ok, status); + + GdipDeleteGraphics(graphics); + GdipDisposeImage((GpImage*)bitmap); } -- 1.7.0.4