Commit c1fd55d6 authored by Dmitry Timoshkov's avatar Dmitry Timoshkov Committed by Alexandre Julliard

comctl32: Listview should accept both unicode and ansi notifications.

Listview receives notifications not only from built-in header control, but also from custom or subclassed application controls, there is no need to assert(0) on application input, printing a FIXME is the maximum we can do on an unknown input.
parent b10f8f25
...@@ -753,25 +753,37 @@ static int get_ansi_notification(UINT unicodeNotificationCode) ...@@ -753,25 +753,37 @@ static int get_ansi_notification(UINT unicodeNotificationCode)
{ {
switch (unicodeNotificationCode) switch (unicodeNotificationCode)
{ {
case LVN_BEGINLABELEDITA:
case LVN_BEGINLABELEDITW: return LVN_BEGINLABELEDITA; case LVN_BEGINLABELEDITW: return LVN_BEGINLABELEDITA;
case LVN_ENDLABELEDITA:
case LVN_ENDLABELEDITW: return LVN_ENDLABELEDITA; case LVN_ENDLABELEDITW: return LVN_ENDLABELEDITA;
case LVN_GETDISPINFOA:
case LVN_GETDISPINFOW: return LVN_GETDISPINFOA; case LVN_GETDISPINFOW: return LVN_GETDISPINFOA;
case LVN_SETDISPINFOA:
case LVN_SETDISPINFOW: return LVN_SETDISPINFOA; case LVN_SETDISPINFOW: return LVN_SETDISPINFOA;
case LVN_ODFINDITEMA:
case LVN_ODFINDITEMW: return LVN_ODFINDITEMA; case LVN_ODFINDITEMW: return LVN_ODFINDITEMA;
case LVN_GETINFOTIPA:
case LVN_GETINFOTIPW: return LVN_GETINFOTIPA; case LVN_GETINFOTIPW: return LVN_GETINFOTIPA;
/* header forwards */ /* header forwards */
case HDN_TRACKA:
case HDN_TRACKW: return HDN_TRACKA; case HDN_TRACKW: return HDN_TRACKA;
case HDN_ENDTRACKA:
case HDN_ENDTRACKW: return HDN_ENDTRACKA; case HDN_ENDTRACKW: return HDN_ENDTRACKA;
case HDN_BEGINDRAG: return HDN_BEGINDRAG; case HDN_BEGINDRAG: return HDN_BEGINDRAG;
case HDN_ENDDRAG: return HDN_ENDDRAG; case HDN_ENDDRAG: return HDN_ENDDRAG;
case HDN_ITEMCHANGINGA:
case HDN_ITEMCHANGINGW: return HDN_ITEMCHANGINGA; case HDN_ITEMCHANGINGW: return HDN_ITEMCHANGINGA;
case HDN_ITEMCHANGEDA:
case HDN_ITEMCHANGEDW: return HDN_ITEMCHANGEDA; case HDN_ITEMCHANGEDW: return HDN_ITEMCHANGEDA;
case HDN_ITEMCLICKA:
case HDN_ITEMCLICKW: return HDN_ITEMCLICKA; case HDN_ITEMCLICKW: return HDN_ITEMCLICKA;
case HDN_DIVIDERDBLCLICKA:
case HDN_DIVIDERDBLCLICKW: return HDN_DIVIDERDBLCLICKA; case HDN_DIVIDERDBLCLICKW: return HDN_DIVIDERDBLCLICKA;
default: break;
} }
ERR("unknown notification %x\n", unicodeNotificationCode); FIXME("unknown notification %x\n", unicodeNotificationCode);
assert(FALSE); return unicodeNotificationCode;
return 0;
} }
/* forwards header notifications to listview parent */ /* forwards header notifications to listview parent */
......
...@@ -4290,6 +4290,45 @@ static void test_destroynotify(void) ...@@ -4290,6 +4290,45 @@ static void test_destroynotify(void)
ok_sequence(sequences, COMBINED_SEQ_INDEX, listview_destroy, "check destroy order", FALSE); ok_sequence(sequences, COMBINED_SEQ_INDEX, listview_destroy, "check destroy order", FALSE);
} }
static void test_header_notification(void)
{
HWND list, header;
HDITEMA item;
NMHEADER nmh;
LVCOLUMNA col;
LRESULT ret;
list = create_listview_control(LVS_REPORT);
ok(list != 0, "failed to create listview window\n");
memset(&col, 0, sizeof(col));
col.mask = LVCF_WIDTH;
col.cx = 100;
ret = SendMessage(list, LVM_INSERTCOLUMNA, 0, (LPARAM)&col);
ok(!ret, "expected 0, got %ld\n", ret);
header = subclass_header(list);
ret = SendMessage(header, HDM_GETITEMCOUNT, 0, 0);
ok(ret == 1, "expected header item count 1, got %ld\n", ret);
ret = SendMessage(header, HDM_GETITEMA, 0, (LPARAM)&item);
ok(ret, "HDM_GETITEM failed\n");
nmh.hdr.hwndFrom = header;
nmh.hdr.idFrom = GetWindowLongPtr(header, GWLP_ID);
nmh.hdr.code = HDN_ITEMCHANGEDA;
nmh.iItem = 0;
nmh.iButton = 0;
item.mask = HDI_WIDTH;
item.cxy = 50;
nmh.pitem = &item;
ret = SendMessage(list, WM_NOTIFY, 0, (LPARAM)&nmh);
ok(!ret, "WM_NOTIFY/HDN_ITEMCHANGED failed\n");
DestroyWindow(list);
}
START_TEST(listview) START_TEST(listview)
{ {
HMODULE hComctl32; HMODULE hComctl32;
...@@ -4318,6 +4357,7 @@ START_TEST(listview) ...@@ -4318,6 +4357,7 @@ START_TEST(listview)
g_is_below_5 = is_below_comctl_5(); g_is_below_5 = is_below_comctl_5();
test_header_notification();
test_images(); test_images();
test_checkboxes(); test_checkboxes();
test_items(); test_items();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment