On Wed, May 25, 2011 at 9:53 AM, Michael Mc Donnell michael@mcdonnell.dk wrote:
On Tue, May 24, 2011 at 8:32 PM, Stefan Dösinger stefandoesinger@gmx.at wrote:
On Tuesday 24 May 2011 19:56:06 Michael Mc Donnell wrote:
*) In your first test you forgot to check the HeapAlloc result.
Ok, I'll return E_OUTOFMEMORY in that case.
I guess the callers will only abort the tests if NewTestContext fails, so I think the NULL / non-NULL return value was better.
I've reverted those changes, so it's back to NULL / non-NULL. I've also moved it near the top of the file, so that other tests will be able to re-use the test context creation.
Should I try to make some more invalid D3DVERTEXELEMENT9 arrays to see if I can provoke an error?
I was thinking about something that would make CreateVertexDeclaration fail, e.g. declaring a usage+usage index twice or using an undefined type. dlls/d3d9/vertexdeclaration.c and dlls/wined3d/vertexdeclaration.c check for a few error conditions in their vertexdeclaration_init functions. Just pick one of them(no need to check all of them) But watch out that you don't open a can of worms here. Our CreateVertexDeclaration probably doesn't catch all error conditions. I recommend that you pick one it does catch, otherwise you'll have to fix d3d9.dll and wined3d.dll too for a small test.
Ok thanks I'll do that.
I've added some more tests to see if I could make it fail. Microsoft's UpdateSemantics is not very picky. I can't get it to return anything but D3D_OK except for when I pass a null pointer. My implementation follows this behavior except for two cases: it returns E_FAIL when passing an undefined type and when the offset is not 4 byte aligned. This is because the values are checked inside vertexdeclaration_init. So Wine is stricter. I don't think that it is necessarily a problem because applications that pass bogus declarations like those will likely not work anyway. My own tests with a small interactive demo show that in those cases the application will crash with an access violation when it tries to re-draw the scene.