Vincent Povirk : gdiplus: Add test for GdipSetTextRenderingHint and make it pass.

Alexandre Julliard julliard at winehq.org
Tue Mar 29 11:43:05 CDT 2011


Module: wine
Branch: master
Commit: b3dfe973adaf1a9cbe92f53838fa468c45d6d0ea
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=b3dfe973adaf1a9cbe92f53838fa468c45d6d0ea

Author: Vincent Povirk <vincent at codeweavers.com>
Date:   Mon Mar 28 17:38:38 2011 -0500

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 );




More information about the wine-cvs mailing list