Commit 20eb2f99 authored by Francois Gouget's avatar Francois Gouget Committed by Alexandre Julliard

comctl32: Fix LVM_GETITEM/LVIF_STATE so it only returns the bits it

has been asked for, and sets all the others to zero (with conformance test).
parent 3a03248a
...@@ -5364,7 +5364,7 @@ static BOOL LISTVIEW_GetItemT(LISTVIEW_INFO *infoPtr, LPLVITEMW lpLVItem, BOOL i ...@@ -5364,7 +5364,7 @@ static BOOL LISTVIEW_GetItemT(LISTVIEW_INFO *infoPtr, LPLVITEMW lpLVItem, BOOL i
/* ... the state field (this one is different due to uCallbackmask) */ /* ... the state field (this one is different due to uCallbackmask) */
if (lpLVItem->mask & LVIF_STATE) if (lpLVItem->mask & LVIF_STATE)
{ {
lpLVItem->state = lpItem->state; lpLVItem->state = lpItem->state & lpLVItem->stateMask;
if (dispInfo.item.mask & LVIF_STATE) if (dispInfo.item.mask & LVIF_STATE)
{ {
lpLVItem->state &= ~dispInfo.item.stateMask; lpLVItem->state &= ~dispInfo.item.stateMask;
......
...@@ -189,6 +189,16 @@ static void test_checkboxes(void) ...@@ -189,6 +189,16 @@ static void test_checkboxes(void)
r = SendMessage(hwnd, LVM_GETITEMA, 0, (LPARAM) &item); r = SendMessage(hwnd, LVM_GETITEMA, 0, (LPARAM) &item);
ok(item.state == 0x2aaa, "state %x\n", item.state); ok(item.state == 0x2aaa, "state %x\n", item.state);
/* Check that only the bits we asked for are returned,
* and that all the others are set to zero
*/
item.iItem = 3;
item.mask = LVIF_STATE;
item.stateMask = 0xf000;
item.state = 0xffff;
r = SendMessage(hwnd, LVM_GETITEMA, 0, (LPARAM) &item);
ok(item.state == 0x2000, "state %x\n", item.state);
/* Set the style again and check that doesn't change an item's state */ /* Set the style again and check that doesn't change an item's state */
r = SendMessage(hwnd, LVM_SETEXTENDEDLISTVIEWSTYLE, LVS_EX_CHECKBOXES, LVS_EX_CHECKBOXES); r = SendMessage(hwnd, LVM_SETEXTENDEDLISTVIEWSTYLE, LVS_EX_CHECKBOXES, LVS_EX_CHECKBOXES);
ok(r == LVS_EX_CHECKBOXES, "ret %lx\n", r); ok(r == LVS_EX_CHECKBOXES, "ret %lx\n", r);
......
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