[WINESYNC]d3dx9_36: Support NULL terminated strings in ID3DXFont_DrawText

Signed-off-by: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>

wine-staging patch by Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
This commit is contained in:
winesync 2020-01-04 02:11:30 +01:00 committed by Jérôme Gardou
parent 54240ccee0
commit 219ef2e81f
3 changed files with 146 additions and 2 deletions

View file

@ -306,6 +306,7 @@ static void test_ID3DXSprite(IDirect3DDevice9 *device)
static void test_ID3DXFont(IDirect3DDevice9 *device)
{
static const WCHAR testW[] = {'t','e','s','t',0};
static const char testA[] = "test";
static const struct
{
int font_height;
@ -637,6 +638,49 @@ static void test_ID3DXFont(IDirect3DDevice9 *device)
ID3DXFont_Release(font);
}
/* ID3DXFont_DrawTextA, ID3DXFont_DrawTextW */
hr = D3DXCreateFontA(device, 12, 0, FW_DONTCARE, 0, FALSE, DEFAULT_CHARSET, OUT_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH, "Arial", &font);
if (SUCCEEDED(hr)) {
RECT rect;
int height;
SetRect(&rect, 10, 10, 200, 200);
height = ID3DXFont_DrawTextA(font, NULL, testA, -2, &rect, 0, 0xFF00FF);
ok(height == 12, "DrawTextA returned %d, expected 12.\n", height);
height = ID3DXFont_DrawTextA(font, NULL, testA, -1, &rect, 0, 0xFF00FF);
ok(height == 12, "DrawTextA returned %d, expected 12.\n", height);
height = ID3DXFont_DrawTextA(font, NULL, testA, 0, &rect, 0, 0xFF00FF);
ok(height == 0, "DrawTextA returned %d, expected 0.\n", height);
height = ID3DXFont_DrawTextA(font, NULL, testA, 1, &rect, 0, 0xFF00FF);
ok(height == 12, "DrawTextA returned %d, expected 12.\n", height);
height = ID3DXFont_DrawTextA(font, NULL, testA, 2, &rect, 0, 0xFF00FF);
ok(height == 12, "DrawTextA returned %d, expected 12.\n", height);
if (0) { /* Causes a lockup on windows 7. */
height = ID3DXFont_DrawTextW(font, NULL, testW, -2, &rect, 0, 0xFF00FF);
ok(height == 12, "DrawTextW returned %d, expected 12.\n", height);
}
height = ID3DXFont_DrawTextW(font, NULL, testW, -1, &rect, 0, 0xFF00FF);
ok(height == 12, "DrawTextW returned %d, expected 12.\n", height);
height = ID3DXFont_DrawTextW(font, NULL, testW, 0, &rect, 0, 0xFF00FF);
ok(height == 0, "DrawTextW returned %d, expected 0.\n", height);
height = ID3DXFont_DrawTextW(font, NULL, testW, 1, &rect, 0, 0xFF00FF);
ok(height == 12, "DrawTextW returned %d, expected 12.\n", height);
height = ID3DXFont_DrawTextW(font, NULL, testW, 2, &rect, 0, 0xFF00FF);
ok(height == 12, "DrawTextW returned %d, expected 12.\n", height);
ID3DXFont_Release(font);
}
}
static void test_D3DXCreateRenderToSurface(IDirect3DDevice9 *device)