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.
This commit is contained in:
Dmitry Timoshkov 2010-02-18 20:46:27 +08:00 committed by Alexandre Julliard
parent b10f8f254e
commit c1fd55d6c9
2 changed files with 55 additions and 3 deletions

View File

@ -753,25 +753,37 @@ static int get_ansi_notification(UINT unicodeNotificationCode)
{
switch (unicodeNotificationCode)
{
case LVN_BEGINLABELEDITA:
case LVN_BEGINLABELEDITW: return LVN_BEGINLABELEDITA;
case LVN_ENDLABELEDITA:
case LVN_ENDLABELEDITW: return LVN_ENDLABELEDITA;
case LVN_GETDISPINFOA:
case LVN_GETDISPINFOW: return LVN_GETDISPINFOA;
case LVN_SETDISPINFOA:
case LVN_SETDISPINFOW: return LVN_SETDISPINFOA;
case LVN_ODFINDITEMA:
case LVN_ODFINDITEMW: return LVN_ODFINDITEMA;
case LVN_GETINFOTIPA:
case LVN_GETINFOTIPW: return LVN_GETINFOTIPA;
/* header forwards */
case HDN_TRACKA:
case HDN_TRACKW: return HDN_TRACKA;
case HDN_ENDTRACKA:
case HDN_ENDTRACKW: return HDN_ENDTRACKA;
case HDN_BEGINDRAG: return HDN_BEGINDRAG;
case HDN_ENDDRAG: return HDN_ENDDRAG;
case HDN_ITEMCHANGINGA:
case HDN_ITEMCHANGINGW: return HDN_ITEMCHANGINGA;
case HDN_ITEMCHANGEDA:
case HDN_ITEMCHANGEDW: return HDN_ITEMCHANGEDA;
case HDN_ITEMCLICKA:
case HDN_ITEMCLICKW: return HDN_ITEMCLICKA;
case HDN_DIVIDERDBLCLICKA:
case HDN_DIVIDERDBLCLICKW: return HDN_DIVIDERDBLCLICKA;
default: break;
}
ERR("unknown notification %x\n", unicodeNotificationCode);
assert(FALSE);
return 0;
FIXME("unknown notification %x\n", unicodeNotificationCode);
return unicodeNotificationCode;
}
/* forwards header notifications to listview parent */

View File

@ -4290,6 +4290,45 @@ static void test_destroynotify(void)
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)
{
HMODULE hComctl32;
@ -4318,6 +4357,7 @@ START_TEST(listview)
g_is_below_5 = is_below_comctl_5();
test_header_notification();
test_images();
test_checkboxes();
test_items();