mirror of
https://github.com/reactos/wine.git
synced 2024-11-25 04:39:45 +00:00
gdi32/tests: Make GetStockObject tests pass on East-Asian machines.
This commit is contained in:
parent
2f7453f81f
commit
afdc84cf03
@ -4373,38 +4373,69 @@ static int get_font_dpi(const LOGFONT *lf)
|
|||||||
|
|
||||||
static void test_stock_fonts(void)
|
static void test_stock_fonts(void)
|
||||||
{
|
{
|
||||||
|
static const int font[] =
|
||||||
|
{
|
||||||
|
ANSI_FIXED_FONT, ANSI_VAR_FONT, SYSTEM_FONT, DEVICE_DEFAULT_FONT, DEFAULT_GUI_FONT
|
||||||
|
/* SYSTEM_FIXED_FONT, OEM_FIXED_FONT */
|
||||||
|
};
|
||||||
static const struct test_data
|
static const struct test_data
|
||||||
{
|
{
|
||||||
int id, weight, height, dpi;
|
int charset, weight, height, dpi;
|
||||||
const char face_name[LF_FACESIZE];
|
const char face_name[LF_FACESIZE];
|
||||||
} td[] =
|
} td[][11] =
|
||||||
{
|
{
|
||||||
{ ANSI_FIXED_FONT, FW_NORMAL, 12, 96, "Courier" },
|
{ /* ANSI_FIXED_FONT */
|
||||||
{ ANSI_FIXED_FONT, FW_NORMAL, 12, 120, "Courier" },
|
{ DEFAULT_CHARSET, FW_NORMAL, 12, 96, "Courier" },
|
||||||
{ ANSI_VAR_FONT, FW_NORMAL, 12, 96, "MS Sans Serif" },
|
{ DEFAULT_CHARSET, FW_NORMAL, 12, 120, "Courier" },
|
||||||
{ ANSI_VAR_FONT, FW_NORMAL, 12, 120, "MS Sans Serif" },
|
{ 0 }
|
||||||
{ SYSTEM_FONT, FW_BOLD, 16, 96, "System" },
|
},
|
||||||
{ SYSTEM_FONT, FW_BOLD, 20, 120, "System" },
|
{ /* ANSI_VAR_FONT */
|
||||||
{ DEVICE_DEFAULT_FONT, FW_BOLD, 16, 96, "System" },
|
{ DEFAULT_CHARSET, FW_NORMAL, 12, 96, "MS Sans Serif" },
|
||||||
{ DEVICE_DEFAULT_FONT, FW_BOLD, 20, 120, "System" },
|
{ DEFAULT_CHARSET, FW_NORMAL, 12, 120, "MS Sans Serif" },
|
||||||
{ DEFAULT_GUI_FONT, FW_NORMAL, -11, 96, "MS Shell Dlg" },
|
{ 0 }
|
||||||
{ DEFAULT_GUI_FONT, FW_NORMAL, -13, 120, "MS Shell Dlg" }
|
},
|
||||||
|
{ /* SYSTEM_FONT */
|
||||||
/*{ SYSTEM_FIXED_FONT, FW_NORMAL, 15, 96, "Fixedsys" },*/
|
{ SHIFTJIS_CHARSET, FW_NORMAL, 18, 96, "System" },
|
||||||
/*{ SYSTEM_FIXED_FONT, FW_NORMAL, 20, 120, "Fixedsys" },*/
|
{ SHIFTJIS_CHARSET, FW_NORMAL, 22, 120, "System" },
|
||||||
/*{ OEM_FIXED_FONT, FW_NORMAL, 16, 96, "Terminal" },*/
|
{ HANGEUL_CHARSET, FW_NORMAL, 16, 96, "System" },
|
||||||
/*{ OEM_FIXED_FONT, FW_NORMAL, 20, 120, "Terminal" },*/
|
{ HANGEUL_CHARSET, FW_NORMAL, 20, 120, "System" },
|
||||||
|
{ DEFAULT_CHARSET, FW_BOLD, 16, 96, "System" },
|
||||||
|
{ DEFAULT_CHARSET, FW_BOLD, 20, 120, "System" },
|
||||||
|
{ 0 }
|
||||||
|
},
|
||||||
|
{ /* DEVICE_DEFAULT_FONT */
|
||||||
|
{ SHIFTJIS_CHARSET, FW_NORMAL, 18, 96, "System" },
|
||||||
|
{ SHIFTJIS_CHARSET, FW_NORMAL, 22, 120, "System" },
|
||||||
|
{ HANGEUL_CHARSET, FW_NORMAL, 16, 96, "System" },
|
||||||
|
{ HANGEUL_CHARSET, FW_NORMAL, 20, 120, "System" },
|
||||||
|
{ DEFAULT_CHARSET, FW_BOLD, 16, 96, "System" },
|
||||||
|
{ DEFAULT_CHARSET, FW_BOLD, 20, 120, "System" },
|
||||||
|
{ 0 }
|
||||||
|
},
|
||||||
|
{ /* DEFAULT_GUI_FONT */
|
||||||
|
{ SHIFTJIS_CHARSET, FW_NORMAL, -12, 96, "?MS UI Gothic" },
|
||||||
|
{ SHIFTJIS_CHARSET, FW_NORMAL, -15, 120, "?MS UI Gothic" },
|
||||||
|
{ HANGEUL_CHARSET, FW_NORMAL, -12, 96, "?Gulim" },
|
||||||
|
{ HANGEUL_CHARSET, FW_NORMAL, -15, 120, "?Gulim" },
|
||||||
|
{ GB2312_CHARSET, FW_NORMAL, -12, 96, "?SimHei" },
|
||||||
|
{ GB2312_CHARSET, FW_NORMAL, -15, 120, "?SimHei" },
|
||||||
|
{ CHINESEBIG5_CHARSET, FW_NORMAL, -12, 96, "?MingLiU" },
|
||||||
|
{ CHINESEBIG5_CHARSET, FW_NORMAL, -15, 120, "?MingLiU" },
|
||||||
|
{ DEFAULT_CHARSET, FW_NORMAL, -11, 96, "MS Shell Dlg" },
|
||||||
|
{ DEFAULT_CHARSET, FW_NORMAL, -13, 120, "MS Shell Dlg" },
|
||||||
|
{ 0 }
|
||||||
|
}
|
||||||
};
|
};
|
||||||
int i;
|
int i, j;
|
||||||
|
|
||||||
for (i = 0; i < sizeof(td)/sizeof(td[0]); i++)
|
for (i = 0; i < sizeof(font)/sizeof(font[0]); i++)
|
||||||
{
|
{
|
||||||
HFONT hfont;
|
HFONT hfont;
|
||||||
LOGFONT lf;
|
LOGFONT lf;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
hfont = GetStockObject(td[i].id);
|
hfont = GetStockObject(font[i]);
|
||||||
ok(hfont != 0, "%d: GetStockObject(%d) failed\n", i, td[i].id);
|
ok(hfont != 0, "%d: GetStockObject(%d) failed\n", i, font[i]);
|
||||||
|
|
||||||
ret = GetObject(hfont, sizeof(lf), &lf);
|
ret = GetObject(hfont, sizeof(lf), &lf);
|
||||||
if (ret != sizeof(lf))
|
if (ret != sizeof(lf))
|
||||||
@ -4414,16 +4445,43 @@ static void test_stock_fonts(void)
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = get_font_dpi(&lf);
|
for (j = 0; td[i][j].face_name[0] != 0; j++)
|
||||||
if (ret != td[i].dpi)
|
|
||||||
{
|
{
|
||||||
trace("%d: font %s %d dpi doesn't match test data %d\n", i, lf.lfFaceName, ret, td[i].dpi);
|
if (lf.lfCharSet != td[i][j].charset && td[i][j].charset != DEFAULT_CHARSET)
|
||||||
continue;
|
{
|
||||||
}
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
ok(td[i].weight == lf.lfWeight, "%d: expected lfWeight %d, got %d\n", i, td[i].weight, lf.lfWeight);
|
ret = get_font_dpi(&lf);
|
||||||
ok(td[i].height == lf.lfHeight, "%d: expected lfHeight %d, got %d\n", i, td[i].height, lf.lfHeight);
|
if (ret != td[i][j].dpi)
|
||||||
ok(!lstrcmp(td[i].face_name, lf.lfFaceName), "%d: expected lfFaceName %s, got %s\n", i, td[i].face_name, lf.lfFaceName);
|
{
|
||||||
|
trace("%d(%d): font %s %d dpi doesn't match test data %d\n",
|
||||||
|
i, j, lf.lfFaceName, ret, td[i][j].dpi);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((font[i] == DEVICE_DEFAULT_FONT || font[i] == SYSTEM_FONT) && td[i][j].charset != DEFAULT_CHARSET)
|
||||||
|
todo_wine ok(td[i][j].weight == lf.lfWeight, "%d(%d): expected lfWeight %d, got %d\n", i, j, td[i][j].weight, lf.lfWeight);
|
||||||
|
else
|
||||||
|
ok(td[i][j].weight == lf.lfWeight, "%d(%d): expected lfWeight %d, got %d\n", i, j, td[i][j].weight, lf.lfWeight);
|
||||||
|
if ((font[i] == DEFAULT_GUI_FONT && td[i][j].charset != DEFAULT_CHARSET) ||
|
||||||
|
((font[i] == DEVICE_DEFAULT_FONT || font[i] == SYSTEM_FONT) && td[i][j].charset == SHIFTJIS_CHARSET))
|
||||||
|
todo_wine ok(td[i][j].height == lf.lfHeight, "%d(%d): expected lfHeight %d, got %d\n", i, j, td[i][j].height, lf.lfHeight);
|
||||||
|
else
|
||||||
|
ok(td[i][j].height == lf.lfHeight, "%d(%d): expected lfHeight %d, got %d\n", i, j, td[i][j].height, lf.lfHeight);
|
||||||
|
if (td[i][j].face_name[0] == '?')
|
||||||
|
{
|
||||||
|
/* Wine doesn't have this font, skip this case for now.
|
||||||
|
Actually, the face name is localized on Windows and varies
|
||||||
|
dpending on Windows versions (e.g. Japanese NT4 vs win2k). */
|
||||||
|
trace("%d(%d): default gui font is %s\n", i, j, lf.lfFaceName);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ok(!lstrcmp(td[i][j].face_name, lf.lfFaceName), "%d(%d): expected lfFaceName %s, got %s\n", i, j, td[i][j].face_name, lf.lfFaceName);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user