https://git.reactos.org/?p=reactos.git;a=commitdiff;h=ed0c6135284f2fb74da138...
commit ed0c6135284f2fb74da138f3f1f3c34cf0ee7e9e Author: Katayama Hirofumi MZ katayama.hirofumi.mz@gmail.com AuthorDate: Mon May 27 11:19:44 2019 +0900 Commit: GitHub noreply@github.com CommitDate: Mon May 27 11:19:44 2019 +0900
[GDI32_APITEST] Improve GetGlyphIndices testcase (#1582)
Strengthen the testcase for gdi32!GetGlyphIndicesW. CORE-12825 --- modules/rostests/apitests/gdi32/GetGlyphIndices.c | 33 ++++++++++++++++++++--- 1 file changed, 29 insertions(+), 4 deletions(-)
diff --git a/modules/rostests/apitests/gdi32/GetGlyphIndices.c b/modules/rostests/apitests/gdi32/GetGlyphIndices.c index 281616b614..745ab2d067 100644 --- a/modules/rostests/apitests/gdi32/GetGlyphIndices.c +++ b/modules/rostests/apitests/gdi32/GetGlyphIndices.c @@ -90,6 +90,8 @@ START_TEST(GetGlyphIndices) HFONT hFont; HDC hdc; int i; + DWORD ret; + static const WCHAR s_invalids[] = {0xFEFE, 0xFEFF, 0xFFFE, 0};
if (!InstallTempFont(TempTTFFile)) { @@ -116,21 +118,32 @@ START_TEST(GetGlyphIndices) ok_lasterrornotchanged();
/* Test invalid params */ + ok_int(GetGlyphIndicesW(hdc, NULL, 1, NULL, 0), GDI_ERROR); + ok_lasterrornotchanged(); + ok_int(GetGlyphIndicesW(hdc, NULL, 32, NULL, 0), GDI_ERROR); + ok_lasterrornotchanged(); ok_int(GetGlyphIndicesW(hdc, NULL, 0, Indices, 0), GDI_ERROR); ok_lasterrornotchanged(); ok_int(GetGlyphIndicesW(hdc, NULL, 1, Indices, 0), GDI_ERROR); ok_lasterrornotchanged(); + ok_int(GetGlyphIndicesW(hdc, NULL, 32, Indices, 0), GDI_ERROR); + ok_lasterrornotchanged(); ok_int(GetGlyphIndicesW(hdc, Single, 0, NULL, 0), GDI_ERROR); ok_lasterrornotchanged(); + ok_int(GetGlyphIndicesW(hdc, Single, 1, NULL, 0), GDI_ERROR); + ok_lasterrornotchanged(); + ok_int(GetGlyphIndicesW(hdc, Glyphs, 32, NULL, 0), GDI_ERROR); + ok_lasterrornotchanged(); ok_int(GetGlyphIndicesW(hdc, Single, 0, Indices, 0), GDI_ERROR); ok_lasterrornotchanged(); - ok_int(GetGlyphIndicesW(hdc, Single, 1, NULL, 0), GDI_ERROR); + ok_int(GetGlyphIndicesW(hdc, Single, 1, Indices, 0xFFFFFFFF), 1); ok_lasterrornotchanged();
/* Test an exceptional case that does not seem to return an error */ - // FIXME: What does the returned value exactly means? - ok(GetGlyphIndicesW(hdc, NULL, 0, NULL, 0) != 0, - "GetGlyphIndicesW(hdc, NULL, 0, NULL, 0) return expected not zero, but got zero!\n"); + /* In this case, it returns the number of glyphs */ + ret = GetGlyphIndicesW(hdc, NULL, 0, NULL, 0); + ok(ret == 988, + "GetGlyphIndicesW(hdc, NULL, 0, NULL, 0) return expected 988, but got %ld\n", ret); ok_lasterrornotchanged();
/* Test a single valid char */ @@ -152,6 +165,18 @@ START_TEST(GetGlyphIndices) ok_int(Indices[2], 21); ok_int(Indices[3], 22);
+ ok_int(GetGlyphIndicesW(hdc, s_invalids, 3, Indices, 0), 3); + ok_lasterrornotchanged(); + ok_int(Indices[0], 0); + ok_int(Indices[1], 0); + ok_int(Indices[2], 0); + + ok_int(GetGlyphIndicesW(hdc, s_invalids, 3, Indices, GGI_MARK_NONEXISTING_GLYPHS), 3); + ok_lasterrornotchanged(); + ok_int(Indices[0], 0xFFFF); + ok_int(Indices[1], 0xFFFF); + ok_int(Indices[2], 0xFFFF); + /* Setup an array of all possible BMP glyphs */ for (i = 0; i < MAX_BMP_GLYPHS; i++) Glyphs[i] = (WCHAR)i;