[PATCH] comctl32/tests: Fix propsheet template buffer size test on RTL locales
Alex Henrie
alexhenrie24 at gmail.com
Sun Nov 12 23:13:03 CST 2017
Fixes test failures on Arabic and Hebrew Windows. For some reason, on
these locales Windows uses a different formula for allocating the
template buffer, allocating a little more than 2 times the resource
size on Hebrew and a little less on Arabic. Because we don't know how
exactly the buffer size is determined on these locales, just accept a
size near 2 times the resource size.
Signed-off-by: Alex Henrie <alexhenrie24 at gmail.com>
---
dlls/comctl32/tests/propsheet.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/dlls/comctl32/tests/propsheet.c b/dlls/comctl32/tests/propsheet.c
index a3f910d2d5..68dce519bb 100644
--- a/dlls/comctl32/tests/propsheet.c
+++ b/dlls/comctl32/tests/propsheet.c
@@ -58,16 +58,21 @@ static int CALLBACK sheet_callback(HWND hwnd, UINT msg, LPARAM lparam)
case PSCB_PRECREATE:
{
HMODULE module = GetModuleHandleA("comctl32.dll");
+ HMODULE kernel32 = GetModuleHandleA("kernel32.dll");
+ LANGID (WINAPI *pGetThreadUILanguage)(void) = (void *)GetProcAddress(kernel32, "GetThreadUILanguage");
DWORD size, buffer_size;
HRSRC hrsrc;
+ int reading_layout;
hrsrc = FindResourceA(module, MAKEINTRESOURCEA(1006 /* IDD_PROPSHEET */),
(LPSTR)RT_DIALOG);
size = SizeofResource(module, hrsrc);
ok(size != 0, "Failed to get size of propsheet dialog resource\n");
buffer_size = HeapSize(GetProcessHeap(), 0, (void *)lparam);
- ok(buffer_size == 2 * size, "Unexpected template buffer size %u, resource size %u\n",
- buffer_size, size);
+ GetLocaleInfoA(pGetThreadUILanguage ? pGetThreadUILanguage() : GetUserDefaultUILanguage(),
+ LOCALE_IREADINGLAYOUT | LOCALE_RETURN_NUMBER, (void *)&reading_layout, sizeof(reading_layout));
+ ok(reading_layout == 2 /* RTL */ ? abs(buffer_size - 2 * size) <= 32 : buffer_size == 2 * size,
+ "Unexpected template buffer size %u, resource size %u\n", buffer_size, size);
break;
}
case PSCB_INITIALIZED:
--
2.15.0
More information about the wine-devel
mailing list