gdi32/tests: GetTextExtentPoint should give repeatable results

Daniel Jelinski djelinski1 at gmail.com
Sat Jan 12 16:46:50 CST 2013


-------------- next part --------------
From d2c6335dcfd35d98035c507ae7f2acd90fb9bfc6 Mon Sep 17 00:00:00 2001
From: Daniel Jelinski <djelinski1 at gmail.com>
Date: Sat, 12 Jan 2013 23:32:48 +0100
Subject: gdi32/tests: GetTextExtentPoint should give repeatable results

These are tests for bug 32529. Since commit ebaf5ea17623268fb1c0f68b1cf9a5984bd4e46e
(Don't load bitmap glyphs when using subpixel rendering in GetGlyphOutline)
GetTextExtentPoint returns different results before and after glyphs are loaded,
at least for wine's Tahoma.
---
 dlls/gdi32/tests/font.c |   25 +++++++++++++++++++++++++
 1 files changed, 25 insertions(+), 0 deletions(-)

diff --git a/dlls/gdi32/tests/font.c b/dlls/gdi32/tests/font.c
index 337a6b9..1707405 100644
--- a/dlls/gdi32/tests/font.c
+++ b/dlls/gdi32/tests/font.c
@@ -4808,10 +4808,35 @@ static void test_stock_fonts(void)
     }
 }
 
+static void test_text_extents_repeatable(void)
+{
+    const char text[10] = "ABCDEFGHIJ";
+    HDC hdc;
+    HFONT hfont;
+    SIZE sz1, sz2;
+    LOGFONTA lf;
+
+    memset(&lf, 0, sizeof(lf));
+    strcpy(lf.lfFaceName, "Tahoma");
+    lf.lfHeight = -13;
+
+    hfont = CreateFontIndirectA(&lf);
+    hdc = GetDC(0);
+    hfont = SelectObject(hdc, hfont);
+    GetTextExtentPointA(hdc, text, sizeof(text), &sz1);
+    ExtTextOutA(hdc, 0, 0, 0, 0, text, sizeof(text), 0);
+    GetTextExtentPointA(hdc, text, sizeof(text), &sz2);
+    todo_wine ok(sz1.cx == sz2.cx, "extents different: first %d, second %d\n", sz1.cx, sz2.cx);
+    hfont = SelectObject(hdc, hfont);
+    DeleteObject(hfont);
+    DeleteDC(hdc);
+}
+
 START_TEST(font)
 {
     init();
 
+    test_text_extents_repeatable();
     test_stock_fonts();
     test_logfont();
     test_bitmap_font();
-- 
1.7.5.4


More information about the wine-patches mailing list