From dd661cb15840e9b3da564cf79a73378a2c06fff6 Mon Sep 17 00:00:00 2001 From: Vincent Povirk Date: Mon, 28 Mar 2011 17:38:38 -0500 Subject: [PATCH 2/2] gdiplus: Add test for GdipSetTextRenderingHint and make it pass. --- dlls/gdiplus/graphics.c | 2 +- dlls/gdiplus/tests/graphics.c | 49 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 50 insertions(+), 1 deletions(-) diff --git a/dlls/gdiplus/graphics.c b/dlls/gdiplus/graphics.c index eb74021..163aaac 100644 --- a/dlls/gdiplus/graphics.c +++ b/dlls/gdiplus/graphics.c @@ -5023,7 +5023,7 @@ GpStatus WINGDIPAPI GdipSetTextRenderingHint(GpGraphics *graphics, { TRACE("(%p, %d)\n", graphics, hint); - if(!graphics) + if(!graphics || hint > TextRenderingHintClearTypeGridFit) return InvalidParameter; if(graphics->busy) diff --git a/dlls/gdiplus/tests/graphics.c b/dlls/gdiplus/tests/graphics.c index d42b37a..3adf6c6 100644 --- a/dlls/gdiplus/tests/graphics.c +++ b/dlls/gdiplus/tests/graphics.c @@ -3113,6 +3113,54 @@ static void test_get_set_interpolation(void) ReleaseDC(hwnd, hdc); } +static void test_get_set_textrenderinghint(void) +{ + GpGraphics *graphics; + HDC hdc = GetDC( hwnd ); + GpStatus status; + TextRenderingHint hint; + + ok(hdc != NULL, "Expected HDC to be initialized\n"); + status = GdipCreateFromHDC(hdc, &graphics); + expect(Ok, status); + ok(graphics != NULL, "Expected graphics to be initialized\n"); + + status = GdipGetTextRenderingHint(NULL, &hint); + expect(InvalidParameter, status); + + status = GdipGetTextRenderingHint(graphics, NULL); + expect(InvalidParameter, status); + + status = GdipSetTextRenderingHint(NULL, TextRenderingHintAntiAlias); + expect(InvalidParameter, status); + + /* out of range */ + status = GdipSetTextRenderingHint(graphics, TextRenderingHintClearTypeGridFit+1); + expect(InvalidParameter, status); + + status = GdipGetTextRenderingHint(graphics, &hint); + expect(Ok, status); + expect(TextRenderingHintSystemDefault, hint); + + status = GdipSetTextRenderingHint(graphics, TextRenderingHintSystemDefault); + expect(Ok, status); + + status = GdipGetTextRenderingHint(graphics, &hint); + expect(Ok, status); + expect(TextRenderingHintSystemDefault, hint); + + status = GdipSetTextRenderingHint(graphics, TextRenderingHintAntiAliasGridFit); + expect(Ok, status); + + status = GdipGetTextRenderingHint(graphics, &hint); + expect(Ok, status); + expect(TextRenderingHintAntiAliasGridFit, hint); + + GdipDeleteGraphics(graphics); + + ReleaseDC(hwnd, hdc); +} + START_TEST(graphics) { struct GdiplusStartupInput gdiplusStartupInput; @@ -3172,6 +3220,7 @@ START_TEST(graphics) test_fromMemoryBitmap(); test_string_functions(); test_get_set_interpolation(); + test_get_set_textrenderinghint(); GdiplusShutdown(gdiplusToken); DestroyWindow( hwnd ); -- 1.7.1