Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=54640
-- v4: comctl32/treeview: Ignore the lParam to WM_PRINTCLIENT and add tests.
From: Alex Henrie alexhenrie24@gmail.com
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=54640 --- dlls/comctl32/tests/treeview.c | 61 ++++++++++++++++++++++++++++++++++ dlls/comctl32/treeview.c | 17 +++------- 2 files changed, 66 insertions(+), 12 deletions(-)
diff --git a/dlls/comctl32/tests/treeview.c b/dlls/comctl32/tests/treeview.c index eda57ed2c81..4b5703b6b76 100644 --- a/dlls/comctl32/tests/treeview.c +++ b/dlls/comctl32/tests/treeview.c @@ -2181,6 +2181,66 @@ static void test_WM_PAINT(void) DestroyWindow(hTree); }
+static void test_WM_PRINTCLIENT(void) +{ + static const LPARAM params[] = {0, PRF_CHECKVISIBLE, PRF_NONCLIENT, PRF_CLIENT, PRF_ERASEBKGND, + PRF_CHILDREN, PRF_OWNED}; + BOOL glyph_is_transparent; + HTHEME hTheme; + HWND hTree; + COLORREF clr; + LONG ret; + RECT rc; + HDC hdc; + int i; + + hTree = create_treeview_control(0); + + clr = SendMessageA(hTree, TVM_SETBKCOLOR, 0, RGB(255, 0, 0)); + ok(clr == CLR_NONE, "got 0x%lx, expected 0x%lx\n", clr, CLR_NONE); + + hdc = GetDC(hMainWnd); + GetClientRect(hMainWnd, &rc); + + hTheme = pGetWindowTheme(hTree); + glyph_is_transparent = hTheme && pIsThemeBackgroundPartiallyTransparent(hTheme, TVP_GLYPH, 0); + + /* test parameters when the treeview is visible */ + for (i = 0; i < ARRAY_SIZE(params); i++) + { + winetest_push_context("lParam=0x%Ix", params[i]); + FillRect(hdc, &rc, GetStockObject(BLACK_BRUSH)); + clr = GetPixel(hdc, 1, 1); + ok(clr == RGB(0, 0, 0), "got 0x%lx\n", clr); + ret = SendMessageA(hTree, WM_PRINTCLIENT, (WPARAM)hdc, params[i]); + ok(ret == 0, "got %ld\n", ret); + clr = GetPixel(hdc, 1, 1); + ok(clr == RGB(255, 0, 0) || (glyph_is_transparent && clr == GetSysColor(COLOR_WINDOW)), + "got 0x%lx\n", clr); + winetest_pop_context(); + } + + /* test parameters when the treeview is hidden */ + ShowWindow(hTree, SW_HIDE); + for (i = 0; i < ARRAY_SIZE(params); i++) + { + winetest_push_context("lParam=0x%Ix", params[i]); + FillRect(hdc, &rc, GetStockObject(BLACK_BRUSH)); + clr = GetPixel(hdc, 1, 1); + ok(clr == RGB(0, 0, 0), "got 0x%lx\n", clr); + ret = SendMessageA(hTree, WM_PRINTCLIENT, (WPARAM)hdc, params[i]); + ok(ret == 0, "got %ld\n", ret); + clr = GetPixel(hdc, 1, 1); + ok(clr == RGB(255, 0, 0) || (glyph_is_transparent && clr == GetSysColor(COLOR_WINDOW)), + "got 0x%lx\n", clr); + winetest_pop_context(); + } + ShowWindow(hTree, SW_SHOW); + + ReleaseDC(hMainWnd, hdc); + DestroyWindow(hTree); +} + static void test_delete_items(void) { const struct message *msg; @@ -3042,6 +3102,7 @@ START_TEST(treeview) test_expandnotify(); test_TVS_SINGLEEXPAND(); test_WM_PAINT(); + test_WM_PRINTCLIENT(); test_delete_items(); test_cchildren(); test_htreeitem_layout(FALSE); diff --git a/dlls/comctl32/treeview.c b/dlls/comctl32/treeview.c index 1c87dc29b05..e866f82db11 100644 --- a/dlls/comctl32/treeview.c +++ b/dlls/comctl32/treeview.c @@ -3114,20 +3114,13 @@ TREEVIEW_Paint(TREEVIEW_INFO *infoPtr, HDC hdc_ref) static LRESULT TREEVIEW_PrintClient(TREEVIEW_INFO *infoPtr, HDC hdc, DWORD options) { - FIXME("Partial Stub: (hdc=%p options=%#lx)\n", hdc, options); - - if ((options & PRF_CHECKVISIBLE) && !IsWindowVisible(infoPtr->hwnd)) - return 0; + RECT rc;
- if (options & PRF_ERASEBKGND) - TREEVIEW_EraseBackground(infoPtr, hdc); + FIXME("Partial Stub: (hdc=%p options=%#lx)\n", hdc, options);
- if (options & PRF_CLIENT) - { - RECT rc; - GetClientRect(infoPtr->hwnd, &rc); - TREEVIEW_Refresh(infoPtr, hdc, &rc); - } + TREEVIEW_EraseBackground(infoPtr, hdc); + GetClientRect(infoPtr->hwnd, &rc); + TREEVIEW_Refresh(infoPtr, hdc, &rc);
return 0; }
This merge request was approved by Zhiyi Zhang.
This merge request was approved by Nikolay Sivov.