kernel32/tests: Add initial tests for GetConsoleFontInfo (v3)

Sebastian Lackner sebastian at fds-team.de
Tue Apr 26 11:41:56 CDT 2016


I am aware that this patch is already committed, but since you are probably
still working on the follow-up patches, here some remarks:

On 26.04.2016 14:06, Hugh McMaster wrote:
> +    GetCurrentConsoleFont(std_output, FALSE, &cfi[0]);
> +    index = cfi[0].nFont;
> +    orig_font = GetConsoleFontSize(std_output, index);
> +

You might want to do a memset here. Currently some of the tests pass,
although Wine has no implementation yet.

> +    SetLastError(0xdeadbeef);
> +    ret = pGetConsoleFontInfo(std_output, FALSE, num_fonts, cfi);
> +    todo_wine ok(ret, "got %d, expected non-zero\n", ret);
> +    todo_wine ok(GetLastError() == 0xdeadbeef, "got %u, expected 0xdeadbeef\n", GetLastError());
> +
> +    ok(cfi[index].dwFontSize.X == win_width, "got %d, expected %d\n", cfi[index].dwFontSize.X, win_width);
> +    ok(cfi[index].dwFontSize.Y == win_height, "got %d, expected %d\n", cfi[index].dwFontSize.Y, win_height);

Could you add an additional test that (cfi[i].nFont == i) holds?
If GetConsoleFontInfo would return elements in arbitrary order, the
code above would not work.

> +
> +    for (i = 0; i < num_fonts; i++)
> +    {
> +        tmp_font = GetConsoleFontSize(std_output, cfi[i].nFont);
> +        tmp_w = (double)orig_font.X / tmp_font.X * win_width;
> +        tmp_h = (double)orig_font.Y / tmp_font.Y * win_height;
> +        ok(cfi[i].dwFontSize.X == tmp_w, "got %d, expected %d\n", cfi[i].dwFontSize.X, tmp_w);
> +        ok(cfi[i].dwFontSize.Y == tmp_h, "got %d, expected %d\n", cfi[i].dwFontSize.Y, tmp_h);
> +    }

It wouldn't hurt to HeapFree() cfi here.

> +}
> +
>  START_TEST(console)
>  {
>      static const char font_name[] = "Lucida Console";
> @@ -2925,4 +2998,5 @@ START_TEST(console)
>      test_GetCurrentConsoleFont(hConOut);
>      test_GetConsoleFontSize(hConOut);
>      test_GetLargestConsoleWindowSize(hConOut);
> +    test_GetConsoleFontInfo(hConOut);
>  }
> 




More information about the wine-devel mailing list