Module: wine Branch: master Commit: 190fbc750094bb88a20a70d3f28cd91b77790b62 URL: https://gitlab.winehq.org/wine/wine/-/commit/190fbc750094bb88a20a70d3f28cd91...
Author: Eric Pouech eric.pouech@gmail.com Date: Thu Nov 17 12:27:50 2022 +0100
comctl32/tests: Fix monthcal selection tests.
Changed MCHITTESTINFO.cbSize to fall back to V1: From the rest of the tests, it looks like the extended size of MCHITTESTINFO requires loading common controls V6, which is only done afterwards in the tests.
Improved lookup of an unselected day.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=50097 Signed-off-by: Eric Pouech eric.pouech@gmail.com
---
dlls/comctl32/tests/monthcal.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-)
diff --git a/dlls/comctl32/tests/monthcal.c b/dlls/comctl32/tests/monthcal.c index fcafb790302..8b01173e86e 100644 --- a/dlls/comctl32/tests/monthcal.c +++ b/dlls/comctl32/tests/monthcal.c @@ -2021,7 +2021,7 @@ static void test_sel_notify(void)
HWND hwnd; RECT rc; - MCHITTESTINFO mchit = {sizeof(MCHITTESTINFO)}; + MCHITTESTINFO mchit = {MCHITTESTINFO_V1_SIZE}; SYSTEMTIME st; Monthcal_style styles[] = { {MCS_NOTODAY, "MCS_NOTODAY"}, @@ -2039,15 +2039,19 @@ static void test_sel_notify(void) MoveWindow(hwnd, 0, 0, rc.right, rc.bottom, FALSE); /* Simulate mouse click on some unselected day to generate MCN_SELECT and MCN_SELCHANGE notifications */ - mchit.pt.x = rc.right / 2; - mchit.pt.y = rc.bottom / 2; - SendMessageA(hwnd, MCM_HITTEST, 0, (LPARAM)&mchit); + mchit.pt.x = mchit.pt.y = 0; SendMessageA(hwnd, MCM_GETCURSEL, 0, (LPARAM)&st); - while(st.wDay == mchit.st.wDay) /* Ensure that mchit.pt points to unselected day */ + + do { - mchit.pt.y++; + /* we assume box for day is larger than 3x3 */ + if ((mchit.pt.y += 3) >= rc.bottom) + { + mchit.pt.y = 0; + if ((mchit.pt.x += 3) >= rc.right) break; + } SendMessageA(hwnd, MCM_HITTEST, 0, (LPARAM)&mchit); - } + } while (mchit.uHit != MCHT_CALENDARDATE || st.wDay == mchit.st.wDay); /* Ensure that mchit.pt points to unselected day */ got_MCN_SELECT = got_MCN_SELCHANGE = FALSE; SendMessageA(hwnd, WM_LBUTTONDOWN, 0, MAKELPARAM(mchit.pt.x, mchit.pt.y)); if (styles[i].val & MCS_MULTISELECT)