Module: wine Branch: master Commit: 7fb21244d9d9369d95c4109e7ad421a176796d59 URL: http://source.winehq.org/git/wine.git/?a=commit;h=7fb21244d9d9369d95c4109e7a...
Author: Guy Albertelli galberte@neo.rr.com Date: Sat Apr 26 00:20:09 2008 -0400
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.
---
dlls/comctl32/listview.c | 2 + dlls/comctl32/tests/listview.c | 49 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 51 insertions(+), 0 deletions(-)
diff --git a/dlls/comctl32/listview.c b/dlls/comctl32/listview.c index a634f98..7760ecb 100644 --- a/dlls/comctl32/listview.c +++ b/dlls/comctl32/listview.c @@ -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;
diff --git a/dlls/comctl32/tests/listview.c b/dlls/comctl32/tests/listview.c index ad82579..838691c 100644 --- a/dlls/comctl32/tests/listview.c +++ b/dlls/comctl32/tests/listview.c @@ -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(); }