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);
37 #define NUM_MSG_SEQUENCES 2
38 #define PARENT_SEQ_INDEX 0
39 #define MONTHCAL_SEQ_INDEX 1
46 static struct msg_sequence *sequences[NUM_MSG_SEQUENCES];
48 static const struct message create_parent_window_seq[] = {
49 { WM_GETMINMAXINFO, sent },
50 { WM_NCCREATE, sent },
51 { WM_NCCALCSIZE, sent|wparam, 0 },
53 { WM_SHOWWINDOW, sent|wparam, 1 },
54 { WM_WINDOWPOSCHANGING, sent|wparam, 0 },
55 { WM_WINDOWPOSCHANGING, sent|wparam, 0 },
56 { WM_ACTIVATEAPP, sent|wparam, 1 },
57 { WM_NCACTIVATE, sent|wparam, 1 },
58 { WM_ACTIVATE, sent|wparam, 1 },
59 { WM_IME_SETCONTEXT, sent|wparam|defwinproc|optional, 1 },
60 { WM_IME_NOTIFY, sent|defwinproc|optional },
61 { WM_SETFOCUS, sent|wparam|defwinproc, 0 },
62 /* Win9x adds SWP_NOZORDER below */
63 { WM_WINDOWPOSCHANGED, sent, /*|wparam, SWP_SHOWWINDOW|SWP_NOSIZE|SWP_NOMOVE|SWP_NOCLIENTSIZE|SWP_NOCLIENTMOVE*/ },
64 { WM_NCCALCSIZE, sent|wparam|optional, 1 },
70 static const struct message create_monthcal_control_seq[] = {
71 { WM_NOTIFYFORMAT, sent|lparam, 0, NF_QUERY },
72 { WM_QUERYUISTATE, sent },
74 { WM_PARENTNOTIFY, sent|wparam, WM_CREATE},
78 static const struct message create_monthcal_multi_sel_style_seq[] = {
79 { WM_NOTIFYFORMAT, sent|lparam, 0, NF_QUERY },
80 { WM_QUERYUISTATE, sent },
85 static const struct message monthcal_color_seq[] = {
86 { MCM_GETCOLOR, sent|wparam|lparam, MCSC_BACKGROUND, 0},
87 { MCM_SETCOLOR, sent|wparam|lparam, MCSC_BACKGROUND, RGB(0,0,0)},
88 { MCM_GETCOLOR, sent|wparam|lparam, MCSC_BACKGROUND, 0},
89 { MCM_SETCOLOR, sent|wparam|lparam, MCSC_BACKGROUND, RGB(255,255,255)},
90 { MCM_GETCOLOR, sent|wparam|lparam, MCSC_BACKGROUND, 0},
92 { MCM_GETCOLOR, sent|wparam|lparam, MCSC_MONTHBK, 0},
93 { MCM_SETCOLOR, sent|wparam|lparam, MCSC_MONTHBK, RGB(0,0,0)},
94 { MCM_GETCOLOR, sent|wparam|lparam, MCSC_MONTHBK, 0},
95 { MCM_SETCOLOR, sent|wparam|lparam, MCSC_MONTHBK, RGB(255,255,255)},
96 { MCM_GETCOLOR, sent|wparam|lparam, MCSC_MONTHBK, 0},
98 { MCM_GETCOLOR, sent|wparam|lparam, MCSC_TEXT, 0},
99 { MCM_SETCOLOR, sent|wparam|lparam, MCSC_TEXT, RGB(0,0,0)},
100 { MCM_GETCOLOR, sent|wparam|lparam, MCSC_TEXT, 0},
101 { MCM_SETCOLOR, sent|wparam|lparam, MCSC_TEXT, RGB(255,255,255)},
102 { MCM_GETCOLOR, sent|wparam|lparam, MCSC_TEXT, 0},
104 { MCM_GETCOLOR, sent|wparam|lparam, MCSC_TITLEBK, 0},
105 { MCM_SETCOLOR, sent|wparam|lparam, MCSC_TITLEBK, RGB(0,0,0)},
106 { MCM_GETCOLOR, sent|wparam|lparam, MCSC_TITLEBK, 0},
107 { MCM_SETCOLOR, sent|wparam|lparam, MCSC_TITLEBK, RGB(255,255,255)},
108 { MCM_GETCOLOR, sent|wparam|lparam, MCSC_TITLEBK, 0},
110 { MCM_GETCOLOR, sent|wparam|lparam, MCSC_TITLETEXT, 0},
111 { MCM_SETCOLOR, sent|wparam|lparam, MCSC_TITLETEXT, RGB(0,0,0)},
112 { MCM_GETCOLOR, sent|wparam|lparam, MCSC_TITLETEXT, 0},
113 { MCM_SETCOLOR, sent|wparam|lparam, MCSC_TITLETEXT, RGB(255,255,255)},
114 { MCM_GETCOLOR, sent|wparam|lparam, MCSC_TITLETEXT, 0},
116 { MCM_GETCOLOR, sent|wparam|lparam, MCSC_TRAILINGTEXT, 0},
117 { MCM_SETCOLOR, sent|wparam|lparam, MCSC_TRAILINGTEXT, RGB(0,0,0)},
118 { MCM_GETCOLOR, sent|wparam|lparam, MCSC_TRAILINGTEXT, 0},
119 { MCM_SETCOLOR, sent|wparam|lparam, MCSC_TRAILINGTEXT, RGB(255,255,255)},
120 { MCM_GETCOLOR, sent|wparam|lparam, MCSC_TRAILINGTEXT, 0},
124 static const struct message monthcal_curr_date_seq[] = {
125 { MCM_SETCURSEL, sent|wparam, 0},
126 { WM_PAINT, sent|wparam|lparam|defwinproc, 0, 0},
127 { WM_ERASEBKGND, sent|lparam|defwinproc, 0},
128 { MCM_SETCURSEL, sent|wparam, 0},
129 { MCM_SETCURSEL, sent|wparam, 0},
130 { MCM_GETCURSEL, sent|wparam, 0},
131 { MCM_GETCURSEL, sent|wparam|lparam, 0, 0},
135 static const struct message monthcal_first_day_seq[] = {
136 { MCM_GETFIRSTDAYOFWEEK, sent|wparam|lparam, 0, 0},
138 { MCM_SETFIRSTDAYOFWEEK, sent|wparam|lparam, 0, -5},
139 { MCM_GETFIRSTDAYOFWEEK, sent|wparam|lparam, 0, 0},
141 { MCM_SETFIRSTDAYOFWEEK, sent|wparam|lparam, 0, -4},
142 { MCM_GETFIRSTDAYOFWEEK, sent|wparam|lparam, 0, 0},
144 { MCM_SETFIRSTDAYOFWEEK, sent|wparam|lparam, 0, -3},
145 { MCM_GETFIRSTDAYOFWEEK, sent|wparam|lparam, 0, 0},
147 { MCM_SETFIRSTDAYOFWEEK, sent|wparam|lparam, 0, -2},
148 { MCM_GETFIRSTDAYOFWEEK, sent|wparam|lparam, 0, 0},
150 { MCM_SETFIRSTDAYOFWEEK, sent|wparam|lparam, 0, -1},
151 { MCM_GETFIRSTDAYOFWEEK, sent|wparam|lparam, 0, 0},
153 { MCM_SETFIRSTDAYOFWEEK, sent|wparam|lparam, 0, 0},
154 { MCM_GETFIRSTDAYOFWEEK, sent|wparam|lparam, 0, 0},
156 { MCM_SETFIRSTDAYOFWEEK, sent|wparam|lparam, 0, 1},
157 { MCM_GETFIRSTDAYOFWEEK, sent|wparam|lparam, 0, 0},
159 { MCM_SETFIRSTDAYOFWEEK, sent|wparam|lparam, 0, 2},
160 { MCM_GETFIRSTDAYOFWEEK, sent|wparam|lparam, 0, 0},
162 { MCM_SETFIRSTDAYOFWEEK, sent|wparam|lparam, 0, 3},
163 { MCM_GETFIRSTDAYOFWEEK, sent|wparam|lparam, 0, 0},
165 { MCM_SETFIRSTDAYOFWEEK, sent|wparam|lparam, 0, 4},
166 { MCM_GETFIRSTDAYOFWEEK, sent|wparam|lparam, 0, 0},
168 { MCM_SETFIRSTDAYOFWEEK, sent|wparam|lparam, 0, 5},
169 { MCM_GETFIRSTDAYOFWEEK, sent|wparam|lparam, 0, 0},
171 { MCM_SETFIRSTDAYOFWEEK, sent|wparam|lparam, 0, 6},
172 { MCM_GETFIRSTDAYOFWEEK, sent|wparam|lparam, 0, 0},
174 { MCM_SETFIRSTDAYOFWEEK, sent|wparam|lparam, 0, 7},
175 { MCM_GETFIRSTDAYOFWEEK, sent|wparam|lparam, 0, 0},
177 { MCM_SETFIRSTDAYOFWEEK, sent|wparam|lparam, 0, 8},
178 { MCM_GETFIRSTDAYOFWEEK, sent|wparam|lparam, 0, 0},
180 { MCM_SETFIRSTDAYOFWEEK, sent|wparam|lparam, 0, 9},
181 { MCM_GETFIRSTDAYOFWEEK, sent|wparam|lparam, 0, 0},
183 { MCM_SETFIRSTDAYOFWEEK, sent|wparam|lparam, 0, 10},
184 { MCM_GETFIRSTDAYOFWEEK, sent|wparam|lparam, 0, 0},
186 { MCM_SETFIRSTDAYOFWEEK, sent|wparam|lparam, 0, 11},
187 { MCM_GETFIRSTDAYOFWEEK, sent|wparam|lparam, 0, 0},
191 static const struct message monthcal_unicode_seq[] = {
192 { MCM_GETUNICODEFORMAT, sent|wparam|lparam, 0, 0},
193 { MCM_SETUNICODEFORMAT, sent|wparam|lparam, 1, 0},
194 { MCM_GETUNICODEFORMAT, sent|wparam|lparam, 0, 0},
195 { MCM_SETUNICODEFORMAT, sent|wparam|lparam, 0, 0},
196 { MCM_GETUNICODEFORMAT, sent|wparam|lparam, 0, 0},
197 { MCM_SETUNICODEFORMAT, sent|wparam|lparam, 1, 0},
201 static const struct message monthcal_hit_test_seq[] = {
202 { MCM_SETCURSEL, sent|wparam, 0},
203 { WM_PAINT, sent|wparam|lparam|defwinproc, 0, 0},
204 { MCM_HITTEST, sent|wparam, 0},
205 { MCM_HITTEST, sent|wparam, 0},
206 { MCM_HITTEST, sent|wparam, 0},
207 { MCM_HITTEST, sent|wparam, 0},
208 { MCM_HITTEST, sent|wparam, 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},
219 { MCM_HITTEST, sent|wparam, 0},
220 { MCM_HITTEST, sent|wparam, 0},
224 static const struct message monthcal_todaylink_seq[] = {
225 { MCM_HITTEST, sent|wparam, 0},
226 { MCM_SETTODAY, sent|wparam, 0},
227 { WM_PAINT, sent|wparam|lparam|defwinproc, 0, 0},
228 { MCM_GETTODAY, sent|wparam, 0},
229 { WM_LBUTTONDOWN, sent|wparam|lparam, MK_LBUTTON, MAKELONG(70, 370)},
230 { WM_CAPTURECHANGED, sent|wparam|lparam|defwinproc, 0, 0},
231 { WM_PAINT, sent|wparam|lparam|defwinproc, 0, 0},
232 { MCM_GETCURSEL, sent|wparam, 0},
236 static const struct message monthcal_today_seq[] = {
237 { MCM_SETTODAY, sent|wparam, 0},
238 { WM_PAINT, sent|wparam|lparam|defwinproc, 0, 0},
239 { MCM_GETTODAY, sent|wparam, 0},
240 { MCM_SETTODAY, sent|wparam, 0},
241 { WM_PAINT, sent|wparam|lparam|defwinproc, 0, 0},
242 { MCM_GETTODAY, sent|wparam, 0},
246 static const struct message monthcal_scroll_seq[] = {
247 { MCM_SETMONTHDELTA, sent|wparam|lparam, 2, 0},
248 { MCM_SETMONTHDELTA, sent|wparam|lparam, 3, 0},
249 { MCM_GETMONTHDELTA, sent|wparam|lparam, 0, 0},
250 { MCM_SETMONTHDELTA, sent|wparam|lparam, 12, 0},
251 { MCM_GETMONTHDELTA, sent|wparam|lparam, 0, 0},
252 { MCM_SETMONTHDELTA, sent|wparam|lparam, 15, 0},
253 { MCM_GETMONTHDELTA, sent|wparam|lparam, 0, 0},
254 { MCM_SETMONTHDELTA, sent|wparam|lparam, -5, 0},
255 { MCM_GETMONTHDELTA, sent|wparam|lparam, 0, 0},
259 static const struct message monthcal_monthrange_seq[] = {
260 { MCM_GETMONTHRANGE, sent|wparam, GMR_VISIBLE},
261 { MCM_GETMONTHRANGE, sent|wparam, GMR_DAYSTATE},
265 static const struct message monthcal_max_sel_day_seq[] = {
266 { MCM_SETMAXSELCOUNT, sent|wparam|lparam, 5, 0},
267 { MCM_GETMAXSELCOUNT, sent|wparam|lparam, 0, 0},
268 { MCM_SETMAXSELCOUNT, sent|wparam|lparam, 15, 0},
269 { MCM_GETMAXSELCOUNT, sent|wparam|lparam, 0, 0},
270 { MCM_SETMAXSELCOUNT, sent|wparam|lparam, -1, 0},
271 { MCM_GETMAXSELCOUNT, sent|wparam|lparam, 0, 0},
275 /* expected message sequence for parent*/
276 static const struct message destroy_monthcal_parent_msgs_seq[] = {
277 { WM_PARENTNOTIFY, sent|wparam, WM_DESTROY},
281 /* expected message sequence for child*/
282 static const struct message destroy_monthcal_child_msgs_seq[] = {
283 { WM_SHOWWINDOW, sent|wparam|lparam, 0, 0},
284 { WM_WINDOWPOSCHANGING, sent|wparam, 0},
285 { WM_WINDOWPOSCHANGED, sent|wparam, 0},
286 { WM_DESTROY, sent|wparam|lparam, 0, 0},
287 { WM_NCDESTROY, sent|wparam|lparam, 0, 0},
291 static const struct message destroy_monthcal_multi_sel_style_seq[] = {
292 { WM_DESTROY, sent|wparam|lparam, 0, 0},
293 { WM_NCDESTROY, sent|wparam|lparam, 0, 0},
297 /* expected message sequence for parent window*/
298 static const struct message destroy_parent_seq[] = {
299 { WM_WINDOWPOSCHANGING, sent|wparam, 0},
300 { WM_WINDOWPOSCHANGED, sent|wparam, 0},
301 { WM_NCACTIVATE, sent|wparam|lparam, 0, 0},
302 { WM_ACTIVATE, sent|wparam|lparam, 0, 0},
303 { WM_ACTIVATEAPP, sent|wparam, 0},
304 { WM_KILLFOCUS, sent|wparam|lparam, 0, 0},
305 { WM_IME_SETCONTEXT, sent|wparam|optional, 0},
306 { WM_IME_NOTIFY, sent|wparam|lparam|defwinproc|optional, 1, 0},
307 { WM_DESTROY, sent|wparam|lparam, 0, 0},
308 { WM_NCDESTROY, sent|wparam|lparam, 0, 0},
312 static void test_monthcal(void)
315 SYSTEMTIME st[2], st1[2];
316 INITCOMMONCONTROLSEX ic = {sizeof(INITCOMMONCONTROLSEX), ICC_DATE_CLASSES};
317 int res, month_range;
319 InitCommonControlsEx(&ic);
320 hwnd = CreateWindowA(MONTHCAL_CLASSA, "MonthCal", WS_POPUP | WS_VISIBLE, CW_USEDEFAULT,
321 0, 300, 300, 0, 0, NULL, NULL);
322 ok(hwnd != NULL, "Failed to create MonthCal\n");
323 GetSystemTime(&st[0]);
326 /* Invalid date/time */
328 /* Time should not matter */
329 st[1].wHour = st[1].wMinute = st[1].wSecond = 70;
330 ok(SendMessage(hwnd, MCM_SETRANGE, GDTR_MAX, (LPARAM)st), "Failed to set MAX limit\n");
331 ok(SendMessage(hwnd, MCM_GETRANGE, 0, (LPARAM)st1) == GDTR_MAX, "No limits should be set\n");
332 ok(st1[0].wYear != 2000, "Lover limit changed\n");
335 ok(!SendMessage(hwnd, MCM_SETRANGE, GDTR_MIN | GDTR_MAX, (LPARAM)st), "Should have failed to set limits\n");
336 ok(SendMessage(hwnd, MCM_GETRANGE, 0, (LPARAM)st1) == GDTR_MAX, "No limits should be set\n");
337 ok(st1[0].wYear != 2000, "Lover limit changed\n");
338 ok(!SendMessage(hwnd, MCM_SETRANGE, GDTR_MAX, (LPARAM)st), "Should have failed to set MAX limit\n");
339 ok(SendMessage(hwnd, MCM_GETRANGE, 0, (LPARAM)st1) == GDTR_MAX, "No limits should be set\n");
340 ok(st1[0].wYear != 2000, "Lover limit changed\n");
342 GetSystemTime(&st[0]);
347 month_range = SendMessage(hwnd, MCM_GETMONTHRANGE, GMR_VISIBLE, (LPARAM)st1);
349 ok(SendMessage(hwnd, MCM_SETRANGE, GDTR_MIN | GDTR_MAX, (LPARAM)st), "Failed to set both min and max limits\n");
350 res = SendMessage(hwnd, MCM_GETMONTHRANGE, GMR_VISIBLE, (LPARAM)st1);
351 ok(res == month_range, "Invalid month range (%d)\n", res);
352 ok(SendMessage(hwnd, MCM_GETRANGE, 0, (LPARAM)st1) == (GDTR_MIN|GDTR_MAX), "Limits should be set\n");
355 ok(SendMessage(hwnd, MCM_SETRANGE, GDTR_MIN | GDTR_MAX, (LPARAM)st), "Failed to set both min and max limits\n");
356 res = SendMessage(hwnd, MCM_GETMONTHRANGE, GMR_VISIBLE, (LPARAM)st1);
357 ok(res == month_range, "Invalid month range (%d)\n", res);
360 ok(SendMessage(hwnd, MCM_SETRANGE, GDTR_MIN | GDTR_MAX, (LPARAM)st), "Failed to set both min and max limits\n");
362 ok(SendMessage(hwnd, MCM_SETRANGE, GDTR_MIN | GDTR_MAX, (LPARAM)st), "Failed to set both min and max limits\n");
365 ok(SendMessage(hwnd, MCM_SETRANGE, GDTR_MAX, (LPARAM)st), "Failed to set max limit\n");
366 ok(SendMessage(hwnd, MCM_GETRANGE, 0, (LPARAM)st1) == GDTR_MAX, "Only MAX limit should be set\n");
368 ok(SendMessage(hwnd, MCM_SETRANGE, GDTR_MAX, (LPARAM)st), "Failed to set max limit\n");
370 ok(SendMessage(hwnd, MCM_SETRANGE, GDTR_MAX, (LPARAM)st), "Failed to set max limit\n");
372 ok(SendMessage(hwnd, MCM_SETRANGE, GDTR_MAX, (LPARAM)st), "Failed to set max limit\n");
373 ok(SendMessage(hwnd, MCM_GETRANGE, 0, (LPARAM)st1) == GDTR_MAX, "Only MAX limit should be set\n");
378 static LRESULT WINAPI parent_wnd_proc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
380 static long defwndproc_counter = 0;
384 /* do not log painting messages */
385 if (message != WM_PAINT &&
386 message != WM_ERASEBKGND &&
387 message != WM_NCPAINT &&
388 message != WM_NCHITTEST &&
389 message != WM_GETTEXT &&
390 message != WM_GETICON &&
391 message != WM_DEVICECHANGE)
393 trace("parent: %p, %04x, %08lx, %08lx\n", hwnd, message, wParam, lParam);
395 msg.message = message;
396 msg.flags = sent|wparam|lparam;
397 if (defwndproc_counter) msg.flags |= defwinproc;
400 add_message(sequences, PARENT_SEQ_INDEX, &msg);
403 defwndproc_counter++;
404 ret = DefWindowProcA(hwnd, message, wParam, lParam);
405 defwndproc_counter--;
410 static BOOL register_parent_wnd_class(void)
415 cls.lpfnWndProc = parent_wnd_proc;
418 cls.hInstance = GetModuleHandleA(NULL);
420 cls.hCursor = LoadCursorA(0, (LPSTR)IDC_ARROW);
421 cls.hbrBackground = GetStockObject(WHITE_BRUSH);
422 cls.lpszMenuName = NULL;
423 cls.lpszClassName = "Month-Cal test parent class";
424 return RegisterClassA(&cls);
427 static HWND create_parent_window(void)
431 InitCommonControls();
433 /* flush message sequences, so we can check the new sequence by the end of function */
434 flush_sequences(sequences, NUM_MSG_SEQUENCES);
436 if (!register_parent_wnd_class())
439 hwnd = CreateWindowEx(0, "Month-Cal test parent class",
440 "Month-Cal test parent window",
441 WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX |
442 WS_MAXIMIZEBOX | WS_VISIBLE,
444 GetDesktopWindow(), NULL, GetModuleHandleA(NULL), NULL);
448 /* check for message sequences */
449 ok_sequence(sequences, PARENT_SEQ_INDEX, create_parent_window_seq, "create parent window", TRUE);
454 static LRESULT WINAPI monthcal_subclass_proc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
456 struct subclass_info *info = (struct subclass_info *)GetWindowLongPtrA(hwnd, GWLP_USERDATA);
457 static long defwndproc_counter = 0;
461 trace("monthcal: %p, %04x, %08lx, %08lx\n", hwnd, message, wParam, lParam);
463 msg.message = message;
464 msg.flags = sent|wparam|lparam;
465 if (defwndproc_counter) msg.flags |= defwinproc;
468 add_message(sequences, MONTHCAL_SEQ_INDEX, &msg);
470 defwndproc_counter++;
471 ret = CallWindowProcA(info->oldproc, hwnd, message, wParam, lParam);
472 defwndproc_counter--;
477 static HWND create_monthcal_control(DWORD style, HWND parent_window)
479 struct subclass_info *info;
481 static const INITCOMMONCONTROLSEX ic = {sizeof(INITCOMMONCONTROLSEX), ICC_DATE_CLASSES};
483 InitCommonControlsEx(&ic);
485 info = HeapAlloc(GetProcessHeap(), 0, sizeof(struct subclass_info));
489 hwnd = CreateWindowEx(0,
494 parent_window, NULL, GetModuleHandleA(NULL), NULL);
498 HeapFree(GetProcessHeap(), 0, info);
502 info->oldproc = (WNDPROC)SetWindowLongPtrA(hwnd, GWLP_WNDPROC,
503 (LONG_PTR)monthcal_subclass_proc);
504 SetWindowLongPtrA(hwnd, GWLP_USERDATA, (LONG_PTR)info);
510 /* Setter and Getters Tests */
512 static void test_monthcal_color(HWND hwnd)
516 flush_sequences(sequences, NUM_MSG_SEQUENCES);
518 /* Setter and Getters for color*/
519 temp = SendMessage(hwnd, MCM_GETCOLOR, MCSC_BACKGROUND, 0);
520 res = SendMessage(hwnd, MCM_SETCOLOR, MCSC_BACKGROUND, RGB(0,0,0));
522 temp = SendMessage(hwnd, MCM_GETCOLOR, MCSC_BACKGROUND, 0);
523 expect(RGB(0,0,0), temp);
524 res = SendMessage(hwnd, MCM_SETCOLOR, MCSC_BACKGROUND, RGB(255,255,255));
526 temp = SendMessage(hwnd, MCM_GETCOLOR, MCSC_BACKGROUND, 0);
527 expect(RGB(255,255,255), temp);
529 temp = SendMessage(hwnd, MCM_GETCOLOR, MCSC_MONTHBK, 0);
530 res = SendMessage(hwnd, MCM_SETCOLOR, MCSC_MONTHBK, RGB(0,0,0));
532 temp = SendMessage(hwnd, MCM_GETCOLOR, MCSC_MONTHBK, 0);
533 expect(RGB(0,0,0), temp);
534 res = SendMessage(hwnd, MCM_SETCOLOR, MCSC_MONTHBK, RGB(255,255,255));
536 temp = SendMessage(hwnd, MCM_GETCOLOR, MCSC_MONTHBK, 0);
537 expect(RGB(255,255,255), temp);
539 temp = SendMessage(hwnd, MCM_GETCOLOR, MCSC_TEXT, 0);
540 res = SendMessage(hwnd, MCM_SETCOLOR, MCSC_TEXT, RGB(0,0,0));
542 temp = SendMessage(hwnd, MCM_GETCOLOR, MCSC_TEXT, 0);
543 expect(RGB(0,0,0), temp);
544 res = SendMessage(hwnd, MCM_SETCOLOR, MCSC_TEXT, RGB(255,255,255));
546 temp = SendMessage(hwnd, MCM_GETCOLOR, MCSC_TEXT, 0);
547 expect(RGB(255,255,255), temp);
549 temp = SendMessage(hwnd, MCM_GETCOLOR, MCSC_TITLEBK, 0);
550 res = SendMessage(hwnd, MCM_SETCOLOR, MCSC_TITLEBK, RGB(0,0,0));
552 temp = SendMessage(hwnd, MCM_GETCOLOR, MCSC_TITLEBK, 0);
553 expect(RGB(0,0,0), temp);
554 res = SendMessage(hwnd, MCM_SETCOLOR, MCSC_TITLEBK, RGB(255,255,255));
556 temp = SendMessage(hwnd, MCM_GETCOLOR, MCSC_TITLEBK, 0);
557 expect(RGB(255,255,255), temp);
559 temp = SendMessage(hwnd, MCM_GETCOLOR, MCSC_TITLETEXT, 0);
560 res = SendMessage(hwnd, MCM_SETCOLOR, MCSC_TITLETEXT, RGB(0,0,0));
562 temp = SendMessage(hwnd, MCM_GETCOLOR, MCSC_TITLETEXT, 0);
563 expect(RGB(0,0,0), temp);
564 res = SendMessage(hwnd, MCM_SETCOLOR, MCSC_TITLETEXT, RGB(255,255,255));
566 temp = SendMessage(hwnd, MCM_GETCOLOR, MCSC_TITLETEXT, 0);
567 expect(RGB(255,255,255), temp);
569 temp = SendMessage(hwnd, MCM_GETCOLOR, MCSC_TRAILINGTEXT, 0);
570 res = SendMessage(hwnd, MCM_SETCOLOR, MCSC_TRAILINGTEXT, RGB(0,0,0));
572 temp = SendMessage(hwnd, MCM_GETCOLOR, MCSC_TRAILINGTEXT, 0);
573 expect(RGB(0,0,0), temp);
574 res = SendMessage(hwnd, MCM_SETCOLOR, MCSC_TRAILINGTEXT, RGB(255,255,255));
576 temp = SendMessage(hwnd, MCM_GETCOLOR, MCSC_TRAILINGTEXT, 0);
577 expect(RGB(255,255,255), temp);
579 ok_sequence(sequences, MONTHCAL_SEQ_INDEX, monthcal_color_seq, "monthcal color", FALSE);
582 static void test_monthcal_currDate(HWND hwnd)
584 SYSTEMTIME st_original, st_new, st_test;
587 flush_sequences(sequences, NUM_MSG_SEQUENCES);
589 /* Setter and Getters for current date selected */
590 st_original.wYear = 2000;
591 st_original.wMonth = 11;
592 st_original.wDay = 28;
593 st_original.wHour = 11;
594 st_original.wMinute = 59;
595 st_original.wSecond = 30;
596 st_original.wMilliseconds = 0;
597 st_original.wDayOfWeek = 0;
599 st_new = st_test = st_original;
601 /* Should not validate the time */
602 res = SendMessage(hwnd, MCM_SETCURSEL, 0, (LPARAM)&st_test);
605 /* Overflow matters, check for wDay */
607 res = SendMessage(hwnd, MCM_SETCURSEL, 0, (LPARAM)&st_test);
610 /* correct wDay before checking for wMonth */
612 expect(st_original.wDay, st_test.wDay);
614 /* Overflow matters, check for wMonth */
616 res = SendMessage(hwnd, MCM_SETCURSEL, 0, (LPARAM)&st_test);
619 /* checking if gets the information right, modify st_new */
627 res = SendMessage(hwnd, MCM_GETCURSEL, 0, (LPARAM)&st_new);
630 /* st_new change to st_origin, above settings with overflow */
631 /* should not change the current settings */
632 expect(st_original.wYear, st_new.wYear);
633 expect(st_original.wMonth, st_new.wMonth);
634 expect(st_original.wDay, st_new.wDay);
635 expect(st_original.wHour, st_new.wHour);
636 expect(st_original.wMinute, st_new.wMinute);
637 expect(st_original.wSecond, st_new.wSecond);
639 /* lparam cannot be NULL */
640 res = SendMessage(hwnd, MCM_GETCURSEL, 0, (LPARAM) NULL);
643 ok_sequence(sequences, MONTHCAL_SEQ_INDEX, monthcal_curr_date_seq, "monthcal currDate", TRUE);
646 static void test_monthcal_firstDay(HWND hwnd)
648 int res, fday, i, prev;
650 LCID lcid = LOCALE_USER_DEFAULT;
652 flush_sequences(sequences, NUM_MSG_SEQUENCES);
654 /* Setter and Getters for first day of week */
655 /* check for locale first day */
656 if(GetLocaleInfo(lcid, LOCALE_IFIRSTDAYOFWEEK, b, 128)){
658 res = SendMessage(hwnd, MCM_GETFIRSTDAYOFWEEK, 0, 0);
662 /* checking for the values that actually will be stored as */
663 /* current first day when we set a new value */
664 for (i = -5; i < 12; i++){
665 res = SendMessage(hwnd, MCM_SETFIRSTDAYOFWEEK, 0, (LPARAM) i);
667 res = SendMessage(hwnd, MCM_GETFIRSTDAYOFWEEK, 0, 0);
671 expect(MAKELONG(fday, FALSE), res);
673 expect(MAKELONG(fday, TRUE), res);
675 expect(MAKELONG(i, TRUE), res);
679 ok_sequence(sequences, MONTHCAL_SEQ_INDEX, monthcal_first_day_seq, "monthcal firstDay", FALSE);
682 skip("Cannot retrieve first day of the week\n");
687 static void test_monthcal_unicode(HWND hwnd)
691 flush_sequences(sequences, NUM_MSG_SEQUENCES);
693 /* Setter and Getters for Unicode format */
695 /* getting the current settings */
696 temp = SendMessage(hwnd, MCM_GETUNICODEFORMAT, 0, 0);
698 /* setting to 1, should return previous settings */
699 res = SendMessage(hwnd, MCM_SETUNICODEFORMAT, 1, 0);
702 /* current setting is 1, so, should return 1 */
703 res = SendMessage(hwnd, MCM_GETUNICODEFORMAT, 0, 0);
704 todo_wine {expect(1, res);}
706 /* setting to 0, should return previous settings */
707 res = SendMessage(hwnd, MCM_SETUNICODEFORMAT, 0, 0);
708 todo_wine {expect(1, res);}
710 /* current setting is 0, so, it should return 0 */
711 res = SendMessage(hwnd, MCM_GETUNICODEFORMAT, 0, 0);
714 /* should return previous settings */
715 res = SendMessage(hwnd, MCM_SETUNICODEFORMAT, 1, 0);
718 ok_sequence(sequences, MONTHCAL_SEQ_INDEX, monthcal_unicode_seq, "monthcal unicode", FALSE);
721 static void test_monthcal_HitTest(HWND hwnd)
727 memset(&mchit, 0, sizeof(MCHITTESTINFO));
729 flush_sequences(sequences, NUM_MSG_SEQUENCES);
737 st.wMilliseconds = 0;
740 res = SendMessage(hwnd, MCM_SETCURSEL, 0, (LPARAM)&st);
743 /* (0, 0) is the top left of the control and should not be active */
744 mchit.cbSize = sizeof(MCHITTESTINFO);
747 res = SendMessage(hwnd, MCM_HITTEST, 0, (LPARAM) & mchit);
748 expect(0, mchit.pt.x);
749 expect(0, mchit.pt.y);
750 expect(mchit.uHit, res);
751 todo_wine {expect(MCHT_NOWHERE, res);}
753 /* (300, 400) is the bottom right of the control and should not be active */
756 res = SendMessage(hwnd, MCM_HITTEST, 0, (LPARAM) & mchit);
757 expect(300, mchit.pt.x);
758 expect(400, mchit.pt.y);
759 expect(mchit.uHit, res);
760 todo_wine {expect(MCHT_NOWHERE, res);}
762 /* (500, 500) is completely out of the control and should not be active */
765 res = SendMessage(hwnd, MCM_HITTEST, 0, (LPARAM) & mchit);
766 expect(500, mchit.pt.x);
767 expect(500, mchit.pt.y);
768 expect(mchit.uHit, res);
769 todo_wine {expect(MCHT_NOWHERE, res);}
771 /* (120, 180) is in active area - calendar background */
774 res = SendMessage(hwnd, MCM_HITTEST, 0, (LPARAM) & mchit);
775 expect(120, mchit.pt.x);
776 expect(180, mchit.pt.y);
777 expect(mchit.uHit, res);
778 expect(MCHT_CALENDARBK, res);
780 /* (50, 40) is in active area - previous month button */
783 res = SendMessage(hwnd, MCM_HITTEST, 0, (LPARAM) & mchit);
784 expect(50, mchit.pt.x);
785 expect(40, mchit.pt.y);
786 expect(mchit.uHit, res);
787 todo_wine {expect(MCHT_TITLEBTNPREV, res);}
789 /* (90, 40) is in active area - background section of the title */
792 res = SendMessage(hwnd, MCM_HITTEST, 0, (LPARAM) & mchit);
793 expect(90, mchit.pt.x);
794 expect(40, mchit.pt.y);
795 expect(mchit.uHit, res);
796 todo_wine {expect(MCHT_TITLE, res);}
798 /* (140, 40) is in active area - month section of the title */
801 res = SendMessage(hwnd, MCM_HITTEST, 0, (LPARAM) & mchit);
802 expect(140, mchit.pt.x);
803 expect(40, mchit.pt.y);
804 expect(mchit.uHit, res);
805 todo_wine {expect(MCHT_TITLEMONTH, res);}
807 /* (250, 40) is in active area - next month button */
810 res = SendMessage(hwnd, MCM_HITTEST, 0, (LPARAM) & mchit);
811 expect(250, mchit.pt.x);
812 expect(40, mchit.pt.y);
813 expect(mchit.uHit, res);
814 todo_wine {expect(MCHT_TITLEBTNNEXT, res);}
816 /* (70, 70) is in active area - day of the week */
819 res = SendMessage(hwnd, MCM_HITTEST, 0, (LPARAM) & mchit);
820 expect(70, mchit.pt.x);
821 expect(70, mchit.pt.y);
822 expect(mchit.uHit, res);
823 todo_wine {expect(MCHT_CALENDARDAY, res);}
825 /* (70, 90) is in active area - date from prev month */
828 res = SendMessage(hwnd, MCM_HITTEST, 0, (LPARAM) & mchit);
829 expect(70, mchit.pt.x);
830 expect(90, mchit.pt.y);
831 expect(mchit.uHit, res);
832 todo_wine {expect(MCHT_CALENDARDATEPREV, res);}
835 /* (125, 115) is in active area - date from this month */
838 res = SendMessage(hwnd, MCM_HITTEST, 0, (LPARAM) & mchit);
839 expect(125, mchit.pt.x);
840 expect(115, mchit.pt.y);
841 expect(mchit.uHit, res);
842 expect(MCHT_CALENDARDATE, res);
845 /* (80, 220) is in active area - background section of the title */
848 res = SendMessage(hwnd, MCM_HITTEST, 0, (LPARAM) & mchit);
849 expect(80, mchit.pt.x);
850 expect(220, mchit.pt.y);
851 expect(mchit.uHit, res);
852 todo_wine {expect(MCHT_TITLEBK, res);}
854 /* (140, 215) is in active area - month section of the title */
857 res = SendMessage(hwnd, MCM_HITTEST, 0, (LPARAM) & mchit);
858 expect(140, mchit.pt.x);
859 expect(215, mchit.pt.y);
860 expect(mchit.uHit, res);
861 todo_wine {expect(MCHT_TITLEMONTH, res);}
863 /* (170, 215) is in active area - year section of the title */
866 res = SendMessage(hwnd, MCM_HITTEST, 0, (LPARAM) & mchit);
867 expect(170, mchit.pt.x);
868 expect(215, mchit.pt.y);
869 expect(mchit.uHit, res);
870 todo_wine {expect(MCHT_TITLEYEAR, res);}
872 /* (150, 260) is in active area - date from this month */
875 res = SendMessage(hwnd, MCM_HITTEST, 0, (LPARAM) & mchit);
876 expect(150, mchit.pt.x);
877 expect(260, mchit.pt.y);
878 expect(mchit.uHit, res);
879 todo_wine {expect(MCHT_CALENDARDATE, res);}
881 /* (150, 350) is in active area - date from next month */
884 res = SendMessage(hwnd, MCM_HITTEST, 0, (LPARAM) & mchit);
885 expect(150, mchit.pt.x);
886 expect(350, mchit.pt.y);
887 expect(mchit.uHit, res);
888 todo_wine {expect(MCHT_CALENDARDATENEXT, res);}
890 /* (150, 370) is in active area - today link */
893 res = SendMessage(hwnd, MCM_HITTEST, 0, (LPARAM) & mchit);
894 expect(150, mchit.pt.x);
895 expect(370, mchit.pt.y);
896 expect(mchit.uHit, res);
897 todo_wine {expect(MCHT_TODAYLINK, res);}
899 /* (70, 370) is in active area - today link */
902 res = SendMessage(hwnd, MCM_HITTEST, 0, (LPARAM) & mchit);
903 expect(70, mchit.pt.x);
904 expect(370, mchit.pt.y);
905 expect(mchit.uHit, res);
906 todo_wine {expect(MCHT_TODAYLINK, res);}
908 ok_sequence(sequences, MONTHCAL_SEQ_INDEX, monthcal_hit_test_seq, "monthcal hit test", TRUE);
911 static void test_monthcal_todaylink(HWND hwnd)
914 SYSTEMTIME st_test, st_new;
918 memset(&mchit, 0, sizeof(MCHITTESTINFO));
920 flush_sequences(sequences, NUM_MSG_SEQUENCES);
922 /* (70, 370) is in active area - today link */
923 mchit.cbSize = sizeof(MCHITTESTINFO);
926 res = SendMessage(hwnd, MCM_HITTEST, 0, (LPARAM) & mchit);
927 expect(70, mchit.pt.x);
928 expect(370, mchit.pt.y);
929 expect(mchit.uHit, res);
930 todo_wine {expect(MCHT_TODAYLINK, res);}
931 if (70 != mchit.pt.x || 370 != mchit.pt.y || mchit.uHit != res
932 || MCHT_TODAYLINK != res)
937 st_test.wYear = 2005;
938 memset(&st_new, 0, sizeof(SYSTEMTIME));
940 SendMessage(hwnd, MCM_SETTODAY, 0, (LPARAM)&st_test);
942 res = SendMessage(hwnd, MCM_GETTODAY, 0, (LPARAM)&st_new);
944 expect(1, st_new.wDay);
945 expect(1, st_new.wMonth);
946 expect(2005, st_new.wYear);
947 if (1 != res || 1 != st_new.wDay || 1 != st_new.wMonth
948 || 2005 != st_new.wYear)
952 skip("cannot perform today link test\n");
956 res = SendMessage(hwnd, WM_LBUTTONDOWN, MK_LBUTTON, MAKELONG(70, 370));
959 memset(&st_new, 0, sizeof(SYSTEMTIME));
960 res = SendMessage(hwnd, MCM_GETCURSEL, 0, (LPARAM)&st_new);
962 expect(1, st_new.wDay);
963 expect(1, st_new.wMonth);
964 expect(2005, st_new.wYear);
966 ok_sequence(sequences, MONTHCAL_SEQ_INDEX, monthcal_todaylink_seq, "monthcal hit test", TRUE);
969 static void test_monthcal_today(HWND hwnd)
971 SYSTEMTIME st_test, st_new;
974 flush_sequences(sequences, NUM_MSG_SEQUENCES);
976 /* Setter and Getters for "today" information */
978 /* check for overflow, should be ok */
985 SendMessage(hwnd, MCM_SETTODAY, 0, (LPARAM)&st_test);
987 res = SendMessage(hwnd, MCM_GETTODAY, 0, (LPARAM)&st_new);
990 /* st_test should not change */
991 expect(38, st_test.wDay);
992 expect(38, st_test.wMonth);
994 /* st_new should change, overflow does not matter */
995 expect(38, st_new.wDay);
996 expect(38, st_new.wMonth);
998 /* check for zero, should be ok*/
1002 SendMessage(hwnd, MCM_SETTODAY, 0, (LPARAM)&st_test);
1004 res = SendMessage(hwnd, MCM_GETTODAY, 0, (LPARAM)&st_new);
1007 /* st_test should not change */
1008 expect(0, st_test.wDay);
1009 expect(0, st_test.wMonth);
1011 /* st_new should change to zero*/
1012 expect(0, st_new.wDay);
1013 expect(0, st_new.wMonth);
1015 ok_sequence(sequences, MONTHCAL_SEQ_INDEX, monthcal_today_seq, "monthcal today", TRUE);
1018 static void test_monthcal_scroll(HWND hwnd)
1022 flush_sequences(sequences, NUM_MSG_SEQUENCES);
1024 /* Setter and Getters for scroll rate */
1025 res = SendMessage(hwnd, MCM_SETMONTHDELTA, 2, 0);
1028 res = SendMessage(hwnd, MCM_SETMONTHDELTA, 3, 0);
1030 res = SendMessage(hwnd, MCM_GETMONTHDELTA, 0, 0);
1033 res = SendMessage(hwnd, MCM_SETMONTHDELTA, 12, 0);
1035 res = SendMessage(hwnd, MCM_GETMONTHDELTA, 0, 0);
1038 res = SendMessage(hwnd, MCM_SETMONTHDELTA, 15, 0);
1040 res = SendMessage(hwnd, MCM_GETMONTHDELTA, 0, 0);
1043 res = SendMessage(hwnd, MCM_SETMONTHDELTA, -5, 0);
1045 res = SendMessage(hwnd, MCM_GETMONTHDELTA, 0, 0);
1048 ok_sequence(sequences, MONTHCAL_SEQ_INDEX, monthcal_scroll_seq, "monthcal scroll", FALSE);
1051 static void test_monthcal_monthrange(HWND hwnd)
1054 SYSTEMTIME st_visible[2], st_daystate[2];
1056 flush_sequences(sequences, NUM_MSG_SEQUENCES);
1057 st_visible[0].wYear = 0;
1058 st_visible[0].wMonth = 0;
1059 st_visible[0].wDay = 0;
1060 st_daystate[1] = st_daystate[0] = st_visible[1] = st_visible[0];
1062 res = SendMessage(hwnd, MCM_GETMONTHRANGE, GMR_VISIBLE, (LPARAM)st_visible);
1065 expect(2000, st_visible[0].wYear);
1066 expect(11, st_visible[0].wMonth);
1067 expect(1, st_visible[0].wDay);
1068 expect(2000, st_visible[1].wYear);
1069 expect(12, st_visible[1].wMonth);
1070 expect(31, st_visible[1].wDay);
1072 res = SendMessage(hwnd, MCM_GETMONTHRANGE, GMR_DAYSTATE, (LPARAM)st_daystate);
1075 expect(2000, st_daystate[0].wYear);
1076 expect(10, st_daystate[0].wMonth);
1077 expect(29, st_daystate[0].wDay);
1078 expect(2001, st_daystate[1].wYear);
1079 expect(1, st_daystate[1].wMonth);
1080 expect(6, st_daystate[1].wDay);
1083 ok_sequence(sequences, MONTHCAL_SEQ_INDEX, monthcal_monthrange_seq, "monthcal monthrange", FALSE);
1086 static void test_monthcal_MaxSelDay(HWND hwnd)
1090 flush_sequences(sequences, NUM_MSG_SEQUENCES);
1092 /* Setter and Getters for max selected days */
1093 res = SendMessage(hwnd, MCM_SETMAXSELCOUNT, 5, 0);
1095 res = SendMessage(hwnd, MCM_GETMAXSELCOUNT, 0, 0);
1098 res = SendMessage(hwnd, MCM_SETMAXSELCOUNT, 15, 0);
1100 res = SendMessage(hwnd, MCM_GETMAXSELCOUNT, 0, 0);
1103 res = SendMessage(hwnd, MCM_SETMAXSELCOUNT, -1, 0);
1104 todo_wine {expect(0, res);}
1105 res = SendMessage(hwnd, MCM_GETMAXSELCOUNT, 0, 0);
1106 todo_wine {expect(15, res);}
1108 ok_sequence(sequences, MONTHCAL_SEQ_INDEX, monthcal_max_sel_day_seq, "monthcal MaxSelDay", FALSE);
1112 START_TEST(monthcal)
1114 HWND hwnd, parent_wnd;
1117 init_msg_sequences(sequences, NUM_MSG_SEQUENCES);
1119 parent_wnd = create_parent_window();
1121 flush_sequences(sequences, NUM_MSG_SEQUENCES);
1122 hwnd = create_monthcal_control(WS_CHILD | WS_BORDER | WS_VISIBLE, parent_wnd);
1124 ok_sequence(sequences, PARENT_SEQ_INDEX, create_monthcal_control_seq, "create monthcal control", TRUE);
1126 SendMessage(hwnd, WM_SETFONT, (WPARAM)GetStockObject(SYSTEM_FONT), 0);
1128 test_monthcal_color(hwnd);
1129 test_monthcal_currDate(hwnd);
1130 test_monthcal_firstDay(hwnd);
1131 test_monthcal_unicode(hwnd);
1132 test_monthcal_today(hwnd);
1133 test_monthcal_scroll(hwnd);
1134 test_monthcal_monthrange(hwnd);
1135 test_monthcal_HitTest(hwnd);
1136 test_monthcal_todaylink(hwnd);
1138 flush_sequences(sequences, NUM_MSG_SEQUENCES);
1139 DestroyWindow(hwnd);
1140 ok_sequence(sequences, PARENT_SEQ_INDEX, destroy_monthcal_parent_msgs_seq, "Destroy monthcal (parent msg)", FALSE);
1141 ok_sequence(sequences, MONTHCAL_SEQ_INDEX, destroy_monthcal_child_msgs_seq, "Destroy monthcal (child msg)", FALSE);
1143 flush_sequences(sequences, NUM_MSG_SEQUENCES);
1144 hwnd = create_monthcal_control(MCS_MULTISELECT, parent_wnd);
1146 ok_sequence(sequences, PARENT_SEQ_INDEX, create_monthcal_multi_sel_style_seq, "create monthcal (multi sel style)", TRUE);
1148 test_monthcal_MaxSelDay(hwnd);
1150 flush_sequences(sequences, NUM_MSG_SEQUENCES);
1151 DestroyWindow(hwnd);
1152 ok_sequence(sequences, MONTHCAL_SEQ_INDEX, destroy_monthcal_multi_sel_style_seq, "Destroy monthcal (multi sel style)", FALSE);
1154 flush_sequences(sequences, NUM_MSG_SEQUENCES);
1155 DestroyWindow(parent_wnd);
1156 ok_sequence(sequences, PARENT_SEQ_INDEX, destroy_parent_seq, "Destroy parent window", FALSE);