From: Nikolay Sivov nsivov@codeweavers.com
Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/comctl32/tests/listview.c | 77 ++++++++++++++++++++++------------ 1 file changed, 51 insertions(+), 26 deletions(-)
diff --git a/dlls/comctl32/tests/listview.c b/dlls/comctl32/tests/listview.c index 1a9831bbaec..3629f82904f 100644 --- a/dlls/comctl32/tests/listview.c +++ b/dlls/comctl32/tests/listview.c @@ -2403,51 +2403,75 @@ static void test_item_position(void) DestroyWindow(hwnd); }
-static void test_getorigin(void) +static void test_LVM_GETORIGIN(BOOL is_v6) { - /* LVM_GETORIGIN */ - + POINT position; HWND hwnd; DWORD r; - POINT position; - - position.x = position.y = 0;
hwnd = create_listview_control(LVS_ICON); ok(hwnd != NULL, "failed to create a listview window\n"); - flush_sequences(sequences, NUM_MSG_SEQUENCES);
+ position.x = position.y = 123; r = SendMessageA(hwnd, LVM_GETORIGIN, 0, (LPARAM)&position); - expect(TRUE, r); - flush_sequences(sequences, NUM_MSG_SEQUENCES); + ok(r == 1, "Unexpected return value %lu.\n", r); + ok(!position.x && !position.y, "Unexpected position %ld,%ld.\n", position.x, position.y); DestroyWindow(hwnd);
hwnd = create_listview_control(LVS_SMALLICON); ok(hwnd != NULL, "failed to create a listview window\n"); flush_sequences(sequences, NUM_MSG_SEQUENCES);
+ position.x = position.y = 123; r = SendMessageA(hwnd, LVM_GETORIGIN, 0, (LPARAM)&position); - expect(TRUE, r); - flush_sequences(sequences, NUM_MSG_SEQUENCES); + ok(r == 1, "Unexpected return value %lu.\n", r); + ok(!position.x && !position.y, "Unexpected position %ld,%ld.\n", position.x, position.y); DestroyWindow(hwnd);
- hwnd = create_listview_control(LVS_LIST); - ok(hwnd != NULL, "failed to create a listview window\n"); - flush_sequences(sequences, NUM_MSG_SEQUENCES); + if (is_v6) + { + hwnd = create_listview_control(LVS_LIST); + ok(hwnd != NULL, "failed to create a listview window\n");
- r = SendMessageA(hwnd, LVM_GETORIGIN, 0, (LPARAM)&position); - expect(FALSE, r); - flush_sequences(sequences, NUM_MSG_SEQUENCES); - DestroyWindow(hwnd); + position.x = position.y = 123; + r = SendMessageA(hwnd, LVM_GETORIGIN, 0, (LPARAM)&position); + todo_wine + ok(r, "Unexpected return value %lu.\n", r); + todo_wine + ok(!position.x && !position.y, "Unexpected position %ld,%ld.\n", position.x, position.y); + DestroyWindow(hwnd);
- hwnd = create_listview_control(LVS_REPORT); - ok(hwnd != NULL, "failed to create a listview window\n"); - flush_sequences(sequences, NUM_MSG_SEQUENCES); + hwnd = create_listview_control(LVS_REPORT); + ok(hwnd != NULL, "failed to create a listview window\n");
- r = SendMessageA(hwnd, LVM_GETORIGIN, 0, (LPARAM)&position); - expect(FALSE, r); - flush_sequences(sequences, NUM_MSG_SEQUENCES); - DestroyWindow(hwnd); + position.x = position.y = 123; + r = SendMessageA(hwnd, LVM_GETORIGIN, 0, (LPARAM)&position); + todo_wine + ok(r, "Unexpected return value %lu.\n", r); + todo_wine + ok(!position.x && !position.y, "Unexpected position %ld,%ld.\n", position.x, position.y); + DestroyWindow(hwnd); + } + else + { + hwnd = create_listview_control(LVS_LIST); + ok(hwnd != NULL, "failed to create a listview window\n"); + + position.x = position.y = 123; + r = SendMessageA(hwnd, LVM_GETORIGIN, 0, (LPARAM)&position); + ok(!r, "Unexpected return value %lu.\n", r); + ok(position.x == 123 && position.y == 123, "Unexpected position %ld,%ld.\n", position.x, position.y); + DestroyWindow(hwnd); + + hwnd = create_listview_control(LVS_REPORT); + ok(hwnd != NULL, "failed to create a listview window\n"); + + position.x = position.y = 123; + r = SendMessageA(hwnd, LVM_GETORIGIN, 0, (LPARAM)&position); + ok(!r, "Unexpected return value %lu.\n", r); + ok(position.x == 123 && position.y == 123, "Unexpected position %ld,%ld.\n", position.x, position.y); + DestroyWindow(hwnd); + } }
static void test_multiselect(void) @@ -7293,7 +7317,7 @@ START_TEST(listview) test_item_count(); test_item_position(); test_columns(); - test_getorigin(); + test_LVM_GETORIGIN(FALSE); test_multiselect(); test_getitemrect(); test_subitem_rect(); @@ -7387,6 +7411,7 @@ START_TEST(listview) test_LVM_GETNEXTITEM(); test_LVM_SETBKIMAGE(TRUE); test_LVM_GETHOTCURSOR(); + test_LVM_GETORIGIN(TRUE);
unload_v6_module(ctx_cookie, hCtx);
From: Nikolay Sivov nsivov@codeweavers.com
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=57948 Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/comctl32/listview.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/dlls/comctl32/listview.c b/dlls/comctl32/listview.c index 9191aef1c3f..14786ec2b7a 100644 --- a/dlls/comctl32/listview.c +++ b/dlls/comctl32/listview.c @@ -11552,11 +11552,17 @@ LISTVIEW_WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) return 1;
case LVM_GETORIGIN: - if (!lParam) return FALSE; + { + POINT *point = (POINT *)lParam; + + if (!point) return FALSE; if (infoPtr->uView == LV_VIEW_DETAILS || infoPtr->uView == LV_VIEW_LIST) return FALSE; - LISTVIEW_GetOrigin(infoPtr, (LPPOINT)lParam); + LISTVIEW_GetOrigin(infoPtr, point); + point->x = -point->x; + point->y = -point->y; return TRUE; + }
/* case LVM_GETOUTLINECOLOR: */
From: Nikolay Sivov nsivov@codeweavers.com
Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/comctl32/listview.c | 4 ++++ 1 file changed, 4 insertions(+)
diff --git a/dlls/comctl32/listview.c b/dlls/comctl32/listview.c index 14786ec2b7a..1a0c919e962 100644 --- a/dlls/comctl32/listview.c +++ b/dlls/comctl32/listview.c @@ -9842,6 +9842,10 @@ static LRESULT LISTVIEW_VScroll(LISTVIEW_INFO *infoPtr, INT nScrollCode, nScrollDiff = scrollInfo.nPage; break;
+ case SB_TOP: + nScrollDiff = -nOldScrollPos; + break; + case SB_THUMBPOSITION: case SB_THUMBTRACK: nScrollDiff = scrollInfo.nTrackPos - scrollInfo.nPos;
I couldn't quickly figure out how to automate a test for scrolling, to check for actual returned origin. Manual testing works, for both LVM_SCOLL and interactive scrolling.
On Wed Mar 12 07:51:30 2025 +0000, Nikolay Sivov wrote:
I couldn't quickly figure out how to automate a test for scrolling, to check for actual returned origin. Manual testing works, for both LVM_SCOLL and interactive scrolling.
What about something like this?[mr7541-listview.txt](/uploads/15b45969883a8ddba0fd933b5b89cef3/mr7541-listview.txt)