Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
a44f0351
Commit
a44f0351
authored
Sep 26, 2009
by
Nikolay Sivov
Committed by
Alexandre Julliard
Sep 28, 2009
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
comctl32/monthcal: Fix some bugs with date range.
parent
d66dcb4f
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
84 additions
and
11 deletions
+84
-11
monthcal.c
dlls/comctl32/monthcal.c
+7
-11
monthcal.c
dlls/comctl32/tests/monthcal.c
+77
-0
No files found.
dlls/comctl32/monthcal.c
View file @
a44f0351
...
...
@@ -36,9 +36,6 @@
* -- handle resources better (doesn't work now);
* -- take care of internationalization.
* -- keyboard handling.
* -- GetRange: At the moment, we copy ranges anyway, regardless of
* infoPtr->rangeValid; an invalid range is simply filled
* with zeros in SetRange. Is this the right behavior?
* -- search for FIXME
*/
...
...
@@ -931,11 +928,11 @@ MONTHCAL_SetRange(MONTHCAL_INFO *infoPtr, SHORT limits, SYSTEMTIME *range)
/* Only one limit set - we are done */
if
((
infoPtr
->
rangeValid
&
(
GDTR_MIN
|
GDTR_MAX
))
!=
(
GDTR_MIN
|
GDTR_MAX
))
return
TRUE
;
SystemTimeToFileTime
(
&
infoPtr
->
maxDate
,
&
ft_max
);
SystemTimeToFileTime
(
&
infoPtr
->
minDate
,
&
ft_min
);
if
(
CompareFileTime
(
&
ft_min
,
&
ft_max
)
>
0
)
if
(
CompareFileTime
(
&
ft_min
,
&
ft_max
)
>
=
0
)
{
if
((
limits
&
(
GDTR_MIN
|
GDTR_MAX
))
==
(
GDTR_MIN
|
GDTR_MAX
))
{
...
...
@@ -946,8 +943,11 @@ MONTHCAL_SetRange(MONTHCAL_INFO *infoPtr, SHORT limits, SYSTEMTIME *range)
}
else
{
/* Reset the other limit. */
/* FIXME: native sets date&time to 0. Should we do this too? */
static
const
SYSTEMTIME
zero
;
/* reset the other limit */
if
(
limits
&
GDTR_MIN
)
infoPtr
->
maxDate
=
zero
;
if
(
limits
&
GDTR_MAX
)
infoPtr
->
minDate
=
zero
;
infoPtr
->
rangeValid
&=
limits
&
GDTR_MIN
?
~
GDTR_MAX
:
~
GDTR_MIN
;
}
}
...
...
@@ -1873,10 +1873,6 @@ MONTHCAL_Create(HWND hwnd, LPCREATESTRUCTW lpcs)
MONTHCAL_SetFirstDayOfWeek
(
infoPtr
,
-
1
);
infoPtr
->
currentMonth
=
infoPtr
->
todaysDate
.
wMonth
;
infoPtr
->
currentYear
=
infoPtr
->
todaysDate
.
wYear
;
infoPtr
->
minDate
=
infoPtr
->
todaysDate
;
infoPtr
->
maxDate
=
infoPtr
->
todaysDate
;
infoPtr
->
maxDate
.
wYear
=
2050
;
infoPtr
->
minDate
.
wYear
=
1950
;
infoPtr
->
maxSelCount
=
7
;
infoPtr
->
monthRange
=
3
;
infoPtr
->
monthdayState
=
Alloc
(
infoPtr
->
monthRange
*
sizeof
(
MONTHDAYSTATE
));
...
...
dlls/comctl32/tests/monthcal.c
View file @
a44f0351
...
...
@@ -328,6 +328,29 @@ static void test_monthcal(void)
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
"
);
/* test range just after creation */
memset
(
&
st
,
0xcc
,
sizeof
(
st
));
ok
(
SendMessage
(
hwnd
,
MCM_GETRANGE
,
0
,
(
LPARAM
)
st
)
==
0
,
"No limits should be set
\n
"
);
expect
(
0
,
st
[
0
].
wYear
);
expect
(
0
,
st
[
0
].
wMonth
);
expect
(
0
,
st
[
0
].
wDay
);
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
);
GetSystemTime
(
&
st
[
0
]);
st
[
1
]
=
st
[
0
];
...
...
@@ -380,6 +403,60 @@ static void test_monthcal(void)
ok
(
SendMessage
(
hwnd
,
MCM_SETRANGE
,
GDTR_MAX
,
(
LPARAM
)
st
),
"Failed to set max limit
\n
"
);
ok
(
SendMessage
(
hwnd
,
MCM_GETRANGE
,
0
,
(
LPARAM
)
st1
)
==
GDTR_MAX
,
"Only MAX limit should be set
\n
"
);
/* set both limits, then set max < min */
GetSystemTime
(
&
st
[
0
]);
st
[
1
]
=
st
[
0
];
st
[
1
].
wYear
++
;
ok
(
SendMessage
(
hwnd
,
MCM_SETRANGE
,
GDTR_MIN
|
GDTR_MAX
,
(
LPARAM
)
st
),
"Failed to set limits
\n
"
);
ok
(
SendMessage
(
hwnd
,
MCM_GETRANGE
,
0
,
(
LPARAM
)
st1
)
==
(
GDTR_MIN
|
GDTR_MAX
),
"Min limit expected
\n
"
);
st
[
1
].
wYear
-=
2
;
ok
(
SendMessage
(
hwnd
,
MCM_SETRANGE
,
GDTR_MAX
,
(
LPARAM
)
st
),
"Failed to set limits
\n
"
);
ok
(
SendMessage
(
hwnd
,
MCM_GETRANGE
,
0
,
(
LPARAM
)
st1
)
==
GDTR_MAX
,
"Max limit expected
\n
"
);
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
++
;
ok
(
SendMessage
(
hwnd
,
MCM_SETRANGE
,
GDTR_MIN
|
GDTR_MAX
,
(
LPARAM
)
st
),
"Failed to set limits
\n
"
);
ok
(
SendMessage
(
hwnd
,
MCM_GETRANGE
,
0
,
(
LPARAM
)
st1
)
==
(
GDTR_MIN
|
GDTR_MAX
),
"Min limit expected
\n
"
);
st
[
0
].
wYear
++
;
/* start == end now */
ok
(
SendMessage
(
hwnd
,
MCM_SETRANGE
,
GDTR_MIN
,
(
LPARAM
)
st
),
"Failed to set limits
\n
"
);
ok
(
SendMessage
(
hwnd
,
MCM_GETRANGE
,
0
,
(
LPARAM
)
st1
)
==
GDTR_MIN
,
"Min limit expected
\n
"
);
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
);
DestroyWindow
(
hwnd
);
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment