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
9036a84b
Commit
9036a84b
authored
Feb 27, 2018
by
Fabian Maurer
Committed by
Alexandre Julliard
Feb 27, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
comctl32/progress: Fix wrapping of values in PBM_STEPIT and add tests.
Signed-off-by:
Nikolay Sivov
<
nsivov@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
004d32da
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
59 additions
and
2 deletions
+59
-2
progress.c
dlls/comctl32/progress.c
+8
-2
progress.c
dlls/comctl32/tests/progress.c
+51
-0
No files found.
dlls/comctl32/progress.c
View file @
9036a84b
...
...
@@ -655,8 +655,14 @@ static LRESULT WINAPI ProgressWindowProc(HWND hwnd, UINT message,
INT
oldVal
;
oldVal
=
infoPtr
->
CurVal
;
infoPtr
->
CurVal
+=
infoPtr
->
Step
;
if
(
infoPtr
->
CurVal
>
infoPtr
->
MaxVal
)
infoPtr
->
CurVal
=
infoPtr
->
MinVal
;
if
(
infoPtr
->
CurVal
>
infoPtr
->
MaxVal
)
{
infoPtr
->
CurVal
=
(
infoPtr
->
CurVal
-
infoPtr
->
MinVal
)
%
(
infoPtr
->
MaxVal
-
infoPtr
->
MinVal
)
+
infoPtr
->
MinVal
;
}
if
(
infoPtr
->
CurVal
<
infoPtr
->
MinVal
)
{
infoPtr
->
CurVal
=
(
infoPtr
->
CurVal
-
infoPtr
->
MinVal
)
%
(
infoPtr
->
MaxVal
-
infoPtr
->
MinVal
)
+
infoPtr
->
MaxVal
;
}
if
(
oldVal
!=
infoPtr
->
CurVal
)
{
TRACE
(
"PBM_STEPIT: current pos changed from %d to %d
\n
"
,
oldVal
,
infoPtr
->
CurVal
);
...
...
dlls/comctl32/tests/progress.c
View file @
9036a84b
...
...
@@ -237,6 +237,56 @@ static void test_setcolors(void)
DestroyWindow
(
progress
);
}
static
void
test_PBM_STEPIT
(
void
)
{
struct
stepit_test
{
int
min
;
int
max
;
int
step
;
}
stepit_tests
[]
=
{
{
3
,
15
,
5
},
{
3
,
15
,
-
5
},
{
3
,
15
,
50
},
};
HWND
progress
;
int
i
,
j
;
for
(
i
=
0
;
i
<
sizeof
(
stepit_tests
)
/
sizeof
(
stepit_tests
[
0
]);
i
++
)
{
struct
stepit_test
*
test
=
&
stepit_tests
[
i
];
LRESULT
ret
;
progress
=
create_progress
(
0
);
ret
=
SendMessageA
(
progress
,
PBM_SETRANGE32
,
test
->
min
,
test
->
max
);
ok
(
ret
!=
0
,
"Unexpected return value.
\n
"
);
SendMessageA
(
progress
,
PBM_SETPOS
,
test
->
min
,
0
);
SendMessageA
(
progress
,
PBM_SETSTEP
,
test
->
step
,
0
);
for
(
j
=
0
;
j
<
test
->
max
;
j
++
)
{
int
pos
=
SendMessageA
(
progress
,
PBM_GETPOS
,
0
,
0
);
int
current
;
pos
+=
test
->
step
;
if
(
pos
>
test
->
max
)
pos
=
(
pos
-
test
->
min
)
%
(
test
->
max
-
test
->
min
)
+
test
->
min
;
if
(
pos
<
test
->
min
)
pos
=
(
pos
-
test
->
min
)
%
(
test
->
max
-
test
->
min
)
+
test
->
max
;
SendMessageA
(
progress
,
PBM_STEPIT
,
0
,
0
);
current
=
SendMessageA
(
progress
,
PBM_GETPOS
,
0
,
0
);
ok
(
current
==
pos
,
"Unexpected position %d, expected %d.
\n
"
,
current
,
pos
);
}
DestroyWindow
(
progress
);
}
}
static
void
init_functions
(
void
)
{
HMODULE
hComCtl32
=
LoadLibraryA
(
"comctl32.dll"
);
...
...
@@ -260,6 +310,7 @@ START_TEST(progress)
test_redraw
();
test_setcolors
();
test_PBM_STEPIT
();
cleanup
();
}
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