comctl32: Implement WM_GETTEXTLENGTH for datetime picker.

Signed-off-by: Jactry Zeng <jzeng@codeweavers.com>
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Jactry Zeng 2020-09-18 14:20:13 +08:00 committed by Alexandre Julliard
parent d851b2f84f
commit fd53a4b8e3
2 changed files with 22 additions and 0 deletions

View File

@ -1565,6 +1565,20 @@ DATETIME_GetText (const DATETIME_INFO *infoPtr, INT count, LPWSTR dst)
return lstrlenW(dst);
}
static int DATETIME_GetTextLength(const DATETIME_INFO *info)
{
int i, length = 0;
WCHAR buffer[80];
TRACE("%p.\n", info);
for (i = 0; i < info->nrFields; i++)
{
DATETIME_ReturnTxt(info, i, buffer, ARRAY_SIZE(buffer));
length += lstrlenW(buffer);
}
return length;
}
static LRESULT WINAPI
DATETIME_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
@ -1681,6 +1695,9 @@ DATETIME_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
case WM_GETTEXT:
return (LRESULT) DATETIME_GetText(infoPtr, wParam, (LPWSTR)lParam);
case WM_GETTEXTLENGTH:
return (LRESULT)DATETIME_GetTextLength(infoPtr);
case WM_SETTEXT:
return CB_ERR;

View File

@ -793,7 +793,12 @@ static void test_wm_set_get_text(void)
if (ret == 0)
skip("GetDateFormat failed, returned %ld, error %d\n", ret, GetLastError());
else
{
ok(!strcmp(buff, time), "Expected %s, got %s\n", time, buff);
ret = SendMessageA(hWnd, WM_GETTEXTLENGTH, 0, 0);
ok(ret == strlen(time), "Got wrong length: %ld, expected %d.\n", ret, strlen(time));
}
}
DestroyWindow(hWnd);