[PATCH] comctl32/progress: Fix wrapping of values in PBM_STEPIT and add tests

Nikolay Sivov bunglehead at gmail.com
Mon Feb 26 16:15:04 CST 2018


On 2/27/2018 12:14 AM, Fabian Maurer wrote:
> @@ -656,7 +656,7 @@ static LRESULT WINAPI ProgressWindowProc(HWND hwnd, UINT message,
>          oldVal = infoPtr->CurVal;
>          infoPtr->CurVal += infoPtr->Step;
>          if(infoPtr->CurVal > infoPtr->MaxVal)
> -	    infoPtr->CurVal = infoPtr->MinVal;
> +	    infoPtr->CurVal = infoPtr->CurVal % infoPtr->MaxVal;

This looks wrong. I don't think MinVal should be ignored. Your tests
don't show it because you have [0, 12] range.

>  
> +static void test_wrapping(void)

It should be test_PBM_STEPIT().

> +{
> +    const int TEST_MAXIMUM = 12;
> +    const int TEST_STEP_SMALL = 5;
> +    const int TEST_STEP_BIG = 50;

Constants are not helping here I think, it's easier and is more readable
to have them inlined.

Do we have a bug report for this issue by any chance?




More information about the wine-devel mailing list