[PATCH v2] kernel32/tests: Add more tests for GetConsoleFontInfo

Hugh McMaster hugh.mcmaster at outlook.com
Fri Apr 29 08:55:33 CDT 2016


On Friday, 29 April 2016 11:40 PM, Hugh McMaster wrote:

>On Friday, 29 April 2016 11:07 PM, Sebastian Lackner wrote:
>
>On 29.04.2016 13:29, Hugh McMaster wrote:
>>>      SetLastError(0xdeadbeef);
>>>      ret = pGetConsoleFontInfo(NULL, FALSE, 0, cfi);
>>>      ok(!ret, "got %d, expected zero\n", ret);
>>>      todo_wine ok(GetLastError() == ERROR_INVALID_HANDLE, "got %u, expected 6\n", GetLastError());
>>> +    ok(!cfi[0].nFont, "got %d, expected 0\n", cfi[0].nFont);
>>> +    ok(!cfi[0].dwFontSize.X, "got %d, expected 0\n", cfi[0].dwFontSize.X);
>>> +    ok(!cfi[0].dwFontSize.Y, "got %d, expected 0\n", cfi[0].dwFontSize.Y);
>>
>> Those tests do not add much value. Without initializing cfi before each call,
>> its impossible to tell if GetConsoleFontInfo() nulled the struct or if it wasn't
>> touched at all. However, I'm also not sure if we have to care about the struct
>> content in case of a failure.
>
>The values in the struct weren't altered from zero after the first failed call. But I take your point.
>I'll try memset-ing another value and checking the returned values.

I tried doing a memset with values 1, 5 and 10. Each test returned junk values.
Only a memset with zero did not return a junk value (as in the original patch).

So it definitely looks as though GetConsoleFontInfo does not null the struct on error or before
performing an operation. In this case, I'll remove those !cfi[0].element tests.


More information about the wine-devel mailing list