From b7eac4864d91ea7b7eafee1b7a9a159468c94476 Mon Sep 17 00:00:00 2001 From: Lei Zhang Date: Sat, 6 Oct 2007 09:10:29 -0700 Subject: [PATCH] comctl32: fix monthcal hit tests --- dlls/comctl32/tests/monthcal.c | 55 ++++++++++++++++++++++++++++++---------- 1 files changed, 41 insertions(+), 14 deletions(-) diff --git a/dlls/comctl32/tests/monthcal.c b/dlls/comctl32/tests/monthcal.c index 4f29ac9..71f88cc 100644 --- a/dlls/comctl32/tests/monthcal.c +++ b/dlls/comctl32/tests/monthcal.c @@ -200,6 +200,13 @@ static const struct message monthcal_uni }; static const struct message monthcal_hit_test_seq[] = { + { MCM_SETCURSEL, sent|wparam, 0}, + { WM_PAINT, sent|wparam|lparam|defwinproc, 0, 0}, + { WM_NCPAINT, sent|wparam|lparam|defwinproc, 1, 0}, + { WM_ERASEBKGND, sent|lparam|defwinproc, 0}, + { WM_SETFONT, sent|lparam, 0, 0}, + { WM_PAINT, sent|wparam|lparam|defwinproc, 0, 0}, + { WM_ERASEBKGND, sent|lparam|defwinproc, 0}, { MCM_HITTEST, sent|wparam, 0}, { MCM_HITTEST, sent|wparam, 0}, { MCM_HITTEST, sent|wparam, 0}, @@ -224,6 +231,8 @@ static const struct message monthcal_hit static const struct message monthcal_today_seq[] = { { MCM_SETTODAY, sent|wparam, 0}, { WM_PAINT, sent|wparam|lparam|defwinproc, 0, 0}, + { WM_NCPAINT, sent|wparam|lparam|defwinproc, 1, 0}, + { WM_ERASEBKGND, sent|lparam|defwinproc, 0}, { MCM_GETTODAY, sent|wparam, 0}, { MCM_SETTODAY, sent|wparam, 0}, { WM_PAINT, sent|wparam|lparam|defwinproc, 0, 0}, @@ -706,16 +715,32 @@ static void test_monthcal_unicode(HWND h ok_sequence(sequences, MONTHCAL_SEQ_INDEX, monthcal_unicode_seq, "monthcal unicode", FALSE); } -static void test_monthcal_HitTest(HWND hwnd) +static void test_monthcal_HitTest(HWND parent_wnd) { MCHITTESTINFO mchit; int res; + HWND hwnd; + SYSTEMTIME st; + hwnd = create_monthcal_control(WS_CHILD | WS_BORDER | WS_VISIBLE, parent_wnd); + assert(hwnd); memset(&mchit, 0, sizeof(MCHITTESTINFO)); flush_sequences(sequences, NUM_MSG_SEQUENCES); - /* Setters for HITTEST */ + st.wYear = 2007; + st.wMonth = 4; + st.wDay = 11; + st.wHour = 1; + st.wMinute = 0; + st.wSecond = 0; + st.wMilliseconds = 0; + st.wDayOfWeek = 0; + + res = SendMessage(hwnd, MCM_SETCURSEL, 0, (LPARAM)&st); + expect(1,res); + + SendMessage(hwnd, WM_SETFONT, (WPARAM)GetStockObject(DEFAULT_GUI_FONT), 0); /* (0, 0) is the top left of the control and should not be active */ mchit.cbSize = sizeof(MCHITTESTINFO); @@ -745,11 +770,11 @@ static void test_monthcal_HitTest(HWND h expect(mchit.uHit, res); todo_wine {expect(MCHT_NOWHERE, res);} - /* (150, 200) is in active area - calendar background */ - mchit.pt.x = 150; + /* (100, 200) is in active area - calendar background */ + mchit.pt.x = 100; mchit.pt.y = 200; res = SendMessage(hwnd, MCM_HITTEST, 0, (LPARAM) & mchit); - expect(150, mchit.pt.x); + expect(100, mchit.pt.x); expect(200, mchit.pt.y); expect(mchit.uHit, res); expect(MCHT_CALENDARBK, res); @@ -772,11 +797,11 @@ static void test_monthcal_HitTest(HWND h expect(mchit.uHit, res); todo_wine {expect(MCHT_TITLE, res);} - /* (150, 20) is in active area - month section of the title */ - mchit.pt.x = 150; + /* (140, 20) is in active area - month section of the title */ + mchit.pt.x = 140; mchit.pt.y = 20; res = SendMessage(hwnd, MCM_HITTEST, 0, (LPARAM) & mchit); - expect(150, mchit.pt.x); + expect(140, mchit.pt.x); expect(20, mchit.pt.y); expect(mchit.uHit, res); todo_wine {expect(MCHT_TITLEMONTH, res);} @@ -815,7 +840,7 @@ static void test_monthcal_HitTest(HWND h expect(125, mchit.pt.x); expect(115, mchit.pt.y); expect(mchit.uHit, res); - todo_wine {expect(MCHT_CALENDARDATE, res);} + expect(MCHT_CALENDARDATE, res); /* (80, 160) is in active area - background section of the title */ mchit.pt.x = 80; @@ -826,11 +851,11 @@ static void test_monthcal_HitTest(HWND h expect(mchit.uHit, res); todo_wine {expect(MCHT_TITLEBK, res);} - /* (150, 160) is in active area - month section of the title */ - mchit.pt.x = 150; + /* (140, 160) is in active area - month section of the title */ + mchit.pt.x = 140; mchit.pt.y = 160; res = SendMessage(hwnd, MCM_HITTEST, 0, (LPARAM) & mchit); - expect(150, mchit.pt.x); + expect(140, mchit.pt.x); expect(160, mchit.pt.y); expect(mchit.uHit, res); todo_wine {expect(MCHT_TITLEMONTH, res);} @@ -880,7 +905,9 @@ static void test_monthcal_HitTest(HWND h expect(mchit.uHit, res); todo_wine {expect(MCHT_TODAYLINK, res);} - ok_sequence(sequences, MONTHCAL_SEQ_INDEX, monthcal_hit_test_seq, "monthcal hit test", FALSE); + ok_sequence(sequences, MONTHCAL_SEQ_INDEX, monthcal_hit_test_seq, "monthcal hit test", TRUE); + + DestroyWindow(hwnd); } static void test_monthcal_today(HWND hwnd) @@ -1044,7 +1071,7 @@ START_TEST(monthcal) test_monthcal_currDate(hwnd); test_monthcal_firstDay(hwnd); test_monthcal_unicode(hwnd); - test_monthcal_HitTest(hwnd); + test_monthcal_HitTest(parent_wnd); test_monthcal_today(hwnd); test_monthcal_scroll(hwnd); test_monthcal_monthrange(hwnd); -- 1.4.1