comctl32/datetime: It isn't allowed to change DTS_SHOWNONE after creation.
This commit is contained in:
parent
a096ba4c5b
commit
f12f948849
|
@ -1251,6 +1251,23 @@ DATETIME_Size (DATETIME_INFO *infoPtr, INT width, INT height)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static LRESULT
|
||||
DATETIME_StyleChanging(DATETIME_INFO *infoPtr, WPARAM wStyleType, STYLESTRUCT *lpss)
|
||||
{
|
||||
TRACE("(styletype=%lx, styleOld=0x%08x, styleNew=0x%08x)\n",
|
||||
wStyleType, lpss->styleOld, lpss->styleNew);
|
||||
|
||||
/* block DTS_SHOWNONE change */
|
||||
if ((lpss->styleNew ^ lpss->styleOld) & DTS_SHOWNONE)
|
||||
{
|
||||
if (lpss->styleOld & DTS_SHOWNONE)
|
||||
lpss->styleNew |= DTS_SHOWNONE;
|
||||
else
|
||||
lpss->styleNew &= ~DTS_SHOWNONE;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static LRESULT
|
||||
DATETIME_StyleChanged(DATETIME_INFO *infoPtr, WPARAM wStyleType, const STYLESTRUCT *lpss)
|
||||
|
@ -1449,6 +1466,9 @@ DATETIME_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
|||
case WM_COMMAND:
|
||||
return DATETIME_Command (infoPtr, wParam, lParam);
|
||||
|
||||
case WM_STYLECHANGING:
|
||||
return DATETIME_StyleChanging(infoPtr, wParam, (LPSTYLESTRUCT)lParam);
|
||||
|
||||
case WM_STYLECHANGED:
|
||||
return DATETIME_StyleChanged(infoPtr, wParam, (LPSTYLESTRUCT)lParam);
|
||||
|
||||
|
|
|
@ -677,6 +677,27 @@ static void test_wm_set_get_text(void)
|
|||
DestroyWindow(hWnd);
|
||||
}
|
||||
|
||||
static void test_dts_shownone(void)
|
||||
{
|
||||
HWND hwnd;
|
||||
DWORD style;
|
||||
|
||||
/* it isn't allowed to change DTS_SHOWNONE after creation */
|
||||
hwnd = create_datetime_control(0);
|
||||
style = GetWindowLong(hwnd, GWL_STYLE);
|
||||
SetWindowLong(hwnd, GWL_STYLE, style | DTS_SHOWNONE);
|
||||
style = GetWindowLong(hwnd, GWL_STYLE);
|
||||
ok(!(style & DTS_SHOWNONE), "Expected DTS_SHOWNONE not to be set\n");
|
||||
DestroyWindow(hwnd);
|
||||
|
||||
hwnd = create_datetime_control(DTS_SHOWNONE);
|
||||
style = GetWindowLong(hwnd, GWL_STYLE);
|
||||
SetWindowLong(hwnd, GWL_STYLE, style & ~DTS_SHOWNONE);
|
||||
style = GetWindowLong(hwnd, GWL_STYLE);
|
||||
ok(style & DTS_SHOWNONE, "Expected DTS_SHOWNONE to be set\n");
|
||||
DestroyWindow(hwnd);
|
||||
}
|
||||
|
||||
START_TEST(datetime)
|
||||
{
|
||||
HMODULE hComctl32;
|
||||
|
@ -704,4 +725,5 @@ START_TEST(datetime)
|
|||
test_dtm_set_range_swap_min_max();
|
||||
test_dtm_set_and_get_system_time();
|
||||
test_wm_set_get_text();
|
||||
test_dts_shownone();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue