Same as MR !2394
Signed-off-by: Zhaoyi zhaoyi@uniontech.com
-- v3: comctl32/listview: Set bNoItemMetrics to TRUE in LISTVIEW_DeleteAllItems().
From: Zhaoyi zhaoyi@uniontech.com
Signed-off-by: Zhaoyi zhaoyi@uniontech.com --- dlls/comctl32/tests/listview.c | 160 +++++++++++++++++++++++++++++++++ 1 file changed, 160 insertions(+)
diff --git a/dlls/comctl32/tests/listview.c b/dlls/comctl32/tests/listview.c index b1cb0ef16c2..6dfa672220e 100644 --- a/dlls/comctl32/tests/listview.c +++ b/dlls/comctl32/tests/listview.c @@ -99,6 +99,132 @@ static void init_functions(void) #undef X }
+typedef struct tagRANGES +{ + HDPA hdpa; +} *RANGES; + +typedef struct tagDELAYED_ITEM_EDIT +{ + BOOL fEnabled; + INT iItem; +} DELAYED_ITEM_EDIT; + +typedef struct tagLISTVIEW_INFO +{ + /* control window */ + HWND hwndSelf; + RECT rcList; /* This rectangle is really the window + * client rectangle possibly reduced by the + * horizontal scroll bar and/or header - see + * LISTVIEW_UpdateSize. This rectangle offset + * by the LISTVIEW_GetOrigin value is in + * client coordinates */ + + /* notification window */ + SHORT notifyFormat; + HWND hwndNotify; + DWORD notify_mask; + UINT uCallbackMask; + + /* tooltips */ + HWND hwndToolTip; + + /* items */ + INT nItemCount; /* the number of items in the list */ + HDPA hdpaItems; /* array ITEM_INFO pointers */ + HDPA hdpaItemIds; /* array of ITEM_ID pointers */ + HDPA hdpaPosX; /* maintains the (X, Y) coordinates of the */ + HDPA hdpaPosY; /* items in LVS_ICON, and LVS_SMALLICON modes */ + RANGES selectionRanges; + INT nSelectionMark; /* item to start next multiselection from */ + INT nHotItem; + + /* columns */ + HDPA hdpaColumns; /* array of COLUMN_INFO pointers */ + BOOL colRectsDirty; /* trigger column rectangles requery from header */ + INT selected_column; /* index for LVM_SETSELECTEDCOLUMN/LVM_GETSELECTEDCOLUMN */ + + /* item metrics */ + BOOL bNoItemMetrics; /* flags if item metrics are not yet computed */ + INT nItemHeight; + INT nItemWidth; + + /* style */ + DWORD dwStyle; /* the cached window GWL_STYLE */ + DWORD dwLvExStyle; /* extended listview style */ + DWORD uView; /* current view available through LVM_[G,S]ETVIEW */ + + /* edit item */ + HWND hwndEdit; + WNDPROC EditWndProc; + INT nEditLabelItem; + DELAYED_ITEM_EDIT itemEdit; /* Pointer to this structure will be the timer ID */ + + /* icons */ + HIMAGELIST himlNormal; + HIMAGELIST himlSmall; + HIMAGELIST himlState; + SIZE iconSize; + BOOL autoSpacing; + SIZE iconSpacing; + SIZE iconStateSize; + POINT currIconPos; /* this is the position next icon will be placed */ + + /* header */ + HWND hwndHeader; + INT xTrackLine; /* The x coefficient of the track line or -1 if none */ + + /* marquee selection */ + BOOL bMarqueeSelect; /* marquee selection/highlight underway */ + BOOL bScrolling; + RECT marqueeRect; /* absolute coordinates of marquee selection */ + RECT marqueeDrawRect; /* relative coordinates for drawing marquee */ + POINT marqueeOrigin; /* absolute coordinates of marquee click origin */ + + /* focus drawing */ + BOOL bFocus; /* control has focus */ + INT nFocusedItem; + RECT rcFocus; /* focus bounds */ + + /* colors */ + HBRUSH hBkBrush; + COLORREF clrBk; + COLORREF clrText; + COLORREF clrTextBk; + HBITMAP hBkBitmap; + + /* font */ + HFONT hDefaultFont; + HFONT hFont; + INT ntmHeight; /* Some cached metrics of the font used */ + INT ntmMaxCharWidth; /* by the listview to draw items */ + INT nEllipsisWidth; + + /* mouse operation */ + BOOL bLButtonDown; + BOOL bDragging; + POINT ptClickPos; /* point where the user clicked */ + INT nLButtonDownItem; /* tracks item to reset multiselection on WM_LBUTTONUP */ + DWORD dwHoverTime; + HCURSOR hHotCursor; + INT cWheelRemainder; + + /* keyboard operation */ + DWORD lastKeyPressTimestamp; + WPARAM charCode; + INT nSearchParamLength; + WCHAR szSearchParam[ MAX_PATH ]; + + /* painting */ + BOOL bIsDrawing; /* Drawing in progress */ + INT nMeasureItemHeight; /* WM_MEASUREITEM result */ + BOOL redraw; /* WM_SETREDRAW switch */ + + /* misc */ + DWORD iVersion; /* CCM_[G,S]ETVERSION */ +} LISTVIEW_INFO; + static struct msg_sequence *sequences[NUM_MSG_SEQUENCES];
static const struct message create_ownerdrawfixed_parent_seq[] = { @@ -7102,6 +7228,39 @@ static void test_LVM_SETBKIMAGE(BOOL is_v6) CoUninitialize(); }
+static void test_LVM_DELETEALLITEMS(void) +{ + HWND hwnd; + BOOL ret; + HDC hdc; + LISTVIEW_INFO *infoPtr_initial; + LISTVIEW_INFO *infoPtr_after; + + hwnd = create_listview_control(LVS_LIST); + + insert_item(hwnd, 0); + + /*initial state*/ + infoPtr_initial = (LISTVIEW_INFO *)GetWindowLongPtrW(hwnd, 0); + ok(infoPtr_initial->bNoItemMetrics, "Got Unexpected value %d.\n", infoPtr_initial->bNoItemMetrics); + + hdc = GetDC(hwnd); + + ret = SendMessageA(hwnd, WM_PAINT, (WPARAM)hdc, 0); + ok(!ret, "Unexpected return value %d.\n", ret); + + /*click from initial state to another item*/ + ret = SendMessageA(hwnd, LVM_DELETEALLITEMS, 0, 0); + ok(ret, "Unexpected return value %d.\n", ret); + + infoPtr_after = (LISTVIEW_INFO *)GetWindowLongPtrW(hwnd, 0); + todo_wine ok(infoPtr_after->bNoItemMetrics, "Got Unexpected value %d.\n", infoPtr_after->bNoItemMetrics); + + ReleaseDC(hwnd, hdc); + + DestroyWindow(hwnd); +} + START_TEST(listview) { ULONG_PTR ctx_cookie; @@ -7214,6 +7373,7 @@ START_TEST(listview) test_selected_column(); test_LVM_GETNEXTITEMINDEX(); test_LVM_SETBKIMAGE(TRUE); + test_LVM_DELETEALLITEMS();
unload_v6_module(ctx_cookie, hCtx);
From: Zhaoyi zhaoyi@uniontech.com
bNoItemMetrics should be reset to TRUE after calling LISTVIEW_DeleteAllItems().
Signed-off-by: Zhaoyi zhaoyi@uniontech.com --- dlls/comctl32/listview.c | 1 + dlls/comctl32/tests/listview.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-)
diff --git a/dlls/comctl32/listview.c b/dlls/comctl32/listview.c index 750e447dbef..7972be9669d 100644 --- a/dlls/comctl32/listview.c +++ b/dlls/comctl32/listview.c @@ -5590,6 +5590,7 @@ static BOOL LISTVIEW_DeleteAllItems(LISTVIEW_INFO *infoPtr, BOOL destroy) LISTVIEW_UpdateScroll(infoPtr); } LISTVIEW_InvalidateList(infoPtr); + infoPtr->bNoItemMetrics = TRUE;
return TRUE; } diff --git a/dlls/comctl32/tests/listview.c b/dlls/comctl32/tests/listview.c index 6dfa672220e..8952b9a744b 100644 --- a/dlls/comctl32/tests/listview.c +++ b/dlls/comctl32/tests/listview.c @@ -7254,7 +7254,7 @@ static void test_LVM_DELETEALLITEMS(void) ok(ret, "Unexpected return value %d.\n", ret);
infoPtr_after = (LISTVIEW_INFO *)GetWindowLongPtrW(hwnd, 0); - todo_wine ok(infoPtr_after->bNoItemMetrics, "Got Unexpected value %d.\n", infoPtr_after->bNoItemMetrics); + ok(infoPtr_after->bNoItemMetrics, "Got Unexpected value %d.\n", infoPtr_after->bNoItemMetrics);
ReleaseDC(hwnd, hdc);
Hi,
It looks like your patch introduced the new failures shown below. Please investigate and fix them before resubmitting your patch. If they are not new, fixing them anyway would help a lot. Otherwise please ask for the known failures list to be updated.
The tests also ran into some preexisting test failures. If you know how to fix them that would be helpful. See the TestBot job for the details:
The full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=135156
Your paranoid android.
=== w7u_2qxl (32 bit report) ===
comctl32: listview.c:7245: Test failed: Got Unexpected value 0. listview.c:7257: Test failed: Got Unexpected value 0.
=== w7u_adm (32 bit report) ===
comctl32: listview.c:7245: Test failed: Got Unexpected value 0. listview.c:7257: Test failed: Got Unexpected value 0.
=== w7u_el (32 bit report) ===
comctl32: listview.c:7245: Test failed: Got Unexpected value 0. listview.c:7257: Test failed: Got Unexpected value 0.
=== w8 (32 bit report) ===
comctl32: listview.c:7245: Test failed: Got Unexpected value 0. listview.c:7257: Test failed: Got Unexpected value 0.
=== w8adm (32 bit report) ===
comctl32: listview.c:7245: Test failed: Got Unexpected value 0. listview.c:7257: Test failed: Got Unexpected value 0.
=== w864 (32 bit report) ===
comctl32: listview.c:7245: Test failed: Got Unexpected value 0. listview.c:7257: Test failed: Got Unexpected value 0.
=== w1064v1507 (32 bit report) ===
comctl32: listview.c:7245: Test failed: Got Unexpected value 0. listview.c:7257: Test failed: Got Unexpected value 0.
=== w1064v1809 (32 bit report) ===
comctl32: listview.c:7245: Test failed: Got Unexpected value 0. listview.c:7257: Test failed: Got Unexpected value 0.
=== w1064_tsign (32 bit report) ===
comctl32: listview.c:7245: Test failed: Got Unexpected value 0. listview.c:7257: Test failed: Got Unexpected value 0.
=== w10pro64 (32 bit report) ===
comctl32: listview.c:7245: Test failed: Got Unexpected value 0. listview.c:7257: Test failed: Got Unexpected value 0.
=== w11pro64 (32 bit report) ===
comctl32: listview.c:7245: Test failed: Got Unexpected value 0. listview.c:7257: Test failed: Got Unexpected value 0.
=== w7pro64 (64 bit report) ===
comctl32: listview.c:7245: Test failed: Got Unexpected value 0. listview.c:7257: Test failed: Got Unexpected value 0.
=== w864 (64 bit report) ===
comctl32: listview.c:7245: Test failed: Got Unexpected value 0. listview.c:7257: Test failed: Got Unexpected value 0.
=== w1064v1507 (64 bit report) ===
comctl32: listview.c:7245: Test failed: Got Unexpected value 0. listview.c:7257: Test failed: Got Unexpected value 0.
=== w1064v1809 (64 bit report) ===
comctl32: listview.c:7245: Test failed: Got Unexpected value 0. listview.c:7257: Test failed: Got Unexpected value 0.
=== w1064_2qxl (64 bit report) ===
comctl32: listview.c:7245: Test failed: Got Unexpected value 0. listview.c:7257: Test failed: Got Unexpected value 0.
=== w1064_adm (64 bit report) ===
comctl32: listview.c:7245: Test failed: Got Unexpected value 0. listview.c:7257: Test failed: Got Unexpected value 0.
=== w1064_tsign (64 bit report) ===
comctl32: listview.c:7245: Test failed: Got Unexpected value 0. listview.c:7257: Test failed: Got Unexpected value 0.
=== w10pro64 (64 bit report) ===
comctl32: listview.c:7245: Test failed: Got Unexpected value 0. listview.c:7257: Test failed: Got Unexpected value 0.
=== w10pro64_en_AE_u8 (64 bit report) ===
comctl32: listview.c:7245: Test failed: Got Unexpected value 0. listview.c:7257: Test failed: Got Unexpected value 0.
=== w10pro64_ar (64 bit report) ===
comctl32: listview.c:7245: Test failed: Got Unexpected value 0. listview.c:7257: Test failed: Got Unexpected value 0.
=== w10pro64_ja (64 bit report) ===
comctl32: listview.c:7245: Test failed: Got Unexpected value 0. listview.c:7257: Test failed: Got Unexpected value 0.
=== w10pro64_zh_CN (64 bit report) ===
comctl32: listview.c:7245: Test failed: Got Unexpected value 0. listview.c:7257: Test failed: Got Unexpected value 0.
=== w11pro64_amd (64 bit report) ===
comctl32: listview.c:7245: Test failed: Got Unexpected value 0. listview.c:7257: Test failed: Got Unexpected value 0.
=== debian11b (64 bit WoW report) ===
win32u: win32u.c:1057: Test failed: buf = windows.devices.bluetooth:bluetooth start dlls/windows.devices.bluetooth/tests/bluetooth.c
Jinoh Kang (@iamahuman) commented about dlls/comctl32/tests/listview.c:
}
+static void test_LVM_DELETEALLITEMS(void) +{
- HWND hwnd;
- BOOL ret;
- HDC hdc;
- LISTVIEW_INFO *infoPtr_initial;
- LISTVIEW_INFO *infoPtr_after;
- hwnd = create_listview_control(LVS_LIST);
- insert_item(hwnd, 0);
- /*initial state*/
- infoPtr_initial = (LISTVIEW_INFO *)GetWindowLongPtrW(hwnd, 0);
You should rewrite this test in a way that doesn't depend on Wine internals. Tests run on both Wine and Windows, and test failures indicate that Windows and Wine have different internals for this.
On Mon Jul 24 14:50:58 2023 +0000, Jinoh Kang wrote:
You should rewrite this test in a way that doesn't depend on Wine internals. Tests run on both Wine and Windows, and test failures indicate that Windows and Wine have different internals for this.
I will rewrite this test later.Thank you.
On Tue Jul 25 00:51:18 2023 +0000, Zhao Yi wrote:
I will rewrite this test later.Thank you.
After my efforts I found it a bit difficult to rewrite this test in a way that doesn't depend on Wine internals.
On Wed Jul 26 07:51:09 2023 +0000, Zhao Yi wrote:
After my efforts I found it a bit difficult to rewrite this test in a way that doesn't depend on Wine internals.
As I said in MR2394, I can approve the commit after you change the commit message. The change is simple enough that I think it's fine without a test. It could be difficult to test this specific variable. So you can remove the tests for this MR. I didn't approve MR2394 because you chose to close the MR later. By the way, you don't need to close and open a new MR for updated versions of commits.
On Wed Jul 26 08:20:10 2023 +0000, Zhiyi Zhang wrote:
As I said in MR2394, I can approve the commit after you change the commit message. The change is simple enough that I think it's fine without a test. It could be difficult to test this specific variable. So you can remove the tests for this MR. I didn't approve MR2394 because you chose to close the MR later. By the way, you don't need to close and open a new MR for updated versions of commits.
I see, I will remove the tests for this MR later, Thank you!