Vincent Povirk : gdiplus: Add tests for the HDC' s we get from bitmap objects.
Alexandre Julliard
julliard at winehq.org
Tue Aug 17 11:31:12 CDT 2010
Module: wine
Branch: master
Commit: 728aaf2902840a3eccfb9e462e8e2a4bde7f652d
URL: http://source.winehq.org/git/wine.git/?a=commit;h=728aaf2902840a3eccfb9e462e8e2a4bde7f652d
Author: Vincent Povirk <vincent at codeweavers.com>
Date: Mon Aug 16 15:47:17 2010 -0500
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);
}
More information about the wine-cvs
mailing list