Nikolay Sivov : gdi32/tests: Some empty string tests for GetTextExtentPoint.

Alexandre Julliard julliard at wine.codeweavers.com
Mon Nov 16 09:43:46 CST 2015


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

Author: Nikolay Sivov <nsivov at codeweavers.com>
Date:   Sat Nov 14 00:38:39 2015 +0300

gdi32/tests: Some empty string tests for GetTextExtentPoint.

Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/gdi32/tests/font.c | 24 +++++++++++++++++++++++-
 1 file changed, 23 insertions(+), 1 deletion(-)

diff --git a/dlls/gdi32/tests/font.c b/dlls/gdi32/tests/font.c
index 6eefc3b..53945da 100644
--- a/dlls/gdi32/tests/font.c
+++ b/dlls/gdi32/tests/font.c
@@ -1410,6 +1410,7 @@ static void test_GetCharABCWidths(void)
 static void test_text_extents(void)
 {
     static const WCHAR wt[] = {'O','n','e','\n','t','w','o',' ','3',0};
+    static const WCHAR emptyW[] = {0};
     LPINT extents;
     INT i, len, fit1, fit2, extents2[3];
     LOGFONTA lf;
@@ -1428,9 +1429,20 @@ static void test_text_extents(void)
     hdc = GetDC(0);
     hfont = SelectObject(hdc, hfont);
     GetTextMetricsA(hdc, &tm);
-    GetTextExtentPointA(hdc, "o", 1, &sz);
+    ret = GetTextExtentPointA(hdc, "o", 1, &sz);
+    ok(ret, "got %d\n", ret);
     ok(sz.cy == tm.tmHeight, "cy %d tmHeight %d\n", sz.cy, tm.tmHeight);
 
+    memset(&sz, 0xcc, sizeof(sz));
+    ret = GetTextExtentPointA(hdc, "o", 0, &sz);
+    ok(ret, "got %d\n", ret);
+    ok(sz.cx == 0 && sz.cy == 0, "cx %d, cy %d\n", sz.cx, sz.cy);
+
+    memset(&sz, 0xcc, sizeof(sz));
+    ret = GetTextExtentPointA(hdc, "", 0, &sz);
+    ok(ret, "got %d\n", ret);
+    ok(sz.cx == 0 && sz.cy == 0, "cx %d, cy %d\n", sz.cx, sz.cy);
+
     SetLastError(0xdeadbeef);
     GetTextExtentExPointW(hdc, wt, 1, 1, &fit1, &fit2, &sz1);
     if (GetLastError() == ERROR_CALL_NOT_IMPLEMENTED)
@@ -1442,6 +1454,16 @@ static void test_text_extents(void)
         return;
     }
 
+    memset(&sz, 0xcc, sizeof(sz));
+    ret = GetTextExtentPointW(hdc, wt, 0, &sz);
+    ok(ret, "got %d\n", ret);
+    ok(sz.cx == 0 && sz.cy == 0, "cx %d, cy %d\n", sz.cx, sz.cy);
+
+    memset(&sz, 0xcc, sizeof(sz));
+    ret = GetTextExtentPointW(hdc, emptyW, 0, &sz);
+    ok(ret, "got %d\n", ret);
+    ok(sz.cx == 0 && sz.cy == 0, "cx %d, cy %d\n", sz.cx, sz.cy);
+
     len = lstrlenW(wt);
     extents = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, len * sizeof extents[0]);
     extents[0] = 1;         /* So that the increasing sequence test will fail




More information about the wine-cvs mailing list