d3dx9/tests: Add effect parameter value GetFloatArray() test.

This commit is contained in:
Rico Schüller 2011-12-22 12:16:11 +01:00 committed by Alexandre Julliard
parent 47ae7db16a
commit 828b82780d
1 changed files with 45 additions and 0 deletions

View File

@ -757,6 +757,50 @@ static void test_effect_parameter_value_GetFloat(const struct test_effect_parame
} }
} }
static void test_effect_parameter_value_GetFloatArray(const struct test_effect_parameter_value_result *res,
ID3DXEffect *effect, const DWORD *res_value, D3DXHANDLE parameter, UINT i)
{
const D3DXPARAMETER_DESC *res_desc = &res->desc;
LPCSTR res_full_name = res->full_name;
FLOAT favalue[EFFECT_PARAMETER_VALUE_ARRAY_SIZE];
HRESULT hr;
UINT l;
DWORD cmp = 0xabababab;
memset(favalue, 0xab, sizeof(favalue));
hr = effect->lpVtbl->GetFloatArray(effect, parameter, favalue, res_desc->Bytes / sizeof(*favalue));
if (res_desc->Class == D3DXPC_SCALAR
|| res_desc->Class == D3DXPC_VECTOR
|| res_desc->Class == D3DXPC_MATRIX_ROWS)
{
ok(hr == D3D_OK, "%u - %s: GetFloatArray failed, got %#x, expected %#x\n", i, res_full_name, hr, D3D_OK);
for (l = 0; l < res_desc->Bytes / sizeof(*favalue); ++l)
{
ok(compare_float(favalue[l], get_float(res_desc->Type, &res_value[l]), 512),
"%u - %s: GetFloatArray favalue[%u] failed, got %f, expected %f\n",
i, res_full_name, l, favalue[l], get_float(res_desc->Type, &res_value[l]));
}
for (l = res_desc->Bytes / sizeof(*favalue); l < EFFECT_PARAMETER_VALUE_ARRAY_SIZE; ++l)
{
ok(favalue[l] == *(FLOAT *)&cmp, "%u - %s: GetFloatArray favalue[%u] failed, got %f, expected %f\n",
i, res_full_name, l, favalue[l], *(FLOAT *)&cmp);
}
}
else
{
ok(hr == D3DERR_INVALIDCALL, "%u - %s: GetFloatArray failed, got %#x, expected %#x\n",
i, res_full_name, hr, D3DERR_INVALIDCALL);
for (l = 0; l < EFFECT_PARAMETER_VALUE_ARRAY_SIZE; ++l)
{
ok(favalue[l] == *(FLOAT *)&cmp, "%u - %s: GetFloatArray favalue[%u] failed, got %f, expected %f\n",
i, res_full_name, l, favalue[l], *(FLOAT *)&cmp);
}
}
}
static void test_effect_parameter_value(IDirect3DDevice9 *device) static void test_effect_parameter_value(IDirect3DDevice9 *device)
{ {
UINT i; UINT i;
@ -832,6 +876,7 @@ static void test_effect_parameter_value(IDirect3DDevice9 *device)
test_effect_parameter_value_GetInt(&res[k], effect, &blob[res_value_offset], parameter, i); test_effect_parameter_value_GetInt(&res[k], effect, &blob[res_value_offset], parameter, i);
test_effect_parameter_value_GetIntArray(&res[k], effect, &blob[res_value_offset], parameter, i); test_effect_parameter_value_GetIntArray(&res[k], effect, &blob[res_value_offset], parameter, i);
test_effect_parameter_value_GetFloat(&res[k], effect, &blob[res_value_offset], parameter, i); test_effect_parameter_value_GetFloat(&res[k], effect, &blob[res_value_offset], parameter, i);
test_effect_parameter_value_GetFloatArray(&res[k], effect, &blob[res_value_offset], parameter, i);
} }
count = effect->lpVtbl->Release(effect); count = effect->lpVtbl->Release(effect);