[PATCH 1/2] user32/tests: Test NUMCOLORS for display DCs.

Huw Davies huw at codeweavers.com
Thu Apr 7 02:16:33 CDT 2022


On Wed, Apr 06, 2022 at 06:56:01PM +0800, Zhiyi Zhang wrote:
> +    /* Test NUMCOLORS for display DCs */
> +    for (i = 0; i < ARRAY_SIZE(bpps); ++i)
> +    {
> +        winetest_push_context("bpp %d", bpps[i]);
> +
> +        memset(&dm2, 0, sizeof(dm2));
> +        dm2.dmSize = sizeof(dm2);
> +        for (mode_idx = 0; EnumDisplaySettingsA(NULL, mode_idx, &dm2); ++mode_idx)
> +        {
> +            if (dm2.dmBitsPerPel == bpps[i])
> +                break;
> +        }
> +        if (dm2.dmBitsPerPel != bpps[i])
> +        {
> +            skip("%d-bit display mode not found.\n", bpps[i]);
> +            winetest_pop_context();
> +            continue;
> +        }
> +
> +        res = ChangeDisplaySettingsExA(NULL, &dm2, NULL, CDS_RESET, NULL);
> +        /* Win8 TestBots */
> +        ok(res == DISP_CHANGE_SUCCESSFUL || broken(res == DISP_CHANGE_FAILED),
> +                "ChangeDisplaySettingsExA returned unexpected %ld.\n", res);
> +        if (res == DISP_CHANGE_SUCCESSFUL)
> +        {
> +            value = GetDeviceCaps(hdc, BITSPIXEL);
> +            ok(value == (bpps[i] == 4 ? 1 : bpps[i]), "Expected %d, got %d.\n",
> +                    (bpps[i] == 4 ? 1 : bpps[i]), value);
> +
> +            value = GetDeviceCaps(hdc, NUMCOLORS);
> +            if (bpps[i] > 8 || (bpps[i] == 8 && LOBYTE(LOWORD(GetVersion())) >= 6))
> +                todo_wine_if(bpps[i] == 8 && LOBYTE(LOWORD(GetVersion())) >= 6)
> +                ok(value == -1, "Expected -1, got %d.\n", value);
> +            else if (bpps[i] == 8 && LOBYTE(LOWORD(GetVersion())) < 6)
> +                ok(value > 16 && value <= 256, "Got %d.\n", value);
> +            else
> +                ok(value == 1 << bpps[i], "Expected %d, got %d.\n", 1 << bpps[i], value);
> +
> +            res = ChangeDisplaySettingsExA(NULL, NULL, NULL, 0, NULL);
> +            ok(res == DISP_CHANGE_SUCCESSFUL, "ChangeDisplaySettingsExA returned unexpected %ld.\n",
> +                    res);
> +        }
> +        winetest_pop_context();
> +    }

Do we really need add yet more mode changes - is there a way to
integrate these into the existing ones?

Huw.



More information about the wine-devel mailing list