Commit 2a79d962 authored by Kanit Therdsteerasukdi's avatar Kanit Therdsteerasukdi Committed by Alexandre Julliard

comctl32: datetime: Reject invalid flags in DTM_SETSYSTEMTIME.

Reject invalid flags in DTM_SETSYSTEMTIME i.e. when the flag is neither GDT_VALID nor GDT_NONE when the style is set to DTS_SHOWNONE. Corresponding setters and message sequence tests were also added.
parent c9ca25aa
......@@ -176,10 +176,12 @@ DATETIME_SetSystemTime (DATETIME_INFO *infoPtr, DWORD flag, SYSTEMTIME *lprgSysT
MONTHCAL_CopyTime (lprgSysTimeArray, &infoPtr->date);
SendMessageW (infoPtr->hMonthCal, MCM_SETCURSEL, 0, (LPARAM)(&infoPtr->date));
SendMessageW (infoPtr->hwndCheckbut, BM_SETCHECK, BST_CHECKED, 0);
} else if (flag == GDT_NONE) {
} else if ((infoPtr->dwStyle & DTS_SHOWNONE) && (flag == GDT_NONE)) {
infoPtr->dateValid = FALSE;
SendMessageW (infoPtr->hwndCheckbut, BM_SETCHECK, BST_UNCHECKED, 0);
}
else
return 0;
InvalidateRect(infoPtr->hwndSelf, NULL, TRUE);
return TRUE;
......
......@@ -112,6 +112,9 @@ static const struct message test_dtm_set_range_swap_min_max_seq[] = {
static const struct message test_dtm_set_and_get_system_time_seq[] = {
{ DTM_SETSYSTEMTIME, sent|wparam, 0x00000001 },
{ WM_DESTROY, sent|wparam|lparam, 0x00000000, 0x00000000 },
{ WM_NCDESTROY, sent|wparam|lparam, 0x00000000, 0x00000000 },
{ DTM_SETSYSTEMTIME, sent|wparam, 0x00000001 },
{ DTM_GETSYSTEMTIME, sent|wparam, 0x00000000 },
{ DTM_SETSYSTEMTIME, sent|wparam, 0x00000000 },
{ DTM_SETSYSTEMTIME, sent|wparam, 0x00000000 },
......@@ -477,6 +480,23 @@ static void test_dtm_set_and_get_system_time(HWND hWndDateTime)
LRESULT r;
SYSTEMTIME st;
SYSTEMTIME getSt;
HWND hWndDateTime_test_gdt_none;
hWndDateTime_test_gdt_none = create_datetime_control(0, 0);
ok(hWndDateTime_test_gdt_none!=NULL, "Expected non NULL, got %p\n", hWndDateTime_test_gdt_none);
if(hWndDateTime_test_gdt_none) {
r = SendMessage(hWndDateTime_test_gdt_none, DTM_SETSYSTEMTIME, GDT_NONE, (LPARAM)&st);
expect(0, r);
}
else {
skip("hWndDateTime_test_gdt_none is NULL\n");
flush_sequences(sequences, NUM_MSG_SEQUENCES);
return;
}
DestroyWindow(hWndDateTime_test_gdt_none);
r = SendMessage(hWndDateTime, DTM_SETSYSTEMTIME, GDT_NONE, (LPARAM)&st);
expect(1, r);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment