[1/3] gdi32: Initial Gamma setting tests

Nikolay Sivov bunglehead at gmail.com
Wed Aug 10 16:24:46 CDT 2011


On 8/11/2011 00:58, André Hentschel wrote:
> ---
>   dlls/gdi32/tests/dc.c |   40 ++++++++++++++++++++++++++++++++++++++++
>   1 files changed, 40 insertions(+), 0 deletions(-)
>
> diff --git a/dlls/gdi32/tests/dc.c b/dlls/gdi32/tests/dc.c
> index 5017583..f8ceccd 100644
> --- a/dlls/gdi32/tests/dc.c
> +++ b/dlls/gdi32/tests/dc.c
> @@ -24,6 +24,7 @@
>   #include<assert.h>
>   #include<stdio.h>
>
> +#include "ddraw.h"
>   #include "wine/test.h"
>   #include "winbase.h"
>   #include "wingdi.h"
> @@ -599,6 +600,44 @@ static void test_desktop_colorres(void)
>       ReleaseDC(NULL, hdc);
>   }
>
> +static void test_gamma(void)
> +{
> +    BOOL ret;
> +    HDC hdc = GetDC(NULL);
> +    DDGAMMARAMP oldramp;
I think it's better to use plain buffer for that to match prototype.
> +
> +    ret = GetDeviceGammaRamp(hdc,&oldramp);
> +
> +    if (ret)
> +    {
To avoid extra indentation level maybe just exit earlier..
> +        DDGAMMARAMP ramp;
> +        ZeroMemory(&ramp, sizeof(ramp));
> +
> +        /* ramps are zero for every color */
> +        ret = SetDeviceGammaRamp(hdc,&ramp);
> +        todo_wine ok(!ret, "SetDeviceGammaRamp succeeded\n");
> +
> +        /* set a ramp part at the end of every color to non-zero */
> +        ramp.red[255] = 1;
> +        ramp.green[255] = 1;
> +        ramp.blue[255] = 1;
> +        ret = SetDeviceGammaRamp(hdc,&ramp);
> +        todo_wine ok(!ret, "SetDeviceGammaRamp succeeded\n");
> +
> +        /* set a ramp part in the middle of one color to non-zero */
> +        ramp.blue[127] = 1;
> +        ret = SetDeviceGammaRamp(hdc,&ramp);
> +        todo_wine ok(!ret, "SetDeviceGammaRamp succeeded\n");
> +
This needs more tests, is it possible you can't have any zeros at all?
> +        /* cleanup: set old ramp */
> +        ret = SetDeviceGammaRamp(hdc,&oldramp);
> +        ok(ret || broken(!ret), "SetDeviceGammaRamp failed\n");
What a broken case is about?
> +    else win_skip("GetDeviceGammaRamp failed, skipping tests\n");
When it fails on native by the way?
> +
> +    ReleaseDC(NULL, hdc);
> +}
> +
>   START_TEST(dc)
>   {
>       test_savedc();
> @@ -609,4 +648,5 @@ START_TEST(dc)
>       test_DeleteDC();
>       test_boundsrect_invalid();
>       test_desktop_colorres();
> +    test_gamma();
>   }




More information about the wine-devel mailing list