2 * comctl32 month calendar unit tests
4 * Copyright (C) 2006 Vitaliy Margolen
5 * Copyright (C) 2007 Farshad Agah
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
30 #include "wine/test.h"
35 #define expect(expected, got) ok(expected == got, "Expected %d, got %d\n", expected, got);
36 #define expect_hex(expected, got) ok(expected == got, "Expected %x, got %x\n", expected, got);
38 #define NUM_MSG_SEQUENCES 2
39 #define PARENT_SEQ_INDEX 0
40 #define MONTHCAL_SEQ_INDEX 1
47 static struct msg_sequence
*sequences
[NUM_MSG_SEQUENCES
];
49 static HWND parent_wnd
;
51 static const struct message create_parent_window_seq
[] = {
52 { WM_GETMINMAXINFO
, sent
},
53 { WM_NCCREATE
, sent
},
54 { WM_NCCALCSIZE
, sent
|wparam
, 0 },
56 { WM_SHOWWINDOW
, sent
|wparam
, 1 },
57 { WM_WINDOWPOSCHANGING
, sent
|wparam
, 0 },
58 { WM_QUERYNEWPALETTE
, sent
|optional
},
59 { WM_WINDOWPOSCHANGING
, sent
|wparam
|optional
, 0 },
60 { WM_WINDOWPOSCHANGED
, sent
|optional
},
61 { WM_ACTIVATEAPP
, sent
|wparam
, 1 },
62 { WM_NCACTIVATE
, sent
},
63 { WM_ACTIVATE
, sent
|wparam
, 1 },
64 { WM_IME_SETCONTEXT
, sent
|wparam
|defwinproc
|optional
, 1 },
65 { WM_IME_NOTIFY
, sent
|defwinproc
|optional
},
66 { WM_SETFOCUS
, sent
|wparam
|defwinproc
, 0 },
67 /* Win9x adds SWP_NOZORDER below */
68 { WM_WINDOWPOSCHANGED
, sent
, /*|wparam, SWP_SHOWWINDOW|SWP_NOSIZE|SWP_NOMOVE|SWP_NOCLIENTSIZE|SWP_NOCLIENTMOVE*/ },
69 { WM_NCCALCSIZE
, sent
|wparam
|optional
, 1 },
75 static const struct message create_monthcal_control_seq
[] = {
76 { WM_NOTIFYFORMAT
, sent
|lparam
, 0, NF_QUERY
},
77 { WM_QUERYUISTATE
, sent
|optional
},
79 { WM_PARENTNOTIFY
, sent
|wparam
, WM_CREATE
},
83 static const struct message create_monthcal_multi_sel_style_seq
[] = {
84 { WM_NOTIFYFORMAT
, sent
|lparam
, 0, NF_QUERY
},
85 { WM_QUERYUISTATE
, sent
|optional
},
87 { WM_PARENTNOTIFY
, sent
},
91 static const struct message monthcal_color_seq
[] = {
92 { MCM_GETCOLOR
, sent
|wparam
|lparam
, MCSC_BACKGROUND
, 0},
93 { MCM_SETCOLOR
, sent
|wparam
|lparam
, MCSC_BACKGROUND
, RGB(0,0,0)},
94 { MCM_GETCOLOR
, sent
|wparam
|lparam
, MCSC_BACKGROUND
, 0},
95 { MCM_SETCOLOR
, sent
|wparam
|lparam
, MCSC_BACKGROUND
, RGB(255,255,255)},
96 { MCM_GETCOLOR
, sent
|wparam
|lparam
, MCSC_BACKGROUND
, 0},
98 { MCM_GETCOLOR
, sent
|wparam
|lparam
, MCSC_MONTHBK
, 0},
99 { MCM_SETCOLOR
, sent
|wparam
|lparam
, MCSC_MONTHBK
, RGB(0,0,0)},
100 { MCM_GETCOLOR
, sent
|wparam
|lparam
, MCSC_MONTHBK
, 0},
101 { MCM_SETCOLOR
, sent
|wparam
|lparam
, MCSC_MONTHBK
, RGB(255,255,255)},
102 { MCM_GETCOLOR
, sent
|wparam
|lparam
, MCSC_MONTHBK
, 0},
104 { MCM_GETCOLOR
, sent
|wparam
|lparam
, MCSC_TEXT
, 0},
105 { MCM_SETCOLOR
, sent
|wparam
|lparam
, MCSC_TEXT
, RGB(0,0,0)},
106 { MCM_GETCOLOR
, sent
|wparam
|lparam
, MCSC_TEXT
, 0},
107 { MCM_SETCOLOR
, sent
|wparam
|lparam
, MCSC_TEXT
, RGB(255,255,255)},
108 { MCM_GETCOLOR
, sent
|wparam
|lparam
, MCSC_TEXT
, 0},
110 { MCM_GETCOLOR
, sent
|wparam
|lparam
, MCSC_TITLEBK
, 0},
111 { MCM_SETCOLOR
, sent
|wparam
|lparam
, MCSC_TITLEBK
, RGB(0,0,0)},
112 { MCM_GETCOLOR
, sent
|wparam
|lparam
, MCSC_TITLEBK
, 0},
113 { MCM_SETCOLOR
, sent
|wparam
|lparam
, MCSC_TITLEBK
, RGB(255,255,255)},
114 { MCM_GETCOLOR
, sent
|wparam
|lparam
, MCSC_TITLEBK
, 0},
116 { MCM_GETCOLOR
, sent
|wparam
|lparam
, MCSC_TITLETEXT
, 0},
117 { MCM_SETCOLOR
, sent
|wparam
|lparam
, MCSC_TITLETEXT
, RGB(0,0,0)},
118 { MCM_GETCOLOR
, sent
|wparam
|lparam
, MCSC_TITLETEXT
, 0},
119 { MCM_SETCOLOR
, sent
|wparam
|lparam
, MCSC_TITLETEXT
, RGB(255,255,255)},
120 { MCM_GETCOLOR
, sent
|wparam
|lparam
, MCSC_TITLETEXT
, 0},
122 { MCM_GETCOLOR
, sent
|wparam
|lparam
, MCSC_TRAILINGTEXT
, 0},
123 { MCM_SETCOLOR
, sent
|wparam
|lparam
, MCSC_TRAILINGTEXT
, RGB(0,0,0)},
124 { MCM_GETCOLOR
, sent
|wparam
|lparam
, MCSC_TRAILINGTEXT
, 0},
125 { MCM_SETCOLOR
, sent
|wparam
|lparam
, MCSC_TRAILINGTEXT
, RGB(255,255,255)},
126 { MCM_GETCOLOR
, sent
|wparam
|lparam
, MCSC_TRAILINGTEXT
, 0},
130 static const struct message monthcal_curr_date_seq
[] = {
131 { MCM_SETCURSEL
, sent
|wparam
, 0},
132 { WM_PAINT
, sent
|wparam
|lparam
|defwinproc
, 0, 0},
133 { MCM_SETCURSEL
, sent
|wparam
, 0},
134 { MCM_SETCURSEL
, sent
|wparam
, 0},
135 { MCM_GETCURSEL
, sent
|wparam
, 0},
136 { MCM_GETCURSEL
, sent
|wparam
|lparam
, 0, 0},
140 static const struct message monthcal_first_day_seq
[] = {
141 { MCM_GETFIRSTDAYOFWEEK
, sent
|wparam
|lparam
, 0, 0},
143 { MCM_SETFIRSTDAYOFWEEK
, sent
|wparam
|lparam
, 0, -5},
144 { MCM_GETFIRSTDAYOFWEEK
, sent
|wparam
|lparam
, 0, 0},
146 { MCM_SETFIRSTDAYOFWEEK
, sent
|wparam
|lparam
, 0, -4},
147 { MCM_GETFIRSTDAYOFWEEK
, sent
|wparam
|lparam
, 0, 0},
149 { MCM_SETFIRSTDAYOFWEEK
, sent
|wparam
|lparam
, 0, -3},
150 { MCM_GETFIRSTDAYOFWEEK
, sent
|wparam
|lparam
, 0, 0},
152 { MCM_SETFIRSTDAYOFWEEK
, sent
|wparam
|lparam
, 0, -2},
153 { MCM_GETFIRSTDAYOFWEEK
, sent
|wparam
|lparam
, 0, 0},
155 { MCM_SETFIRSTDAYOFWEEK
, sent
|wparam
|lparam
, 0, -1},
156 { MCM_GETFIRSTDAYOFWEEK
, sent
|wparam
|lparam
, 0, 0},
158 { MCM_SETFIRSTDAYOFWEEK
, sent
|wparam
|lparam
, 0, 0},
159 { MCM_GETFIRSTDAYOFWEEK
, sent
|wparam
|lparam
, 0, 0},
161 { MCM_SETFIRSTDAYOFWEEK
, sent
|wparam
|lparam
, 0, 1},
162 { MCM_GETFIRSTDAYOFWEEK
, sent
|wparam
|lparam
, 0, 0},
164 { MCM_SETFIRSTDAYOFWEEK
, sent
|wparam
|lparam
, 0, 2},
165 { MCM_GETFIRSTDAYOFWEEK
, sent
|wparam
|lparam
, 0, 0},
167 { MCM_SETFIRSTDAYOFWEEK
, sent
|wparam
|lparam
, 0, 3},
168 { MCM_GETFIRSTDAYOFWEEK
, sent
|wparam
|lparam
, 0, 0},
170 { MCM_SETFIRSTDAYOFWEEK
, sent
|wparam
|lparam
, 0, 4},
171 { MCM_GETFIRSTDAYOFWEEK
, sent
|wparam
|lparam
, 0, 0},
173 { MCM_SETFIRSTDAYOFWEEK
, sent
|wparam
|lparam
, 0, 5},
174 { MCM_GETFIRSTDAYOFWEEK
, sent
|wparam
|lparam
, 0, 0},
176 { MCM_SETFIRSTDAYOFWEEK
, sent
|wparam
|lparam
, 0, 6},
177 { MCM_GETFIRSTDAYOFWEEK
, sent
|wparam
|lparam
, 0, 0},
179 { MCM_SETFIRSTDAYOFWEEK
, sent
|wparam
|lparam
, 0, 7},
180 { MCM_GETFIRSTDAYOFWEEK
, sent
|wparam
|lparam
, 0, 0},
182 { MCM_SETFIRSTDAYOFWEEK
, sent
|wparam
|lparam
, 0, 8},
183 { MCM_GETFIRSTDAYOFWEEK
, sent
|wparam
|lparam
, 0, 0},
185 { MCM_SETFIRSTDAYOFWEEK
, sent
|wparam
|lparam
, 0, 9},
186 { MCM_GETFIRSTDAYOFWEEK
, sent
|wparam
|lparam
, 0, 0},
188 { MCM_SETFIRSTDAYOFWEEK
, sent
|wparam
|lparam
, 0, 10},
189 { MCM_GETFIRSTDAYOFWEEK
, sent
|wparam
|lparam
, 0, 0},
191 { MCM_SETFIRSTDAYOFWEEK
, sent
|wparam
|lparam
, 0, 11},
192 { MCM_GETFIRSTDAYOFWEEK
, sent
|wparam
|lparam
, 0, 0},
196 static const struct message monthcal_unicode_seq
[] = {
197 { MCM_GETUNICODEFORMAT
, sent
|wparam
|lparam
, 0, 0},
198 { MCM_SETUNICODEFORMAT
, sent
|wparam
|lparam
, 1, 0},
199 { MCM_GETUNICODEFORMAT
, sent
|wparam
|lparam
, 0, 0},
200 { MCM_SETUNICODEFORMAT
, sent
|wparam
|lparam
, 0, 0},
201 { MCM_GETUNICODEFORMAT
, sent
|wparam
|lparam
, 0, 0},
202 { MCM_SETUNICODEFORMAT
, sent
|wparam
|lparam
, 1, 0},
206 static const struct message monthcal_hit_test_seq
[] = {
207 { MCM_SETCURSEL
, sent
|wparam
, 0},
208 { WM_PAINT
, sent
|wparam
|lparam
|defwinproc
, 0, 0},
209 { MCM_HITTEST
, sent
|wparam
, 0},
210 { MCM_HITTEST
, sent
|wparam
, 0},
211 { MCM_HITTEST
, sent
|wparam
, 0},
212 { MCM_HITTEST
, sent
|wparam
, 0},
213 { MCM_HITTEST
, sent
|wparam
, 0},
214 { MCM_HITTEST
, sent
|wparam
, 0},
215 { MCM_HITTEST
, sent
|wparam
, 0},
216 { MCM_HITTEST
, sent
|wparam
, 0},
217 { MCM_HITTEST
, sent
|wparam
, 0},
218 { MCM_HITTEST
, sent
|wparam
, 0},
222 static const struct message monthcal_todaylink_seq
[] = {
223 { MCM_HITTEST
, sent
|wparam
, 0},
224 { MCM_SETTODAY
, sent
|wparam
, 0},
225 { WM_PAINT
, sent
|wparam
|lparam
|defwinproc
, 0, 0},
226 { MCM_GETTODAY
, sent
|wparam
, 0},
227 { WM_LBUTTONDOWN
, sent
|wparam
|lparam
, MK_LBUTTON
, MAKELONG(70, 370)},
228 { WM_CAPTURECHANGED
, sent
|wparam
|lparam
|defwinproc
, 0, 0},
229 { WM_PAINT
, sent
|wparam
|lparam
|defwinproc
, 0, 0},
230 { MCM_GETCURSEL
, sent
|wparam
, 0},
234 static const struct message monthcal_today_seq
[] = {
235 { MCM_SETTODAY
, sent
|wparam
, 0},
236 { WM_PAINT
, sent
|wparam
|lparam
|defwinproc
, 0, 0},
237 { MCM_GETTODAY
, sent
|wparam
, 0},
238 { MCM_SETTODAY
, sent
|wparam
, 0},
239 { WM_PAINT
, sent
|wparam
|lparam
|defwinproc
, 0, 0},
240 { MCM_GETTODAY
, sent
|wparam
, 0},
244 static const struct message monthcal_scroll_seq
[] = {
245 { MCM_SETMONTHDELTA
, sent
|wparam
|lparam
, 2, 0},
246 { MCM_SETMONTHDELTA
, sent
|wparam
|lparam
, 3, 0},
247 { MCM_GETMONTHDELTA
, sent
|wparam
|lparam
, 0, 0},
248 { MCM_SETMONTHDELTA
, sent
|wparam
|lparam
, 12, 0},
249 { MCM_GETMONTHDELTA
, sent
|wparam
|lparam
, 0, 0},
250 { MCM_SETMONTHDELTA
, sent
|wparam
|lparam
, 15, 0},
251 { MCM_GETMONTHDELTA
, sent
|wparam
|lparam
, 0, 0},
252 { MCM_SETMONTHDELTA
, sent
|wparam
|lparam
, -5, 0},
253 { MCM_GETMONTHDELTA
, sent
|wparam
|lparam
, 0, 0},
257 static const struct message monthcal_monthrange_seq
[] = {
258 { MCM_GETMONTHRANGE
, sent
|wparam
, GMR_VISIBLE
},
259 { MCM_GETMONTHRANGE
, sent
|wparam
, GMR_DAYSTATE
},
263 static const struct message monthcal_max_sel_day_seq
[] = {
264 { MCM_SETMAXSELCOUNT
, sent
|wparam
|lparam
, 5, 0},
265 { MCM_GETMAXSELCOUNT
, sent
|wparam
|lparam
, 0, 0},
266 { MCM_SETMAXSELCOUNT
, sent
|wparam
|lparam
, 15, 0},
267 { MCM_GETMAXSELCOUNT
, sent
|wparam
|lparam
, 0, 0},
268 { MCM_SETMAXSELCOUNT
, sent
|wparam
|lparam
, -1, 0},
269 { MCM_GETMAXSELCOUNT
, sent
|wparam
|lparam
, 0, 0},
273 /* expected message sequence for parent*/
274 static const struct message destroy_monthcal_parent_msgs_seq
[] = {
275 { WM_PARENTNOTIFY
, sent
|wparam
, WM_DESTROY
},
279 /* expected message sequence for child*/
280 static const struct message destroy_monthcal_child_msgs_seq
[] = {
281 { 0x0090, sent
|optional
}, /* Vista */
282 { WM_SHOWWINDOW
, sent
|wparam
|lparam
, 0, 0},
283 { WM_WINDOWPOSCHANGING
, sent
|wparam
, 0},
284 { WM_WINDOWPOSCHANGED
, sent
|wparam
, 0},
285 { WM_DESTROY
, sent
|wparam
|lparam
, 0, 0},
286 { WM_NCDESTROY
, sent
|wparam
|lparam
, 0, 0},
290 static const struct message destroy_monthcal_multi_sel_style_seq
[] = {
291 { 0x0090, sent
|optional
}, /* Vista */
292 { WM_SHOWWINDOW
, sent
|wparam
|lparam
, 0, 0},
293 { WM_WINDOWPOSCHANGING
, sent
|wparam
, 0},
294 { WM_WINDOWPOSCHANGED
, sent
|wparam
, 0},
295 { WM_DESTROY
, sent
|wparam
|lparam
, 0, 0},
296 { WM_NCDESTROY
, sent
|wparam
|lparam
, 0, 0},
300 /* expected message sequence for parent window*/
301 static const struct message destroy_parent_seq
[] = {
302 { 0x0090, sent
|optional
}, /* Vista */
303 { WM_WINDOWPOSCHANGING
, sent
|wparam
, 0},
304 { WM_WINDOWPOSCHANGED
, sent
|wparam
, 0},
305 { WM_IME_SETCONTEXT
, sent
|wparam
|optional
, 0},
306 { WM_IME_NOTIFY
, sent
|wparam
|lparam
|defwinproc
|optional
, 1, 0},
307 { WM_NCACTIVATE
, sent
|wparam
|optional
, 0},
308 { WM_ACTIVATE
, sent
|wparam
|optional
, 0},
309 { WM_NCACTIVATE
, sent
|wparam
|lparam
|optional
, 0, 0},
310 { WM_ACTIVATE
, sent
|wparam
|lparam
|optional
, 0, 0},
311 { WM_ACTIVATEAPP
, sent
|wparam
|optional
, 0},
312 { WM_KILLFOCUS
, sent
|wparam
|lparam
|optional
, 0, 0},
313 { WM_IME_SETCONTEXT
, sent
|wparam
|optional
, 0},
314 { WM_IME_NOTIFY
, sent
|wparam
|lparam
|defwinproc
|optional
, 1, 0},
315 { WM_DESTROY
, sent
|wparam
|lparam
, 0, 0},
316 { WM_NCDESTROY
, sent
|wparam
|lparam
, 0, 0},
320 static void test_monthcal(void)
323 SYSTEMTIME st
[2], st1
[2], today
;
324 int res
, month_range
;
327 hwnd
= CreateWindowA(MONTHCAL_CLASSA
, "MonthCal", WS_POPUP
| WS_VISIBLE
, CW_USEDEFAULT
,
328 0, 300, 300, 0, 0, NULL
, NULL
);
329 ok(hwnd
!= NULL
, "Failed to create MonthCal\n");
331 /* test range just after creation */
332 memset(&st
, 0xcc, sizeof(st
));
333 limits
= SendMessage(hwnd
, MCM_GETRANGE
, 0, (LPARAM
)st
);
335 broken(limits
== GDTR_MIN
), /* comctl32 <= 4.70 */
336 "No limits should be set (%d)\n", limits
);
337 if (limits
== GDTR_MIN
)
339 win_skip("comctl32 <= 4.70 is broken\n");
344 ok(0 == st
[0].wYear
||
345 broken(1752 == st
[0].wYear
), /* comctl32 <= 4.72 */
346 "Expected 0, got %d\n", st
[0].wYear
);
347 ok(0 == st
[0].wMonth
||
348 broken(9 == st
[0].wMonth
), /* comctl32 <= 4.72 */
349 "Expected 0, got %d\n", st
[0].wMonth
);
350 ok(0 == st
[0].wDay
||
351 broken(14 == st
[0].wDay
), /* comctl32 <= 4.72 */
352 "Expected 0, got %d\n", st
[0].wDay
);
353 expect(0, st
[0].wDayOfWeek
);
354 expect(0, st
[0].wHour
);
355 expect(0, st
[0].wMinute
);
356 expect(0, st
[0].wSecond
);
357 expect(0, st
[0].wMilliseconds
);
359 expect(0, st
[1].wYear
);
360 expect(0, st
[1].wMonth
);
361 expect(0, st
[1].wDay
);
362 expect(0, st
[1].wDayOfWeek
);
363 expect(0, st
[1].wHour
);
364 expect(0, st
[1].wMinute
);
365 expect(0, st
[1].wSecond
);
366 expect(0, st
[1].wMilliseconds
);
368 GetSystemTime(&st
[0]);
371 SendMessage(hwnd
, MCM_GETTODAY
, 0, (LPARAM
)&today
);
373 /* Invalid date/time */
375 /* Time should not matter */
376 st
[1].wHour
= st
[1].wMinute
= st
[1].wSecond
= 70;
377 st
[1].wMilliseconds
= 1200;
378 ok(SendMessage(hwnd
, MCM_SETRANGE
, GDTR_MAX
, (LPARAM
)st
), "Failed to set MAX limit\n");
379 /* invalid timestamp is written back with today data and msecs untouched */
380 expect(today
.wHour
, st
[1].wHour
);
381 expect(today
.wMinute
, st
[1].wMinute
);
382 expect(today
.wSecond
, st
[1].wSecond
);
383 expect(1200, st
[1].wMilliseconds
);
385 ok(SendMessage(hwnd
, MCM_GETRANGE
, 0, (LPARAM
)st1
) == GDTR_MAX
, "No limits should be set\n");
386 ok(st1
[0].wYear
!= 2000, "Lover limit changed\n");
387 /* invalid timestamp should be replaced with today data, except msecs */
388 expect(today
.wHour
, st1
[1].wHour
);
389 expect(today
.wMinute
, st1
[1].wMinute
);
390 expect(today
.wSecond
, st1
[1].wSecond
);
391 expect(1200, st1
[1].wMilliseconds
);
393 /* Invalid date/time with invalid milliseconds only */
394 GetSystemTime(&st
[0]);
396 /* Time should not matter */
397 st
[1].wMilliseconds
= 1200;
398 ok(SendMessage(hwnd
, MCM_SETRANGE
, GDTR_MAX
, (LPARAM
)st
), "Failed to set MAX limit\n");
399 /* invalid milliseconds field doesn't lead to invalid timestamp */
400 expect(st
[0].wHour
, st
[1].wHour
);
401 expect(st
[0].wMinute
, st
[1].wMinute
);
402 expect(st
[0].wSecond
, st
[1].wSecond
);
403 expect(1200, st
[1].wMilliseconds
);
405 GetSystemTime(&st
[0]);
408 ok(!SendMessage(hwnd
, MCM_SETRANGE
, GDTR_MIN
| GDTR_MAX
, (LPARAM
)st
), "Should have failed to set limits\n");
409 ok(SendMessage(hwnd
, MCM_GETRANGE
, 0, (LPARAM
)st1
) == GDTR_MAX
, "No limits should be set\n");
410 ok(st1
[0].wYear
!= 2000, "Lover limit changed\n");
411 ok(!SendMessage(hwnd
, MCM_SETRANGE
, GDTR_MAX
, (LPARAM
)st
), "Should have failed to set MAX limit\n");
412 ok(SendMessage(hwnd
, MCM_GETRANGE
, 0, (LPARAM
)st1
) == GDTR_MAX
, "No limits should be set\n");
413 ok(st1
[0].wYear
!= 2000, "Lover limit changed\n");
415 GetSystemTime(&st
[0]);
420 month_range
= SendMessage(hwnd
, MCM_GETMONTHRANGE
, GMR_VISIBLE
, (LPARAM
)st1
);
422 ok(SendMessage(hwnd
, MCM_SETRANGE
, GDTR_MIN
| GDTR_MAX
, (LPARAM
)st
), "Failed to set both min and max limits\n");
423 res
= SendMessage(hwnd
, MCM_GETMONTHRANGE
, GMR_VISIBLE
, (LPARAM
)st1
);
424 ok(res
== month_range
, "Invalid month range (%d)\n", res
);
425 ok(SendMessage(hwnd
, MCM_GETRANGE
, 0, (LPARAM
)st1
) == (GDTR_MIN
|GDTR_MAX
), "Limits should be set\n");
428 ok(SendMessage(hwnd
, MCM_SETRANGE
, GDTR_MIN
| GDTR_MAX
, (LPARAM
)st
), "Failed to set both min and max limits\n");
429 res
= SendMessage(hwnd
, MCM_GETMONTHRANGE
, GMR_VISIBLE
, (LPARAM
)st1
);
430 ok(res
== month_range
, "Invalid month range (%d)\n", res
);
433 ok(SendMessage(hwnd
, MCM_SETRANGE
, GDTR_MIN
| GDTR_MAX
, (LPARAM
)st
), "Failed to set both min and max limits\n");
435 ok(SendMessage(hwnd
, MCM_SETRANGE
, GDTR_MIN
| GDTR_MAX
, (LPARAM
)st
), "Failed to set both min and max limits\n");
438 ok(SendMessage(hwnd
, MCM_SETRANGE
, GDTR_MAX
, (LPARAM
)st
), "Failed to set max limit\n");
439 ok(SendMessage(hwnd
, MCM_GETRANGE
, 0, (LPARAM
)st1
) == GDTR_MAX
, "Only MAX limit should be set\n");
441 ok(SendMessage(hwnd
, MCM_SETRANGE
, GDTR_MAX
, (LPARAM
)st
), "Failed to set max limit\n");
443 ok(SendMessage(hwnd
, MCM_SETRANGE
, GDTR_MAX
, (LPARAM
)st
), "Failed to set max limit\n");
445 ok(SendMessage(hwnd
, MCM_SETRANGE
, GDTR_MAX
, (LPARAM
)st
), "Failed to set max limit\n");
446 ok(SendMessage(hwnd
, MCM_GETRANGE
, 0, (LPARAM
)st1
) == GDTR_MAX
, "Only MAX limit should be set\n");
448 /* set both limits, then set max < min */
449 GetSystemTime(&st
[0]);
452 ok(SendMessage(hwnd
, MCM_SETRANGE
, GDTR_MIN
|GDTR_MAX
, (LPARAM
)st
), "Failed to set limits\n");
453 ok(SendMessage(hwnd
, MCM_GETRANGE
, 0, (LPARAM
)st1
) == (GDTR_MIN
|GDTR_MAX
), "Min limit expected\n");
455 ok(SendMessage(hwnd
, MCM_SETRANGE
, GDTR_MAX
, (LPARAM
)st
), "Failed to set limits\n");
456 ok(SendMessage(hwnd
, MCM_GETRANGE
, 0, (LPARAM
)st1
) == GDTR_MAX
, "Max limit expected\n");
458 expect(0, st1
[0].wYear
);
459 expect(0, st1
[0].wMonth
);
460 expect(0, st1
[0].wDay
);
461 expect(0, st1
[0].wDayOfWeek
);
462 expect(0, st1
[0].wHour
);
463 expect(0, st1
[0].wMinute
);
464 expect(0, st1
[0].wSecond
);
465 expect(0, st1
[0].wMilliseconds
);
467 expect(st
[1].wYear
, st1
[1].wYear
);
468 expect(st
[1].wMonth
, st1
[1].wMonth
);
469 expect(st
[1].wDay
, st1
[1].wDay
);
470 expect(st
[1].wDayOfWeek
, st1
[1].wDayOfWeek
);
471 expect(st
[1].wHour
, st1
[1].wHour
);
472 expect(st
[1].wMinute
, st1
[1].wMinute
);
473 expect(st
[1].wSecond
, st1
[1].wSecond
);
474 expect(st
[1].wMilliseconds
, st1
[1].wMilliseconds
);
478 ok(SendMessage(hwnd
, MCM_SETRANGE
, GDTR_MIN
|GDTR_MAX
, (LPARAM
)st
), "Failed to set limits\n");
479 ok(SendMessage(hwnd
, MCM_GETRANGE
, 0, (LPARAM
)st1
) == (GDTR_MIN
|GDTR_MAX
), "Min limit expected\n");
480 st
[0].wYear
++; /* start == end now */
481 ok(SendMessage(hwnd
, MCM_SETRANGE
, GDTR_MIN
, (LPARAM
)st
), "Failed to set limits\n");
482 ok(SendMessage(hwnd
, MCM_GETRANGE
, 0, (LPARAM
)st1
) == GDTR_MIN
, "Min limit expected\n");
484 expect(st
[0].wYear
, st1
[0].wYear
);
485 expect(st
[0].wMonth
, st1
[0].wMonth
);
486 expect(st
[0].wDay
, st1
[0].wDay
);
487 expect(st
[0].wDayOfWeek
, st1
[0].wDayOfWeek
);
488 expect(st
[0].wHour
, st1
[0].wHour
);
489 expect(st
[0].wMinute
, st1
[0].wMinute
);
490 expect(st
[0].wSecond
, st1
[0].wSecond
);
491 expect(st
[0].wMilliseconds
, st1
[0].wMilliseconds
);
493 expect(0, st1
[1].wYear
);
494 expect(0, st1
[1].wMonth
);
495 expect(0, st1
[1].wDay
);
496 expect(0, st1
[1].wDayOfWeek
);
497 expect(0, st1
[1].wHour
);
498 expect(0, st1
[1].wMinute
);
499 expect(0, st1
[1].wSecond
);
500 expect(0, st1
[1].wMilliseconds
);
505 static LRESULT WINAPI
parent_wnd_proc(HWND hwnd
, UINT message
, WPARAM wParam
, LPARAM lParam
)
507 static LONG defwndproc_counter
= 0;
511 /* log system messages, except for painting */
512 if (message
< WM_USER
&&
513 message
!= WM_PAINT
&&
514 message
!= WM_ERASEBKGND
&&
515 message
!= WM_NCPAINT
&&
516 message
!= WM_NCHITTEST
&&
517 message
!= WM_GETTEXT
&&
518 message
!= WM_GETICON
&&
519 message
!= WM_DEVICECHANGE
)
521 trace("parent: %p, %04x, %08lx, %08lx\n", hwnd
, message
, wParam
, lParam
);
523 msg
.message
= message
;
524 msg
.flags
= sent
|wparam
|lparam
;
525 if (defwndproc_counter
) msg
.flags
|= defwinproc
;
528 add_message(sequences
, PARENT_SEQ_INDEX
, &msg
);
531 defwndproc_counter
++;
532 ret
= DefWindowProcA(hwnd
, message
, wParam
, lParam
);
533 defwndproc_counter
--;
538 static BOOL
register_parent_wnd_class(void)
543 cls
.lpfnWndProc
= parent_wnd_proc
;
546 cls
.hInstance
= GetModuleHandleA(NULL
);
548 cls
.hCursor
= LoadCursorA(0, IDC_ARROW
);
549 cls
.hbrBackground
= GetStockObject(WHITE_BRUSH
);
550 cls
.lpszMenuName
= NULL
;
551 cls
.lpszClassName
= "Month-Cal test parent class";
552 return RegisterClassA(&cls
);
555 static HWND
create_parent_window(void)
559 InitCommonControls();
561 /* flush message sequences, so we can check the new sequence by the end of function */
562 flush_sequences(sequences
, NUM_MSG_SEQUENCES
);
564 if (!register_parent_wnd_class())
567 hwnd
= CreateWindowEx(0, "Month-Cal test parent class",
568 "Month-Cal test parent window",
569 WS_CAPTION
| WS_SYSMENU
| WS_MINIMIZEBOX
|
570 WS_MAXIMIZEBOX
| WS_VISIBLE
,
572 GetDesktopWindow(), NULL
, GetModuleHandleA(NULL
), NULL
);
576 /* check for message sequences */
577 ok_sequence(sequences
, PARENT_SEQ_INDEX
, create_parent_window_seq
, "create parent window", FALSE
);
582 static LRESULT WINAPI
monthcal_subclass_proc(HWND hwnd
, UINT message
, WPARAM wParam
, LPARAM lParam
)
584 struct subclass_info
*info
= (struct subclass_info
*)GetWindowLongPtrA(hwnd
, GWLP_USERDATA
);
585 static LONG defwndproc_counter
= 0;
589 msg
.message
= message
;
590 msg
.flags
= sent
|wparam
|lparam
;
591 if (defwndproc_counter
) msg
.flags
|= defwinproc
;
594 add_message(sequences
, MONTHCAL_SEQ_INDEX
, &msg
);
596 /* some debug output for style changing */
597 if ((message
== WM_STYLECHANGING
||
598 message
== WM_STYLECHANGED
) && lParam
)
600 STYLESTRUCT
*style
= (STYLESTRUCT
*)lParam
;
601 trace("\told style: 0x%08x, new style: 0x%08x\n", style
->styleOld
, style
->styleNew
);
604 defwndproc_counter
++;
605 ret
= CallWindowProcA(info
->oldproc
, hwnd
, message
, wParam
, lParam
);
606 defwndproc_counter
--;
611 static HWND
create_monthcal_control(DWORD style
)
613 struct subclass_info
*info
;
616 info
= HeapAlloc(GetProcessHeap(), 0, sizeof(struct subclass_info
));
620 hwnd
= CreateWindowEx(0,
623 WS_CHILD
| WS_BORDER
| WS_VISIBLE
| style
,
625 parent_wnd
, NULL
, GetModuleHandleA(NULL
), NULL
);
629 HeapFree(GetProcessHeap(), 0, info
);
633 info
->oldproc
= (WNDPROC
)SetWindowLongPtrA(hwnd
, GWLP_WNDPROC
,
634 (LONG_PTR
)monthcal_subclass_proc
);
635 SetWindowLongPtrA(hwnd
, GWLP_USERDATA
, (LONG_PTR
)info
);
637 SendMessage(hwnd
, WM_SETFONT
, (WPARAM
)GetStockObject(SYSTEM_FONT
), 0);
643 /* Setter and Getters Tests */
645 static void test_monthcal_color(void)
650 hwnd
= create_monthcal_control(0);
652 flush_sequences(sequences
, NUM_MSG_SEQUENCES
);
654 /* Setter and Getters for color*/
655 temp
= SendMessage(hwnd
, MCM_GETCOLOR
, MCSC_BACKGROUND
, 0);
656 res
= SendMessage(hwnd
, MCM_SETCOLOR
, MCSC_BACKGROUND
, RGB(0,0,0));
658 temp
= SendMessage(hwnd
, MCM_GETCOLOR
, MCSC_BACKGROUND
, 0);
659 expect(RGB(0,0,0), temp
);
660 res
= SendMessage(hwnd
, MCM_SETCOLOR
, MCSC_BACKGROUND
, RGB(255,255,255));
662 temp
= SendMessage(hwnd
, MCM_GETCOLOR
, MCSC_BACKGROUND
, 0);
663 expect(RGB(255,255,255), temp
);
665 temp
= SendMessage(hwnd
, MCM_GETCOLOR
, MCSC_MONTHBK
, 0);
666 res
= SendMessage(hwnd
, MCM_SETCOLOR
, MCSC_MONTHBK
, RGB(0,0,0));
668 temp
= SendMessage(hwnd
, MCM_GETCOLOR
, MCSC_MONTHBK
, 0);
669 expect(RGB(0,0,0), temp
);
670 res
= SendMessage(hwnd
, MCM_SETCOLOR
, MCSC_MONTHBK
, RGB(255,255,255));
672 temp
= SendMessage(hwnd
, MCM_GETCOLOR
, MCSC_MONTHBK
, 0);
673 expect(RGB(255,255,255), temp
);
675 temp
= SendMessage(hwnd
, MCM_GETCOLOR
, MCSC_TEXT
, 0);
676 res
= SendMessage(hwnd
, MCM_SETCOLOR
, MCSC_TEXT
, RGB(0,0,0));
678 temp
= SendMessage(hwnd
, MCM_GETCOLOR
, MCSC_TEXT
, 0);
679 expect(RGB(0,0,0), temp
);
680 res
= SendMessage(hwnd
, MCM_SETCOLOR
, MCSC_TEXT
, RGB(255,255,255));
682 temp
= SendMessage(hwnd
, MCM_GETCOLOR
, MCSC_TEXT
, 0);
683 expect(RGB(255,255,255), temp
);
685 temp
= SendMessage(hwnd
, MCM_GETCOLOR
, MCSC_TITLEBK
, 0);
686 res
= SendMessage(hwnd
, MCM_SETCOLOR
, MCSC_TITLEBK
, RGB(0,0,0));
688 temp
= SendMessage(hwnd
, MCM_GETCOLOR
, MCSC_TITLEBK
, 0);
689 expect(RGB(0,0,0), temp
);
690 res
= SendMessage(hwnd
, MCM_SETCOLOR
, MCSC_TITLEBK
, RGB(255,255,255));
692 temp
= SendMessage(hwnd
, MCM_GETCOLOR
, MCSC_TITLEBK
, 0);
693 expect(RGB(255,255,255), temp
);
695 temp
= SendMessage(hwnd
, MCM_GETCOLOR
, MCSC_TITLETEXT
, 0);
696 res
= SendMessage(hwnd
, MCM_SETCOLOR
, MCSC_TITLETEXT
, RGB(0,0,0));
698 temp
= SendMessage(hwnd
, MCM_GETCOLOR
, MCSC_TITLETEXT
, 0);
699 expect(RGB(0,0,0), temp
);
700 res
= SendMessage(hwnd
, MCM_SETCOLOR
, MCSC_TITLETEXT
, RGB(255,255,255));
702 temp
= SendMessage(hwnd
, MCM_GETCOLOR
, MCSC_TITLETEXT
, 0);
703 expect(RGB(255,255,255), temp
);
705 temp
= SendMessage(hwnd
, MCM_GETCOLOR
, MCSC_TRAILINGTEXT
, 0);
706 res
= SendMessage(hwnd
, MCM_SETCOLOR
, MCSC_TRAILINGTEXT
, RGB(0,0,0));
708 temp
= SendMessage(hwnd
, MCM_GETCOLOR
, MCSC_TRAILINGTEXT
, 0);
709 expect(RGB(0,0,0), temp
);
710 res
= SendMessage(hwnd
, MCM_SETCOLOR
, MCSC_TRAILINGTEXT
, RGB(255,255,255));
712 temp
= SendMessage(hwnd
, MCM_GETCOLOR
, MCSC_TRAILINGTEXT
, 0);
713 expect(RGB(255,255,255), temp
);
715 ok_sequence(sequences
, MONTHCAL_SEQ_INDEX
, monthcal_color_seq
, "monthcal color", FALSE
);
720 static void test_monthcal_currdate(void)
722 SYSTEMTIME st_original
, st_new
, st_test
;
726 hwnd
= create_monthcal_control(0);
728 flush_sequences(sequences
, NUM_MSG_SEQUENCES
);
730 /* Setter and Getters for current date selected */
731 st_original
.wYear
= 2000;
732 st_original
.wMonth
= 11;
733 st_original
.wDay
= 28;
734 st_original
.wHour
= 11;
735 st_original
.wMinute
= 59;
736 st_original
.wSecond
= 30;
737 st_original
.wMilliseconds
= 0;
738 st_original
.wDayOfWeek
= 0;
740 st_new
= st_test
= st_original
;
742 /* Should not validate the time */
743 res
= SendMessage(hwnd
, MCM_SETCURSEL
, 0, (LPARAM
)&st_test
);
746 /* Overflow matters, check for wDay */
748 res
= SendMessage(hwnd
, MCM_SETCURSEL
, 0, (LPARAM
)&st_test
);
751 /* correct wDay before checking for wMonth */
753 expect(st_original
.wDay
, st_test
.wDay
);
755 /* Overflow matters, check for wMonth */
757 res
= SendMessage(hwnd
, MCM_SETCURSEL
, 0, (LPARAM
)&st_test
);
760 /* checking if gets the information right, modify st_new */
768 res
= SendMessage(hwnd
, MCM_GETCURSEL
, 0, (LPARAM
)&st_new
);
771 /* st_new change to st_origin, above settings with overflow */
772 /* should not change the current settings */
773 expect(st_original
.wYear
, st_new
.wYear
);
774 expect(st_original
.wMonth
, st_new
.wMonth
);
775 expect(st_original
.wDay
, st_new
.wDay
);
776 ok(st_original
.wHour
== st_new
.wHour
||
777 broken(0 == st_new
.wHour
), /* comctl32 <= 4.70 */
778 "Expected %d, got %d\n", st_original
.wHour
, st_new
.wHour
);
779 ok(st_original
.wMinute
== st_new
.wMinute
||
780 broken(0 == st_new
.wMinute
), /* comctl32 <= 4.70 */
781 "Expected %d, got %d\n", st_original
.wMinute
, st_new
.wMinute
);
782 ok(st_original
.wSecond
== st_new
.wSecond
||
783 broken(0 == st_new
.wSecond
), /* comctl32 <= 4.70 */
784 "Expected %d, got %d\n", st_original
.wSecond
, st_new
.wSecond
);
786 /* lparam cannot be NULL */
787 res
= SendMessage(hwnd
, MCM_GETCURSEL
, 0, 0);
790 ok_sequence(sequences
, MONTHCAL_SEQ_INDEX
, monthcal_curr_date_seq
, "monthcal currDate", TRUE
);
792 /* December, 31, 9999 is the maximum allowed date */
793 memset(&st_new
, 0, sizeof(st_new
));
797 res
= SendMessage(hwnd
, MCM_SETCURSEL
, 0, (LPARAM
)&st_new
);
799 memset(&st_test
, 0, sizeof(st_test
));
800 res
= SendMessage(hwnd
, MCM_GETCURSEL
, 0, (LPARAM
)&st_test
);
802 expect(st_new
.wYear
, st_test
.wYear
);
803 expect(st_new
.wMonth
, st_test
.wMonth
);
804 expect(st_new
.wDay
, st_test
.wDay
);
805 expect(st_new
.wHour
, st_test
.wHour
);
806 expect(st_new
.wMinute
, st_test
.wMinute
);
807 expect(st_new
.wSecond
, st_test
.wSecond
);
808 /* try one day later */
809 st_original
= st_new
;
810 st_new
.wYear
= 10000;
813 res
= SendMessage(hwnd
, MCM_SETCURSEL
, 0, (LPARAM
)&st_new
);
815 memset(&st_test
, 0, sizeof(st_test
));
816 res
= SendMessage(hwnd
, MCM_GETCURSEL
, 0, (LPARAM
)&st_test
);
818 expect(st_original
.wYear
, st_test
.wYear
);
819 expect(st_original
.wMonth
, st_test
.wMonth
);
820 expect(st_original
.wDay
, st_test
.wDay
);
821 expect(st_original
.wHour
, st_test
.wHour
);
822 expect(st_original
.wMinute
, st_test
.wMinute
);
823 expect(st_original
.wSecond
, st_test
.wSecond
);
828 static void test_monthcal_firstDay(void)
830 int res
, fday
, i
, prev
;
832 LCID lcid
= LOCALE_USER_DEFAULT
;
835 hwnd
= create_monthcal_control(0);
837 flush_sequences(sequences
, NUM_MSG_SEQUENCES
);
839 /* Setter and Getters for first day of week */
840 /* check for locale first day */
841 if(GetLocaleInfoA(lcid
, LOCALE_IFIRSTDAYOFWEEK
, b
, 128)){
843 trace("fday: %d\n", fday
);
844 res
= SendMessage(hwnd
, MCM_GETFIRSTDAYOFWEEK
, 0, 0);
848 /* checking for the values that actually will be stored as */
849 /* current first day when we set a new value */
850 for (i
= -5; i
< 12; i
++){
851 res
= SendMessage(hwnd
, MCM_SETFIRSTDAYOFWEEK
, 0, (LPARAM
) i
);
853 res
= SendMessage(hwnd
, MCM_GETFIRSTDAYOFWEEK
, 0, 0);
857 expect(MAKELONG(fday
, FALSE
), res
);
859 /* out of range sets max first day of week, locale is ignored */
860 expect(MAKELONG(6, TRUE
), res
);
862 expect(MAKELONG(i
, TRUE
), res
);
866 ok_sequence(sequences
, MONTHCAL_SEQ_INDEX
, monthcal_first_day_seq
, "monthcal firstDay", FALSE
);
869 skip("Cannot retrieve first day of the week\n");
875 static void test_monthcal_unicode(void)
880 hwnd
= create_monthcal_control(0);
882 flush_sequences(sequences
, NUM_MSG_SEQUENCES
);
884 /* Setter and Getters for Unicode format */
886 /* getting the current settings */
887 temp
= SendMessage(hwnd
, MCM_GETUNICODEFORMAT
, 0, 0);
889 /* setting to 1, should return previous settings */
890 res
= SendMessage(hwnd
, MCM_SETUNICODEFORMAT
, 1, 0);
893 /* current setting is 1, so, should return 1 */
894 res
= SendMessage(hwnd
, MCM_GETUNICODEFORMAT
, 0, 0);
897 broken(0 == res
), /* comctl32 <= 4.70 */
898 "Expected 1, got %d\n", res
);
900 /* setting to 0, should return previous settings */
901 res
= SendMessage(hwnd
, MCM_SETUNICODEFORMAT
, 0, 0);
904 broken(0 == res
), /* comctl32 <= 4.70 */
905 "Expected 1, got %d\n", res
);
907 /* current setting is 0, so, it should return 0 */
908 res
= SendMessage(hwnd
, MCM_GETUNICODEFORMAT
, 0, 0);
911 /* should return previous settings */
912 res
= SendMessage(hwnd
, MCM_SETUNICODEFORMAT
, 1, 0);
915 ok_sequence(sequences
, MONTHCAL_SEQ_INDEX
, monthcal_unicode_seq
, "monthcal unicode", FALSE
);
920 static void test_monthcal_hittest(void)
922 typedef struct hittest_test
928 static const hittest_test_t title_hits
[] = {
929 /* Start is the same everywhere */
931 { MCHT_TITLEBTNPREV
, 0 },
932 /* The middle piece is only tested for presence of items */
933 /* End is the same everywhere */
934 { MCHT_TITLEBTNNEXT
, 0 },
946 char yearmonth
[80], *locale_month
, *locale_year
;
947 int month_count
, year_count
;
950 memset(&mchit
, 0, sizeof(MCHITTESTINFO
));
952 hwnd
= create_monthcal_control(0);
954 /* test with invalid structure size */
955 mchit
.cbSize
= MCHITTESTINFO_V1_SIZE
- 1;
958 res
= SendMessage(hwnd
, MCM_HITTEST
, 0, (LPARAM
)&mchit
);
959 expect(0, mchit
.pt
.x
);
960 expect(0, mchit
.pt
.y
);
962 expect(0, mchit
.uHit
);
963 /* test with invalid pointer */
964 res
= SendMessage(hwnd
, MCM_HITTEST
, 0, (LPARAM
)NULL
);
967 /* resize control to display single Calendar */
968 res
= SendMessage(hwnd
, MCM_GETMINREQRECT
, 0, (LPARAM
)&r
);
971 win_skip("Message MCM_GETMINREQRECT unsupported. Skipping.\n");
975 MoveWindow(hwnd
, 0, 0, r
.right
, r
.bottom
, FALSE
);
977 flush_sequences(sequences
, NUM_MSG_SEQUENCES
);
985 st
.wMilliseconds
= 0;
988 res
= SendMessage(hwnd
, MCM_SETCURSEL
, 0, (LPARAM
)&st
);
991 /* (0, 0) is the top left of the control - title */
992 mchit
.cbSize
= MCHITTESTINFO_V1_SIZE
;
995 res
= SendMessage(hwnd
, MCM_HITTEST
, 0, (LPARAM
)&mchit
);
996 expect(0, mchit
.pt
.x
);
997 expect(0, mchit
.pt
.y
);
998 expect(mchit
.uHit
, res
);
999 expect_hex(MCHT_TITLE
, res
);
1001 /* bottom right of the control and should not be active */
1002 mchit
.pt
.x
= r
.right
;
1003 mchit
.pt
.y
= r
.bottom
;
1004 res
= SendMessage(hwnd
, MCM_HITTEST
, 0, (LPARAM
)&mchit
);
1005 expect(r
.right
, mchit
.pt
.x
);
1006 expect(r
.bottom
, mchit
.pt
.y
);
1007 expect(mchit
.uHit
, res
);
1008 todo_wine
expect_hex(MCHT_NOWHERE
, res
);
1010 /* completely out of the control, should not be active */
1011 mchit
.pt
.x
= 2 * r
.right
;
1012 mchit
.pt
.y
= 2 * r
.bottom
;
1013 res
= SendMessage(hwnd
, MCM_HITTEST
, 0, (LPARAM
) & mchit
);
1014 expect(2 * r
.right
, mchit
.pt
.x
);
1015 expect(2 * r
.bottom
, mchit
.pt
.y
);
1016 expect(mchit
.uHit
, res
);
1017 todo_wine
expect_hex(MCHT_NOWHERE
, res
);
1019 /* in active area - day of the week */
1020 mchit
.pt
.x
= r
.right
/ 2;
1021 mchit
.pt
.y
= r
.bottom
/ 2;
1022 res
= SendMessage(hwnd
, MCM_HITTEST
, 0, (LPARAM
) & mchit
);
1023 expect(r
.right
/ 2, mchit
.pt
.x
);
1024 expect(r
.bottom
/ 2, mchit
.pt
.y
);
1025 expect(mchit
.uHit
, res
);
1026 expect_hex(MCHT_CALENDARDATE
, res
);
1028 /* in active area - day of the week #2 */
1029 mchit
.pt
.x
= r
.right
/ 14; /* half of first day rect */
1030 mchit
.pt
.y
= r
.bottom
/ 2;
1031 res
= SendMessage(hwnd
, MCM_HITTEST
, 0, (LPARAM
) & mchit
);
1032 expect(r
.right
/ 14, mchit
.pt
.x
);
1033 expect(r
.bottom
/ 2, mchit
.pt
.y
);
1034 expect(mchit
.uHit
, res
);
1035 expect_hex(MCHT_CALENDARDATE
, res
);
1037 /* in active area - date from prev month */
1038 mchit
.pt
.x
= r
.right
/ 14; /* half of first day rect */
1039 mchit
.pt
.y
= 6 * r
.bottom
/ 19;
1040 res
= SendMessage(hwnd
, MCM_HITTEST
, 0, (LPARAM
) & mchit
);
1041 expect(r
.right
/ 14, mchit
.pt
.x
);
1042 expect(6 * r
.bottom
/ 19, mchit
.pt
.y
);
1043 expect(mchit
.uHit
, res
);
1044 expect_hex(MCHT_CALENDARDATEPREV
, res
);
1047 /* (125, 115) is in active area - date from this month */
1050 res
= SendMessage(hwnd
, MCM_HITTEST
, 0, (LPARAM
) & mchit
);
1051 expect(125, mchit
.pt
.x
);
1052 expect(115, mchit
.pt
.y
);
1053 expect(mchit
.uHit
, res
);
1054 expect(MCHT_CALENDARDATE
, res
);
1057 /* in active area - date from next month */
1058 mchit
.pt
.x
= 11 * r
.right
/ 14;
1059 mchit
.pt
.y
= 16 * r
.bottom
/ 19;
1060 res
= SendMessage(hwnd
, MCM_HITTEST
, 0, (LPARAM
) & mchit
);
1061 expect(11 * r
.right
/ 14, mchit
.pt
.x
);
1062 expect(16 * r
.bottom
/ 19, mchit
.pt
.y
);
1063 expect(mchit
.uHit
, res
);
1064 expect_hex(MCHT_CALENDARDATENEXT
, res
);
1066 /* in active area - today link */
1067 mchit
.pt
.x
= r
.right
/ 14;
1068 mchit
.pt
.y
= 18 * r
.bottom
/ 19;
1069 res
= SendMessage(hwnd
, MCM_HITTEST
, 0, (LPARAM
) & mchit
);
1070 expect(r
.right
/ 14, mchit
.pt
.x
);
1071 expect(18 * r
.bottom
/ 19, mchit
.pt
.y
);
1072 expect(mchit
.uHit
, res
);
1073 expect_hex(MCHT_TODAYLINK
, res
);
1075 /* in active area - today link */
1076 mchit
.pt
.x
= r
.right
/ 2;
1077 mchit
.pt
.y
= 18 * r
.bottom
/ 19;
1078 res
= SendMessage(hwnd
, MCM_HITTEST
, 0, (LPARAM
) & mchit
);
1079 expect(r
.right
/ 2, mchit
.pt
.x
);
1080 expect(18 * r
.bottom
/ 19, mchit
.pt
.y
);
1081 expect(mchit
.uHit
, res
);
1082 expect_hex(MCHT_TODAYLINK
, res
);
1084 /* in active area - today link */
1085 mchit
.pt
.x
= r
.right
/ 10;
1086 mchit
.pt
.y
= 18 * r
.bottom
/ 19;
1087 res
= SendMessage(hwnd
, MCM_HITTEST
, 0, (LPARAM
) & mchit
);
1088 expect(r
.right
/ 10, mchit
.pt
.x
);
1089 expect(18 * r
.bottom
/ 19, mchit
.pt
.y
);
1090 expect(mchit
.uHit
, res
);
1091 expect_hex(MCHT_TODAYLINK
, res
);
1093 ok_sequence(sequences
, MONTHCAL_SEQ_INDEX
, monthcal_hit_test_seq
, "monthcal hit test", TRUE
);
1095 /* The horizontal position of title bar elements depends on locale (y pos
1096 is constant), so we sample across a horizontal line and make sure we
1097 find all elements. */
1099 /* Get the format of the title */
1100 GetLocaleInfo(LOCALE_USER_DEFAULT
, LOCALE_SYEARMONTH
, yearmonth
, 80);
1101 /* Find out if we have a month and/or year */
1102 locale_year
= strstr(yearmonth
, "y");
1103 locale_month
= strstr(yearmonth
, "M");
1106 mchit
.pt
.y
= (5/2) * r
.bottom
/ 19;
1108 old_res
= SendMessage(hwnd
, MCM_HITTEST
, 0, (LPARAM
) & mchit
);
1109 expect_hex(title_hits
[title_index
].ht
, old_res
);
1111 in_the_middle
= FALSE
;
1112 month_count
= year_count
= 0;
1113 for (x
= 0; x
< r
.right
; x
++){
1115 res
= SendMessage(hwnd
, MCM_HITTEST
, 0, (LPARAM
) & mchit
);
1116 expect(x
, mchit
.pt
.x
);
1117 expect((5/2) * r
.bottom
/ 19, mchit
.pt
.y
);
1118 expect(mchit
.uHit
, res
);
1119 if (res
!= old_res
) {
1121 if (old_res
== MCHT_TITLEBTNPREV
)
1122 in_the_middle
= TRUE
;
1124 if (res
== MCHT_TITLEBTNNEXT
)
1125 in_the_middle
= FALSE
;
1127 if (in_the_middle
) {
1128 if (res
== MCHT_TITLEMONTH
)
1130 else if (res
== MCHT_TITLEYEAR
)
1135 if (sizeof(title_hits
) / sizeof(title_hits
[0]) <= title_index
)
1138 if (title_hits
[title_index
].todo
) {
1140 ok(title_hits
[title_index
].ht
== res
, "Expected %x, got %x, pos %d\n",
1141 title_hits
[title_index
].ht
, res
, x
);
1143 ok(title_hits
[title_index
].ht
== res
, "Expected %x, got %x, pos %d\n",
1144 title_hits
[title_index
].ht
, res
, x
);
1151 /* There are some limits, even if LOCALE_SYEARMONTH contains rubbish
1152 * or no month/year indicators at all */
1154 todo_wine
ok(month_count
== 1, "Expected 1 month item, got %d\n", month_count
);
1156 ok(month_count
<= 1, "Too many month items: %d\n", month_count
);
1159 todo_wine
ok(year_count
== 1, "Expected 1 year item, got %d\n", year_count
);
1161 ok(year_count
<= 1, "Too many year items: %d\n", year_count
);
1163 todo_wine
ok(month_count
+ year_count
>= 1, "Not enough month and year items\n");
1165 ok(r
.right
<= x
&& title_index
+ 1 == sizeof(title_hits
) / sizeof(title_hits
[0]),
1166 "Wrong title layout\n");
1168 DestroyWindow(hwnd
);
1171 static void test_monthcal_todaylink(void)
1173 MCHITTESTINFO mchit
;
1174 SYSTEMTIME st_test
, st_new
;
1179 memset(&mchit
, 0, sizeof(MCHITTESTINFO
));
1181 hwnd
= create_monthcal_control(0);
1183 flush_sequences(sequences
, NUM_MSG_SEQUENCES
);
1185 /* (70, 370) is in active area - today link */
1186 mchit
.cbSize
= MCHITTESTINFO_V1_SIZE
;
1189 res
= SendMessage(hwnd
, MCM_HITTEST
, 0, (LPARAM
) & mchit
);
1190 expect(70, mchit
.pt
.x
);
1191 expect(370, mchit
.pt
.y
);
1192 expect(mchit
.uHit
, res
);
1193 todo_wine
{expect(MCHT_TODAYLINK
, res
);}
1194 if (70 != mchit
.pt
.x
|| 370 != mchit
.pt
.y
|| mchit
.uHit
!= res
1195 || MCHT_TODAYLINK
!= res
)
1200 st_test
.wYear
= 2005;
1201 memset(&st_new
, 0, sizeof(SYSTEMTIME
));
1203 SendMessage(hwnd
, MCM_SETTODAY
, 0, (LPARAM
)&st_test
);
1205 res
= SendMessage(hwnd
, MCM_GETTODAY
, 0, (LPARAM
)&st_new
);
1207 expect(1, st_new
.wDay
);
1208 expect(1, st_new
.wMonth
);
1209 expect(2005, st_new
.wYear
);
1210 if (1 != res
|| 1 != st_new
.wDay
|| 1 != st_new
.wMonth
1211 || 2005 != st_new
.wYear
)
1215 skip("cannot perform today link test\n");
1219 res
= SendMessage(hwnd
, WM_LBUTTONDOWN
, MK_LBUTTON
, MAKELONG(70, 370));
1222 memset(&st_new
, 0, sizeof(SYSTEMTIME
));
1223 res
= SendMessage(hwnd
, MCM_GETCURSEL
, 0, (LPARAM
)&st_new
);
1225 expect(1, st_new
.wDay
);
1226 expect(1, st_new
.wMonth
);
1227 expect(2005, st_new
.wYear
);
1229 ok_sequence(sequences
, MONTHCAL_SEQ_INDEX
, monthcal_todaylink_seq
, "monthcal hit test", TRUE
);
1231 DestroyWindow(hwnd
);
1234 static void test_monthcal_today(void)
1236 SYSTEMTIME st_test
, st_new
;
1240 hwnd
= create_monthcal_control(0);
1242 flush_sequences(sequences
, NUM_MSG_SEQUENCES
);
1244 /* Setter and Getters for "today" information */
1246 /* check for overflow, should be ok */
1248 st_test
.wMonth
= 38;
1253 SendMessage(hwnd
, MCM_SETTODAY
, 0, (LPARAM
)&st_test
);
1255 res
= SendMessage(hwnd
, MCM_GETTODAY
, 0, (LPARAM
)&st_new
);
1258 /* st_test should not change */
1259 expect(38, st_test
.wDay
);
1260 expect(38, st_test
.wMonth
);
1262 /* st_new should change, overflow does not matter */
1263 expect(38, st_new
.wDay
);
1264 expect(38, st_new
.wMonth
);
1266 /* check for zero, should be ok*/
1270 SendMessage(hwnd
, MCM_SETTODAY
, 0, (LPARAM
)&st_test
);
1272 res
= SendMessage(hwnd
, MCM_GETTODAY
, 0, (LPARAM
)&st_new
);
1275 /* st_test should not change */
1276 expect(0, st_test
.wDay
);
1277 expect(0, st_test
.wMonth
);
1279 /* st_new should change to zero*/
1280 expect(0, st_new
.wDay
);
1281 expect(0, st_new
.wMonth
);
1283 ok_sequence(sequences
, MONTHCAL_SEQ_INDEX
, monthcal_today_seq
, "monthcal today", TRUE
);
1285 DestroyWindow(hwnd
);
1288 static void test_monthcal_scroll(void)
1293 hwnd
= create_monthcal_control(0);
1295 flush_sequences(sequences
, NUM_MSG_SEQUENCES
);
1297 /* Setter and Getters for scroll rate */
1298 res
= SendMessage(hwnd
, MCM_SETMONTHDELTA
, 2, 0);
1301 res
= SendMessage(hwnd
, MCM_SETMONTHDELTA
, 3, 0);
1303 res
= SendMessage(hwnd
, MCM_GETMONTHDELTA
, 0, 0);
1306 res
= SendMessage(hwnd
, MCM_SETMONTHDELTA
, 12, 0);
1308 res
= SendMessage(hwnd
, MCM_GETMONTHDELTA
, 0, 0);
1311 res
= SendMessage(hwnd
, MCM_SETMONTHDELTA
, 15, 0);
1313 res
= SendMessage(hwnd
, MCM_GETMONTHDELTA
, 0, 0);
1316 res
= SendMessage(hwnd
, MCM_SETMONTHDELTA
, -5, 0);
1318 res
= SendMessage(hwnd
, MCM_GETMONTHDELTA
, 0, 0);
1321 ok_sequence(sequences
, MONTHCAL_SEQ_INDEX
, monthcal_scroll_seq
, "monthcal scroll", FALSE
);
1323 DestroyWindow(hwnd
);
1326 static void test_monthcal_monthrange(void)
1329 SYSTEMTIME st_visible
[2], st_daystate
[2], st
;
1332 hwnd
= create_monthcal_control(0);
1334 st_visible
[0].wYear
= 0;
1335 st_visible
[0].wMonth
= 0;
1336 st_visible
[0].wDay
= 0;
1337 st_daystate
[1] = st_daystate
[0] = st_visible
[1] = st_visible
[0];
1345 st
.wMilliseconds
= 0;
1348 res
= SendMessage(hwnd
, MCM_SETCURSEL
, 0, (LPARAM
)&st
);
1351 /* to be locale independent */
1352 SendMessage(hwnd
, MCM_SETFIRSTDAYOFWEEK
, 0, (LPARAM
)6);
1354 flush_sequences(sequences
, NUM_MSG_SEQUENCES
);
1356 res
= SendMessage(hwnd
, MCM_GETMONTHRANGE
, GMR_VISIBLE
, (LPARAM
)st_visible
);
1360 expect(2000, st_visible
[0].wYear
);
1361 expect(11, st_visible
[0].wMonth
);
1362 expect(1, st_visible
[0].wDay
);
1363 expect(2000, st_visible
[1].wYear
);
1366 expect(12, st_visible
[1].wMonth
);
1367 expect(31, st_visible
[1].wDay
);
1369 res
= SendMessage(hwnd
, MCM_GETMONTHRANGE
, GMR_DAYSTATE
, (LPARAM
)st_daystate
);
1372 expect(2000, st_daystate
[0].wYear
);
1373 expect(10, st_daystate
[0].wMonth
);
1374 expect(29, st_daystate
[0].wDay
);
1375 expect(2001, st_daystate
[1].wYear
);
1376 expect(1, st_daystate
[1].wMonth
);
1377 expect(6, st_daystate
[1].wDay
);
1380 ok_sequence(sequences
, MONTHCAL_SEQ_INDEX
, monthcal_monthrange_seq
, "monthcal monthrange", FALSE
);
1382 DestroyWindow(hwnd
);
1385 static void test_monthcal_maxselday(void)
1391 hwnd
= create_monthcal_control(0);
1392 /* if no style specified default to 1 */
1393 res
= SendMessage(hwnd
, MCM_GETMAXSELCOUNT
, 0, 0);
1395 res
= SendMessage(hwnd
, MCM_SETMAXSELCOUNT
, 5, 0);
1397 res
= SendMessage(hwnd
, MCM_GETMAXSELCOUNT
, 0, 0);
1400 /* try to set style */
1401 style
= GetWindowLong(hwnd
, GWL_STYLE
);
1402 SetWindowLong(hwnd
, GWL_STYLE
, style
| MCS_MULTISELECT
);
1403 style
= GetWindowLong(hwnd
, GWL_STYLE
);
1404 ok(!(style
& MCS_MULTISELECT
), "Expected MCS_MULTISELECT not to be set\n");
1405 DestroyWindow(hwnd
);
1407 hwnd
= create_monthcal_control(MCS_MULTISELECT
);
1408 /* try to remove style */
1409 style
= GetWindowLong(hwnd
, GWL_STYLE
);
1410 SetWindowLong(hwnd
, GWL_STYLE
, style
& ~MCS_MULTISELECT
);
1411 style
= GetWindowLong(hwnd
, GWL_STYLE
);
1412 ok(style
& MCS_MULTISELECT
, "Expected MCS_MULTISELECT to be set\n");
1413 DestroyWindow(hwnd
);
1415 hwnd
= create_monthcal_control(MCS_MULTISELECT
);
1417 /* default width is a week */
1418 res
= SendMessage(hwnd
, MCM_GETMAXSELCOUNT
, 0, 0);
1421 flush_sequences(sequences
, NUM_MSG_SEQUENCES
);
1423 /* Setter and Getters for max selected days */
1424 res
= SendMessage(hwnd
, MCM_SETMAXSELCOUNT
, 5, 0);
1426 res
= SendMessage(hwnd
, MCM_GETMAXSELCOUNT
, 0, 0);
1429 res
= SendMessage(hwnd
, MCM_SETMAXSELCOUNT
, 15, 0);
1431 res
= SendMessage(hwnd
, MCM_GETMAXSELCOUNT
, 0, 0);
1434 /* test invalid value */
1435 res
= SendMessage(hwnd
, MCM_SETMAXSELCOUNT
, -1, 0);
1437 res
= SendMessage(hwnd
, MCM_GETMAXSELCOUNT
, 0, 0);
1440 ok_sequence(sequences
, MONTHCAL_SEQ_INDEX
, monthcal_max_sel_day_seq
, "monthcal MaxSelDay", FALSE
);
1442 /* zero value is invalid too */
1443 res
= SendMessage(hwnd
, MCM_SETMAXSELCOUNT
, 0, 0);
1445 res
= SendMessage(hwnd
, MCM_GETMAXSELCOUNT
, 0, 0);
1448 DestroyWindow(hwnd
);
1451 static void test_monthcal_size(void)
1455 HFONT hFont1
, hFont2
;
1459 hwnd
= create_monthcal_control(0);
1461 lstrcpyA(logfont
.lfFaceName
, "Arial");
1462 memset(&logfont
, 0, sizeof(logfont
));
1463 logfont
.lfHeight
= 12;
1464 hFont1
= CreateFontIndirectA(&logfont
);
1466 logfont
.lfHeight
= 24;
1467 hFont2
= CreateFontIndirectA(&logfont
);
1469 /* initialize to a font we can compare against */
1470 SendMessage(hwnd
, WM_SETFONT
, (WPARAM
)hFont1
, 0);
1471 res
= SendMessage(hwnd
, MCM_GETMINREQRECT
, 0, (LPARAM
)&r1
);
1473 /* check that setting a larger font results in an larger rect */
1474 SendMessage(hwnd
, WM_SETFONT
, (WPARAM
)hFont2
, 0);
1475 res
= SendMessage(hwnd
, MCM_GETMINREQRECT
, 0, (LPARAM
)&r2
);
1477 OffsetRect(&r1
, -r1
.left
, -r1
.top
);
1478 OffsetRect(&r2
, -r2
.left
, -r2
.top
);
1480 ok(r1
.bottom
< r2
.bottom
, "Failed to get larger rect with larger font\n");
1482 DestroyWindow(hwnd
);
1485 static void test_monthcal_create(void)
1489 flush_sequences(sequences
, NUM_MSG_SEQUENCES
);
1491 hwnd
= create_monthcal_control(0);
1492 ok_sequence(sequences
, PARENT_SEQ_INDEX
, create_monthcal_control_seq
, "create monthcal control", TRUE
);
1494 DestroyWindow(hwnd
);
1496 flush_sequences(sequences
, NUM_MSG_SEQUENCES
);
1497 hwnd
= create_monthcal_control(MCS_MULTISELECT
);
1498 ok_sequence(sequences
, PARENT_SEQ_INDEX
, create_monthcal_multi_sel_style_seq
, "create monthcal (multi sel style)", TRUE
);
1499 DestroyWindow(hwnd
);
1502 static void test_monthcal_destroy(void)
1506 hwnd
= create_monthcal_control(0);
1507 flush_sequences(sequences
, NUM_MSG_SEQUENCES
);
1508 DestroyWindow(hwnd
);
1509 ok_sequence(sequences
, PARENT_SEQ_INDEX
, destroy_monthcal_parent_msgs_seq
, "Destroy monthcal (parent msg)", FALSE
);
1510 ok_sequence(sequences
, MONTHCAL_SEQ_INDEX
, destroy_monthcal_child_msgs_seq
, "Destroy monthcal (child msg)", FALSE
);
1512 /* MCS_MULTISELECT */
1513 hwnd
= create_monthcal_control(MCS_MULTISELECT
);
1514 flush_sequences(sequences
, NUM_MSG_SEQUENCES
);
1515 DestroyWindow(hwnd
);
1516 ok_sequence(sequences
, MONTHCAL_SEQ_INDEX
, destroy_monthcal_multi_sel_style_seq
, "Destroy monthcal (multi sel style)", FALSE
);
1519 static void test_monthcal_selrange(void)
1522 SYSTEMTIME st
, range
[2], range2
[2];
1523 BOOL ret
, old_comctl32
= FALSE
;
1525 hwnd
= create_monthcal_control(MCS_MULTISELECT
);
1527 /* just after creation selection should start and end today */
1528 ret
= SendMessage(hwnd
, MCM_GETTODAY
, 0, (LPARAM
)&st
);
1531 memset(range
, 0xcc, sizeof(range
));
1532 ret
= SendMessage(hwnd
, MCM_GETSELRANGE
, 0, (LPARAM
)range
);
1534 expect(st
.wYear
, range
[0].wYear
);
1535 expect(st
.wMonth
, range
[0].wMonth
);
1536 expect(st
.wDay
, range
[0].wDay
);
1537 if (range
[0].wDayOfWeek
== 0)
1539 win_skip("comctl32 <= 4.70 doesn't set some values\n");
1540 old_comctl32
= TRUE
;
1544 expect(st
.wDayOfWeek
, range
[0].wDayOfWeek
);
1545 expect(st
.wHour
, range
[0].wHour
);
1546 expect(st
.wMinute
, range
[0].wMinute
);
1547 expect(st
.wSecond
, range
[0].wSecond
);
1548 expect(st
.wMilliseconds
, range
[0].wMilliseconds
);
1551 expect(st
.wYear
, range
[1].wYear
);
1552 expect(st
.wMonth
, range
[1].wMonth
);
1553 expect(st
.wDay
, range
[1].wDay
);
1556 expect(st
.wDayOfWeek
, range
[1].wDayOfWeek
);
1557 expect(st
.wHour
, range
[1].wHour
);
1558 expect(st
.wMinute
, range
[1].wMinute
);
1559 expect(st
.wSecond
, range
[1].wSecond
);
1560 expect(st
.wMilliseconds
, range
[1].wMilliseconds
);
1563 /* bounds are swapped if min > max */
1564 memset(&range
[0], 0, sizeof(range
[0]));
1565 range
[0].wYear
= 2009;
1566 range
[0].wMonth
= 10;
1568 range
[1] = range
[0];
1571 ret
= SendMessage(hwnd
, MCM_SETSELRANGE
, 0, (LPARAM
)range
);
1574 ret
= SendMessage(hwnd
, MCM_GETSELRANGE
, 0, (LPARAM
)range2
);
1577 expect(range
[1].wYear
, range2
[0].wYear
);
1578 expect(range
[1].wMonth
, range2
[0].wMonth
);
1579 expect(range
[1].wDay
, range2
[0].wDay
);
1580 expect(6, range2
[0].wDayOfWeek
);
1581 expect(range
[1].wHour
, range2
[0].wHour
);
1582 expect(range
[1].wMinute
, range2
[0].wMinute
);
1583 expect(range
[1].wSecond
, range2
[0].wSecond
);
1584 expect(range
[1].wMilliseconds
, range2
[0].wMilliseconds
);
1586 expect(range
[0].wYear
, range2
[1].wYear
);
1587 expect(range
[0].wMonth
, range2
[1].wMonth
);
1588 expect(range
[0].wDay
, range2
[1].wDay
);
1589 expect(1, range2
[1].wDayOfWeek
);
1590 expect(range
[0].wHour
, range2
[1].wHour
);
1591 expect(range
[0].wMinute
, range2
[1].wMinute
);
1592 expect(range
[0].wSecond
, range2
[1].wSecond
);
1593 expect(range
[0].wMilliseconds
, range2
[1].wMilliseconds
);
1595 /* try with range larger than maximum configured */
1596 memset(&range
[0], 0, sizeof(range
[0]));
1597 range
[0].wYear
= 2009;
1598 range
[0].wMonth
= 10;
1600 range
[1] = range
[0];
1602 ret
= SendMessage(hwnd
, MCM_SETSELRANGE
, 0, (LPARAM
)range
);
1605 range
[1] = range
[0];
1606 /* default max. range is 7 days */
1609 ret
= SendMessage(hwnd
, MCM_SETSELRANGE
, 0, (LPARAM
)range
);
1612 ret
= SendMessage(hwnd
, MCM_GETSELRANGE
, 0, (LPARAM
)range2
);
1615 expect(range
[0].wYear
, range2
[0].wYear
);
1616 expect(range
[0].wMonth
, range2
[0].wMonth
);
1617 expect(range
[0].wDay
, range2
[0].wDay
);
1618 expect(range
[0].wYear
, range2
[1].wYear
);
1619 expect(range
[0].wMonth
, range2
[1].wMonth
);
1620 expect(range
[0].wDay
, range2
[1].wDay
);
1622 DestroyWindow(hwnd
);
1625 START_TEST(monthcal
)
1628 BOOL (WINAPI
*pInitCommonControlsEx
)(const INITCOMMONCONTROLSEX
*);
1629 INITCOMMONCONTROLSEX iccex
;
1631 hComctl32
= GetModuleHandleA("comctl32.dll");
1632 pInitCommonControlsEx
= (void*)GetProcAddress(hComctl32
, "InitCommonControlsEx");
1633 if (!pInitCommonControlsEx
)
1635 skip("InitCommonControlsEx() is missing. Skipping the tests\n");
1638 iccex
.dwSize
= sizeof(iccex
);
1639 iccex
.dwICC
= ICC_DATE_CLASSES
;
1640 pInitCommonControlsEx(&iccex
);
1644 init_msg_sequences(sequences
, NUM_MSG_SEQUENCES
);
1646 parent_wnd
= create_parent_window();
1648 test_monthcal_create();
1649 test_monthcal_destroy();
1650 test_monthcal_color();
1651 test_monthcal_currdate();
1652 test_monthcal_firstDay();
1653 test_monthcal_unicode();
1654 test_monthcal_today();
1655 test_monthcal_scroll();
1656 test_monthcal_monthrange();
1657 test_monthcal_hittest();
1658 test_monthcal_todaylink();
1659 test_monthcal_size();
1660 test_monthcal_maxselday();
1661 test_monthcal_selrange();
1663 flush_sequences(sequences
, NUM_MSG_SEQUENCES
);
1664 DestroyWindow(parent_wnd
);
1665 ok_sequence(sequences
, PARENT_SEQ_INDEX
, destroy_parent_seq
, "Destroy parent window", FALSE
);