Commit cee2d4c4 authored by Matteo Bruni's avatar Matteo Bruni Committed by Alexandre Julliard

d3dx9/tests: Clean up test_update_semantics() a bit.

Inspired by a patch from Eric Pouech <eric.pouech@gmail.com>. Signed-off-by: 's avatarMatteo Bruni <mbruni@codeweavers.com> Signed-off-by: 's avatarAlexandre Julliard <julliard@winehq.org>
parent 71c6f5b1
......@@ -4739,11 +4739,9 @@ static void test_update_semantics(void)
D3DVERTEXELEMENT9 *decl_ptr;
DWORD exp_vertex_size = sizeof(*vertices);
DWORD vertex_size = 0;
BYTE *decl_mem;
int equal;
int i = 0;
int *decl_mem;
int filler_a = 0xaaaaaaaa;
int filler_b = 0xbbbbbbbb;
test_context = new_test_context();
if (!test_context)
......@@ -4815,22 +4813,20 @@ static void test_update_semantics(void)
/* Check that GetDeclaration only writes up to the D3DDECL_END() marker and
* not the full MAX_FVF_DECL_SIZE elements.
*/
memset(declaration, filler_a, sizeof(declaration));
memset(declaration, 0xaa, sizeof(declaration));
memcpy(declaration, declaration0, sizeof(declaration0));
hr = mesh->lpVtbl->UpdateSemantics(mesh, declaration);
ok(hr == D3D_OK, "Test UpdateSemantics, "
"got %#x expected D3D_OK\n", hr);
memset(declaration, filler_b, sizeof(declaration));
memset(declaration, 0xbb, sizeof(declaration));
hr = mesh->lpVtbl->GetDeclaration(mesh, declaration);
ok(hr == D3D_OK, "Couldn't get vertex declaration. Got %#x, expected D3D_OK\n", hr);
decl_mem = (int*)declaration;
for (i = sizeof(declaration0)/sizeof(*decl_mem); i < sizeof(declaration)/sizeof(*decl_mem); i++)
{
equal = memcmp(&decl_mem[i], &filler_b, sizeof(filler_b));
ok(equal == 0,
"GetDeclaration wrote past the D3DDECL_END() marker. "
"Got %#x, expected %#x\n", decl_mem[i], filler_b);
if (equal != 0) break;
decl_mem = (BYTE *)declaration;
for (i = sizeof(declaration0); i < sizeof(declaration); ++i)
{
ok(decl_mem[i] == 0xbb, "Unexpected %#x.\n", decl_mem[i]);
if (equal != 0)
break;
}
/* UpdateSemantics does not check for overlapping fields */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment