[1/3] gdiplus: Add a test for drawing to HDC's backed by 32-bit alpha dibs.

Vincent Povirk madewokherd at gmail.com
Mon Dec 3 17:12:47 CST 2012


-------------- next part --------------
From e794356c06f5b91bd2200a7ac6176757ad871d67 Mon Sep 17 00:00:00 2001
From: Vincent Povirk <vincent at codeweavers.com>
Date: Mon, 3 Dec 2012 16:00:36 -0600
Subject: [PATCH 1/3] gdiplus: Add a test for drawing to HDC's backed by
 32-bit alpha dibs.

---
 dlls/gdiplus/tests/graphics.c |   50 +++++++++++++++++++++++++++++++++++++++++
 1 file changed, 50 insertions(+)

diff --git a/dlls/gdiplus/tests/graphics.c b/dlls/gdiplus/tests/graphics.c
index 5fc1626..553e77f 100644
--- a/dlls/gdiplus/tests/graphics.c
+++ b/dlls/gdiplus/tests/graphics.c
@@ -4083,6 +4083,55 @@ static void test_measured_extra_space(void)
     GdipDeleteStringFormat(format);
 }
 
+static void test_alpha_hdc(void)
+{
+    GpStatus status;
+    HDC hdc;
+    HBITMAP hbm, old_hbm;
+    GpGraphics *graphics;
+    ULONG *bits;
+    BITMAPINFO bmi;
+
+    hdc = CreateCompatibleDC(0);
+    ok(hdc != NULL, "CreateCompatibleDC failed\n");
+    bmi.bmiHeader.biSize = sizeof(bmi.bmiHeader);
+    bmi.bmiHeader.biHeight = 5;
+    bmi.bmiHeader.biWidth = 5;
+    bmi.bmiHeader.biBitCount = 32;
+    bmi.bmiHeader.biPlanes = 1;
+    bmi.bmiHeader.biCompression = BI_RGB;
+    bmi.bmiHeader.biClrUsed = 0;
+
+    hbm = CreateDIBSection(hdc, &bmi, DIB_RGB_COLORS, (void**)&bits, NULL, 0);
+    ok(hbm != NULL, "CreateDIBSection failed\n");
+
+    old_hbm = SelectObject(hdc, hbm);
+
+    status = GdipCreateFromHDC(hdc, &graphics);
+    expect(Ok, status);
+
+    bits[0] = 0xdeadbeef;
+
+    status = GdipGraphicsClear(graphics, 0xffaaaaaa);
+    expect(Ok, status);
+
+    todo_wine expect(0xffaaaaaa, bits[0]);
+
+    SelectObject(hdc, old_hbm);
+
+    bits[0] = 0xdeadbeef;
+
+    status = GdipGraphicsClear(graphics, 0xffbbbbbb);
+    expect(Ok, status);
+
+    todo_wine expect(0xffbbbbbb, bits[0]);
+
+    GdipDeleteGraphics(graphics);
+
+    DeleteObject(hbm);
+    DeleteDC(hdc);
+}
+
 START_TEST(graphics)
 {
     struct GdiplusStartupInput gdiplusStartupInput;
@@ -4149,6 +4198,7 @@ START_TEST(graphics)
     test_get_set_interpolation();
     test_get_set_textrenderinghint();
     test_getdc_scaled();
+    test_alpha_hdc();
 
     GdiplusShutdown(gdiplusToken);
     DestroyWindow( hwnd );
-- 
1.7.10.4


More information about the wine-patches mailing list