Sven Baars : gdi32/tests: Add some more GetCharacterPlacement tests.

Alexandre Julliard julliard at winehq.org
Tue Feb 18 16:13:46 CST 2020


Module: wine
Branch: master
Commit: 7ef3d8015a56f2d4ac31939e5fd9d26956e94c9d
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=7ef3d8015a56f2d4ac31939e5fd9d26956e94c9d

Author: Sven Baars <sbaars at codeweavers.com>
Date:   Mon Feb 17 16:28:51 2020 +0100

gdi32/tests: Add some more GetCharacterPlacement tests.

Signed-off-by: Sven Baars <sbaars at codeweavers.com>
Signed-off-by: Huw Davies <huw at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/gdi32/tests/font.c | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/dlls/gdi32/tests/font.c b/dlls/gdi32/tests/font.c
index ea1bb960df..c96d8b1b56 100644
--- a/dlls/gdi32/tests/font.c
+++ b/dlls/gdi32/tests/font.c
@@ -4926,6 +4926,7 @@ static void test_GetCharacterPlacement(void)
     GCP_RESULTSA result;
     DWORD size, size2;
     WCHAR glyphs[20];
+    int pos[20];
     HDC hdc;
 
     hdc = CreateCompatibleDC(0);
@@ -4933,11 +4934,26 @@ static void test_GetCharacterPlacement(void)
 
     memset(&result, 0, sizeof(result));
     result.lStructSize = sizeof(result);
+    result.lpCaretPos = pos;
     result.lpGlyphs = glyphs;
     result.nGlyphs  = 20;
 
+    pos[0] = -1;
+    glyphs[0] = '!';
     size = GetCharacterPlacementA(hdc, "Wine Test", 9, 0, &result, 0);
     ok(size, "GetCharacterPlacementA failed!\n");
+    ok(result.nGlyphs == 9, "Unexpected number of glyphs %u\n", result.nGlyphs);
+    ok(glyphs[0] == 'W', "Unexpected first glyph %s\n", wine_dbgstr_wn(glyphs, 1));
+    ok(pos[0] == 0, "Unexpected caret position %d\n", pos[0]);
+
+    pos[0] = -1;
+    glyphs[0] = '!';
+    result.nGlyphs = 20;
+    size2 = GetCharacterPlacementA(hdc, "Wine Test", 0, 0, &result, 0);
+    ok(!size2, "Expected GetCharacterPlacementA to fail\n");
+    todo_wine ok(result.nGlyphs == 20, "Unexpected number of glyphs %u\n", result.nGlyphs);
+    ok(glyphs[0] == '!', "Unexpected first glyph %s\n", wine_dbgstr_wn(glyphs, 1));
+    todo_wine ok(pos[0] == -1, "Unexpected caret position %d\n", pos[0]);
 
     size2 = GetCharacterPlacementA(hdc, "Wine Test", 9, 0, NULL, 0);
     ok(size2, "GetCharacterPlacementA failed!\n");
@@ -4947,9 +4963,15 @@ static void test_GetCharacterPlacement(void)
     ok(size2, "GetCharacterPlacementA failed!\n");
     ok(size == size2, "GetCharacterPlacementA returned different result: %u vs %u\n", size2, size);
 
+    pos[0] = -1;
+    glyphs[0] = '!';
+    result.nGlyphs = 20;
     size = GetCharacterPlacementA(hdc, "Wine Test", 9, 1024, &result, GCP_REORDER);
     ok(size, "GetCharacterPlacementA failed!\n");
     ok(size == size2, "GetCharacterPlacementA returned different result: %u vs %u\n", size2, size);
+    ok(result.nGlyphs == 9, "Unexpected number of glyphs %u\n", result.nGlyphs);
+    ok(glyphs[0] == 'W', "Unexpected first glyph %s\n", wine_dbgstr_wn(glyphs, 1));
+    todo_wine ok(pos[0] == 0, "Unexpected caret position %d\n", pos[0]);
 
     DeleteDC(hdc);
 }




More information about the wine-cvs mailing list