Added some more tests for returned dummy skininfo interface
From: Michael Müller michael@fds-team.de
Signed-off-by: Vijay Kiran Kamuju infyquest@gmail.com --- dlls/d3dx9_36/tests/mesh.c | 168 +++++++++++++++++++++++++++++++++++++ 1 file changed, 168 insertions(+)
diff --git a/dlls/d3dx9_36/tests/mesh.c b/dlls/d3dx9_36/tests/mesh.c index e36ee0adcd..1bc248202d 100644 --- a/dlls/d3dx9_36/tests/mesh.c +++ b/dlls/d3dx9_36/tests/mesh.c @@ -25,6 +25,9 @@ #include <limits.h> #include "wine/test.h" #include "d3dx9.h" +#include "initguid.h" +#include "rmxftmpl.h" +#include "rmxfguid.h"
#ifndef NAN /* From wine/port.h */ @@ -2544,6 +2547,170 @@ static void D3DXLoadMeshTest(void) free_test_context(test_context); }
+static ID3DXFileData *get_mesh_data(const char *memory, SIZE_T length) +{ + D3DXF_FILELOADMEMORY source; + ID3DXFileEnumObject *enumobj = NULL; + ID3DXFileData *filedata = NULL; + ID3DXFileData *ret = NULL; + ID3DXFile *d3dxfile = NULL; + SIZE_T i, nb_children; + HRESULT hr; + GUID guid; + + hr = D3DXFileCreate(&d3dxfile); + if (FAILED(hr)) return NULL; + + hr = d3dxfile->lpVtbl->RegisterTemplates(d3dxfile, D3DRM_XTEMPLATES, D3DRM_XTEMPLATE_BYTES); + if (FAILED(hr)) goto cleanup; + + source.lpMemory = (void *)memory; + source.dSize = length; + + hr = d3dxfile->lpVtbl->CreateEnumObject(d3dxfile, &source, D3DXF_FILELOAD_FROMMEMORY, &enumobj); + if (FAILED(hr)) goto cleanup; + + hr = enumobj->lpVtbl->GetChildren(enumobj, &nb_children); + if (FAILED(hr)) goto cleanup; + + for (i = 0; i < nb_children; i++) + { + hr = enumobj->lpVtbl->GetChild(enumobj, i, &filedata); + if (FAILED(hr)) goto cleanup; + + hr = filedata->lpVtbl->GetType(filedata, &guid); + if (SUCCEEDED(hr) && IsEqualGUID(&guid, &TID_D3DRMMesh)) + { + ret = filedata; + break; + } + else + filedata->lpVtbl->Release(filedata); + } + +cleanup: + if (enumobj) enumobj->lpVtbl->Release(enumobj); + if (d3dxfile) d3dxfile->lpVtbl->Release(d3dxfile); + + return ret; +} + +static void D3DXLoadSkinMeshFromXofTest(void) +{ + static const char simple_xfile[] = + "xof 0303txt 0032" + "Mesh {" + "3;" + "0.0; 0.0; 0.0;," + "0.0; 1.0; 0.0;," + "1.0; 1.0; 0.0;;" + "1;" + "3; 0, 1, 2;;" + "}"; + ID3DXBuffer *adjacency, *materials, *effects; + D3DPRESENT_PARAMETERS d3dpp; + IDirect3DDevice9 *device; + ID3DXFileData *filedata; + ID3DXSkinInfo *skininfo; + ID3DXMesh *mesh; + IDirect3D9 *d3d; + DWORD mat_count; + HRESULT hr; + HWND hwnd; + + if (!(hwnd = CreateWindowA("static", "d3dx9_test", WS_OVERLAPPEDWINDOW, 0, 0, + 640, 480, NULL, NULL, NULL, NULL))) + { + skip("Couldn't create application window\n"); + return; + } + + d3d = Direct3DCreate9(D3D_SDK_VERSION); + if (!d3d) + { + skip("Couldn't create IDirect3D9 object\n"); + DestroyWindow(hwnd); + return; + } + + ZeroMemory(&d3dpp, sizeof(d3dpp)); + d3dpp.Windowed = TRUE; + d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD; + + hr = IDirect3D9_CreateDevice(d3d, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, hwnd, D3DCREATE_SOFTWARE_VERTEXPROCESSING, &d3dpp, &device); + IDirect3D9_Release(d3d); + if (FAILED(hr)) + { + skip("Failed to create IDirect3DDevice9 object %#x\n", hr); + DestroyWindow(hwnd); + return; + } + + filedata = get_mesh_data(simple_xfile, sizeof(simple_xfile) - 1); + ok(filedata != NULL, "Failed to load mesh data\n"); + + adjacency = materials = effects = NULL; + skininfo = NULL; + mesh = NULL; + + hr = D3DXLoadSkinMeshFromXof(filedata, 0, device, &adjacency, &materials, &effects, &mat_count, &skininfo, &mesh); + ok(hr == D3D_OK, "Got result %x, expected 0 (D3D_OK)\n", hr); + ok(skininfo != NULL, "Expected non-null skininfo\n"); + + if (skininfo) + { + DWORD dword_result; + float flt_result; + const char *string_result; + D3DXMATRIX *transform; + D3DVERTEXELEMENT9 declaration_out[MAX_FVF_DECL_SIZE]; + const D3DVERTEXELEMENT9 expect_declaration[] = + { + {0, 0, D3DDECLTYPE_FLOAT3, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_POSITION, 0}, + D3DDECL_END(), + }; + + hr = skininfo->lpVtbl->GetDeclaration(skininfo, declaration_out); + ok(hr == D3D_OK, "Expected D3D_OK, got %#x\n", hr); + if (SUCCEEDED(hr)) + compare_elements(declaration_out, expect_declaration, __LINE__, 0); + + dword_result = skininfo->lpVtbl->GetNumBones(skininfo); + ok(dword_result == 0, "Expected 0, got %u\n", dword_result); + + flt_result = skininfo->lpVtbl->GetMinBoneInfluence(skininfo); + ok(flt_result == 0.0f, "Expected 0.0, got %g\n", flt_result); + + string_result = skininfo->lpVtbl->GetBoneName(skininfo, 0); + ok(string_result == NULL, "Expected NULL, got %p\n", string_result); + + dword_result = skininfo->lpVtbl->GetFVF(skininfo); + ok(dword_result == 2, "Expected 2, got %u\n", dword_result); + + dword_result = skininfo->lpVtbl->GetNumBoneInfluences(skininfo, 0); + ok(dword_result == 0, "Expected 0, got %u\n", dword_result); + + dword_result = skininfo->lpVtbl->GetNumBoneInfluences(skininfo, 1); + ok(dword_result == 0, "Expected 0, got %u\n", dword_result); + + transform = skininfo->lpVtbl->GetBoneOffsetMatrix(skininfo, -1); + ok(transform == NULL, "Expected NULL, got %p\n", transform); + + transform = skininfo->lpVtbl->GetBoneOffsetMatrix(skininfo, 0); + ok(transform == NULL, "Expected NULL, got %p\n", transform); + } + + if (adjacency) adjacency->lpVtbl->Release(adjacency); + if (materials) materials->lpVtbl->Release(materials); + if (effects) effects->lpVtbl->Release(effects); + if (skininfo) skininfo->lpVtbl->Release(skininfo); + if (mesh) mesh->lpVtbl->Release(mesh); + + filedata->lpVtbl->Release(filedata); + IDirect3DDevice9_Release(device); + DestroyWindow(hwnd); +} + static BOOL compute_box(struct mesh *mesh, float width, float height, float depth) { unsigned int i, face; @@ -11201,6 +11368,7 @@ START_TEST(mesh) D3DXCreateMeshTest(); D3DXCreateMeshFVFTest(); D3DXLoadMeshTest(); + D3DXLoadSkinMeshFromXofTest(); D3DXCreateBoxTest(); D3DXCreatePolygonTest(); D3DXCreateSphereTest();
Hi,
While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=49861
Your paranoid android.
=== debian9 (32 bit report) ===
d3dx9_36: mesh.c:2658: Test failed: Expected non-null skininfo
=== debian9 (32 bit French report) ===
d3dx9_36: mesh.c:2658: Test failed: Expected non-null skininfo
=== debian9 (32 bit Japanese:Japan report) ===
d3dx9_36: mesh.c:2658: Test failed: Expected non-null skininfo
=== debian9 (32 bit Chinese:China report) ===
d3dx9_36: mesh.c:2658: Test failed: Expected non-null skininfo
=== debian9b (32 bit WoW report) ===
d3dx9_36: mesh.c:2658: Test failed: Expected non-null skininfo
=== debian9b (64 bit WoW report) ===
d3dx9_36: mesh.c:2658: Test failed: Expected non-null skininfo