2006-02-06 20:58:48 +01:00
|
|
|
/*
|
|
|
|
* comctl32 month calendar unit tests
|
|
|
|
*
|
|
|
|
* Copyright (C) 2006 Vitaliy Margolen
|
2007-02-16 08:59:08 +01:00
|
|
|
* Copyright (C) 2007 Farshad Agah
|
2006-02-06 20:58:48 +01:00
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
2006-05-18 14:49:52 +02:00
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
2006-02-06 20:58:48 +01:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include <stdarg.h>
|
|
|
|
|
|
|
|
#include "windef.h"
|
|
|
|
#include "winbase.h"
|
|
|
|
#include "winuser.h"
|
|
|
|
|
|
|
|
#include "commctrl.h"
|
|
|
|
|
|
|
|
#include "wine/test.h"
|
2010-08-04 12:29:27 +02:00
|
|
|
#include "v6util.h"
|
2007-02-16 08:59:08 +01:00
|
|
|
#include <windows.h>
|
2007-03-16 08:32:49 +01:00
|
|
|
#include "msg.h"
|
2007-02-16 08:59:08 +01:00
|
|
|
|
|
|
|
#define expect(expected, got) ok(expected == got, "Expected %d, got %d\n", expected, got);
|
2009-09-28 20:50:21 +02:00
|
|
|
#define expect_hex(expected, got) ok(expected == got, "Expected %x, got %x\n", expected, got);
|
2010-08-04 12:29:27 +02:00
|
|
|
#define expect_d(expected, got) ok(abs((expected) - (got)) <= 2, "Expected %d, got %d\n", expected, got);
|
2006-02-06 20:58:48 +01:00
|
|
|
|
2007-03-16 08:32:49 +01:00
|
|
|
#define NUM_MSG_SEQUENCES 2
|
|
|
|
#define PARENT_SEQ_INDEX 0
|
|
|
|
#define MONTHCAL_SEQ_INDEX 1
|
|
|
|
|
2012-08-17 08:17:02 +02:00
|
|
|
#define SEL_NOTIFY_TEST_ID 100
|
|
|
|
|
2007-03-16 08:32:49 +01:00
|
|
|
static struct msg_sequence *sequences[NUM_MSG_SEQUENCES];
|
|
|
|
|
2009-09-25 22:51:04 +02:00
|
|
|
static HWND parent_wnd;
|
|
|
|
|
2007-03-16 08:32:49 +01:00
|
|
|
static const struct message create_parent_window_seq[] = {
|
|
|
|
{ WM_GETMINMAXINFO, sent },
|
|
|
|
{ WM_NCCREATE, sent },
|
|
|
|
{ WM_NCCALCSIZE, sent|wparam, 0 },
|
|
|
|
{ WM_CREATE, sent },
|
|
|
|
{ WM_SHOWWINDOW, sent|wparam, 1 },
|
|
|
|
{ WM_WINDOWPOSCHANGING, sent|wparam, 0 },
|
2008-09-15 03:06:03 +02:00
|
|
|
{ WM_QUERYNEWPALETTE, sent|optional },
|
2009-03-05 23:00:49 +01:00
|
|
|
{ WM_WINDOWPOSCHANGING, sent|wparam|optional, 0 },
|
|
|
|
{ WM_WINDOWPOSCHANGED, sent|optional },
|
2007-03-16 08:32:49 +01:00
|
|
|
{ WM_ACTIVATEAPP, sent|wparam, 1 },
|
2009-08-31 09:13:53 +02:00
|
|
|
{ WM_NCACTIVATE, sent },
|
2007-03-16 08:32:49 +01:00
|
|
|
{ WM_ACTIVATE, sent|wparam, 1 },
|
|
|
|
{ WM_IME_SETCONTEXT, sent|wparam|defwinproc|optional, 1 },
|
|
|
|
{ WM_IME_NOTIFY, sent|defwinproc|optional },
|
|
|
|
{ WM_SETFOCUS, sent|wparam|defwinproc, 0 },
|
|
|
|
/* Win9x adds SWP_NOZORDER below */
|
|
|
|
{ WM_WINDOWPOSCHANGED, sent, /*|wparam, SWP_SHOWWINDOW|SWP_NOSIZE|SWP_NOMOVE|SWP_NOCLIENTSIZE|SWP_NOCLIENTMOVE*/ },
|
|
|
|
{ WM_NCCALCSIZE, sent|wparam|optional, 1 },
|
|
|
|
{ WM_SIZE, sent },
|
|
|
|
{ WM_MOVE, sent },
|
|
|
|
{ 0 }
|
|
|
|
};
|
|
|
|
|
|
|
|
static const struct message create_monthcal_control_seq[] = {
|
|
|
|
{ WM_NOTIFYFORMAT, sent|lparam, 0, NF_QUERY },
|
2008-09-08 07:45:03 +02:00
|
|
|
{ WM_QUERYUISTATE, sent|optional },
|
2007-03-16 08:32:49 +01:00
|
|
|
{ WM_GETFONT, sent },
|
|
|
|
{ WM_PARENTNOTIFY, sent|wparam, WM_CREATE},
|
|
|
|
{ 0 }
|
|
|
|
};
|
|
|
|
|
|
|
|
static const struct message create_monthcal_multi_sel_style_seq[] = {
|
|
|
|
{ WM_NOTIFYFORMAT, sent|lparam, 0, NF_QUERY },
|
2008-09-08 07:45:03 +02:00
|
|
|
{ WM_QUERYUISTATE, sent|optional },
|
2007-03-16 08:32:49 +01:00
|
|
|
{ WM_GETFONT, sent },
|
2009-09-25 22:51:04 +02:00
|
|
|
{ WM_PARENTNOTIFY, sent },
|
2007-03-16 08:32:49 +01:00
|
|
|
{ 0 }
|
|
|
|
};
|
|
|
|
|
|
|
|
static const struct message monthcal_curr_date_seq[] = {
|
|
|
|
{ MCM_SETCURSEL, sent|wparam, 0},
|
|
|
|
{ WM_PAINT, sent|wparam|lparam|defwinproc, 0, 0},
|
|
|
|
{ MCM_SETCURSEL, sent|wparam, 0},
|
|
|
|
{ MCM_SETCURSEL, sent|wparam, 0},
|
|
|
|
{ MCM_GETCURSEL, sent|wparam, 0},
|
|
|
|
{ MCM_GETCURSEL, sent|wparam|lparam, 0, 0},
|
|
|
|
{ 0 }
|
|
|
|
};
|
|
|
|
|
|
|
|
static const struct message monthcal_first_day_seq[] = {
|
|
|
|
{ MCM_GETFIRSTDAYOFWEEK, sent|wparam|lparam, 0, 0},
|
|
|
|
|
2007-03-16 08:34:36 +01:00
|
|
|
{ MCM_SETFIRSTDAYOFWEEK, sent|wparam|lparam, 0, -5},
|
2007-03-16 08:32:49 +01:00
|
|
|
{ MCM_GETFIRSTDAYOFWEEK, sent|wparam|lparam, 0, 0},
|
|
|
|
|
2007-03-16 08:34:36 +01:00
|
|
|
{ MCM_SETFIRSTDAYOFWEEK, sent|wparam|lparam, 0, -4},
|
2007-03-16 08:32:49 +01:00
|
|
|
{ MCM_GETFIRSTDAYOFWEEK, sent|wparam|lparam, 0, 0},
|
|
|
|
|
2007-03-16 08:34:36 +01:00
|
|
|
{ MCM_SETFIRSTDAYOFWEEK, sent|wparam|lparam, 0, -3},
|
2007-03-16 08:32:49 +01:00
|
|
|
{ MCM_GETFIRSTDAYOFWEEK, sent|wparam|lparam, 0, 0},
|
|
|
|
|
2007-03-16 08:34:36 +01:00
|
|
|
{ MCM_SETFIRSTDAYOFWEEK, sent|wparam|lparam, 0, -2},
|
2007-03-16 08:32:49 +01:00
|
|
|
{ MCM_GETFIRSTDAYOFWEEK, sent|wparam|lparam, 0, 0},
|
|
|
|
|
2007-03-16 08:34:36 +01:00
|
|
|
{ MCM_SETFIRSTDAYOFWEEK, sent|wparam|lparam, 0, -1},
|
|
|
|
{ MCM_GETFIRSTDAYOFWEEK, sent|wparam|lparam, 0, 0},
|
|
|
|
|
|
|
|
{ MCM_SETFIRSTDAYOFWEEK, sent|wparam|lparam, 0, 0},
|
|
|
|
{ MCM_GETFIRSTDAYOFWEEK, sent|wparam|lparam, 0, 0},
|
|
|
|
|
|
|
|
{ MCM_SETFIRSTDAYOFWEEK, sent|wparam|lparam, 0, 1},
|
|
|
|
{ MCM_GETFIRSTDAYOFWEEK, sent|wparam|lparam, 0, 0},
|
|
|
|
|
|
|
|
{ MCM_SETFIRSTDAYOFWEEK, sent|wparam|lparam, 0, 2},
|
2007-03-16 08:32:49 +01:00
|
|
|
{ MCM_GETFIRSTDAYOFWEEK, sent|wparam|lparam, 0, 0},
|
|
|
|
|
2007-03-16 08:34:36 +01:00
|
|
|
{ MCM_SETFIRSTDAYOFWEEK, sent|wparam|lparam, 0, 3},
|
2007-03-16 08:32:49 +01:00
|
|
|
{ MCM_GETFIRSTDAYOFWEEK, sent|wparam|lparam, 0, 0},
|
2007-03-16 08:34:36 +01:00
|
|
|
|
|
|
|
{ MCM_SETFIRSTDAYOFWEEK, sent|wparam|lparam, 0, 4},
|
|
|
|
{ MCM_GETFIRSTDAYOFWEEK, sent|wparam|lparam, 0, 0},
|
|
|
|
|
|
|
|
{ MCM_SETFIRSTDAYOFWEEK, sent|wparam|lparam, 0, 5},
|
|
|
|
{ MCM_GETFIRSTDAYOFWEEK, sent|wparam|lparam, 0, 0},
|
|
|
|
|
2007-03-16 08:32:49 +01:00
|
|
|
{ MCM_SETFIRSTDAYOFWEEK, sent|wparam|lparam, 0, 6},
|
2007-03-16 08:34:36 +01:00
|
|
|
{ MCM_GETFIRSTDAYOFWEEK, sent|wparam|lparam, 0, 0},
|
|
|
|
|
|
|
|
{ MCM_SETFIRSTDAYOFWEEK, sent|wparam|lparam, 0, 7},
|
|
|
|
{ MCM_GETFIRSTDAYOFWEEK, sent|wparam|lparam, 0, 0},
|
|
|
|
|
|
|
|
{ MCM_SETFIRSTDAYOFWEEK, sent|wparam|lparam, 0, 8},
|
|
|
|
{ MCM_GETFIRSTDAYOFWEEK, sent|wparam|lparam, 0, 0},
|
|
|
|
|
|
|
|
{ MCM_SETFIRSTDAYOFWEEK, sent|wparam|lparam, 0, 9},
|
|
|
|
{ MCM_GETFIRSTDAYOFWEEK, sent|wparam|lparam, 0, 0},
|
2007-03-16 08:32:49 +01:00
|
|
|
|
2007-03-16 08:34:36 +01:00
|
|
|
{ MCM_SETFIRSTDAYOFWEEK, sent|wparam|lparam, 0, 10},
|
|
|
|
{ MCM_GETFIRSTDAYOFWEEK, sent|wparam|lparam, 0, 0},
|
|
|
|
|
|
|
|
{ MCM_SETFIRSTDAYOFWEEK, sent|wparam|lparam, 0, 11},
|
2007-03-16 08:32:49 +01:00
|
|
|
{ MCM_GETFIRSTDAYOFWEEK, sent|wparam|lparam, 0, 0},
|
|
|
|
{ 0 }
|
|
|
|
};
|
|
|
|
|
|
|
|
static const struct message monthcal_unicode_seq[] = {
|
|
|
|
{ MCM_GETUNICODEFORMAT, sent|wparam|lparam, 0, 0},
|
|
|
|
{ MCM_SETUNICODEFORMAT, sent|wparam|lparam, 1, 0},
|
|
|
|
{ MCM_GETUNICODEFORMAT, sent|wparam|lparam, 0, 0},
|
|
|
|
{ MCM_SETUNICODEFORMAT, sent|wparam|lparam, 0, 0},
|
|
|
|
{ MCM_GETUNICODEFORMAT, sent|wparam|lparam, 0, 0},
|
|
|
|
{ MCM_SETUNICODEFORMAT, sent|wparam|lparam, 1, 0},
|
|
|
|
{ 0 }
|
|
|
|
};
|
|
|
|
|
|
|
|
static const struct message monthcal_hit_test_seq[] = {
|
2007-10-07 14:36:19 +02:00
|
|
|
{ MCM_SETCURSEL, sent|wparam, 0},
|
|
|
|
{ WM_PAINT, sent|wparam|lparam|defwinproc, 0, 0},
|
2007-04-12 06:34:48 +02:00
|
|
|
{ MCM_HITTEST, sent|wparam, 0},
|
|
|
|
{ MCM_HITTEST, sent|wparam, 0},
|
|
|
|
{ MCM_HITTEST, sent|wparam, 0},
|
|
|
|
{ MCM_HITTEST, sent|wparam, 0},
|
|
|
|
{ MCM_HITTEST, sent|wparam, 0},
|
|
|
|
{ MCM_HITTEST, sent|wparam, 0},
|
|
|
|
{ MCM_HITTEST, sent|wparam, 0},
|
|
|
|
{ MCM_HITTEST, sent|wparam, 0},
|
|
|
|
{ MCM_HITTEST, sent|wparam, 0},
|
|
|
|
{ MCM_HITTEST, sent|wparam, 0},
|
2007-03-16 08:32:49 +01:00
|
|
|
{ 0 }
|
|
|
|
};
|
|
|
|
|
2007-10-15 02:04:08 +02:00
|
|
|
static const struct message monthcal_todaylink_seq[] = {
|
|
|
|
{ MCM_HITTEST, sent|wparam, 0},
|
|
|
|
{ MCM_SETTODAY, sent|wparam, 0},
|
|
|
|
{ WM_PAINT, sent|wparam|lparam|defwinproc, 0, 0},
|
|
|
|
{ MCM_GETTODAY, sent|wparam, 0},
|
2009-10-11 17:02:51 +02:00
|
|
|
{ WM_LBUTTONDOWN, sent|wparam, MK_LBUTTON},
|
2007-10-15 02:04:08 +02:00
|
|
|
{ WM_CAPTURECHANGED, sent|wparam|lparam|defwinproc, 0, 0},
|
|
|
|
{ WM_PAINT, sent|wparam|lparam|defwinproc, 0, 0},
|
|
|
|
{ MCM_GETCURSEL, sent|wparam, 0},
|
|
|
|
{ 0 }
|
|
|
|
};
|
|
|
|
|
2007-03-16 08:32:49 +01:00
|
|
|
static const struct message monthcal_today_seq[] = {
|
|
|
|
{ MCM_SETTODAY, sent|wparam, 0},
|
|
|
|
{ WM_PAINT, sent|wparam|lparam|defwinproc, 0, 0},
|
|
|
|
{ MCM_GETTODAY, sent|wparam, 0},
|
|
|
|
{ MCM_SETTODAY, sent|wparam, 0},
|
|
|
|
{ WM_PAINT, sent|wparam|lparam|defwinproc, 0, 0},
|
|
|
|
{ MCM_GETTODAY, sent|wparam, 0},
|
|
|
|
{ 0 }
|
|
|
|
};
|
|
|
|
|
|
|
|
static const struct message monthcal_scroll_seq[] = {
|
|
|
|
{ MCM_SETMONTHDELTA, sent|wparam|lparam, 2, 0},
|
|
|
|
{ MCM_SETMONTHDELTA, sent|wparam|lparam, 3, 0},
|
|
|
|
{ MCM_GETMONTHDELTA, sent|wparam|lparam, 0, 0},
|
|
|
|
{ MCM_SETMONTHDELTA, sent|wparam|lparam, 12, 0},
|
|
|
|
{ MCM_GETMONTHDELTA, sent|wparam|lparam, 0, 0},
|
|
|
|
{ MCM_SETMONTHDELTA, sent|wparam|lparam, 15, 0},
|
|
|
|
{ MCM_GETMONTHDELTA, sent|wparam|lparam, 0, 0},
|
|
|
|
{ MCM_SETMONTHDELTA, sent|wparam|lparam, -5, 0},
|
|
|
|
{ MCM_GETMONTHDELTA, sent|wparam|lparam, 0, 0},
|
|
|
|
{ 0 }
|
|
|
|
};
|
|
|
|
|
2007-04-13 03:44:55 +02:00
|
|
|
static const struct message monthcal_monthrange_seq[] = {
|
|
|
|
{ MCM_GETMONTHRANGE, sent|wparam, GMR_VISIBLE},
|
|
|
|
{ MCM_GETMONTHRANGE, sent|wparam, GMR_DAYSTATE},
|
|
|
|
{ 0 }
|
|
|
|
};
|
|
|
|
|
2007-03-16 08:32:49 +01:00
|
|
|
static const struct message monthcal_max_sel_day_seq[] = {
|
|
|
|
{ MCM_SETMAXSELCOUNT, sent|wparam|lparam, 5, 0},
|
|
|
|
{ MCM_GETMAXSELCOUNT, sent|wparam|lparam, 0, 0},
|
|
|
|
{ MCM_SETMAXSELCOUNT, sent|wparam|lparam, 15, 0},
|
|
|
|
{ MCM_GETMAXSELCOUNT, sent|wparam|lparam, 0, 0},
|
|
|
|
{ MCM_SETMAXSELCOUNT, sent|wparam|lparam, -1, 0},
|
|
|
|
{ MCM_GETMAXSELCOUNT, sent|wparam|lparam, 0, 0},
|
|
|
|
{ 0 }
|
|
|
|
};
|
|
|
|
|
|
|
|
/* expected message sequence for parent*/
|
|
|
|
static const struct message destroy_monthcal_parent_msgs_seq[] = {
|
|
|
|
{ WM_PARENTNOTIFY, sent|wparam, WM_DESTROY},
|
|
|
|
{ 0 }
|
|
|
|
};
|
|
|
|
|
|
|
|
/* expected message sequence for child*/
|
|
|
|
static const struct message destroy_monthcal_child_msgs_seq[] = {
|
2008-01-26 09:49:09 +01:00
|
|
|
{ 0x0090, sent|optional }, /* Vista */
|
2007-03-16 08:32:49 +01:00
|
|
|
{ WM_SHOWWINDOW, sent|wparam|lparam, 0, 0},
|
|
|
|
{ WM_WINDOWPOSCHANGING, sent|wparam, 0},
|
|
|
|
{ WM_WINDOWPOSCHANGED, sent|wparam, 0},
|
|
|
|
{ WM_DESTROY, sent|wparam|lparam, 0, 0},
|
|
|
|
{ WM_NCDESTROY, sent|wparam|lparam, 0, 0},
|
|
|
|
{ 0 }
|
|
|
|
};
|
|
|
|
|
|
|
|
static const struct message destroy_monthcal_multi_sel_style_seq[] = {
|
2008-01-26 09:49:09 +01:00
|
|
|
{ 0x0090, sent|optional }, /* Vista */
|
2009-09-25 22:51:04 +02:00
|
|
|
{ WM_SHOWWINDOW, sent|wparam|lparam, 0, 0},
|
|
|
|
{ WM_WINDOWPOSCHANGING, sent|wparam, 0},
|
|
|
|
{ WM_WINDOWPOSCHANGED, sent|wparam, 0},
|
2007-03-16 08:32:49 +01:00
|
|
|
{ WM_DESTROY, sent|wparam|lparam, 0, 0},
|
|
|
|
{ WM_NCDESTROY, sent|wparam|lparam, 0, 0},
|
|
|
|
{ 0 }
|
|
|
|
};
|
|
|
|
|
2006-12-11 21:22:02 +01:00
|
|
|
static void test_monthcal(void)
|
2006-02-06 20:58:48 +01:00
|
|
|
{
|
|
|
|
HWND hwnd;
|
2009-09-26 18:06:48 +02:00
|
|
|
SYSTEMTIME st[2], st1[2], today;
|
2006-02-16 12:19:09 +01:00
|
|
|
int res, month_range;
|
2009-10-03 14:51:09 +02:00
|
|
|
DWORD limits;
|
2006-02-06 20:58:48 +01:00
|
|
|
|
|
|
|
hwnd = CreateWindowA(MONTHCAL_CLASSA, "MonthCal", WS_POPUP | WS_VISIBLE, CW_USEDEFAULT,
|
|
|
|
0, 300, 300, 0, 0, NULL, NULL);
|
|
|
|
ok(hwnd != NULL, "Failed to create MonthCal\n");
|
2009-09-26 01:09:06 +02:00
|
|
|
|
|
|
|
/* test range just after creation */
|
|
|
|
memset(&st, 0xcc, sizeof(st));
|
2013-12-01 22:33:53 +01:00
|
|
|
limits = SendMessageA(hwnd, MCM_GETRANGE, 0, (LPARAM)st);
|
2009-10-03 14:51:09 +02:00
|
|
|
ok(limits == 0 ||
|
|
|
|
broken(limits == GDTR_MIN), /* comctl32 <= 4.70 */
|
|
|
|
"No limits should be set (%d)\n", limits);
|
|
|
|
if (limits == GDTR_MIN)
|
|
|
|
{
|
|
|
|
win_skip("comctl32 <= 4.70 is broken\n");
|
|
|
|
DestroyWindow(hwnd);
|
|
|
|
return;
|
|
|
|
}
|
2009-09-26 01:09:06 +02:00
|
|
|
|
2009-10-03 14:44:34 +02:00
|
|
|
ok(0 == st[0].wYear ||
|
|
|
|
broken(1752 == st[0].wYear), /* comctl32 <= 4.72 */
|
|
|
|
"Expected 0, got %d\n", st[0].wYear);
|
|
|
|
ok(0 == st[0].wMonth ||
|
|
|
|
broken(9 == st[0].wMonth), /* comctl32 <= 4.72 */
|
|
|
|
"Expected 0, got %d\n", st[0].wMonth);
|
|
|
|
ok(0 == st[0].wDay ||
|
|
|
|
broken(14 == st[0].wDay), /* comctl32 <= 4.72 */
|
|
|
|
"Expected 0, got %d\n", st[0].wDay);
|
2009-09-26 01:09:06 +02:00
|
|
|
expect(0, st[0].wDayOfWeek);
|
|
|
|
expect(0, st[0].wHour);
|
|
|
|
expect(0, st[0].wMinute);
|
|
|
|
expect(0, st[0].wSecond);
|
|
|
|
expect(0, st[0].wMilliseconds);
|
|
|
|
|
|
|
|
expect(0, st[1].wYear);
|
|
|
|
expect(0, st[1].wMonth);
|
|
|
|
expect(0, st[1].wDay);
|
|
|
|
expect(0, st[1].wDayOfWeek);
|
|
|
|
expect(0, st[1].wHour);
|
|
|
|
expect(0, st[1].wMinute);
|
|
|
|
expect(0, st[1].wSecond);
|
|
|
|
expect(0, st[1].wMilliseconds);
|
|
|
|
|
2006-02-14 17:12:45 +01:00
|
|
|
GetSystemTime(&st[0]);
|
|
|
|
st[1] = st[0];
|
|
|
|
|
2013-12-01 22:33:53 +01:00
|
|
|
SendMessageA(hwnd, MCM_GETTODAY, 0, (LPARAM)&today);
|
2009-09-26 18:06:48 +02:00
|
|
|
|
2006-02-14 17:12:45 +01:00
|
|
|
/* Invalid date/time */
|
|
|
|
st[0].wYear = 2000;
|
|
|
|
/* Time should not matter */
|
|
|
|
st[1].wHour = st[1].wMinute = st[1].wSecond = 70;
|
2009-09-26 18:06:48 +02:00
|
|
|
st[1].wMilliseconds = 1200;
|
2013-12-01 22:33:53 +01:00
|
|
|
ok(SendMessageA(hwnd, MCM_SETRANGE, GDTR_MAX, (LPARAM)st), "Failed to set MAX limit\n");
|
2009-09-26 18:06:48 +02:00
|
|
|
/* invalid timestamp is written back with today data and msecs untouched */
|
|
|
|
expect(today.wHour, st[1].wHour);
|
|
|
|
expect(today.wMinute, st[1].wMinute);
|
|
|
|
expect(today.wSecond, st[1].wSecond);
|
|
|
|
expect(1200, st[1].wMilliseconds);
|
|
|
|
|
2013-12-01 22:33:53 +01:00
|
|
|
ok(SendMessageA(hwnd, MCM_GETRANGE, 0, (LPARAM)st1) == GDTR_MAX, "No limits should be set\n");
|
2009-10-06 23:02:10 +02:00
|
|
|
ok(st1[0].wYear != 2000, "Lower limit changed\n");
|
2009-09-26 18:06:48 +02:00
|
|
|
/* invalid timestamp should be replaced with today data, except msecs */
|
|
|
|
expect(today.wHour, st1[1].wHour);
|
|
|
|
expect(today.wMinute, st1[1].wMinute);
|
|
|
|
expect(today.wSecond, st1[1].wSecond);
|
|
|
|
expect(1200, st1[1].wMilliseconds);
|
|
|
|
|
|
|
|
/* Invalid date/time with invalid milliseconds only */
|
|
|
|
GetSystemTime(&st[0]);
|
|
|
|
st[1] = st[0];
|
|
|
|
/* Time should not matter */
|
|
|
|
st[1].wMilliseconds = 1200;
|
2013-12-01 22:33:53 +01:00
|
|
|
ok(SendMessageA(hwnd, MCM_SETRANGE, GDTR_MAX, (LPARAM)st), "Failed to set MAX limit\n");
|
2009-09-26 18:06:48 +02:00
|
|
|
/* invalid milliseconds field doesn't lead to invalid timestamp */
|
|
|
|
expect(st[0].wHour, st[1].wHour);
|
|
|
|
expect(st[0].wMinute, st[1].wMinute);
|
|
|
|
expect(st[0].wSecond, st[1].wSecond);
|
|
|
|
expect(1200, st[1].wMilliseconds);
|
|
|
|
|
|
|
|
GetSystemTime(&st[0]);
|
2006-02-14 17:12:45 +01:00
|
|
|
|
|
|
|
st[1].wMonth = 0;
|
2013-12-01 22:33:53 +01:00
|
|
|
ok(!SendMessageA(hwnd, MCM_SETRANGE, GDTR_MIN | GDTR_MAX, (LPARAM)st),
|
|
|
|
"Should have failed to set limits\n");
|
|
|
|
ok(SendMessageA(hwnd, MCM_GETRANGE, 0, (LPARAM)st1) == GDTR_MAX, "No limits should be set\n");
|
2009-10-06 23:02:10 +02:00
|
|
|
ok(st1[0].wYear != 2000, "Lower limit changed\n");
|
2013-12-01 22:33:53 +01:00
|
|
|
ok(!SendMessageA(hwnd, MCM_SETRANGE, GDTR_MAX, (LPARAM)st),
|
|
|
|
"Should have failed to set MAX limit\n");
|
|
|
|
ok(SendMessageA(hwnd, MCM_GETRANGE, 0, (LPARAM)st1) == GDTR_MAX, "No limits should be set\n");
|
2009-10-06 23:02:10 +02:00
|
|
|
ok(st1[0].wYear != 2000, "Lower limit changed\n");
|
2006-02-14 17:12:45 +01:00
|
|
|
|
2006-02-06 20:58:48 +01:00
|
|
|
GetSystemTime(&st[0]);
|
2006-03-31 12:45:59 +02:00
|
|
|
st[0].wDay = 20;
|
2006-02-06 20:58:48 +01:00
|
|
|
st[0].wMonth = 5;
|
|
|
|
st[1] = st[0];
|
|
|
|
|
2013-12-01 22:33:53 +01:00
|
|
|
month_range = SendMessageA(hwnd, MCM_GETMONTHRANGE, GMR_VISIBLE, (LPARAM)st1);
|
2006-02-06 20:58:48 +01:00
|
|
|
st[1].wMonth--;
|
2013-12-01 22:33:53 +01:00
|
|
|
ok(SendMessageA(hwnd, MCM_SETRANGE, GDTR_MIN | GDTR_MAX, (LPARAM)st),
|
|
|
|
"Failed to set both min and max limits\n");
|
|
|
|
res = SendMessageA(hwnd, MCM_GETMONTHRANGE, GMR_VISIBLE, (LPARAM)st1);
|
2006-02-16 12:19:09 +01:00
|
|
|
ok(res == month_range, "Invalid month range (%d)\n", res);
|
2013-12-01 22:33:53 +01:00
|
|
|
ok(SendMessageA(hwnd, MCM_GETRANGE, 0, (LPARAM)st1) == (GDTR_MIN|GDTR_MAX),
|
|
|
|
"Limits should be set\n");
|
2006-02-16 12:19:09 +01:00
|
|
|
|
2006-02-06 20:58:48 +01:00
|
|
|
st[1].wMonth += 2;
|
2013-12-01 22:33:53 +01:00
|
|
|
ok(SendMessageA(hwnd, MCM_SETRANGE, GDTR_MIN | GDTR_MAX, (LPARAM)st),
|
|
|
|
"Failed to set both min and max limits\n");
|
|
|
|
res = SendMessageA(hwnd, MCM_GETMONTHRANGE, GMR_VISIBLE, (LPARAM)st1);
|
2006-02-16 12:19:09 +01:00
|
|
|
ok(res == month_range, "Invalid month range (%d)\n", res);
|
|
|
|
|
2006-02-06 20:58:48 +01:00
|
|
|
st[1].wYear --;
|
2013-12-01 22:33:53 +01:00
|
|
|
ok(SendMessageA(hwnd, MCM_SETRANGE, GDTR_MIN | GDTR_MAX, (LPARAM)st),
|
|
|
|
"Failed to set both min and max limits\n");
|
2006-02-06 20:58:48 +01:00
|
|
|
st[1].wYear += 1;
|
2013-12-01 22:33:53 +01:00
|
|
|
ok(SendMessageA(hwnd, MCM_SETRANGE, GDTR_MIN | GDTR_MAX, (LPARAM)st),
|
|
|
|
"Failed to set both min and max limits\n");
|
2006-02-06 20:58:48 +01:00
|
|
|
|
|
|
|
st[1].wMonth -= 3;
|
2013-12-01 22:33:53 +01:00
|
|
|
ok(SendMessageA(hwnd, MCM_SETRANGE, GDTR_MAX, (LPARAM)st), "Failed to set max limit\n");
|
|
|
|
ok(SendMessageA(hwnd, MCM_GETRANGE, 0, (LPARAM)st1) == GDTR_MAX,
|
|
|
|
"Only MAX limit should be set\n");
|
2006-02-06 20:58:48 +01:00
|
|
|
st[1].wMonth += 4;
|
2013-12-01 22:33:53 +01:00
|
|
|
ok(SendMessageA(hwnd, MCM_SETRANGE, GDTR_MAX, (LPARAM)st), "Failed to set max limit\n");
|
2006-02-06 20:58:48 +01:00
|
|
|
st[1].wYear -= 3;
|
2013-12-01 22:33:53 +01:00
|
|
|
ok(SendMessageA(hwnd, MCM_SETRANGE, GDTR_MAX, (LPARAM)st), "Failed to set max limit\n");
|
2006-02-06 20:58:48 +01:00
|
|
|
st[1].wYear += 4;
|
2013-12-01 22:33:53 +01:00
|
|
|
ok(SendMessageA(hwnd, MCM_SETRANGE, GDTR_MAX, (LPARAM)st), "Failed to set max limit\n");
|
|
|
|
ok(SendMessageA(hwnd, MCM_GETRANGE, 0, (LPARAM)st1) == GDTR_MAX,
|
|
|
|
"Only MAX limit should be set\n");
|
2007-02-16 08:59:08 +01:00
|
|
|
|
2009-09-26 01:09:06 +02:00
|
|
|
/* set both limits, then set max < min */
|
|
|
|
GetSystemTime(&st[0]);
|
2012-02-29 08:02:27 +01:00
|
|
|
st[0].wDay = 25;
|
2009-09-26 01:09:06 +02:00
|
|
|
st[1] = st[0];
|
|
|
|
st[1].wYear++;
|
2013-12-01 22:33:53 +01:00
|
|
|
ok(SendMessageA(hwnd, MCM_SETRANGE, GDTR_MIN|GDTR_MAX, (LPARAM)st), "Failed to set limits\n");
|
|
|
|
ok(SendMessageA(hwnd, MCM_GETRANGE, 0, (LPARAM)st1) == (GDTR_MIN|GDTR_MAX),
|
|
|
|
"Min limit expected\n");
|
2009-09-26 01:09:06 +02:00
|
|
|
st[1].wYear -= 2;
|
2013-12-01 22:33:53 +01:00
|
|
|
ok(SendMessageA(hwnd, MCM_SETRANGE, GDTR_MAX, (LPARAM)st), "Failed to set limits\n");
|
|
|
|
ok(SendMessageA(hwnd, MCM_GETRANGE, 0, (LPARAM)st1) == GDTR_MAX, "Max limit expected\n");
|
2009-09-26 01:09:06 +02:00
|
|
|
|
|
|
|
expect(0, st1[0].wYear);
|
|
|
|
expect(0, st1[0].wMonth);
|
|
|
|
expect(0, st1[0].wDay);
|
|
|
|
expect(0, st1[0].wDayOfWeek);
|
|
|
|
expect(0, st1[0].wHour);
|
|
|
|
expect(0, st1[0].wMinute);
|
|
|
|
expect(0, st1[0].wSecond);
|
|
|
|
expect(0, st1[0].wMilliseconds);
|
|
|
|
|
|
|
|
expect(st[1].wYear, st1[1].wYear);
|
|
|
|
expect(st[1].wMonth, st1[1].wMonth);
|
|
|
|
expect(st[1].wDay, st1[1].wDay);
|
|
|
|
expect(st[1].wDayOfWeek, st1[1].wDayOfWeek);
|
|
|
|
expect(st[1].wHour, st1[1].wHour);
|
|
|
|
expect(st[1].wMinute, st1[1].wMinute);
|
|
|
|
expect(st[1].wSecond, st1[1].wSecond);
|
|
|
|
expect(st[1].wMilliseconds, st1[1].wMilliseconds);
|
|
|
|
|
|
|
|
st[1] = st[0];
|
|
|
|
st[1].wYear++;
|
2013-12-01 22:33:53 +01:00
|
|
|
ok(SendMessageA(hwnd, MCM_SETRANGE, GDTR_MIN|GDTR_MAX, (LPARAM)st), "Failed to set limits\n");
|
|
|
|
ok(SendMessageA(hwnd, MCM_GETRANGE, 0, (LPARAM)st1) == (GDTR_MIN|GDTR_MAX),
|
|
|
|
"Min limit expected\n");
|
2009-09-26 01:09:06 +02:00
|
|
|
st[0].wYear++; /* start == end now */
|
2013-12-01 22:33:53 +01:00
|
|
|
ok(SendMessageA(hwnd, MCM_SETRANGE, GDTR_MIN, (LPARAM)st), "Failed to set limits\n");
|
|
|
|
ok(SendMessageA(hwnd, MCM_GETRANGE, 0, (LPARAM)st1) == GDTR_MIN, "Min limit expected\n");
|
2009-09-26 01:09:06 +02:00
|
|
|
|
|
|
|
expect(st[0].wYear, st1[0].wYear);
|
|
|
|
expect(st[0].wMonth, st1[0].wMonth);
|
|
|
|
expect(st[0].wDay, st1[0].wDay);
|
|
|
|
expect(st[0].wDayOfWeek, st1[0].wDayOfWeek);
|
|
|
|
expect(st[0].wHour, st1[0].wHour);
|
|
|
|
expect(st[0].wMinute, st1[0].wMinute);
|
|
|
|
expect(st[0].wSecond, st1[0].wSecond);
|
|
|
|
expect(st[0].wMilliseconds, st1[0].wMilliseconds);
|
|
|
|
|
|
|
|
expect(0, st1[1].wYear);
|
|
|
|
expect(0, st1[1].wMonth);
|
|
|
|
expect(0, st1[1].wDay);
|
|
|
|
expect(0, st1[1].wDayOfWeek);
|
|
|
|
expect(0, st1[1].wHour);
|
|
|
|
expect(0, st1[1].wMinute);
|
|
|
|
expect(0, st1[1].wSecond);
|
|
|
|
expect(0, st1[1].wMilliseconds);
|
|
|
|
|
2007-02-16 08:59:08 +01:00
|
|
|
DestroyWindow(hwnd);
|
|
|
|
}
|
|
|
|
|
2007-03-16 08:32:49 +01:00
|
|
|
static LRESULT WINAPI parent_wnd_proc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
|
|
|
|
{
|
2009-04-02 12:04:50 +02:00
|
|
|
static LONG defwndproc_counter = 0;
|
2007-03-16 08:32:49 +01:00
|
|
|
LRESULT ret;
|
|
|
|
struct message msg;
|
|
|
|
|
2008-09-15 03:06:03 +02:00
|
|
|
/* log system messages, except for painting */
|
|
|
|
if (message < WM_USER &&
|
|
|
|
message != WM_PAINT &&
|
2007-03-16 08:32:49 +01:00
|
|
|
message != WM_ERASEBKGND &&
|
|
|
|
message != WM_NCPAINT &&
|
|
|
|
message != WM_NCHITTEST &&
|
|
|
|
message != WM_GETTEXT &&
|
|
|
|
message != WM_GETICON &&
|
|
|
|
message != WM_DEVICECHANGE)
|
|
|
|
{
|
|
|
|
msg.message = message;
|
|
|
|
msg.flags = sent|wparam|lparam;
|
|
|
|
if (defwndproc_counter) msg.flags |= defwinproc;
|
|
|
|
msg.wParam = wParam;
|
|
|
|
msg.lParam = lParam;
|
|
|
|
add_message(sequences, PARENT_SEQ_INDEX, &msg);
|
|
|
|
}
|
|
|
|
|
2011-09-30 21:41:04 +02:00
|
|
|
if (message == WM_NOTIFY)
|
|
|
|
{
|
|
|
|
NMHDR *hdr = (NMHDR*)lParam;
|
|
|
|
switch (hdr->code)
|
|
|
|
{
|
|
|
|
case MCN_GETDAYSTATE:
|
|
|
|
{
|
|
|
|
NMDAYSTATE *nmstate = (NMDAYSTATE*)lParam;
|
2011-10-16 17:22:32 +02:00
|
|
|
static MONTHDAYSTATE months[14] = { 0 };
|
2011-09-30 21:41:04 +02:00
|
|
|
|
|
|
|
ok(nmstate->cDayState > 0, "got %d\n", nmstate->cDayState);
|
|
|
|
ok(nmstate->cDayState <= 14, "got %d\n", nmstate->cDayState);
|
|
|
|
ok(nmstate->prgDayState != NULL, "got %p\n", nmstate->prgDayState);
|
|
|
|
|
|
|
|
nmstate->prgDayState = months;
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
2012-08-17 08:17:02 +02:00
|
|
|
case MCN_SELECT:
|
|
|
|
case MCN_SELCHANGE:
|
|
|
|
{
|
|
|
|
NMSELCHANGE *nmchg = (NMSELCHANGE*)lParam;
|
|
|
|
SYSTEMTIME st[2];
|
2013-12-01 22:33:53 +01:00
|
|
|
BOOL is_multisel = GetWindowLongPtrA(nmchg->nmhdr.hwndFrom, GWL_STYLE) & MCS_MULTISELECT;
|
2012-08-17 08:17:02 +02:00
|
|
|
|
2013-12-01 22:33:53 +01:00
|
|
|
if(GetWindowLongPtrA(nmchg->nmhdr.hwndFrom, GWLP_ID) != SEL_NOTIFY_TEST_ID)
|
2012-08-17 08:17:02 +02:00
|
|
|
break;
|
2013-12-01 22:33:53 +01:00
|
|
|
SendMessageA(nmchg->nmhdr.hwndFrom, is_multisel ? MCM_GETSELRANGE : MCM_GETCURSEL,
|
|
|
|
0, (LPARAM)st);
|
2012-08-17 08:17:02 +02:00
|
|
|
|
|
|
|
expect(st[0].wYear, nmchg->stSelStart.wYear);
|
|
|
|
expect(st[0].wMonth, nmchg->stSelStart.wMonth);
|
2012-08-17 08:24:12 +02:00
|
|
|
expect(0, nmchg->stSelStart.wDayOfWeek);
|
2012-08-17 08:17:02 +02:00
|
|
|
expect(st[0].wDay, nmchg->stSelStart.wDay);
|
|
|
|
|
|
|
|
if(is_multisel)
|
|
|
|
{
|
|
|
|
expect(st[1].wYear, nmchg->stSelEnd.wYear);
|
|
|
|
expect(st[1].wMonth, nmchg->stSelEnd.wMonth);
|
2012-08-17 08:24:12 +02:00
|
|
|
expect(0, nmchg->stSelEnd.wDayOfWeek);
|
2012-08-17 08:17:02 +02:00
|
|
|
expect(st[1].wDay, nmchg->stSelEnd.wDay);
|
|
|
|
}
|
|
|
|
else
|
2012-08-17 08:24:12 +02:00
|
|
|
ok(!(nmchg->stSelEnd.wYear | nmchg->stSelEnd.wMonth |
|
2012-08-17 08:17:02 +02:00
|
|
|
nmchg->stSelEnd.wDayOfWeek | nmchg->stSelEnd.wDay |
|
|
|
|
nmchg->stSelEnd.wHour | nmchg->stSelEnd.wMinute |
|
|
|
|
nmchg->stSelEnd.wSecond | nmchg->stSelEnd.wMilliseconds),
|
|
|
|
"Non-zero member in stSelEnd\n");
|
|
|
|
return TRUE;
|
|
|
|
}
|
2011-09-30 21:41:04 +02:00
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-03-16 08:32:49 +01:00
|
|
|
defwndproc_counter++;
|
|
|
|
ret = DefWindowProcA(hwnd, message, wParam, lParam);
|
|
|
|
defwndproc_counter--;
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2007-08-29 21:42:28 +02:00
|
|
|
static BOOL register_parent_wnd_class(void)
|
2007-03-16 08:32:49 +01:00
|
|
|
{
|
|
|
|
WNDCLASSA cls;
|
|
|
|
|
|
|
|
cls.style = 0;
|
|
|
|
cls.lpfnWndProc = parent_wnd_proc;
|
|
|
|
cls.cbClsExtra = 0;
|
|
|
|
cls.cbWndExtra = 0;
|
|
|
|
cls.hInstance = GetModuleHandleA(NULL);
|
|
|
|
cls.hIcon = 0;
|
2013-12-01 22:33:53 +01:00
|
|
|
cls.hCursor = LoadCursorA(0, (LPCSTR)IDC_ARROW);
|
2007-03-16 08:32:49 +01:00
|
|
|
cls.hbrBackground = GetStockObject(WHITE_BRUSH);
|
|
|
|
cls.lpszMenuName = NULL;
|
|
|
|
cls.lpszClassName = "Month-Cal test parent class";
|
|
|
|
return RegisterClassA(&cls);
|
|
|
|
}
|
|
|
|
|
|
|
|
static HWND create_parent_window(void)
|
|
|
|
{
|
|
|
|
HWND hwnd;
|
|
|
|
|
|
|
|
InitCommonControls();
|
|
|
|
|
|
|
|
/* flush message sequences, so we can check the new sequence by the end of function */
|
|
|
|
flush_sequences(sequences, NUM_MSG_SEQUENCES);
|
|
|
|
|
|
|
|
if (!register_parent_wnd_class())
|
|
|
|
return NULL;
|
|
|
|
|
2013-12-01 22:33:53 +01:00
|
|
|
hwnd = CreateWindowExA(0, "Month-Cal test parent class", "Month-Cal test parent window",
|
|
|
|
WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX | WS_MAXIMIZEBOX | WS_VISIBLE,
|
|
|
|
0, 0, 500, 500, GetDesktopWindow(), NULL, GetModuleHandleA(NULL), NULL);
|
2014-02-13 09:31:48 +01:00
|
|
|
ok(hwnd != NULL, "failed to create parent wnd\n");
|
2007-03-16 08:32:49 +01:00
|
|
|
|
|
|
|
/* check for message sequences */
|
2009-03-05 23:00:49 +01:00
|
|
|
ok_sequence(sequences, PARENT_SEQ_INDEX, create_parent_window_seq, "create parent window", FALSE);
|
2007-03-16 08:32:49 +01:00
|
|
|
|
|
|
|
return hwnd;
|
|
|
|
}
|
|
|
|
|
|
|
|
static LRESULT WINAPI monthcal_subclass_proc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
|
|
|
|
{
|
2009-10-11 14:25:17 +02:00
|
|
|
WNDPROC oldproc = (WNDPROC)GetWindowLongPtrA(hwnd, GWLP_USERDATA);
|
2009-04-02 12:04:50 +02:00
|
|
|
static LONG defwndproc_counter = 0;
|
2007-03-16 08:32:49 +01:00
|
|
|
LRESULT ret;
|
|
|
|
struct message msg;
|
|
|
|
|
|
|
|
msg.message = message;
|
|
|
|
msg.flags = sent|wparam|lparam;
|
|
|
|
if (defwndproc_counter) msg.flags |= defwinproc;
|
|
|
|
msg.wParam = wParam;
|
|
|
|
msg.lParam = lParam;
|
2012-12-08 17:38:27 +01:00
|
|
|
msg.id = 0;
|
2007-03-16 08:32:49 +01:00
|
|
|
add_message(sequences, MONTHCAL_SEQ_INDEX, &msg);
|
|
|
|
|
2009-10-01 20:49:02 +02:00
|
|
|
/* some debug output for style changing */
|
|
|
|
if ((message == WM_STYLECHANGING ||
|
|
|
|
message == WM_STYLECHANGED) && lParam)
|
|
|
|
{
|
|
|
|
STYLESTRUCT *style = (STYLESTRUCT*)lParam;
|
|
|
|
trace("\told style: 0x%08x, new style: 0x%08x\n", style->styleOld, style->styleNew);
|
|
|
|
}
|
|
|
|
|
2007-03-16 08:32:49 +01:00
|
|
|
defwndproc_counter++;
|
2009-10-11 14:25:17 +02:00
|
|
|
ret = CallWindowProcA(oldproc, hwnd, message, wParam, lParam);
|
2007-03-16 08:32:49 +01:00
|
|
|
defwndproc_counter--;
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2009-09-25 22:51:04 +02:00
|
|
|
static HWND create_monthcal_control(DWORD style)
|
2007-02-16 08:59:08 +01:00
|
|
|
{
|
2009-10-11 14:25:17 +02:00
|
|
|
WNDPROC oldproc;
|
2015-03-01 19:08:13 +01:00
|
|
|
RECT rect;
|
2007-02-16 08:59:08 +01:00
|
|
|
HWND hwnd;
|
2015-03-01 19:08:13 +01:00
|
|
|
BOOL ret;
|
2007-02-16 08:59:08 +01:00
|
|
|
|
2013-12-01 22:33:53 +01:00
|
|
|
hwnd = CreateWindowExA(0, MONTHCAL_CLASSA, "", WS_CHILD | WS_BORDER | WS_VISIBLE | style,
|
|
|
|
0, 0, 300, 400, parent_wnd, NULL, GetModuleHandleA(NULL), NULL);
|
2014-02-13 09:31:48 +01:00
|
|
|
ok(hwnd != NULL, "failed to create monthcal wnd\n");
|
2009-10-11 14:25:17 +02:00
|
|
|
if (!hwnd) return NULL;
|
2007-03-16 08:32:49 +01:00
|
|
|
|
2009-10-11 14:25:17 +02:00
|
|
|
oldproc = (WNDPROC)SetWindowLongPtrA(hwnd, GWLP_WNDPROC,
|
|
|
|
(LONG_PTR)monthcal_subclass_proc);
|
|
|
|
SetWindowLongPtrA(hwnd, GWLP_USERDATA, (LONG_PTR)oldproc);
|
2007-02-16 08:59:08 +01:00
|
|
|
|
2013-12-01 22:33:53 +01:00
|
|
|
SendMessageA(hwnd, WM_SETFONT, (WPARAM)GetStockObject(SYSTEM_FONT), 0);
|
2009-09-25 22:51:04 +02:00
|
|
|
|
2015-03-01 19:08:13 +01:00
|
|
|
/* make sure calendar grid is 2x1 */
|
|
|
|
ret = SendMessageA(hwnd, MCM_GETMINREQRECT, 0, (LPARAM)&rect);
|
|
|
|
ok(ret, "got %d\n", ret);
|
|
|
|
|
|
|
|
ret = SetWindowPos(hwnd, NULL, 0, 0, rect.right * 5 / 2, rect.bottom * 3 / 2, SWP_NOMOVE);
|
|
|
|
ok(ret, "got %d\n", ret);
|
|
|
|
|
2007-02-16 08:59:08 +01:00
|
|
|
return hwnd;
|
|
|
|
}
|
|
|
|
|
2007-03-16 08:32:49 +01:00
|
|
|
|
|
|
|
/* Setter and Getters Tests */
|
|
|
|
|
2010-08-04 12:32:51 +02:00
|
|
|
static void test_color(void)
|
2007-02-16 08:59:08 +01:00
|
|
|
{
|
2010-08-08 14:54:23 +02:00
|
|
|
COLORREF color, prev;
|
2009-09-25 22:51:04 +02:00
|
|
|
HWND hwnd;
|
|
|
|
|
|
|
|
hwnd = create_monthcal_control(0);
|
2007-02-16 08:59:08 +01:00
|
|
|
|
2010-08-08 14:54:23 +02:00
|
|
|
/* invalid color index */
|
2013-12-01 22:33:53 +01:00
|
|
|
color = SendMessageA(hwnd, MCM_GETCOLOR, MCSC_TRAILINGTEXT + 1, 0);
|
2011-06-04 23:27:33 +02:00
|
|
|
expect(~0u, color);
|
2013-12-01 22:33:53 +01:00
|
|
|
prev = SendMessageA(hwnd, MCM_SETCOLOR, MCSC_TRAILINGTEXT + 1, RGB(255,255,255));
|
2011-06-04 23:27:33 +02:00
|
|
|
expect(~0u, prev);
|
2010-08-08 14:54:23 +02:00
|
|
|
|
2013-12-01 22:33:53 +01:00
|
|
|
color = SendMessageA(hwnd, MCM_GETCOLOR, MCSC_BACKGROUND, 0);
|
|
|
|
prev = SendMessageA(hwnd, MCM_SETCOLOR, MCSC_BACKGROUND, RGB(0,0,0));
|
2010-08-08 14:54:23 +02:00
|
|
|
expect(color, prev);
|
2013-12-01 22:33:53 +01:00
|
|
|
color = SendMessageA(hwnd, MCM_GETCOLOR, MCSC_BACKGROUND, 0);
|
2010-08-08 14:54:23 +02:00
|
|
|
expect(RGB(0,0,0), color);
|
2013-12-01 22:33:53 +01:00
|
|
|
prev = SendMessageA(hwnd, MCM_SETCOLOR, MCSC_BACKGROUND, RGB(255,255,255));
|
2010-08-08 14:54:23 +02:00
|
|
|
expect(color, prev);
|
2013-12-01 22:33:53 +01:00
|
|
|
color = SendMessageA(hwnd, MCM_GETCOLOR, MCSC_BACKGROUND, 0);
|
2010-08-08 14:54:23 +02:00
|
|
|
expect(RGB(255,255,255), color);
|
|
|
|
|
2013-12-01 22:33:53 +01:00
|
|
|
color = SendMessageA(hwnd, MCM_GETCOLOR, MCSC_MONTHBK, 0);
|
|
|
|
prev = SendMessageA(hwnd, MCM_SETCOLOR, MCSC_MONTHBK, RGB(0,0,0));
|
2010-08-08 14:54:23 +02:00
|
|
|
expect(color, prev);
|
2013-12-01 22:33:53 +01:00
|
|
|
color = SendMessageA(hwnd, MCM_GETCOLOR, MCSC_MONTHBK, 0);
|
2010-08-08 14:54:23 +02:00
|
|
|
expect(RGB(0,0,0), color);
|
2013-12-01 22:33:53 +01:00
|
|
|
prev = SendMessageA(hwnd, MCM_SETCOLOR, MCSC_MONTHBK, RGB(255,255,255));
|
2010-08-08 14:54:23 +02:00
|
|
|
expect(color, prev);
|
2013-12-01 22:33:53 +01:00
|
|
|
color = SendMessageA(hwnd, MCM_GETCOLOR, MCSC_MONTHBK, 0);
|
2010-08-08 14:54:23 +02:00
|
|
|
expect(RGB(255,255,255), color);
|
|
|
|
|
2013-12-01 22:33:53 +01:00
|
|
|
color = SendMessageA(hwnd, MCM_GETCOLOR, MCSC_TEXT, 0);
|
|
|
|
prev = SendMessageA(hwnd, MCM_SETCOLOR, MCSC_TEXT, RGB(0,0,0));
|
2010-08-08 14:54:23 +02:00
|
|
|
expect(color, prev);
|
2013-12-01 22:33:53 +01:00
|
|
|
color = SendMessageA(hwnd, MCM_GETCOLOR, MCSC_TEXT, 0);
|
2010-08-08 14:54:23 +02:00
|
|
|
expect(RGB(0,0,0), color);
|
2013-12-01 22:33:53 +01:00
|
|
|
prev = SendMessageA(hwnd, MCM_SETCOLOR, MCSC_TEXT, RGB(255,255,255));
|
2010-08-08 14:54:23 +02:00
|
|
|
expect(color, prev);
|
2013-12-01 22:33:53 +01:00
|
|
|
color = SendMessageA(hwnd, MCM_GETCOLOR, MCSC_TEXT, 0);
|
2010-08-08 14:54:23 +02:00
|
|
|
expect(RGB(255,255,255), color);
|
|
|
|
|
2013-12-01 22:33:53 +01:00
|
|
|
color = SendMessageA(hwnd, MCM_GETCOLOR, MCSC_TITLEBK, 0);
|
|
|
|
prev = SendMessageA(hwnd, MCM_SETCOLOR, MCSC_TITLEBK, RGB(0,0,0));
|
2010-08-08 14:54:23 +02:00
|
|
|
expect(color, prev);
|
2013-12-01 22:33:53 +01:00
|
|
|
color = SendMessageA(hwnd, MCM_GETCOLOR, MCSC_TITLEBK, 0);
|
2010-08-08 14:54:23 +02:00
|
|
|
expect(RGB(0,0,0), color);
|
2013-12-01 22:33:53 +01:00
|
|
|
prev = SendMessageA(hwnd, MCM_SETCOLOR, MCSC_TITLEBK, RGB(255,255,255));
|
2010-08-08 14:54:23 +02:00
|
|
|
expect(color, prev);
|
2013-12-01 22:33:53 +01:00
|
|
|
color = SendMessageA(hwnd, MCM_GETCOLOR, MCSC_TITLEBK, 0);
|
2010-08-08 14:54:23 +02:00
|
|
|
expect(RGB(255,255,255), color);
|
|
|
|
|
2013-12-01 22:33:53 +01:00
|
|
|
color = SendMessageA(hwnd, MCM_GETCOLOR, MCSC_TITLETEXT, 0);
|
|
|
|
prev = SendMessageA(hwnd, MCM_SETCOLOR, MCSC_TITLETEXT, RGB(0,0,0));
|
2010-08-08 14:54:23 +02:00
|
|
|
expect(color, prev);
|
2013-12-01 22:33:53 +01:00
|
|
|
color = SendMessageA(hwnd, MCM_GETCOLOR, MCSC_TITLETEXT, 0);
|
2010-08-08 14:54:23 +02:00
|
|
|
expect(RGB(0,0,0), color);
|
2013-12-01 22:33:53 +01:00
|
|
|
prev = SendMessageA(hwnd, MCM_SETCOLOR, MCSC_TITLETEXT, RGB(255,255,255));
|
2010-08-08 14:54:23 +02:00
|
|
|
expect(color, prev);
|
2013-12-01 22:33:53 +01:00
|
|
|
color = SendMessageA(hwnd, MCM_GETCOLOR, MCSC_TITLETEXT, 0);
|
2010-08-08 14:54:23 +02:00
|
|
|
expect(RGB(255,255,255), color);
|
|
|
|
|
2013-12-01 22:33:53 +01:00
|
|
|
color = SendMessageA(hwnd, MCM_GETCOLOR, MCSC_TRAILINGTEXT, 0);
|
|
|
|
prev = SendMessageA(hwnd, MCM_SETCOLOR, MCSC_TRAILINGTEXT, RGB(0,0,0));
|
2010-08-08 14:54:23 +02:00
|
|
|
expect(color, prev);
|
2013-12-01 22:33:53 +01:00
|
|
|
color = SendMessageA(hwnd, MCM_GETCOLOR, MCSC_TRAILINGTEXT, 0);
|
2010-08-08 14:54:23 +02:00
|
|
|
expect(RGB(0,0,0), color);
|
2013-12-01 22:33:53 +01:00
|
|
|
prev = SendMessageA(hwnd, MCM_SETCOLOR, MCSC_TRAILINGTEXT, RGB(255,255,255));
|
2010-08-08 14:54:23 +02:00
|
|
|
expect(color, prev);
|
2013-12-01 22:33:53 +01:00
|
|
|
color = SendMessageA(hwnd, MCM_GETCOLOR, MCSC_TRAILINGTEXT, 0);
|
2010-08-08 14:54:23 +02:00
|
|
|
expect(RGB(255,255,255), color);
|
2009-09-25 22:51:04 +02:00
|
|
|
|
|
|
|
DestroyWindow(hwnd);
|
2007-02-16 08:59:08 +01:00
|
|
|
}
|
|
|
|
|
2010-08-04 12:32:51 +02:00
|
|
|
static void test_currdate(void)
|
2007-02-16 08:59:08 +01:00
|
|
|
{
|
|
|
|
SYSTEMTIME st_original, st_new, st_test;
|
|
|
|
int res;
|
2009-09-25 22:51:04 +02:00
|
|
|
HWND hwnd;
|
|
|
|
|
|
|
|
hwnd = create_monthcal_control(0);
|
2007-02-16 08:59:08 +01:00
|
|
|
|
2007-03-16 08:32:49 +01:00
|
|
|
flush_sequences(sequences, NUM_MSG_SEQUENCES);
|
|
|
|
|
2007-02-16 08:59:08 +01:00
|
|
|
/* Setter and Getters for current date selected */
|
|
|
|
st_original.wYear = 2000;
|
|
|
|
st_original.wMonth = 11;
|
|
|
|
st_original.wDay = 28;
|
|
|
|
st_original.wHour = 11;
|
|
|
|
st_original.wMinute = 59;
|
|
|
|
st_original.wSecond = 30;
|
|
|
|
st_original.wMilliseconds = 0;
|
|
|
|
st_original.wDayOfWeek = 0;
|
|
|
|
|
|
|
|
st_new = st_test = st_original;
|
|
|
|
|
|
|
|
/* Should not validate the time */
|
2013-12-01 22:33:53 +01:00
|
|
|
res = SendMessageA(hwnd, MCM_SETCURSEL, 0, (LPARAM)&st_test);
|
2007-02-16 08:59:08 +01:00
|
|
|
expect(1,res);
|
|
|
|
|
|
|
|
/* Overflow matters, check for wDay */
|
|
|
|
st_test.wDay += 4;
|
2013-12-01 22:33:53 +01:00
|
|
|
res = SendMessageA(hwnd, MCM_SETCURSEL, 0, (LPARAM)&st_test);
|
2007-03-09 05:48:48 +01:00
|
|
|
expect(0,res);
|
2007-02-16 08:59:08 +01:00
|
|
|
|
|
|
|
/* correct wDay before checking for wMonth */
|
|
|
|
st_test.wDay -= 4;
|
|
|
|
expect(st_original.wDay, st_test.wDay);
|
|
|
|
|
|
|
|
/* Overflow matters, check for wMonth */
|
|
|
|
st_test.wMonth += 4;
|
2013-12-01 22:33:53 +01:00
|
|
|
res = SendMessageA(hwnd, MCM_SETCURSEL, 0, (LPARAM)&st_test);
|
2007-03-09 05:48:48 +01:00
|
|
|
expect(0,res);
|
2007-02-16 08:59:08 +01:00
|
|
|
|
|
|
|
/* checking if gets the information right, modify st_new */
|
|
|
|
st_new.wYear += 4;
|
|
|
|
st_new.wMonth += 4;
|
|
|
|
st_new.wDay += 4;
|
|
|
|
st_new.wHour += 4;
|
|
|
|
st_new.wMinute += 4;
|
|
|
|
st_new.wSecond += 4;
|
|
|
|
|
2013-12-01 22:33:53 +01:00
|
|
|
res = SendMessageA(hwnd, MCM_GETCURSEL, 0, (LPARAM)&st_new);
|
2007-02-16 08:59:08 +01:00
|
|
|
expect(1, res);
|
|
|
|
|
|
|
|
/* st_new change to st_origin, above settings with overflow */
|
|
|
|
/* should not change the current settings */
|
|
|
|
expect(st_original.wYear, st_new.wYear);
|
2007-03-09 05:48:48 +01:00
|
|
|
expect(st_original.wMonth, st_new.wMonth);
|
2007-02-16 08:59:08 +01:00
|
|
|
expect(st_original.wDay, st_new.wDay);
|
2009-10-03 15:00:56 +02:00
|
|
|
ok(st_original.wHour == st_new.wHour ||
|
|
|
|
broken(0 == st_new.wHour), /* comctl32 <= 4.70 */
|
|
|
|
"Expected %d, got %d\n", st_original.wHour, st_new.wHour);
|
|
|
|
ok(st_original.wMinute == st_new.wMinute ||
|
|
|
|
broken(0 == st_new.wMinute), /* comctl32 <= 4.70 */
|
|
|
|
"Expected %d, got %d\n", st_original.wMinute, st_new.wMinute);
|
|
|
|
ok(st_original.wSecond == st_new.wSecond ||
|
|
|
|
broken(0 == st_new.wSecond), /* comctl32 <= 4.70 */
|
|
|
|
"Expected %d, got %d\n", st_original.wSecond, st_new.wSecond);
|
2007-02-16 08:59:08 +01:00
|
|
|
|
2007-02-20 15:57:10 +01:00
|
|
|
/* lparam cannot be NULL */
|
2013-12-01 22:33:53 +01:00
|
|
|
res = SendMessageA(hwnd, MCM_GETCURSEL, 0, 0);
|
2007-02-16 08:59:08 +01:00
|
|
|
expect(0, res);
|
2007-03-16 08:32:49 +01:00
|
|
|
|
|
|
|
ok_sequence(sequences, MONTHCAL_SEQ_INDEX, monthcal_curr_date_seq, "monthcal currDate", TRUE);
|
2009-09-25 22:51:04 +02:00
|
|
|
|
2009-10-04 21:17:33 +02:00
|
|
|
/* December, 31, 9999 is the maximum allowed date */
|
|
|
|
memset(&st_new, 0, sizeof(st_new));
|
|
|
|
st_new.wYear = 9999;
|
|
|
|
st_new.wMonth = 12;
|
|
|
|
st_new.wDay = 31;
|
2013-12-01 22:33:53 +01:00
|
|
|
res = SendMessageA(hwnd, MCM_SETCURSEL, 0, (LPARAM)&st_new);
|
2009-10-04 21:17:33 +02:00
|
|
|
expect(1, res);
|
|
|
|
memset(&st_test, 0, sizeof(st_test));
|
2013-12-01 22:33:53 +01:00
|
|
|
res = SendMessageA(hwnd, MCM_GETCURSEL, 0, (LPARAM)&st_test);
|
2009-10-04 21:17:33 +02:00
|
|
|
expect(1, res);
|
|
|
|
expect(st_new.wYear, st_test.wYear);
|
|
|
|
expect(st_new.wMonth, st_test.wMonth);
|
|
|
|
expect(st_new.wDay, st_test.wDay);
|
|
|
|
expect(st_new.wHour, st_test.wHour);
|
|
|
|
expect(st_new.wMinute, st_test.wMinute);
|
|
|
|
expect(st_new.wSecond, st_test.wSecond);
|
|
|
|
/* try one day later */
|
|
|
|
st_original = st_new;
|
|
|
|
st_new.wYear = 10000;
|
|
|
|
st_new.wMonth = 1;
|
|
|
|
st_new.wDay = 1;
|
2013-12-01 22:33:53 +01:00
|
|
|
res = SendMessageA(hwnd, MCM_SETCURSEL, 0, (LPARAM)&st_new);
|
2009-10-08 08:00:14 +02:00
|
|
|
ok(0 == res ||
|
|
|
|
broken(1 == res), /* comctl32 <= 4.72 */
|
|
|
|
"Expected 0, got %d\n", res);
|
|
|
|
if (0 == res)
|
|
|
|
{
|
|
|
|
memset(&st_test, 0, sizeof(st_test));
|
2013-12-01 22:33:53 +01:00
|
|
|
res = SendMessageA(hwnd, MCM_GETCURSEL, 0, (LPARAM)&st_test);
|
2009-10-08 08:00:14 +02:00
|
|
|
expect(1, res);
|
|
|
|
expect(st_original.wYear, st_test.wYear);
|
|
|
|
expect(st_original.wMonth, st_test.wMonth);
|
|
|
|
expect(st_original.wDay, st_test.wDay);
|
|
|
|
expect(st_original.wHour, st_test.wHour);
|
|
|
|
expect(st_original.wMinute, st_test.wMinute);
|
|
|
|
expect(st_original.wSecond, st_test.wSecond);
|
|
|
|
}
|
2009-10-04 21:17:33 +02:00
|
|
|
|
2009-10-05 21:05:53 +02:00
|
|
|
/* setting selection equal to current reports success even if out range */
|
|
|
|
memset(&st_new, 0, sizeof(st_new));
|
|
|
|
st_new.wYear = 2009;
|
|
|
|
st_new.wDay = 5;
|
|
|
|
st_new.wMonth = 10;
|
2013-12-01 22:33:53 +01:00
|
|
|
res = SendMessageA(hwnd, MCM_SETCURSEL, 0, (LPARAM)&st_new);
|
2009-10-05 21:05:53 +02:00
|
|
|
expect(1, res);
|
|
|
|
memset(&st_test, 0, sizeof(st_test));
|
|
|
|
st_test.wYear = 2009;
|
|
|
|
st_test.wDay = 6;
|
|
|
|
st_test.wMonth = 10;
|
2013-12-01 22:33:53 +01:00
|
|
|
res = SendMessageA(hwnd, MCM_SETRANGE, GDTR_MIN, (LPARAM)&st_test);
|
2009-10-05 21:05:53 +02:00
|
|
|
expect(1, res);
|
|
|
|
/* set to current again */
|
2013-12-01 22:33:53 +01:00
|
|
|
res = SendMessageA(hwnd, MCM_SETCURSEL, 0, (LPARAM)&st_new);
|
2009-10-05 21:05:53 +02:00
|
|
|
expect(1, res);
|
|
|
|
|
2011-09-23 11:34:37 +02:00
|
|
|
/* set with invalid day of week */
|
|
|
|
memset(&st_test, 0, sizeof(st_test));
|
|
|
|
st_test.wYear = 2009;
|
|
|
|
st_test.wDay = 7;
|
|
|
|
st_test.wMonth = 10;
|
|
|
|
st_test.wDayOfWeek = 100;
|
2013-12-01 22:33:53 +01:00
|
|
|
res = SendMessageA(hwnd, MCM_SETCURSEL, 0, (LPARAM)&st_test);
|
2011-09-23 12:17:14 +02:00
|
|
|
expect(1, res);
|
2011-09-23 11:34:37 +02:00
|
|
|
|
|
|
|
memset(&st_test, 0, sizeof(st_test));
|
2013-12-01 22:33:53 +01:00
|
|
|
res = SendMessageA(hwnd, MCM_GETCURSEL, 0, (LPARAM)&st_test);
|
2011-09-23 11:34:37 +02:00
|
|
|
expect(1, res);
|
|
|
|
expect(2009, st_test.wYear);
|
2011-09-23 12:17:14 +02:00
|
|
|
expect(7, st_test.wDay);
|
2011-09-23 11:34:37 +02:00
|
|
|
expect(10, st_test.wMonth);
|
2011-09-23 12:17:14 +02:00
|
|
|
expect(3, st_test.wDayOfWeek);
|
2011-09-23 11:34:37 +02:00
|
|
|
|
2009-09-25 22:51:04 +02:00
|
|
|
DestroyWindow(hwnd);
|
2007-02-16 08:59:08 +01:00
|
|
|
}
|
|
|
|
|
2010-08-04 12:32:51 +02:00
|
|
|
static void test_firstDay(void)
|
2007-02-16 08:59:08 +01:00
|
|
|
{
|
2007-03-16 08:34:36 +01:00
|
|
|
int res, fday, i, prev;
|
2010-08-19 07:50:04 +02:00
|
|
|
CHAR b[128], caltype[3];
|
2007-02-16 08:59:08 +01:00
|
|
|
LCID lcid = LOCALE_USER_DEFAULT;
|
2009-09-25 22:51:04 +02:00
|
|
|
HWND hwnd;
|
2010-08-19 07:50:04 +02:00
|
|
|
LRESULT ret;
|
|
|
|
|
|
|
|
SetLastError(0xdeadbeef);
|
|
|
|
ret = GetLocaleInfoA(lcid, LOCALE_ICALENDARTYPE, caltype, 3);
|
|
|
|
if (ret == 0) {
|
|
|
|
skip("Must know local calendar type (%x)\n", GetLastError());
|
|
|
|
return;
|
|
|
|
} else if (atoi(caltype) != CAL_GREGORIAN) {
|
|
|
|
skip("MonthCalendar Control only supports Gregorian calendar (type: %s)\n", caltype);
|
|
|
|
return;
|
|
|
|
}
|
2009-09-25 22:51:04 +02:00
|
|
|
|
|
|
|
hwnd = create_monthcal_control(0);
|
2007-02-16 08:59:08 +01:00
|
|
|
|
2007-03-16 08:32:49 +01:00
|
|
|
flush_sequences(sequences, NUM_MSG_SEQUENCES);
|
|
|
|
|
2007-02-16 08:59:08 +01:00
|
|
|
/* Setter and Getters for first day of week */
|
2007-03-16 08:34:36 +01:00
|
|
|
/* check for locale first day */
|
2009-09-29 12:14:37 +02:00
|
|
|
if(GetLocaleInfoA(lcid, LOCALE_IFIRSTDAYOFWEEK, b, 128)){
|
2007-03-16 08:34:36 +01:00
|
|
|
fday = atoi(b);
|
2013-12-01 22:33:53 +01:00
|
|
|
res = SendMessageA(hwnd, MCM_GETFIRSTDAYOFWEEK, 0, 0);
|
2007-03-16 08:34:36 +01:00
|
|
|
expect(fday, res);
|
|
|
|
prev = fday;
|
2007-02-16 08:59:08 +01:00
|
|
|
|
2007-03-16 08:34:36 +01:00
|
|
|
/* checking for the values that actually will be stored as */
|
|
|
|
/* current first day when we set a new value */
|
|
|
|
for (i = -5; i < 12; i++){
|
2013-12-01 22:33:53 +01:00
|
|
|
res = SendMessageA(hwnd, MCM_SETFIRSTDAYOFWEEK, 0, i);
|
2007-03-16 08:34:36 +01:00
|
|
|
expect(prev, res);
|
2013-12-01 22:33:53 +01:00
|
|
|
res = SendMessageA(hwnd, MCM_GETFIRSTDAYOFWEEK, 0, 0);
|
2007-03-16 08:34:36 +01:00
|
|
|
prev = res;
|
|
|
|
|
|
|
|
if (i == -1){
|
|
|
|
expect(MAKELONG(fday, FALSE), res);
|
|
|
|
}else if (i >= 7){
|
2008-09-28 20:22:20 +02:00
|
|
|
/* out of range sets max first day of week, locale is ignored */
|
|
|
|
expect(MAKELONG(6, TRUE), res);
|
2007-03-16 08:34:36 +01:00
|
|
|
}else{
|
|
|
|
expect(MAKELONG(i, TRUE), res);
|
|
|
|
}
|
2007-02-16 08:59:08 +01:00
|
|
|
}
|
|
|
|
|
2007-03-16 08:34:36 +01:00
|
|
|
ok_sequence(sequences, MONTHCAL_SEQ_INDEX, monthcal_first_day_seq, "monthcal firstDay", FALSE);
|
|
|
|
|
|
|
|
}else{
|
|
|
|
skip("Cannot retrieve first day of the week\n");
|
2007-02-16 08:59:08 +01:00
|
|
|
}
|
2007-03-16 08:32:49 +01:00
|
|
|
|
2009-09-25 22:51:04 +02:00
|
|
|
DestroyWindow(hwnd);
|
2007-02-16 08:59:08 +01:00
|
|
|
}
|
|
|
|
|
2010-08-04 12:32:51 +02:00
|
|
|
static void test_unicode(void)
|
2007-02-16 08:59:08 +01:00
|
|
|
{
|
|
|
|
int res, temp;
|
2009-09-25 22:51:04 +02:00
|
|
|
HWND hwnd;
|
|
|
|
|
|
|
|
hwnd = create_monthcal_control(0);
|
2007-02-16 08:59:08 +01:00
|
|
|
|
2007-03-16 08:32:49 +01:00
|
|
|
flush_sequences(sequences, NUM_MSG_SEQUENCES);
|
|
|
|
|
2007-02-16 08:59:08 +01:00
|
|
|
/* Setter and Getters for Unicode format */
|
|
|
|
|
|
|
|
/* getting the current settings */
|
2013-12-01 22:33:53 +01:00
|
|
|
temp = SendMessageA(hwnd, MCM_GETUNICODEFORMAT, 0, 0);
|
2007-02-16 08:59:08 +01:00
|
|
|
|
|
|
|
/* setting to 1, should return previous settings */
|
2013-12-01 22:33:53 +01:00
|
|
|
res = SendMessageA(hwnd, MCM_SETUNICODEFORMAT, 1, 0);
|
2007-02-16 08:59:08 +01:00
|
|
|
expect(temp, res);
|
|
|
|
|
|
|
|
/* current setting is 1, so, should return 1 */
|
2013-12-01 22:33:53 +01:00
|
|
|
res = SendMessageA(hwnd, MCM_GETUNICODEFORMAT, 0, 0);
|
2009-10-03 15:10:40 +02:00
|
|
|
ok(1 == res ||
|
|
|
|
broken(0 == res), /* comctl32 <= 4.70 */
|
|
|
|
"Expected 1, got %d\n", res);
|
2007-02-16 08:59:08 +01:00
|
|
|
|
|
|
|
/* setting to 0, should return previous settings */
|
2013-12-01 22:33:53 +01:00
|
|
|
res = SendMessageA(hwnd, MCM_SETUNICODEFORMAT, 0, 0);
|
2009-10-03 15:10:40 +02:00
|
|
|
ok(1 == res ||
|
|
|
|
broken(0 == res), /* comctl32 <= 4.70 */
|
|
|
|
"Expected 1, got %d\n", res);
|
2007-02-16 08:59:08 +01:00
|
|
|
|
|
|
|
/* current setting is 0, so, it should return 0 */
|
2013-12-01 22:33:53 +01:00
|
|
|
res = SendMessageA(hwnd, MCM_GETUNICODEFORMAT, 0, 0);
|
2007-02-16 08:59:08 +01:00
|
|
|
expect(0, res);
|
|
|
|
|
|
|
|
/* should return previous settings */
|
2013-12-01 22:33:53 +01:00
|
|
|
res = SendMessageA(hwnd, MCM_SETUNICODEFORMAT, 1, 0);
|
2007-02-16 08:59:08 +01:00
|
|
|
expect(0, res);
|
2007-03-16 08:32:49 +01:00
|
|
|
|
|
|
|
ok_sequence(sequences, MONTHCAL_SEQ_INDEX, monthcal_unicode_seq, "monthcal unicode", FALSE);
|
2009-09-25 22:51:04 +02:00
|
|
|
|
|
|
|
DestroyWindow(hwnd);
|
2007-02-16 08:59:08 +01:00
|
|
|
}
|
|
|
|
|
2010-08-04 12:32:51 +02:00
|
|
|
static void test_hittest(void)
|
2007-02-16 08:59:08 +01:00
|
|
|
{
|
2009-09-28 22:12:39 +02:00
|
|
|
typedef struct hittest_test
|
|
|
|
{
|
|
|
|
UINT ht;
|
2014-01-03 02:03:28 +01:00
|
|
|
BOOL todo;
|
2009-09-28 22:12:39 +02:00
|
|
|
} hittest_test_t;
|
|
|
|
|
|
|
|
static const hittest_test_t title_hits[] = {
|
2009-10-02 09:21:44 +02:00
|
|
|
/* Start is the same everywhere */
|
2014-01-03 02:03:28 +01:00
|
|
|
{ MCHT_TITLE, FALSE },
|
|
|
|
{ MCHT_TITLEBTNPREV, FALSE },
|
2009-10-02 09:21:44 +02:00
|
|
|
/* The middle piece is only tested for presence of items */
|
|
|
|
/* End is the same everywhere */
|
2014-01-03 02:03:28 +01:00
|
|
|
{ MCHT_TITLEBTNNEXT, FALSE },
|
|
|
|
{ MCHT_TITLE, FALSE },
|
|
|
|
{ MCHT_NOWHERE, TRUE }
|
2009-09-28 22:12:39 +02:00
|
|
|
};
|
|
|
|
|
2007-02-16 08:59:08 +01:00
|
|
|
MCHITTESTINFO mchit;
|
2009-09-28 22:12:39 +02:00
|
|
|
UINT res, old_res;
|
2007-10-07 14:36:19 +02:00
|
|
|
SYSTEMTIME st;
|
2009-01-04 16:20:56 +01:00
|
|
|
LONG x;
|
|
|
|
UINT title_index;
|
2009-09-25 22:51:04 +02:00
|
|
|
HWND hwnd;
|
2009-09-28 20:50:21 +02:00
|
|
|
RECT r;
|
2009-10-02 09:21:44 +02:00
|
|
|
char yearmonth[80], *locale_month, *locale_year;
|
|
|
|
int month_count, year_count;
|
|
|
|
BOOL in_the_middle;
|
2007-02-16 08:59:08 +01:00
|
|
|
|
|
|
|
memset(&mchit, 0, sizeof(MCHITTESTINFO));
|
|
|
|
|
2009-09-25 22:51:04 +02:00
|
|
|
hwnd = create_monthcal_control(0);
|
|
|
|
|
2009-09-26 21:26:53 +02:00
|
|
|
/* test with invalid structure size */
|
|
|
|
mchit.cbSize = MCHITTESTINFO_V1_SIZE - 1;
|
|
|
|
mchit.pt.x = 0;
|
|
|
|
mchit.pt.y = 0;
|
2013-12-01 22:33:53 +01:00
|
|
|
res = SendMessageA(hwnd, MCM_HITTEST, 0, (LPARAM)&mchit);
|
2009-09-26 21:26:53 +02:00
|
|
|
expect(0, mchit.pt.x);
|
|
|
|
expect(0, mchit.pt.y);
|
2011-06-04 23:27:33 +02:00
|
|
|
expect(~0u, res);
|
2009-09-26 21:26:53 +02:00
|
|
|
expect(0, mchit.uHit);
|
|
|
|
/* test with invalid pointer */
|
2013-12-01 22:33:53 +01:00
|
|
|
res = SendMessageA(hwnd, MCM_HITTEST, 0, 0);
|
2011-06-04 23:27:33 +02:00
|
|
|
expect(~0u, res);
|
2009-09-26 21:26:53 +02:00
|
|
|
|
2009-09-28 20:50:21 +02:00
|
|
|
/* resize control to display single Calendar */
|
2013-12-01 22:33:53 +01:00
|
|
|
res = SendMessageA(hwnd, MCM_GETMINREQRECT, 0, (LPARAM)&r);
|
2009-09-28 20:50:21 +02:00
|
|
|
if (res == 0)
|
|
|
|
{
|
|
|
|
win_skip("Message MCM_GETMINREQRECT unsupported. Skipping.\n");
|
|
|
|
DestroyWindow(hwnd);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
MoveWindow(hwnd, 0, 0, r.right, r.bottom, FALSE);
|
|
|
|
|
2007-03-16 08:32:49 +01:00
|
|
|
flush_sequences(sequences, NUM_MSG_SEQUENCES);
|
|
|
|
|
2007-10-07 14:36:19 +02:00
|
|
|
st.wYear = 2007;
|
|
|
|
st.wMonth = 4;
|
|
|
|
st.wDay = 11;
|
|
|
|
st.wHour = 1;
|
|
|
|
st.wMinute = 0;
|
|
|
|
st.wSecond = 0;
|
|
|
|
st.wMilliseconds = 0;
|
|
|
|
st.wDayOfWeek = 0;
|
|
|
|
|
2013-12-01 22:33:53 +01:00
|
|
|
res = SendMessageA(hwnd, MCM_SETCURSEL, 0, (LPARAM)&st);
|
2007-10-07 14:36:19 +02:00
|
|
|
expect(1,res);
|
|
|
|
|
2009-09-28 20:50:21 +02:00
|
|
|
/* (0, 0) is the top left of the control - title */
|
2009-09-26 21:26:53 +02:00
|
|
|
mchit.cbSize = MCHITTESTINFO_V1_SIZE;
|
2007-02-16 08:59:08 +01:00
|
|
|
mchit.pt.x = 0;
|
|
|
|
mchit.pt.y = 0;
|
2013-12-01 22:33:53 +01:00
|
|
|
res = SendMessageA(hwnd, MCM_HITTEST, 0, (LPARAM)&mchit);
|
2007-02-16 08:59:08 +01:00
|
|
|
expect(0, mchit.pt.x);
|
|
|
|
expect(0, mchit.pt.y);
|
|
|
|
expect(mchit.uHit, res);
|
2009-09-28 22:12:39 +02:00
|
|
|
expect_hex(MCHT_TITLE, res);
|
2007-02-16 08:59:08 +01:00
|
|
|
|
2009-09-28 20:50:21 +02:00
|
|
|
/* bottom right of the control and should not be active */
|
|
|
|
mchit.pt.x = r.right;
|
|
|
|
mchit.pt.y = r.bottom;
|
2013-12-01 22:33:53 +01:00
|
|
|
res = SendMessageA(hwnd, MCM_HITTEST, 0, (LPARAM)&mchit);
|
2009-09-28 20:50:21 +02:00
|
|
|
expect(r.right, mchit.pt.x);
|
|
|
|
expect(r.bottom, mchit.pt.y);
|
2007-02-16 08:59:08 +01:00
|
|
|
expect(mchit.uHit, res);
|
2009-09-28 20:50:21 +02:00
|
|
|
todo_wine expect_hex(MCHT_NOWHERE, res);
|
2007-02-16 08:59:08 +01:00
|
|
|
|
2009-09-28 20:50:21 +02:00
|
|
|
/* completely out of the control, should not be active */
|
|
|
|
mchit.pt.x = 2 * r.right;
|
|
|
|
mchit.pt.y = 2 * r.bottom;
|
2013-12-01 22:33:53 +01:00
|
|
|
res = SendMessageA(hwnd, MCM_HITTEST, 0, (LPARAM)&mchit);
|
2009-09-28 20:50:21 +02:00
|
|
|
expect(2 * r.right, mchit.pt.x);
|
|
|
|
expect(2 * r.bottom, mchit.pt.y);
|
2007-02-16 08:59:08 +01:00
|
|
|
expect(mchit.uHit, res);
|
2009-09-28 20:50:21 +02:00
|
|
|
todo_wine expect_hex(MCHT_NOWHERE, res);
|
2007-02-16 08:59:08 +01:00
|
|
|
|
2009-09-28 20:50:21 +02:00
|
|
|
/* in active area - day of the week */
|
|
|
|
mchit.pt.x = r.right / 2;
|
|
|
|
mchit.pt.y = r.bottom / 2;
|
2013-12-01 22:33:53 +01:00
|
|
|
res = SendMessageA(hwnd, MCM_HITTEST, 0, (LPARAM)&mchit);
|
2009-09-28 20:50:21 +02:00
|
|
|
expect(r.right / 2, mchit.pt.x);
|
|
|
|
expect(r.bottom / 2, mchit.pt.y);
|
2007-02-16 08:59:08 +01:00
|
|
|
expect(mchit.uHit, res);
|
2009-09-28 20:50:21 +02:00
|
|
|
expect_hex(MCHT_CALENDARDATE, res);
|
2007-04-12 06:34:48 +02:00
|
|
|
|
2009-09-28 20:50:21 +02:00
|
|
|
/* in active area - day of the week #2 */
|
|
|
|
mchit.pt.x = r.right / 14; /* half of first day rect */
|
|
|
|
mchit.pt.y = r.bottom / 2;
|
2013-12-01 22:33:53 +01:00
|
|
|
res = SendMessageA(hwnd, MCM_HITTEST, 0, (LPARAM)&mchit);
|
2009-09-28 20:50:21 +02:00
|
|
|
expect(r.right / 14, mchit.pt.x);
|
|
|
|
expect(r.bottom / 2, mchit.pt.y);
|
2007-04-12 06:34:48 +02:00
|
|
|
expect(mchit.uHit, res);
|
2009-09-28 22:12:39 +02:00
|
|
|
expect_hex(MCHT_CALENDARDATE, res);
|
2007-04-12 06:34:48 +02:00
|
|
|
|
2009-09-28 20:50:21 +02:00
|
|
|
/* in active area - date from prev month */
|
|
|
|
mchit.pt.x = r.right / 14; /* half of first day rect */
|
|
|
|
mchit.pt.y = 6 * r.bottom / 19;
|
2013-12-01 22:33:53 +01:00
|
|
|
res = SendMessageA(hwnd, MCM_HITTEST, 0, (LPARAM)&mchit);
|
2009-09-28 20:50:21 +02:00
|
|
|
expect(r.right / 14, mchit.pt.x);
|
|
|
|
expect(6 * r.bottom / 19, mchit.pt.y);
|
2007-04-12 06:34:48 +02:00
|
|
|
expect(mchit.uHit, res);
|
2009-09-28 22:12:39 +02:00
|
|
|
expect_hex(MCHT_CALENDARDATEPREV, res);
|
2007-04-12 06:34:48 +02:00
|
|
|
|
2014-01-22 22:32:17 +01:00
|
|
|
if (0)
|
|
|
|
{
|
2007-04-12 06:34:48 +02:00
|
|
|
/* (125, 115) is in active area - date from this month */
|
|
|
|
mchit.pt.x = 125;
|
|
|
|
mchit.pt.y = 115;
|
2013-12-01 22:33:53 +01:00
|
|
|
res = SendMessageA(hwnd, MCM_HITTEST, 0, (LPARAM)&mchit);
|
2007-04-12 06:34:48 +02:00
|
|
|
expect(125, mchit.pt.x);
|
|
|
|
expect(115, mchit.pt.y);
|
|
|
|
expect(mchit.uHit, res);
|
2007-10-07 14:36:19 +02:00
|
|
|
expect(MCHT_CALENDARDATE, res);
|
2014-01-22 22:32:17 +01:00
|
|
|
}
|
2007-04-12 06:34:48 +02:00
|
|
|
|
2009-09-28 20:50:21 +02:00
|
|
|
/* in active area - date from next month */
|
|
|
|
mchit.pt.x = 11 * r.right / 14;
|
|
|
|
mchit.pt.y = 16 * r.bottom / 19;
|
2013-12-01 22:33:53 +01:00
|
|
|
res = SendMessageA(hwnd, MCM_HITTEST, 0, (LPARAM)&mchit);
|
2009-09-28 20:50:21 +02:00
|
|
|
expect(11 * r.right / 14, mchit.pt.x);
|
|
|
|
expect(16 * r.bottom / 19, mchit.pt.y);
|
2007-04-12 06:34:48 +02:00
|
|
|
expect(mchit.uHit, res);
|
2009-09-28 20:50:21 +02:00
|
|
|
expect_hex(MCHT_CALENDARDATENEXT, res);
|
2007-04-12 06:34:48 +02:00
|
|
|
|
2009-09-28 20:50:21 +02:00
|
|
|
/* in active area - today link */
|
|
|
|
mchit.pt.x = r.right / 14;
|
|
|
|
mchit.pt.y = 18 * r.bottom / 19;
|
2013-12-01 22:33:53 +01:00
|
|
|
res = SendMessageA(hwnd, MCM_HITTEST, 0, (LPARAM)&mchit);
|
2009-09-28 20:50:21 +02:00
|
|
|
expect(r.right / 14, mchit.pt.x);
|
|
|
|
expect(18 * r.bottom / 19, mchit.pt.y);
|
2007-04-12 06:34:48 +02:00
|
|
|
expect(mchit.uHit, res);
|
2009-09-28 20:50:21 +02:00
|
|
|
expect_hex(MCHT_TODAYLINK, res);
|
2007-04-12 06:34:48 +02:00
|
|
|
|
2009-09-28 20:50:21 +02:00
|
|
|
/* in active area - today link */
|
|
|
|
mchit.pt.x = r.right / 2;
|
|
|
|
mchit.pt.y = 18 * r.bottom / 19;
|
2013-12-01 22:33:53 +01:00
|
|
|
res = SendMessageA(hwnd, MCM_HITTEST, 0, (LPARAM)&mchit);
|
2009-09-28 20:50:21 +02:00
|
|
|
expect(r.right / 2, mchit.pt.x);
|
|
|
|
expect(18 * r.bottom / 19, mchit.pt.y);
|
2007-04-12 06:34:48 +02:00
|
|
|
expect(mchit.uHit, res);
|
2009-09-28 20:50:21 +02:00
|
|
|
expect_hex(MCHT_TODAYLINK, res);
|
2007-04-12 06:34:48 +02:00
|
|
|
|
2009-09-28 20:50:21 +02:00
|
|
|
/* in active area - today link */
|
|
|
|
mchit.pt.x = r.right / 10;
|
|
|
|
mchit.pt.y = 18 * r.bottom / 19;
|
2013-12-01 22:33:53 +01:00
|
|
|
res = SendMessageA(hwnd, MCM_HITTEST, 0, (LPARAM)&mchit);
|
2009-09-28 20:50:21 +02:00
|
|
|
expect(r.right / 10, mchit.pt.x);
|
|
|
|
expect(18 * r.bottom / 19, mchit.pt.y);
|
2007-04-12 06:34:48 +02:00
|
|
|
expect(mchit.uHit, res);
|
2009-09-28 20:50:21 +02:00
|
|
|
expect_hex(MCHT_TODAYLINK, res);
|
2007-03-16 08:32:49 +01:00
|
|
|
|
2007-10-07 14:36:19 +02:00
|
|
|
ok_sequence(sequences, MONTHCAL_SEQ_INDEX, monthcal_hit_test_seq, "monthcal hit test", TRUE);
|
2009-01-04 16:20:56 +01:00
|
|
|
|
|
|
|
/* The horizontal position of title bar elements depends on locale (y pos
|
|
|
|
is constant), so we sample across a horizontal line and make sure we
|
|
|
|
find all elements. */
|
2009-10-02 09:21:44 +02:00
|
|
|
|
|
|
|
/* Get the format of the title */
|
2013-12-01 22:33:53 +01:00
|
|
|
GetLocaleInfoA(LOCALE_USER_DEFAULT, LOCALE_SYEARMONTH, yearmonth, 80);
|
2009-10-02 09:21:44 +02:00
|
|
|
/* Find out if we have a month and/or year */
|
|
|
|
locale_year = strstr(yearmonth, "y");
|
|
|
|
locale_month = strstr(yearmonth, "M");
|
|
|
|
|
2009-09-28 22:12:39 +02:00
|
|
|
mchit.pt.x = 0;
|
2009-09-28 20:50:21 +02:00
|
|
|
mchit.pt.y = (5/2) * r.bottom / 19;
|
2009-01-04 16:20:56 +01:00
|
|
|
title_index = 0;
|
2013-12-01 22:33:53 +01:00
|
|
|
old_res = SendMessageA(hwnd, MCM_HITTEST, 0, (LPARAM)&mchit);
|
2009-10-02 09:21:44 +02:00
|
|
|
expect_hex(title_hits[title_index].ht, old_res);
|
2009-09-28 20:50:21 +02:00
|
|
|
|
2009-10-02 09:21:44 +02:00
|
|
|
in_the_middle = FALSE;
|
|
|
|
month_count = year_count = 0;
|
2009-09-28 20:50:21 +02:00
|
|
|
for (x = 0; x < r.right; x++){
|
2009-01-04 16:20:56 +01:00
|
|
|
mchit.pt.x = x;
|
2013-12-01 22:33:53 +01:00
|
|
|
res = SendMessageA(hwnd, MCM_HITTEST, 0, (LPARAM)&mchit);
|
2009-01-04 16:20:56 +01:00
|
|
|
expect(x, mchit.pt.x);
|
2009-09-28 20:50:21 +02:00
|
|
|
expect((5/2) * r.bottom / 19, mchit.pt.y);
|
2009-01-04 16:20:56 +01:00
|
|
|
expect(mchit.uHit, res);
|
2009-10-02 09:21:44 +02:00
|
|
|
if (res != old_res) {
|
|
|
|
|
|
|
|
if (old_res == MCHT_TITLEBTNPREV)
|
|
|
|
in_the_middle = TRUE;
|
|
|
|
|
|
|
|
if (res == MCHT_TITLEBTNNEXT)
|
|
|
|
in_the_middle = FALSE;
|
|
|
|
|
|
|
|
if (in_the_middle) {
|
|
|
|
if (res == MCHT_TITLEMONTH)
|
|
|
|
month_count++;
|
|
|
|
else if (res == MCHT_TITLEYEAR)
|
|
|
|
year_count++;
|
|
|
|
} else {
|
|
|
|
title_index++;
|
|
|
|
|
|
|
|
if (sizeof(title_hits) / sizeof(title_hits[0]) <= title_index)
|
|
|
|
break;
|
|
|
|
|
|
|
|
if (title_hits[title_index].todo) {
|
|
|
|
todo_wine
|
|
|
|
ok(title_hits[title_index].ht == res, "Expected %x, got %x, pos %d\n",
|
|
|
|
title_hits[title_index].ht, res, x);
|
|
|
|
} else {
|
|
|
|
ok(title_hits[title_index].ht == res, "Expected %x, got %x, pos %d\n",
|
|
|
|
title_hits[title_index].ht, res, x);
|
|
|
|
}
|
2009-09-28 22:12:39 +02:00
|
|
|
}
|
2009-10-02 09:21:44 +02:00
|
|
|
old_res = res;
|
2009-01-04 16:20:56 +01:00
|
|
|
}
|
|
|
|
}
|
2009-09-28 20:50:21 +02:00
|
|
|
|
2009-10-02 09:21:44 +02:00
|
|
|
/* There are some limits, even if LOCALE_SYEARMONTH contains rubbish
|
|
|
|
* or no month/year indicators at all */
|
|
|
|
if (locale_month)
|
|
|
|
todo_wine ok(month_count == 1, "Expected 1 month item, got %d\n", month_count);
|
|
|
|
else
|
|
|
|
ok(month_count <= 1, "Too many month items: %d\n", month_count);
|
|
|
|
|
|
|
|
if (locale_year)
|
|
|
|
todo_wine ok(year_count == 1, "Expected 1 year item, got %d\n", year_count);
|
|
|
|
else
|
|
|
|
ok(year_count <= 1, "Too many year items: %d\n", year_count);
|
|
|
|
|
|
|
|
todo_wine ok(month_count + year_count >= 1, "Not enough month and year items\n");
|
|
|
|
|
|
|
|
ok(r.right <= x && title_index + 1 == sizeof(title_hits) / sizeof(title_hits[0]),
|
|
|
|
"Wrong title layout\n");
|
2009-09-25 22:51:04 +02:00
|
|
|
|
|
|
|
DestroyWindow(hwnd);
|
2007-02-16 08:59:08 +01:00
|
|
|
}
|
|
|
|
|
2010-08-04 12:32:51 +02:00
|
|
|
static void test_todaylink(void)
|
2007-10-15 02:04:08 +02:00
|
|
|
{
|
|
|
|
MCHITTESTINFO mchit;
|
|
|
|
SYSTEMTIME st_test, st_new;
|
2008-03-12 00:24:35 +01:00
|
|
|
UINT res;
|
2009-09-25 22:51:04 +02:00
|
|
|
HWND hwnd;
|
2009-10-11 17:02:51 +02:00
|
|
|
RECT r;
|
2007-10-15 02:04:08 +02:00
|
|
|
|
|
|
|
memset(&mchit, 0, sizeof(MCHITTESTINFO));
|
|
|
|
|
2009-09-25 22:51:04 +02:00
|
|
|
hwnd = create_monthcal_control(0);
|
|
|
|
|
2013-12-01 22:33:53 +01:00
|
|
|
res = SendMessageA(hwnd, MCM_GETMINREQRECT, 0, (LPARAM)&r);
|
2011-02-17 03:20:25 +01:00
|
|
|
expect(1, res);
|
2009-10-11 17:02:51 +02:00
|
|
|
MoveWindow(hwnd, 0, 0, r.right, r.bottom, FALSE);
|
|
|
|
|
2007-10-15 02:04:08 +02:00
|
|
|
flush_sequences(sequences, NUM_MSG_SEQUENCES);
|
|
|
|
|
2009-10-11 17:02:51 +02:00
|
|
|
/* hit active area - today link */
|
2009-09-26 21:26:53 +02:00
|
|
|
mchit.cbSize = MCHITTESTINFO_V1_SIZE;
|
2009-10-11 17:02:51 +02:00
|
|
|
mchit.pt.x = r.right / 14;
|
|
|
|
mchit.pt.y = 18 * r.bottom / 19;
|
2013-12-01 22:33:53 +01:00
|
|
|
res = SendMessageA(hwnd, MCM_HITTEST, 0, (LPARAM)&mchit);
|
2009-10-11 17:02:51 +02:00
|
|
|
expect(r.right / 14, mchit.pt.x);
|
|
|
|
expect(18 * r.bottom / 19, mchit.pt.y);
|
2007-10-15 02:04:08 +02:00
|
|
|
expect(mchit.uHit, res);
|
2009-10-11 17:02:51 +02:00
|
|
|
expect(MCHT_TODAYLINK, res);
|
2007-10-15 02:04:08 +02:00
|
|
|
|
|
|
|
st_test.wDay = 1;
|
|
|
|
st_test.wMonth = 1;
|
|
|
|
st_test.wYear = 2005;
|
|
|
|
|
2013-12-01 22:33:53 +01:00
|
|
|
res = SendMessageA(hwnd, MCM_SETTODAY, 0, (LPARAM)&st_test);
|
2011-09-23 11:34:37 +02:00
|
|
|
expect(0, res);
|
2007-10-15 02:04:08 +02:00
|
|
|
|
2009-10-11 17:02:51 +02:00
|
|
|
memset(&st_new, 0, sizeof(st_new));
|
2013-12-01 22:33:53 +01:00
|
|
|
res = SendMessageA(hwnd, MCM_GETTODAY, 0, (LPARAM)&st_new);
|
2007-10-15 02:04:08 +02:00
|
|
|
expect(1, res);
|
|
|
|
expect(1, st_new.wDay);
|
|
|
|
expect(1, st_new.wMonth);
|
|
|
|
expect(2005, st_new.wYear);
|
|
|
|
|
2013-12-01 22:33:53 +01:00
|
|
|
res = SendMessageA(hwnd, WM_LBUTTONDOWN, MK_LBUTTON, MAKELONG(mchit.pt.x, mchit.pt.y));
|
2007-10-15 02:04:08 +02:00
|
|
|
expect(0, res);
|
|
|
|
|
2009-10-11 17:02:51 +02:00
|
|
|
memset(&st_new, 0, sizeof(st_new));
|
2013-12-01 22:33:53 +01:00
|
|
|
res = SendMessageA(hwnd, MCM_GETCURSEL, 0, (LPARAM)&st_new);
|
2007-10-15 02:04:08 +02:00
|
|
|
expect(1, res);
|
|
|
|
expect(1, st_new.wDay);
|
|
|
|
expect(1, st_new.wMonth);
|
|
|
|
expect(2005, st_new.wYear);
|
|
|
|
|
|
|
|
ok_sequence(sequences, MONTHCAL_SEQ_INDEX, monthcal_todaylink_seq, "monthcal hit test", TRUE);
|
2009-09-25 22:51:04 +02:00
|
|
|
|
|
|
|
DestroyWindow(hwnd);
|
2007-10-15 02:04:08 +02:00
|
|
|
}
|
|
|
|
|
2010-08-04 12:32:51 +02:00
|
|
|
static void test_today(void)
|
2007-02-16 08:59:08 +01:00
|
|
|
{
|
|
|
|
SYSTEMTIME st_test, st_new;
|
|
|
|
int res;
|
2009-09-25 22:51:04 +02:00
|
|
|
HWND hwnd;
|
|
|
|
|
|
|
|
hwnd = create_monthcal_control(0);
|
2007-02-16 08:59:08 +01:00
|
|
|
|
2007-03-16 08:32:49 +01:00
|
|
|
flush_sequences(sequences, NUM_MSG_SEQUENCES);
|
|
|
|
|
2007-02-16 08:59:08 +01:00
|
|
|
/* Setter and Getters for "today" information */
|
|
|
|
|
|
|
|
/* check for overflow, should be ok */
|
2009-11-19 14:20:20 +01:00
|
|
|
memset(&st_test, 0, sizeof(st_test));
|
2007-02-16 08:59:08 +01:00
|
|
|
st_test.wDay = 38;
|
|
|
|
st_test.wMonth = 38;
|
|
|
|
|
|
|
|
st_new.wDay = 27;
|
|
|
|
st_new.wMonth = 27;
|
|
|
|
|
2013-12-01 22:33:53 +01:00
|
|
|
res = SendMessageA(hwnd, MCM_SETTODAY, 0, (LPARAM)&st_test);
|
2011-09-23 11:34:37 +02:00
|
|
|
expect(0, res);
|
2007-02-16 08:59:08 +01:00
|
|
|
|
2013-12-01 22:33:53 +01:00
|
|
|
res = SendMessageA(hwnd, MCM_GETTODAY, 0, (LPARAM)&st_new);
|
2007-02-16 08:59:08 +01:00
|
|
|
expect(1, res);
|
|
|
|
|
|
|
|
/* st_test should not change */
|
|
|
|
expect(38, st_test.wDay);
|
|
|
|
expect(38, st_test.wMonth);
|
|
|
|
|
|
|
|
/* st_new should change, overflow does not matter */
|
|
|
|
expect(38, st_new.wDay);
|
|
|
|
expect(38, st_new.wMonth);
|
|
|
|
|
|
|
|
/* check for zero, should be ok*/
|
|
|
|
st_test.wDay = 0;
|
|
|
|
st_test.wMonth = 0;
|
|
|
|
|
2013-12-01 22:33:53 +01:00
|
|
|
res = SendMessageA(hwnd, MCM_SETTODAY, 0, (LPARAM)&st_test);
|
2011-09-23 11:34:37 +02:00
|
|
|
expect(0, res);
|
2007-02-16 08:59:08 +01:00
|
|
|
|
2013-12-01 22:33:53 +01:00
|
|
|
res = SendMessageA(hwnd, MCM_GETTODAY, 0, (LPARAM)&st_new);
|
2007-02-16 08:59:08 +01:00
|
|
|
expect(1, res);
|
|
|
|
|
|
|
|
/* st_test should not change */
|
|
|
|
expect(0, st_test.wDay);
|
|
|
|
expect(0, st_test.wMonth);
|
|
|
|
|
|
|
|
/* st_new should change to zero*/
|
|
|
|
expect(0, st_new.wDay);
|
|
|
|
expect(0, st_new.wMonth);
|
2007-03-16 08:32:49 +01:00
|
|
|
|
|
|
|
ok_sequence(sequences, MONTHCAL_SEQ_INDEX, monthcal_today_seq, "monthcal today", TRUE);
|
2009-09-25 22:51:04 +02:00
|
|
|
|
|
|
|
DestroyWindow(hwnd);
|
2007-02-16 08:59:08 +01:00
|
|
|
}
|
|
|
|
|
2010-08-04 12:32:51 +02:00
|
|
|
static void test_scroll(void)
|
2007-02-16 08:59:08 +01:00
|
|
|
{
|
|
|
|
int res;
|
2009-09-25 22:51:04 +02:00
|
|
|
HWND hwnd;
|
|
|
|
|
|
|
|
hwnd = create_monthcal_control(0);
|
2007-02-16 08:59:08 +01:00
|
|
|
|
2013-12-01 22:33:53 +01:00
|
|
|
res = SendMessageA(hwnd, MCM_GETMONTHDELTA, 0, 0);
|
2013-08-29 21:57:48 +02:00
|
|
|
expect(2, res);
|
|
|
|
|
2007-03-16 08:32:49 +01:00
|
|
|
flush_sequences(sequences, NUM_MSG_SEQUENCES);
|
|
|
|
|
2007-02-16 08:59:08 +01:00
|
|
|
/* Setter and Getters for scroll rate */
|
2013-12-01 22:33:53 +01:00
|
|
|
res = SendMessageA(hwnd, MCM_SETMONTHDELTA, 2, 0);
|
2007-02-16 08:59:08 +01:00
|
|
|
expect(0, res);
|
|
|
|
|
2013-12-01 22:33:53 +01:00
|
|
|
res = SendMessageA(hwnd, MCM_SETMONTHDELTA, 3, 0);
|
2007-02-16 08:59:08 +01:00
|
|
|
expect(2, res);
|
2013-12-01 22:33:53 +01:00
|
|
|
res = SendMessageA(hwnd, MCM_GETMONTHDELTA, 0, 0);
|
2007-02-16 08:59:08 +01:00
|
|
|
expect(3, res);
|
|
|
|
|
2013-12-01 22:33:53 +01:00
|
|
|
res = SendMessageA(hwnd, MCM_SETMONTHDELTA, 12, 0);
|
2007-02-16 08:59:08 +01:00
|
|
|
expect(3, res);
|
2013-12-01 22:33:53 +01:00
|
|
|
res = SendMessageA(hwnd, MCM_GETMONTHDELTA, 0, 0);
|
2007-02-16 08:59:08 +01:00
|
|
|
expect(12, res);
|
|
|
|
|
2013-12-01 22:33:53 +01:00
|
|
|
res = SendMessageA(hwnd, MCM_SETMONTHDELTA, 15, 0);
|
2007-02-16 08:59:08 +01:00
|
|
|
expect(12, res);
|
2013-12-01 22:33:53 +01:00
|
|
|
res = SendMessageA(hwnd, MCM_GETMONTHDELTA, 0, 0);
|
2007-02-16 08:59:08 +01:00
|
|
|
expect(15, res);
|
|
|
|
|
2013-12-01 22:33:53 +01:00
|
|
|
res = SendMessageA(hwnd, MCM_SETMONTHDELTA, -5, 0);
|
2007-02-16 08:59:08 +01:00
|
|
|
expect(15, res);
|
2013-12-01 22:33:53 +01:00
|
|
|
res = SendMessageA(hwnd, MCM_GETMONTHDELTA, 0, 0);
|
2007-02-16 08:59:08 +01:00
|
|
|
expect(-5, res);
|
2007-03-16 08:32:49 +01:00
|
|
|
|
|
|
|
ok_sequence(sequences, MONTHCAL_SEQ_INDEX, monthcal_scroll_seq, "monthcal scroll", FALSE);
|
2009-09-25 22:51:04 +02:00
|
|
|
|
|
|
|
DestroyWindow(hwnd);
|
2006-02-06 20:58:48 +01:00
|
|
|
}
|
|
|
|
|
2010-08-04 12:32:51 +02:00
|
|
|
static void test_monthrange(void)
|
2007-04-13 03:44:55 +02:00
|
|
|
{
|
|
|
|
int res;
|
2009-09-25 22:51:04 +02:00
|
|
|
SYSTEMTIME st_visible[2], st_daystate[2], st;
|
|
|
|
HWND hwnd;
|
2009-10-10 21:12:43 +02:00
|
|
|
RECT r;
|
2009-09-25 22:51:04 +02:00
|
|
|
|
|
|
|
hwnd = create_monthcal_control(0);
|
2007-04-13 03:44:55 +02:00
|
|
|
|
2013-01-09 02:42:13 +01:00
|
|
|
memset(&st_visible, 0, sizeof(st_visible));
|
|
|
|
memset(&st_daystate, 0, sizeof(st_daystate));
|
2007-04-13 03:44:55 +02:00
|
|
|
|
2009-09-25 22:51:04 +02:00
|
|
|
st.wYear = 2000;
|
|
|
|
st.wMonth = 11;
|
|
|
|
st.wDay = 28;
|
|
|
|
st.wHour = 11;
|
|
|
|
st.wMinute = 59;
|
|
|
|
st.wSecond = 30;
|
|
|
|
st.wMilliseconds = 0;
|
|
|
|
st.wDayOfWeek = 0;
|
|
|
|
|
2013-12-01 22:33:53 +01:00
|
|
|
res = SendMessageA(hwnd, MCM_SETCURSEL, 0, (LPARAM)&st);
|
2009-09-25 22:51:04 +02:00
|
|
|
expect(1,res);
|
|
|
|
|
2009-09-29 12:14:37 +02:00
|
|
|
/* to be locale independent */
|
2013-12-01 22:33:53 +01:00
|
|
|
SendMessageA(hwnd, MCM_SETFIRSTDAYOFWEEK, 0, (LPARAM)6);
|
2009-09-29 12:14:37 +02:00
|
|
|
|
2013-12-01 22:33:53 +01:00
|
|
|
res = SendMessageA(hwnd, MCM_GETMINREQRECT, 0, (LPARAM)&r);
|
2009-10-18 13:33:36 +02:00
|
|
|
expect(TRUE, res);
|
|
|
|
/* resize control to display two Calendars */
|
|
|
|
MoveWindow(hwnd, 0, 0, r.right, (5/2)*r.bottom, FALSE);
|
|
|
|
|
2009-09-25 22:51:04 +02:00
|
|
|
flush_sequences(sequences, NUM_MSG_SEQUENCES);
|
|
|
|
|
2013-12-01 22:33:53 +01:00
|
|
|
res = SendMessageA(hwnd, MCM_GETMONTHRANGE, GMR_VISIBLE, (LPARAM)st_visible);
|
2011-09-22 15:56:40 +02:00
|
|
|
expect(2, res);
|
2009-10-08 12:02:18 +02:00
|
|
|
expect(2000, st_visible[0].wYear);
|
|
|
|
expect(11, st_visible[0].wMonth);
|
|
|
|
expect(1, st_visible[0].wDay);
|
|
|
|
expect(2000, st_visible[1].wYear);
|
2011-09-22 15:56:40 +02:00
|
|
|
expect(12, st_visible[1].wMonth);
|
|
|
|
expect(31, st_visible[1].wDay);
|
2009-10-04 16:27:21 +02:00
|
|
|
|
2013-12-01 22:33:53 +01:00
|
|
|
res = SendMessageA(hwnd, MCM_GETMONTHRANGE, GMR_DAYSTATE, (LPARAM)st_daystate);
|
2011-09-23 08:27:14 +02:00
|
|
|
expect(4, res);
|
2009-10-08 12:02:18 +02:00
|
|
|
expect(2000, st_daystate[0].wYear);
|
|
|
|
expect(10, st_daystate[0].wMonth);
|
|
|
|
expect(29, st_daystate[0].wDay);
|
2011-09-22 15:56:40 +02:00
|
|
|
expect(2001, st_daystate[1].wYear);
|
|
|
|
expect(1, st_daystate[1].wMonth);
|
|
|
|
expect(6, st_daystate[1].wDay);
|
2007-04-13 03:44:55 +02:00
|
|
|
|
|
|
|
ok_sequence(sequences, MONTHCAL_SEQ_INDEX, monthcal_monthrange_seq, "monthcal monthrange", FALSE);
|
2009-09-25 22:51:04 +02:00
|
|
|
|
2011-09-23 08:27:14 +02:00
|
|
|
/* with null date array parameter */
|
2013-12-01 22:33:53 +01:00
|
|
|
res = SendMessageA(hwnd, MCM_GETMONTHRANGE, GMR_VISIBLE, 0);
|
2011-09-23 08:27:14 +02:00
|
|
|
expect(2, res);
|
|
|
|
|
2013-12-01 22:33:53 +01:00
|
|
|
res = SendMessageA(hwnd, MCM_GETMONTHRANGE, GMR_DAYSTATE, 0);
|
2011-09-23 08:27:14 +02:00
|
|
|
expect(4, res);
|
|
|
|
|
2009-10-10 21:12:43 +02:00
|
|
|
/* resize control to display single Calendar */
|
|
|
|
MoveWindow(hwnd, 0, 0, r.right, r.bottom, FALSE);
|
|
|
|
|
|
|
|
memset(&st, 0, sizeof(st));
|
|
|
|
st.wMonth = 9;
|
|
|
|
st.wYear = 1752;
|
|
|
|
st.wDay = 14;
|
|
|
|
|
2013-12-01 22:33:53 +01:00
|
|
|
res = SendMessageA(hwnd, MCM_SETCURSEL, 0, (LPARAM)&st);
|
2009-10-10 21:12:43 +02:00
|
|
|
expect(1, res);
|
|
|
|
|
|
|
|
/* September 1752 has 19 days */
|
2013-12-01 22:33:53 +01:00
|
|
|
res = SendMessageA(hwnd, MCM_GETMONTHRANGE, GMR_VISIBLE, (LPARAM)st_visible);
|
2009-10-10 21:12:43 +02:00
|
|
|
expect(1, res);
|
|
|
|
|
|
|
|
expect(1752, st_visible[0].wYear);
|
|
|
|
expect(9, st_visible[0].wMonth);
|
2009-10-13 08:09:09 +02:00
|
|
|
ok(14 == st_visible[0].wDay ||
|
|
|
|
broken(1 == st_visible[0].wDay), /* comctl32 <= 4.72 */
|
|
|
|
"Expected 14, got %d\n", st_visible[0].wDay);
|
2009-10-10 21:12:43 +02:00
|
|
|
|
|
|
|
expect(1752, st_visible[1].wYear);
|
|
|
|
expect(9, st_visible[1].wMonth);
|
|
|
|
expect(19, st_visible[1].wDay);
|
|
|
|
|
2009-09-25 22:51:04 +02:00
|
|
|
DestroyWindow(hwnd);
|
2007-04-13 03:44:55 +02:00
|
|
|
}
|
|
|
|
|
2010-08-04 12:32:51 +02:00
|
|
|
static void test_maxselday(void)
|
2007-02-16 08:59:08 +01:00
|
|
|
{
|
|
|
|
int res;
|
2009-09-25 22:51:04 +02:00
|
|
|
HWND hwnd;
|
2009-10-01 20:49:02 +02:00
|
|
|
DWORD style;
|
|
|
|
|
|
|
|
hwnd = create_monthcal_control(0);
|
|
|
|
/* if no style specified default to 1 */
|
2013-12-01 22:33:53 +01:00
|
|
|
res = SendMessageA(hwnd, MCM_GETMAXSELCOUNT, 0, 0);
|
2009-10-01 20:49:02 +02:00
|
|
|
expect(1, res);
|
2013-12-01 22:33:53 +01:00
|
|
|
res = SendMessageA(hwnd, MCM_SETMAXSELCOUNT, 5, 0);
|
2009-10-01 21:02:56 +02:00
|
|
|
expect(0, res);
|
2013-12-01 22:33:53 +01:00
|
|
|
res = SendMessageA(hwnd, MCM_GETMAXSELCOUNT, 0, 0);
|
2009-10-01 21:02:56 +02:00
|
|
|
expect(1, res);
|
2009-10-01 20:49:02 +02:00
|
|
|
|
|
|
|
/* try to set style */
|
2013-12-01 22:33:53 +01:00
|
|
|
style = GetWindowLongA(hwnd, GWL_STYLE);
|
|
|
|
SetWindowLongA(hwnd, GWL_STYLE, style | MCS_MULTISELECT);
|
|
|
|
style = GetWindowLongA(hwnd, GWL_STYLE);
|
2009-10-01 20:49:02 +02:00
|
|
|
ok(!(style & MCS_MULTISELECT), "Expected MCS_MULTISELECT not to be set\n");
|
|
|
|
DestroyWindow(hwnd);
|
2009-09-25 22:51:04 +02:00
|
|
|
|
|
|
|
hwnd = create_monthcal_control(MCS_MULTISELECT);
|
2009-10-01 20:49:02 +02:00
|
|
|
/* try to remove style */
|
2013-12-01 22:33:53 +01:00
|
|
|
style = GetWindowLongA(hwnd, GWL_STYLE);
|
|
|
|
SetWindowLongA(hwnd, GWL_STYLE, style & ~MCS_MULTISELECT);
|
|
|
|
style = GetWindowLongA(hwnd, GWL_STYLE);
|
2009-10-01 20:49:02 +02:00
|
|
|
ok(style & MCS_MULTISELECT, "Expected MCS_MULTISELECT to be set\n");
|
|
|
|
DestroyWindow(hwnd);
|
|
|
|
|
|
|
|
hwnd = create_monthcal_control(MCS_MULTISELECT);
|
|
|
|
|
|
|
|
/* default width is a week */
|
2013-12-01 22:33:53 +01:00
|
|
|
res = SendMessageA(hwnd, MCM_GETMAXSELCOUNT, 0, 0);
|
2009-10-01 20:49:02 +02:00
|
|
|
expect(7, res);
|
2007-02-16 08:59:08 +01:00
|
|
|
|
2007-03-16 08:32:49 +01:00
|
|
|
flush_sequences(sequences, NUM_MSG_SEQUENCES);
|
|
|
|
|
2007-02-16 08:59:08 +01:00
|
|
|
/* Setter and Getters for max selected days */
|
2013-12-01 22:33:53 +01:00
|
|
|
res = SendMessageA(hwnd, MCM_SETMAXSELCOUNT, 5, 0);
|
2007-02-16 08:59:08 +01:00
|
|
|
expect(1, res);
|
2013-12-01 22:33:53 +01:00
|
|
|
res = SendMessageA(hwnd, MCM_GETMAXSELCOUNT, 0, 0);
|
2007-02-16 08:59:08 +01:00
|
|
|
expect(5, res);
|
|
|
|
|
2013-12-01 22:33:53 +01:00
|
|
|
res = SendMessageA(hwnd, MCM_SETMAXSELCOUNT, 15, 0);
|
2007-02-16 08:59:08 +01:00
|
|
|
expect(1, res);
|
2013-12-01 22:33:53 +01:00
|
|
|
res = SendMessageA(hwnd, MCM_GETMAXSELCOUNT, 0, 0);
|
2007-02-16 08:59:08 +01:00
|
|
|
expect(15, res);
|
|
|
|
|
2009-10-01 21:02:56 +02:00
|
|
|
/* test invalid value */
|
2013-12-01 22:33:53 +01:00
|
|
|
res = SendMessageA(hwnd, MCM_SETMAXSELCOUNT, -1, 0);
|
2009-10-01 21:02:56 +02:00
|
|
|
expect(0, res);
|
2013-12-01 22:33:53 +01:00
|
|
|
res = SendMessageA(hwnd, MCM_GETMAXSELCOUNT, 0, 0);
|
2009-10-01 21:02:56 +02:00
|
|
|
expect(15, res);
|
2007-03-16 08:32:49 +01:00
|
|
|
|
|
|
|
ok_sequence(sequences, MONTHCAL_SEQ_INDEX, monthcal_max_sel_day_seq, "monthcal MaxSelDay", FALSE);
|
2009-09-25 22:51:04 +02:00
|
|
|
|
2009-10-01 21:02:56 +02:00
|
|
|
/* zero value is invalid too */
|
2013-12-01 22:33:53 +01:00
|
|
|
res = SendMessageA(hwnd, MCM_SETMAXSELCOUNT, 0, 0);
|
2009-10-01 21:02:56 +02:00
|
|
|
expect(0, res);
|
2013-12-01 22:33:53 +01:00
|
|
|
res = SendMessageA(hwnd, MCM_GETMAXSELCOUNT, 0, 0);
|
2009-10-01 21:02:56 +02:00
|
|
|
expect(15, res);
|
|
|
|
|
2009-09-25 22:51:04 +02:00
|
|
|
DestroyWindow(hwnd);
|
2007-02-16 08:59:08 +01:00
|
|
|
}
|
|
|
|
|
2010-08-04 12:32:51 +02:00
|
|
|
static void test_size(void)
|
2008-10-25 18:04:52 +02:00
|
|
|
{
|
|
|
|
int res;
|
|
|
|
RECT r1, r2;
|
|
|
|
HFONT hFont1, hFont2;
|
|
|
|
LOGFONTA logfont;
|
2009-09-25 22:51:04 +02:00
|
|
|
HWND hwnd;
|
|
|
|
|
|
|
|
hwnd = create_monthcal_control(0);
|
2008-10-25 18:04:52 +02:00
|
|
|
|
|
|
|
lstrcpyA(logfont.lfFaceName, "Arial");
|
|
|
|
memset(&logfont, 0, sizeof(logfont));
|
|
|
|
logfont.lfHeight = 12;
|
|
|
|
hFont1 = CreateFontIndirectA(&logfont);
|
|
|
|
|
|
|
|
logfont.lfHeight = 24;
|
|
|
|
hFont2 = CreateFontIndirectA(&logfont);
|
|
|
|
|
|
|
|
/* initialize to a font we can compare against */
|
2013-12-01 22:33:53 +01:00
|
|
|
SendMessageA(hwnd, WM_SETFONT, (WPARAM)hFont1, 0);
|
|
|
|
res = SendMessageA(hwnd, MCM_GETMINREQRECT, 0, (LPARAM)&r1);
|
|
|
|
ok(res, "SendMessageA(MCM_GETMINREQRECT) failed\n");
|
2008-10-25 18:04:52 +02:00
|
|
|
|
|
|
|
/* check that setting a larger font results in an larger rect */
|
2013-12-01 22:33:53 +01:00
|
|
|
SendMessageA(hwnd, WM_SETFONT, (WPARAM)hFont2, 0);
|
|
|
|
res = SendMessageA(hwnd, MCM_GETMINREQRECT, 0, (LPARAM)&r2);
|
|
|
|
ok(res, "SendMessageA(MCM_GETMINREQRECT) failed\n");
|
2008-10-25 18:04:52 +02:00
|
|
|
|
|
|
|
OffsetRect(&r1, -r1.left, -r1.top);
|
|
|
|
OffsetRect(&r2, -r2.left, -r2.top);
|
|
|
|
|
|
|
|
ok(r1.bottom < r2.bottom, "Failed to get larger rect with larger font\n");
|
2009-09-25 22:51:04 +02:00
|
|
|
|
|
|
|
DestroyWindow(hwnd);
|
|
|
|
}
|
|
|
|
|
2010-08-04 12:32:51 +02:00
|
|
|
static void test_create(void)
|
2009-09-25 22:51:04 +02:00
|
|
|
{
|
|
|
|
HWND hwnd;
|
|
|
|
|
|
|
|
flush_sequences(sequences, NUM_MSG_SEQUENCES);
|
|
|
|
|
|
|
|
hwnd = create_monthcal_control(0);
|
|
|
|
ok_sequence(sequences, PARENT_SEQ_INDEX, create_monthcal_control_seq, "create monthcal control", TRUE);
|
|
|
|
|
|
|
|
DestroyWindow(hwnd);
|
|
|
|
|
|
|
|
flush_sequences(sequences, NUM_MSG_SEQUENCES);
|
|
|
|
hwnd = create_monthcal_control(MCS_MULTISELECT);
|
|
|
|
ok_sequence(sequences, PARENT_SEQ_INDEX, create_monthcal_multi_sel_style_seq, "create monthcal (multi sel style)", TRUE);
|
|
|
|
DestroyWindow(hwnd);
|
|
|
|
}
|
|
|
|
|
2010-08-04 12:32:51 +02:00
|
|
|
static void test_destroy(void)
|
2009-09-25 22:51:04 +02:00
|
|
|
{
|
|
|
|
HWND hwnd;
|
|
|
|
|
|
|
|
hwnd = create_monthcal_control(0);
|
|
|
|
flush_sequences(sequences, NUM_MSG_SEQUENCES);
|
|
|
|
DestroyWindow(hwnd);
|
|
|
|
ok_sequence(sequences, PARENT_SEQ_INDEX, destroy_monthcal_parent_msgs_seq, "Destroy monthcal (parent msg)", FALSE);
|
|
|
|
ok_sequence(sequences, MONTHCAL_SEQ_INDEX, destroy_monthcal_child_msgs_seq, "Destroy monthcal (child msg)", FALSE);
|
|
|
|
|
|
|
|
/* MCS_MULTISELECT */
|
|
|
|
hwnd = create_monthcal_control(MCS_MULTISELECT);
|
|
|
|
flush_sequences(sequences, NUM_MSG_SEQUENCES);
|
|
|
|
DestroyWindow(hwnd);
|
|
|
|
ok_sequence(sequences, MONTHCAL_SEQ_INDEX, destroy_monthcal_multi_sel_style_seq, "Destroy monthcal (multi sel style)", FALSE);
|
2008-10-25 18:04:52 +02:00
|
|
|
}
|
2007-02-16 08:59:08 +01:00
|
|
|
|
2010-08-04 12:32:51 +02:00
|
|
|
static void test_selrange(void)
|
2009-09-25 23:20:33 +02:00
|
|
|
{
|
|
|
|
HWND hwnd;
|
2009-10-05 18:26:43 +02:00
|
|
|
SYSTEMTIME st, range[2], range2[2];
|
2009-10-03 15:21:59 +02:00
|
|
|
BOOL ret, old_comctl32 = FALSE;
|
2009-09-25 23:20:33 +02:00
|
|
|
|
|
|
|
hwnd = create_monthcal_control(MCS_MULTISELECT);
|
|
|
|
|
|
|
|
/* just after creation selection should start and end today */
|
2013-12-01 22:33:53 +01:00
|
|
|
ret = SendMessageA(hwnd, MCM_GETTODAY, 0, (LPARAM)&st);
|
2009-09-25 23:20:33 +02:00
|
|
|
expect(TRUE, ret);
|
|
|
|
|
2009-10-03 15:21:59 +02:00
|
|
|
memset(range, 0xcc, sizeof(range));
|
2013-12-01 22:33:53 +01:00
|
|
|
ret = SendMessageA(hwnd, MCM_GETSELRANGE, 0, (LPARAM)range);
|
2009-09-25 23:20:33 +02:00
|
|
|
expect(TRUE, ret);
|
|
|
|
expect(st.wYear, range[0].wYear);
|
|
|
|
expect(st.wMonth, range[0].wMonth);
|
|
|
|
expect(st.wDay, range[0].wDay);
|
2009-10-10 22:32:59 +02:00
|
|
|
if (range[0].wDayOfWeek != st.wDayOfWeek)
|
2009-10-03 15:21:59 +02:00
|
|
|
{
|
|
|
|
win_skip("comctl32 <= 4.70 doesn't set some values\n");
|
|
|
|
old_comctl32 = TRUE;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2009-10-10 22:32:59 +02:00
|
|
|
expect(st.wDayOfWeek, range[0].wDayOfWeek);
|
|
|
|
expect(st.wHour, range[0].wHour);
|
|
|
|
expect(st.wMinute, range[0].wMinute);
|
|
|
|
expect(st.wSecond, range[0].wSecond);
|
|
|
|
expect(st.wMilliseconds, range[0].wMilliseconds);
|
2009-10-03 15:21:59 +02:00
|
|
|
}
|
2009-09-25 23:20:33 +02:00
|
|
|
|
|
|
|
expect(st.wYear, range[1].wYear);
|
|
|
|
expect(st.wMonth, range[1].wMonth);
|
|
|
|
expect(st.wDay, range[1].wDay);
|
2009-10-03 15:21:59 +02:00
|
|
|
if (!old_comctl32)
|
|
|
|
{
|
|
|
|
expect(st.wDayOfWeek, range[1].wDayOfWeek);
|
|
|
|
expect(st.wHour, range[1].wHour);
|
|
|
|
expect(st.wMinute, range[1].wMinute);
|
|
|
|
expect(st.wSecond, range[1].wSecond);
|
|
|
|
expect(st.wMilliseconds, range[1].wMilliseconds);
|
|
|
|
}
|
2009-09-25 23:20:33 +02:00
|
|
|
|
2009-10-05 18:26:43 +02:00
|
|
|
/* bounds are swapped if min > max */
|
|
|
|
memset(&range[0], 0, sizeof(range[0]));
|
|
|
|
range[0].wYear = 2009;
|
|
|
|
range[0].wMonth = 10;
|
|
|
|
range[0].wDay = 5;
|
|
|
|
range[1] = range[0];
|
|
|
|
range[1].wDay = 3;
|
|
|
|
|
2013-12-01 22:33:53 +01:00
|
|
|
ret = SendMessageA(hwnd, MCM_SETSELRANGE, 0, (LPARAM)range);
|
2009-10-05 18:26:43 +02:00
|
|
|
expect(TRUE, ret);
|
|
|
|
|
2013-12-01 22:33:53 +01:00
|
|
|
ret = SendMessageA(hwnd, MCM_GETSELRANGE, 0, (LPARAM)range2);
|
2009-10-05 18:26:43 +02:00
|
|
|
expect(TRUE, ret);
|
|
|
|
|
|
|
|
expect(range[1].wYear, range2[0].wYear);
|
|
|
|
expect(range[1].wMonth, range2[0].wMonth);
|
|
|
|
expect(range[1].wDay, range2[0].wDay);
|
|
|
|
expect(6, range2[0].wDayOfWeek);
|
|
|
|
expect(range[1].wHour, range2[0].wHour);
|
|
|
|
expect(range[1].wMinute, range2[0].wMinute);
|
|
|
|
expect(range[1].wSecond, range2[0].wSecond);
|
|
|
|
expect(range[1].wMilliseconds, range2[0].wMilliseconds);
|
|
|
|
|
|
|
|
expect(range[0].wYear, range2[1].wYear);
|
|
|
|
expect(range[0].wMonth, range2[1].wMonth);
|
|
|
|
expect(range[0].wDay, range2[1].wDay);
|
|
|
|
expect(1, range2[1].wDayOfWeek);
|
|
|
|
expect(range[0].wHour, range2[1].wHour);
|
|
|
|
expect(range[0].wMinute, range2[1].wMinute);
|
|
|
|
expect(range[0].wSecond, range2[1].wSecond);
|
|
|
|
expect(range[0].wMilliseconds, range2[1].wMilliseconds);
|
|
|
|
|
2009-10-05 18:29:31 +02:00
|
|
|
/* try with range larger than maximum configured */
|
|
|
|
memset(&range[0], 0, sizeof(range[0]));
|
|
|
|
range[0].wYear = 2009;
|
|
|
|
range[0].wMonth = 10;
|
|
|
|
range[0].wDay = 1;
|
|
|
|
range[1] = range[0];
|
|
|
|
|
2013-12-01 22:33:53 +01:00
|
|
|
ret = SendMessageA(hwnd, MCM_SETSELRANGE, 0, (LPARAM)range);
|
2009-10-05 18:29:31 +02:00
|
|
|
expect(TRUE, ret);
|
|
|
|
|
|
|
|
range[1] = range[0];
|
|
|
|
/* default max. range is 7 days */
|
|
|
|
range[1].wDay = 8;
|
|
|
|
|
2013-12-01 22:33:53 +01:00
|
|
|
ret = SendMessageA(hwnd, MCM_SETSELRANGE, 0, (LPARAM)range);
|
2009-10-05 18:29:31 +02:00
|
|
|
expect(FALSE, ret);
|
|
|
|
|
2013-12-01 22:33:53 +01:00
|
|
|
ret = SendMessageA(hwnd, MCM_GETSELRANGE, 0, (LPARAM)range2);
|
2009-10-05 18:29:31 +02:00
|
|
|
expect(TRUE, ret);
|
|
|
|
|
|
|
|
expect(range[0].wYear, range2[0].wYear);
|
|
|
|
expect(range[0].wMonth, range2[0].wMonth);
|
|
|
|
expect(range[0].wDay, range2[0].wDay);
|
|
|
|
expect(range[0].wYear, range2[1].wYear);
|
|
|
|
expect(range[0].wMonth, range2[1].wMonth);
|
|
|
|
expect(range[0].wDay, range2[1].wDay);
|
|
|
|
|
2009-09-25 23:20:33 +02:00
|
|
|
DestroyWindow(hwnd);
|
|
|
|
}
|
|
|
|
|
2009-10-10 19:04:16 +02:00
|
|
|
static void test_killfocus(void)
|
|
|
|
{
|
|
|
|
HWND hwnd;
|
|
|
|
DWORD style;
|
|
|
|
|
|
|
|
hwnd = create_monthcal_control(0);
|
|
|
|
|
|
|
|
/* make parent invisible */
|
2013-12-01 22:33:53 +01:00
|
|
|
style = GetWindowLongA(parent_wnd, GWL_STYLE);
|
|
|
|
SetWindowLongA(parent_wnd, GWL_STYLE, style & ~WS_VISIBLE);
|
2009-10-10 19:04:16 +02:00
|
|
|
|
2013-12-01 22:33:53 +01:00
|
|
|
SendMessageA(hwnd, WM_KILLFOCUS, (WPARAM)GetDesktopWindow(), 0);
|
2009-10-10 19:04:16 +02:00
|
|
|
|
2013-12-01 22:33:53 +01:00
|
|
|
style = GetWindowLongA(hwnd, GWL_STYLE);
|
2009-10-10 19:04:16 +02:00
|
|
|
ok(style & WS_VISIBLE, "Expected WS_VISIBLE to be set\n");
|
|
|
|
|
2013-12-01 22:33:53 +01:00
|
|
|
style = GetWindowLongA(parent_wnd, GWL_STYLE);
|
|
|
|
SetWindowLongA(parent_wnd, GWL_STYLE, style | WS_VISIBLE);
|
2009-10-10 19:04:16 +02:00
|
|
|
|
|
|
|
DestroyWindow(hwnd);
|
|
|
|
}
|
|
|
|
|
2010-08-04 12:29:27 +02:00
|
|
|
static void test_hittest_v6(void)
|
|
|
|
{
|
|
|
|
MCHITTESTINFO mchit;
|
|
|
|
DWORD ret;
|
|
|
|
HWND hwnd;
|
|
|
|
RECT r;
|
|
|
|
|
|
|
|
hwnd = create_monthcal_control(0);
|
2013-12-01 22:33:53 +01:00
|
|
|
SendMessageA(hwnd, MCM_SETCALENDARBORDER, TRUE, 0);
|
2010-08-04 12:29:27 +02:00
|
|
|
|
2013-12-01 22:33:53 +01:00
|
|
|
SendMessageA(hwnd, MCM_GETMINREQRECT, 0, (LPARAM)&r);
|
2010-08-04 12:29:27 +02:00
|
|
|
/* reserving some area around calendar */
|
|
|
|
MoveWindow(hwnd, 0, 0, r.right * 3 / 2, r.bottom * 3 / 2, FALSE);
|
|
|
|
mchit.cbSize = sizeof(MCHITTESTINFO);
|
|
|
|
mchit.pt.x = mchit.pt.y = 0;
|
|
|
|
mchit.iOffset = -1;
|
|
|
|
mchit.iRow = -1;
|
|
|
|
mchit.iCol = -1;
|
2013-12-01 22:33:53 +01:00
|
|
|
ret = SendMessageA(hwnd, MCM_HITTEST, 0, (LPARAM)&mchit);
|
2011-06-04 23:27:33 +02:00
|
|
|
if (ret == ~0u)
|
2010-08-04 12:29:27 +02:00
|
|
|
{
|
|
|
|
win_skip("Only MCHITTESTINFO_V1 supported\n");
|
|
|
|
DestroyWindow(hwnd);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
todo_wine expect_hex(MCHT_NOWHERE, ret);
|
|
|
|
expect(-1, mchit.iOffset);
|
|
|
|
expect(-1, mchit.iRow);
|
|
|
|
expect(-1, mchit.iCol);
|
|
|
|
|
|
|
|
MoveWindow(hwnd, 0, 0, r.right, r.bottom, FALSE);
|
|
|
|
mchit.pt.x = r.right / 2;
|
|
|
|
mchit.pt.y = r.bottom / 2;
|
|
|
|
mchit.iOffset = -1;
|
2013-12-01 22:33:53 +01:00
|
|
|
ret = SendMessageA(hwnd, MCM_HITTEST, 0, (LPARAM)&mchit);
|
2010-08-04 12:29:27 +02:00
|
|
|
expect_hex(MCHT_CALENDARDATE, ret);
|
2010-08-07 16:07:03 +02:00
|
|
|
expect(0, mchit.iOffset);
|
2010-08-04 12:29:27 +02:00
|
|
|
|
|
|
|
/* over day area */
|
|
|
|
mchit.pt.x = r.right / (7*2);
|
|
|
|
mchit.pt.y = r.bottom / 2;
|
|
|
|
mchit.iOffset = -1;
|
|
|
|
mchit.iCol = mchit.iRow = -1;
|
|
|
|
mchit.uHit = 0;
|
|
|
|
mchit.rc.left = mchit.rc.right = mchit.rc.top = mchit.rc.bottom = -1;
|
2013-12-01 22:33:53 +01:00
|
|
|
ret = SendMessageA(hwnd, MCM_HITTEST, 0, (LPARAM)&mchit);
|
2010-08-04 12:29:27 +02:00
|
|
|
expect_hex(MCHT_CALENDARDATE, ret);
|
|
|
|
expect_hex(MCHT_CALENDARDATE, mchit.uHit);
|
2010-08-07 16:07:03 +02:00
|
|
|
expect(0, mchit.iOffset);
|
|
|
|
expect(2, mchit.iRow);
|
|
|
|
expect(0, mchit.iCol);
|
2010-08-04 12:29:27 +02:00
|
|
|
/* returned a one day rectangle */
|
2010-08-07 16:07:03 +02:00
|
|
|
expect_d(r.right / 7, mchit.rc.right - mchit.rc.left);
|
|
|
|
expect_d(r.bottom / 10, mchit.rc.bottom - mchit.rc.top);
|
2010-08-04 12:29:27 +02:00
|
|
|
|
|
|
|
/* title */
|
|
|
|
mchit.pt.x = 1;
|
|
|
|
mchit.pt.y = 1;
|
|
|
|
mchit.iOffset = -1;
|
|
|
|
mchit.iCol = mchit.iRow = -1;
|
|
|
|
mchit.uHit = 0;
|
|
|
|
mchit.rc.left = mchit.rc.right = mchit.rc.top = mchit.rc.bottom = -1;
|
2013-12-01 22:33:53 +01:00
|
|
|
ret = SendMessageA(hwnd, MCM_HITTEST, 0, (LPARAM)&mchit);
|
2010-08-04 12:29:27 +02:00
|
|
|
expect_hex(MCHT_TITLE, ret);
|
|
|
|
expect_hex(MCHT_TITLE, mchit.uHit);
|
2010-08-07 16:07:03 +02:00
|
|
|
expect(0, mchit.iOffset);
|
2010-08-04 12:29:27 +02:00
|
|
|
expect(-1, mchit.iRow);
|
|
|
|
expect(-1, mchit.iCol);
|
2010-08-07 16:07:03 +02:00
|
|
|
expect(0, mchit.rc.left);
|
|
|
|
expect(0, mchit.rc.top);
|
|
|
|
expect_d(r.right, mchit.rc.right);
|
|
|
|
ok(mchit.rc.bottom > 0, "got %d\n", mchit.rc.bottom);
|
2010-08-04 12:29:27 +02:00
|
|
|
|
|
|
|
/* between two calendars */
|
|
|
|
MoveWindow(hwnd, 0, 0, r.right * 5/2, r.bottom, FALSE);
|
|
|
|
mchit.pt.x = r.right / (5*4);
|
|
|
|
mchit.pt.y = r.bottom / 2;
|
|
|
|
mchit.iOffset = -2;
|
|
|
|
mchit.iCol = mchit.iRow = -2;
|
2010-08-07 16:07:03 +02:00
|
|
|
mchit.uHit = ~0;
|
2010-08-04 12:29:27 +02:00
|
|
|
mchit.rc.left = mchit.rc.right = mchit.rc.top = mchit.rc.bottom = -1;
|
2013-12-01 22:33:53 +01:00
|
|
|
ret = SendMessageA(hwnd, MCM_HITTEST, 0, (LPARAM)&mchit);
|
2010-08-04 12:29:27 +02:00
|
|
|
todo_wine expect_hex(MCHT_NOWHERE, ret);
|
|
|
|
todo_wine expect_hex(MCHT_NOWHERE, mchit.uHit);
|
|
|
|
expect(-2, mchit.iOffset);
|
|
|
|
expect(-2, mchit.iRow);
|
|
|
|
expect(-2, mchit.iCol);
|
|
|
|
todo_wine expect(0, mchit.rc.left);
|
|
|
|
todo_wine expect(0, mchit.rc.top);
|
|
|
|
todo_wine expect_d(r.right * 5/2, mchit.rc.right);
|
|
|
|
todo_wine expect_d(r.bottom, mchit.rc.bottom);
|
|
|
|
|
|
|
|
DestroyWindow(hwnd);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void test_get_set_border(void)
|
|
|
|
{
|
|
|
|
HWND hwnd;
|
|
|
|
DWORD ret;
|
|
|
|
|
|
|
|
hwnd = create_monthcal_control(0);
|
|
|
|
|
|
|
|
/* a non-default value */
|
2013-12-01 22:33:53 +01:00
|
|
|
ret = SendMessageA(hwnd, MCM_SETCALENDARBORDER, TRUE, 10);
|
2010-08-04 12:29:27 +02:00
|
|
|
expect(0, ret);
|
|
|
|
|
2013-12-01 22:33:53 +01:00
|
|
|
ret = SendMessageA(hwnd, MCM_GETCALENDARBORDER, 0, 0);
|
2010-08-04 12:29:27 +02:00
|
|
|
|
|
|
|
if (ret != 10)
|
|
|
|
{
|
|
|
|
skip("MCM_GET/SETCALENDARBORDER not supported\n");
|
|
|
|
DestroyWindow(hwnd);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
expect(10, ret);
|
|
|
|
|
|
|
|
DestroyWindow(hwnd);
|
|
|
|
}
|
|
|
|
|
2011-04-02 12:35:45 +02:00
|
|
|
static void test_MCM_SIZERECTTOMIN(void)
|
|
|
|
{
|
|
|
|
HWND hwnd;
|
|
|
|
DWORD ret;
|
|
|
|
RECT r, r2;
|
|
|
|
|
|
|
|
hwnd = create_monthcal_control(0);
|
|
|
|
|
|
|
|
ret = SendMessageA(hwnd, MCM_GETMINREQRECT, 0, (LPARAM)&r2);
|
|
|
|
if (ret == 0)
|
|
|
|
{
|
|
|
|
win_skip("Message MCM_GETMINREQRECT unsupported. Skipping.\n");
|
|
|
|
DestroyWindow(hwnd);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
ret = SendMessageA(hwnd, MCM_SIZERECTTOMIN, 0, 0);
|
|
|
|
ok(ret == 0, "got %d\n", ret);
|
|
|
|
|
|
|
|
r.left = r.right = r.top = r.bottom = 0;
|
|
|
|
ret = SendMessageA(hwnd, MCM_SIZERECTTOMIN, 0, (LPARAM)&r);
|
|
|
|
if (ret == 0)
|
|
|
|
{
|
|
|
|
skip("Message MCM_SIZERECTTOMIN unsupported. Skipping.\n");
|
|
|
|
DestroyWindow(hwnd);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
ok(ret == 1, "got %d\n", ret);
|
|
|
|
ok(r.left == 0 && r.right > 0, "got %d, %d\n", r.left, r.right);
|
|
|
|
|
|
|
|
r = r2;
|
|
|
|
ret = SendMessageA(hwnd, MCM_SIZERECTTOMIN, 0, (LPARAM)&r);
|
|
|
|
ok(ret == 1, "got %d\n", ret);
|
|
|
|
|
|
|
|
r2.right = (r2.right - r2.left) * 3;
|
|
|
|
r2.bottom = (r2.bottom - r2.top) * 3;
|
|
|
|
r2.left = r2.top = 0;
|
|
|
|
ret = SendMessageA(hwnd, MCM_SIZERECTTOMIN, 0, (LPARAM)&r2);
|
|
|
|
ok(ret == 1, "got %d\n", ret);
|
|
|
|
|
|
|
|
DestroyWindow(hwnd);
|
|
|
|
}
|
|
|
|
|
2011-09-20 07:57:28 +02:00
|
|
|
static void test_MCM_GETCALENDARCOUNT(void)
|
|
|
|
{
|
|
|
|
HWND hwnd;
|
|
|
|
DWORD ret;
|
|
|
|
|
|
|
|
hwnd = create_monthcal_control(0);
|
|
|
|
|
|
|
|
ret = SendMessageA(hwnd, MCM_GETCALENDARCOUNT, 0, 0);
|
|
|
|
if (ret == 0)
|
|
|
|
{
|
|
|
|
win_skip("Message MCM_GETCALENDARCOUNT unsupported. Skipping.\n");
|
|
|
|
DestroyWindow(hwnd);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2011-09-22 15:56:40 +02:00
|
|
|
expect(2, ret);
|
2011-09-20 07:57:28 +02:00
|
|
|
|
|
|
|
DestroyWindow(hwnd);
|
|
|
|
}
|
|
|
|
|
2011-09-23 10:25:35 +02:00
|
|
|
static void test_daystate(void)
|
|
|
|
{
|
|
|
|
MONTHDAYSTATE state[4];
|
|
|
|
DWORD ret, style;
|
|
|
|
HWND hwnd;
|
2011-10-03 16:31:18 +02:00
|
|
|
RECT r;
|
2011-09-23 10:25:35 +02:00
|
|
|
|
|
|
|
/* without MCS_DAYSTATE */
|
|
|
|
hwnd = create_monthcal_control(0);
|
|
|
|
|
2013-12-01 22:33:53 +01:00
|
|
|
ret = SendMessageA(hwnd, MCM_GETMINREQRECT, 0, (LPARAM)&r);
|
2011-10-03 16:31:18 +02:00
|
|
|
expect(TRUE, ret);
|
|
|
|
|
|
|
|
/* resize control to display two Calendars */
|
|
|
|
MoveWindow(hwnd, 0, 0, r.right, (5/2)*r.bottom, FALSE);
|
|
|
|
|
2011-09-23 10:25:35 +02:00
|
|
|
ret = SendMessageA(hwnd, MCM_GETMONTHRANGE, GMR_DAYSTATE, 0);
|
|
|
|
expect(4, ret);
|
|
|
|
|
|
|
|
ret = SendMessageA(hwnd, MCM_SETDAYSTATE, 4, (LPARAM)&state);
|
|
|
|
expect(0, ret);
|
|
|
|
|
|
|
|
ret = SendMessageA(hwnd, MCM_SETDAYSTATE, 2, (LPARAM)&state);
|
|
|
|
expect(0, ret);
|
|
|
|
|
|
|
|
ret = SendMessageA(hwnd, MCM_SETDAYSTATE, 0, 0);
|
|
|
|
expect(0, ret);
|
|
|
|
|
|
|
|
/* try to switch on */
|
|
|
|
SetWindowLongA(hwnd, GWL_STYLE, GetWindowLongA(hwnd, GWL_STYLE) | MCS_DAYSTATE);
|
|
|
|
style = GetWindowLongA(hwnd, GWL_STYLE);
|
|
|
|
ok((style & MCS_DAYSTATE) == 0, "got 0x%08x\n", style);
|
|
|
|
|
|
|
|
DestroyWindow(hwnd);
|
|
|
|
|
|
|
|
/* with MCS_DAYSTATE */
|
|
|
|
hwnd = create_monthcal_control(MCS_DAYSTATE);
|
|
|
|
|
|
|
|
ret = SendMessageA(hwnd, MCM_GETMONTHRANGE, GMR_DAYSTATE, 0);
|
|
|
|
expect(4, ret);
|
|
|
|
|
|
|
|
ret = SendMessageA(hwnd, MCM_SETDAYSTATE, 4, (LPARAM)&state);
|
|
|
|
expect(1, ret);
|
|
|
|
|
|
|
|
ret = SendMessageA(hwnd, MCM_SETDAYSTATE, 2, (LPARAM)&state);
|
|
|
|
expect(0, ret);
|
|
|
|
|
|
|
|
ret = SendMessageA(hwnd, MCM_SETDAYSTATE, 0, 0);
|
|
|
|
expect(0, ret);
|
|
|
|
|
|
|
|
/* try to switch off */
|
|
|
|
SetWindowLongA(hwnd, GWL_STYLE, GetWindowLongA(hwnd, GWL_STYLE) & ~MCS_DAYSTATE);
|
|
|
|
style = GetWindowLongA(hwnd, GWL_STYLE);
|
|
|
|
ok((style & MCS_DAYSTATE) == MCS_DAYSTATE, "got 0x%08x\n", style);
|
|
|
|
|
|
|
|
DestroyWindow(hwnd);
|
|
|
|
}
|
|
|
|
|
2012-08-17 08:17:02 +02:00
|
|
|
static void test_sel_notify(void)
|
|
|
|
{
|
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
DWORD val;
|
|
|
|
const char* name;
|
|
|
|
} Monthcal_style;
|
|
|
|
|
|
|
|
HWND hwnd;
|
|
|
|
RECT rc;
|
|
|
|
MCHITTESTINFO mchit = {sizeof(MCHITTESTINFO)};
|
|
|
|
SYSTEMTIME st;
|
|
|
|
Monthcal_style styles[] = {
|
|
|
|
{MCS_NOTODAY, "MCS_NOTODAY"},
|
|
|
|
{MCS_NOTODAY | MCS_MULTISELECT, "MCS_NOTODAY | MCS_MULTISELECT"},
|
|
|
|
{MCS_DAYSTATE, "MCS_DAYSTATE"},
|
|
|
|
{MCS_DAYSTATE | MCS_MULTISELECT, "MCS_DAYSTATE | MCS_MULTISELECT"}
|
|
|
|
};
|
|
|
|
int i;
|
|
|
|
|
|
|
|
for(i = 0; i < sizeof styles / sizeof styles[0]; i++)
|
|
|
|
{
|
|
|
|
hwnd = create_monthcal_control(styles[i].val);
|
2013-12-01 22:33:53 +01:00
|
|
|
SetWindowLongPtrA(hwnd, GWLP_ID, SEL_NOTIFY_TEST_ID);
|
|
|
|
SendMessageA(hwnd, MCM_GETMINREQRECT, 0, (LPARAM)&rc);
|
2012-08-17 08:17:02 +02:00
|
|
|
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;
|
2013-12-01 22:33:53 +01:00
|
|
|
SendMessageA(hwnd, MCM_HITTEST, 0, (LPARAM)&mchit);
|
|
|
|
SendMessageA(hwnd, MCM_GETCURSEL, 0, (LPARAM)&st);
|
2012-08-17 08:17:02 +02:00
|
|
|
while(st.wDay == mchit.st.wDay) /* Ensure that mchit.pt points to unselected day */
|
|
|
|
{
|
|
|
|
mchit.pt.y++;
|
2013-12-01 22:33:53 +01:00
|
|
|
SendMessageA(hwnd, MCM_HITTEST, 0, (LPARAM)&mchit);
|
2012-08-17 08:17:02 +02:00
|
|
|
}
|
2013-12-01 22:33:53 +01:00
|
|
|
SendMessageA(hwnd, WM_LBUTTONDOWN, 0, MAKELPARAM(mchit.pt.x, mchit.pt.y));
|
|
|
|
SendMessageA(hwnd, WM_LBUTTONUP, 0, MAKELPARAM(mchit.pt.x, mchit.pt.y));
|
2012-08-17 08:17:02 +02:00
|
|
|
DestroyWindow(hwnd);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-02-06 20:58:48 +01:00
|
|
|
START_TEST(monthcal)
|
|
|
|
{
|
2008-02-05 11:59:47 +01:00
|
|
|
BOOL (WINAPI *pInitCommonControlsEx)(const INITCOMMONCONTROLSEX*);
|
|
|
|
INITCOMMONCONTROLSEX iccex;
|
2010-08-04 12:29:27 +02:00
|
|
|
HMODULE hComctl32;
|
|
|
|
|
|
|
|
ULONG_PTR ctx_cookie;
|
|
|
|
HANDLE hCtx;
|
2008-02-05 11:59:47 +01:00
|
|
|
|
|
|
|
hComctl32 = GetModuleHandleA("comctl32.dll");
|
|
|
|
pInitCommonControlsEx = (void*)GetProcAddress(hComctl32, "InitCommonControlsEx");
|
|
|
|
if (!pInitCommonControlsEx)
|
|
|
|
{
|
|
|
|
skip("InitCommonControlsEx() is missing. Skipping the tests\n");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
iccex.dwSize = sizeof(iccex);
|
|
|
|
iccex.dwICC = ICC_DATE_CLASSES;
|
|
|
|
pInitCommonControlsEx(&iccex);
|
|
|
|
|
2006-02-06 20:58:48 +01:00
|
|
|
test_monthcal();
|
2007-02-16 08:59:08 +01:00
|
|
|
|
2007-03-16 08:32:49 +01:00
|
|
|
init_msg_sequences(sequences, NUM_MSG_SEQUENCES);
|
|
|
|
|
|
|
|
parent_wnd = create_parent_window();
|
|
|
|
|
2010-08-04 12:32:51 +02:00
|
|
|
test_create();
|
|
|
|
test_destroy();
|
|
|
|
test_color();
|
|
|
|
test_currdate();
|
|
|
|
test_firstDay();
|
|
|
|
test_unicode();
|
|
|
|
test_today();
|
|
|
|
test_scroll();
|
|
|
|
test_monthrange();
|
|
|
|
test_hittest();
|
|
|
|
test_todaylink();
|
|
|
|
test_size();
|
|
|
|
test_maxselday();
|
|
|
|
test_selrange();
|
2009-10-10 19:04:16 +02:00
|
|
|
test_killfocus();
|
2011-09-23 10:25:35 +02:00
|
|
|
test_daystate();
|
2012-08-17 08:17:02 +02:00
|
|
|
test_sel_notify();
|
2007-03-16 08:32:49 +01:00
|
|
|
|
2010-08-04 12:29:27 +02:00
|
|
|
if (!load_v6_module(&ctx_cookie, &hCtx))
|
|
|
|
{
|
|
|
|
DestroyWindow(parent_wnd);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
test_hittest_v6();
|
|
|
|
test_get_set_border();
|
2011-04-02 12:35:45 +02:00
|
|
|
test_MCM_SIZERECTTOMIN();
|
2011-09-20 07:57:28 +02:00
|
|
|
test_MCM_GETCALENDARCOUNT();
|
2010-08-04 12:29:27 +02:00
|
|
|
|
|
|
|
unload_v6_module(ctx_cookie, hCtx);
|
|
|
|
|
2007-03-16 08:32:49 +01:00
|
|
|
DestroyWindow(parent_wnd);
|
2006-02-06 20:58:48 +01:00
|
|
|
}
|