comctl32/ipaddress: Fix IPM_CLEARADDRESS return value.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
aff5938965
commit
573b3eb432
|
@ -354,7 +354,7 @@ static BOOL IPADDRESS_SetRange (IPADDRESS_INFO *infoPtr, int index, WORD range)
|
|||
}
|
||||
|
||||
|
||||
static void IPADDRESS_ClearAddress (const IPADDRESS_INFO *infoPtr)
|
||||
static LRESULT IPADDRESS_ClearAddress (const IPADDRESS_INFO *infoPtr)
|
||||
{
|
||||
int i;
|
||||
|
||||
|
@ -362,6 +362,8 @@ static void IPADDRESS_ClearAddress (const IPADDRESS_INFO *infoPtr)
|
|||
|
||||
for (i = 0; i < 4; i++)
|
||||
SetWindowTextW (infoPtr->Part[i].EditHwnd, L"");
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
|
@ -614,8 +616,7 @@ IPADDRESS_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
|||
return 0;
|
||||
|
||||
case IPM_CLEARADDRESS:
|
||||
IPADDRESS_ClearAddress (infoPtr);
|
||||
break;
|
||||
return IPADDRESS_ClearAddress (infoPtr);
|
||||
|
||||
case IPM_SETADDRESS:
|
||||
return IPADDRESS_SetAddress (infoPtr, (DWORD)lParam);
|
||||
|
|
|
@ -144,6 +144,47 @@ static void test_WM_SETFOCUS(void)
|
|||
DestroyWindow(hwnd);
|
||||
}
|
||||
|
||||
static void test_IPM_CLEARADDRESS(void)
|
||||
{
|
||||
struct child_enum child_enum = {{ 0 }};
|
||||
char buff[16];
|
||||
int i, ret;
|
||||
HWND hwnd;
|
||||
|
||||
hwnd = create_ipaddress_control();
|
||||
ok(!!hwnd, "Failed to create control.\n");
|
||||
|
||||
ret = SendMessageA(hwnd, IPM_SETADDRESS, 0, MAKEIPADDRESS(0, 1, 2, 3));
|
||||
ok(ret == 1, "Unexpected return value %d.\n", ret);
|
||||
|
||||
EnumChildWindows(hwnd, test_child_enum_proc, (LPARAM)&child_enum);
|
||||
ok(child_enum.count == 4, "Unexpected child count %u.\n", child_enum.count);
|
||||
|
||||
ret = SendMessageA(hwnd, IPM_SETADDRESS, 0, MAKEIPADDRESS(1, 2, 3, 4));
|
||||
ok(ret == 1, "Unexpected return value %d.\n", ret);
|
||||
|
||||
ret = GetWindowTextA(hwnd, buff, ARRAY_SIZE(buff));
|
||||
ok(ret == 7, "Unexpected return value %d.\n", ret);
|
||||
ok(!strcmp(buff, "1.2.3.4"), "Unexpected address %s.\n", buff);
|
||||
|
||||
ret = SendMessageA(hwnd, IPM_CLEARADDRESS, 0, 0);
|
||||
ok(ret, "Unexpected return value %d.\n", ret);
|
||||
|
||||
ret = GetWindowTextA(hwnd, buff, ARRAY_SIZE(buff));
|
||||
ok(ret == 7, "Unexpected return value %d.\n", ret);
|
||||
ok(!strcmp(buff, "0.0.0.0"), "Unexpected address %s.\n", buff);
|
||||
|
||||
for (i = 0; i < 4; ++i)
|
||||
{
|
||||
buff[0] = 1;
|
||||
ret = GetWindowTextA(child_enum.fields[i], buff, ARRAY_SIZE(buff));
|
||||
ok(ret == 0, "Unexpected return value %d.\n", ret);
|
||||
ok(!*buff, "Unexpected field text %s.\n", buff);
|
||||
}
|
||||
|
||||
DestroyWindow(hwnd);
|
||||
}
|
||||
|
||||
START_TEST(ipaddress)
|
||||
{
|
||||
ULONG_PTR cookie;
|
||||
|
@ -152,6 +193,7 @@ START_TEST(ipaddress)
|
|||
test_get_set_text();
|
||||
test_IPM_SETFOCUS();
|
||||
test_WM_SETFOCUS();
|
||||
test_IPM_CLEARADDRESS();
|
||||
|
||||
if (!load_v6_module(&cookie, &ctxt))
|
||||
return;
|
||||
|
@ -159,6 +201,7 @@ START_TEST(ipaddress)
|
|||
test_get_set_text();
|
||||
test_IPM_SETFOCUS();
|
||||
test_WM_SETFOCUS();
|
||||
test_IPM_CLEARADDRESS();
|
||||
|
||||
unload_v6_module(cookie, ctxt);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue