[v2 3/3] d3dx9: Add test for IsParameterUsed function.

Matteo Bruni matteo.mystral at gmail.com
Thu May 26 10:10:46 CDT 2016


2016-05-23 12:40 GMT+02:00 Paul Gofman <gofmanp at gmail.com>:
> Signed-off-by: Paul Gofman <gofmanp at gmail.com>
> ---
>  dlls/d3dx9_36/tests/effect.c | 537 ++++++++++++++++++++++++++-----------------
>  1 file changed, 321 insertions(+), 216 deletions(-)

You forgot the "/tests" part of the patch subject prefix.

> +static void test_effect_isparameterused(IDirect3DDevice9 *device)
> +{
> +    ID3DXEffect *effect;
> +    HRESULT hr;
> +    D3DXHANDLE param, tech, param_child;
> +    unsigned int i;
> +
> +    hr = D3DXCreateEffect(device, test_effect_preshader_effect_blob, sizeof(test_effect_preshader_effect_blob),
> +            NULL, NULL, 0, NULL, &effect, NULL);
> +    ok(hr == D3D_OK, "Got result %#x.\n", hr);
> +
> +    tech = effect->lpVtbl->GetTechniqueByName(effect, "tech0");
> +    ok(!!tech, "GetTechniqueByName failed.\n");
> +
> +    param = effect->lpVtbl->GetParameterByName(effect, NULL, "opvect3");
> +    ok(!!param, "GetParameterByName failed.\n");
> +    ok(effect->lpVtbl->IsParameterUsed(effect, param, tech), "IsParameterUsed should be TRUE for opvect3.\n");

Pretty minor but I would prefer something like ok(..., "Unexpected
IsParameterUsed() result for opvect3.\n");
Same for the other IsParameterUsed() ok() calls.

> +    param = effect->lpVtbl->GetParameterByName(effect, NULL, "arr2");
> +    ok(!!param, "GetParameterByName failed.\n");
> +    ok(effect->lpVtbl->IsParameterUsed(effect, param, tech), "IsParameterUsed should be TRUE for arr2.\n");
> +    for (i = 0; i < 2; ++i)
> +    {
> +        param_child = effect->lpVtbl->GetParameterElement(effect, param, i);
> +        ok(!!param_child, "GetParameterElement failed.\n");
> +        ok(!effect->lpVtbl->IsParameterUsed(effect, param_child, tech),
> +                "IsParameterUsed should be FALSE for arr2[%u].\n", i);
> +    }

You could make a small function from this and use it through. You
would check that IsParameterUsed() for the parameter gives the
expected result, then enumerate the parameter elements and members and
check that they are all unused. BTW, is there any case where
IsParameterUsed() for a child is TRUE?



More information about the wine-devel mailing list