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);