[PATCH V2 1/2] gdiplus/tests: Add Gdip{Get, Release}DC more test.

Changping Yu dead.ash at hotmail.com
Mon Jun 22 07:02:14 CDT 2020


-------------- next part --------------
>From 792e60bf471b077985d02d912ec718cb9358aa76 Mon Sep 17 00:00:00 2001
From: Changping Yu <dead.ash at hotmail.com>
Date: Mon, 22 Jun 2020 19:54:29 +0800
Subject: [PATCH V2 1/2] gdiplus/tests: Add Gdip{Get, Release}DC more test.

Signed-off-by: Changping Yu <dead.ash at hotmail.com>
---
 dlls/gdiplus/tests/graphics.c | 45 +++++++++++++++++++++++++++++++++++
 1 file changed, 45 insertions(+)

diff --git a/dlls/gdiplus/tests/graphics.c b/dlls/gdiplus/tests/graphics.c
index f2ff589ab5..2b47171d96 100644
--- a/dlls/gdiplus/tests/graphics.c
+++ b/dlls/gdiplus/tests/graphics.c
@@ -1619,6 +1619,10 @@ static void test_Get_Release_DC(void)
     BOOL res;
     ARGB color = 0x00000000;
     HRGN hrgn = CreateRectRgn(0, 0, 10, 10);
+    GpFont *fnt = NULL;
+    LOGFONTA logfont;
+    GpBitmap *bm = NULL;
+    GpGraphics *img_graphics = NULL;
 
     pt[0].X = 10;
     pt[0].Y = 10;
@@ -1694,6 +1698,47 @@ static void test_Get_Release_DC(void)
     status = GdipGetDC(graphics, &retdc);
     expect(ObjectBusy, status);
 
+    /* call GdipCreateFontFromLogfontA */
+    memset(&logfont, 0, sizeof(logfont));
+    strcpy(logfont.lfFaceName,"Arial");
+    logfont.lfHeight = 12;
+    logfont.lfCharSet = DEFAULT_CHARSET;
+    /* try to use temp dc normal */
+    status = GdipCreateFontFromLogfontA(retdc, &logfont, &fnt);
+    expect(Ok, status);
+    status = GdipDeleteFont(fnt);
+    ok(status == Ok, "GdipDeleteFont failed: %d\n", status);
+
+    /* try to use temp dc released */
+    status = GdipReleaseDC(graphics, retdc);
+    expect(Ok, status);
+    status = GdipCreateFontFromLogfontA(retdc, &logfont, &fnt);
+    expect(Ok, status);
+    status = GdipDeleteFont(fnt);
+    ok(status == Ok, "GdipDeleteFont failed: %d\n", status); 
+
+    /* binding image of ImageTypeBitmap & PixelFormatAlpha to graphics */
+    status = GdipCreateBitmapFromScan0(10, 10, 0, PixelFormat32bppARGB, NULL, &bm);
+    expect(Ok, status);
+    status = GdipGetImageGraphicsContext((GpImage*)bm, &img_graphics);
+    expect(Ok, status);
+    status = GdipGetDC(img_graphics, &retdc);
+    expect(Ok, status);
+    status = GdipReleaseDC(img_graphics, retdc);
+    expect(Ok, status);
+    /* try to use temp dc released on image */
+    status = GdipCreateFontFromLogfontA(retdc, &logfont, &fnt);
+    todo_wine
+    expect(Ok, status);
+
+    status = GdipDisposeImage((GpImage*)bm);
+    expect(Ok, status);
+
+    status = GdipDeleteGraphics(img_graphics);
+
+    status = GdipGetDC(graphics, &retdc);
+    expect(Ok, status);
+
     /* try all Graphics calls here */
     status = GdipDrawArc(graphics, pen, 0.0, 0.0, 1.0, 1.0, 0.0, 0.0);
     expect(ObjectBusy, status);
-- 
2.26.2.windows.1



More information about the wine-devel mailing list