From: Sven Baars Subject: [PATCH v2 2/8] d3dx9/tests: Add some tests for ID3DXFont_DrawText. Message-Id: <20200106143408.12864-2-sbaars@codeweavers.com> Date: Mon, 6 Jan 2020 15:34:02 +0100 In-Reply-To: <20200106143408.12864-1-sbaars@codeweavers.com> References: <20200106143408.12864-1-sbaars@codeweavers.com> From: Alistair Leslie-Hughes Signed-off-by: Sven Baars --- v2: Use Tahoma dlls/d3dx9_36/tests/core.c | 63 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) diff --git a/dlls/d3dx9_36/tests/core.c b/dlls/d3dx9_36/tests/core.c index 75146575be..8c1d41e952 100644 --- a/dlls/d3dx9_36/tests/core.c +++ b/dlls/d3dx9_36/tests/core.c @@ -637,6 +637,69 @@ 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, "Tahoma", &font); + if (SUCCEEDED(hr)) { + RECT rect; + int height; + + todo_wine { + SetRect(&rect, 10, 10, 200, 200); + + height = ID3DXFont_DrawTextA(font, NULL, "test", -2, &rect, 0, 0xFF00FF); + ok(height == 12, "DrawTextA returned %d, expected 12.\n", height); + + height = ID3DXFont_DrawTextA(font, NULL, "test", -1, &rect, 0, 0xFF00FF); + ok(height == 12, "DrawTextA returned %d, expected 12.\n", height); + + height = ID3DXFont_DrawTextA(font, NULL, "test", 0, &rect, 0, 0xFF00FF); + ok(height == 0, "DrawTextA returned %d, expected 0.\n", height); + + height = ID3DXFont_DrawTextA(font, NULL, "test", 1, &rect, 0, 0xFF00FF); + ok(height == 12, "DrawTextA returned %d, expected 12.\n", height); + + height = ID3DXFont_DrawTextA(font, NULL, "test", 2, &rect, 0, 0xFF00FF); + ok(height == 12, "DrawTextA returned %d, expected 12.\n", height); + + height = ID3DXFont_DrawTextA(font, NULL, "test", -1, NULL, 0, 0xFF00FF); + ok(height == 12, "DrawTextA returned %d, expected 12.\n", height); + + height = ID3DXFont_DrawTextA(font, NULL, "test", -1, NULL, DT_CALCRECT, 0xFF00FF); + ok(height == 12, "DrawTextA returned %d, expected 12.\n", height); + + height = ID3DXFont_DrawTextA(font, NULL, NULL, -1, NULL, 0, 0xFF00FF); + ok(height == 0, "DrawTextA returned %d, expected 0.\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); + + height = ID3DXFont_DrawTextW(font, NULL, testW, -1, NULL, 0, 0xFF00FF); + ok(height == 12, "DrawTextW returned %d, expected 12.\n", height); + + height = ID3DXFont_DrawTextW(font, NULL, testW, -1, NULL, DT_CALCRECT, 0xFF00FF); + ok(height == 12, "DrawTextW returned %d, expected 12.\n", height); + + height = ID3DXFont_DrawTextW(font, NULL, NULL, -1, NULL, 0, 0xFF00FF); + ok(height == 0, "DrawTextW returned %d, expected 0.\n", height); + } + + ID3DXFont_Release(font); + } } static void test_D3DXCreateRenderToSurface(IDirect3DDevice9 *device) -- 2.24.0