listview: Correct return value from LVM_GETORIGIN including tests for this.

Tests to validate return value of the LVM_GETORIGIN message and fix our
implementation.
This commit is contained in:
Guy Albertelli 2008-04-26 00:20:09 -04:00 committed by Alexandre Julliard
parent e85fa81f3c
commit 7fb21244d9
2 changed files with 51 additions and 0 deletions

View File

@ -9632,6 +9632,8 @@ LISTVIEW_WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
case LVM_GETORIGIN:
if (!lParam) return FALSE;
if ((infoPtr->dwStyle & LVS_TYPEMASK) == LVS_REPORT ||
(infoPtr->dwStyle & LVS_TYPEMASK) == LVS_LIST) return FALSE;
LISTVIEW_GetOrigin(infoPtr, (LPPOINT)lParam);
return TRUE;

View File

@ -1076,6 +1076,54 @@ static void test_item_position(void)
DestroyWindow(hwnd);
}
static void test_getorigin(void)
{
/* LVM_GETORIGIN */
HWND hwnd;
DWORD r;
POINT position;
position.x = position.y = 0;
hwnd = create_custom_listview_control(LVS_ICON);
ok(hwnd != NULL, "failed to create a listview window\n");
flush_sequences(sequences, NUM_MSG_SEQUENCES);
trace("test get origin results\n");
r = SendMessage(hwnd, LVM_GETORIGIN, 0, (LPARAM)&position);
expect(TRUE, r);
flush_sequences(sequences, NUM_MSG_SEQUENCES);
DestroyWindow(hwnd);
hwnd = create_custom_listview_control(LVS_SMALLICON);
ok(hwnd != NULL, "failed to create a listview window\n");
flush_sequences(sequences, NUM_MSG_SEQUENCES);
trace("test get origin results\n");
r = SendMessage(hwnd, LVM_GETORIGIN, 0, (LPARAM)&position);
expect(TRUE, r);
flush_sequences(sequences, NUM_MSG_SEQUENCES);
DestroyWindow(hwnd);
hwnd = create_custom_listview_control(LVS_LIST);
ok(hwnd != NULL, "failed to create a listview window\n");
flush_sequences(sequences, NUM_MSG_SEQUENCES);
trace("test get origin results\n");
r = SendMessage(hwnd, LVM_GETORIGIN, 0, (LPARAM)&position);
expect(FALSE, r);
flush_sequences(sequences, NUM_MSG_SEQUENCES);
DestroyWindow(hwnd);
hwnd = create_custom_listview_control(LVS_REPORT);
ok(hwnd != NULL, "failed to create a listview window\n");
flush_sequences(sequences, NUM_MSG_SEQUENCES);
trace("test get origin results\n");
r = SendMessage(hwnd, LVM_GETORIGIN, 0, (LPARAM)&position);
expect(FALSE, r);
flush_sequences(sequences, NUM_MSG_SEQUENCES);
DestroyWindow(hwnd);
}
START_TEST(listview)
{
HMODULE hComctl32;
@ -1111,4 +1159,5 @@ START_TEST(listview)
test_item_count();
test_item_position();
test_columns();
test_getorigin();
}