Module: wine Branch: master Commit: 455edb1870fcf3c38ba71def757158deff00d16a URL: http://source.winehq.org/git/wine.git/?a=commit;h=455edb1870fcf3c38ba71def75...
Author: André Hentschel nerv@dawncrow.de Date: Fri Jan 13 00:12:47 2012 +0100
d3drm: Add more MeshBuilder tests.
---
dlls/d3drm/tests/Makefile.in | 1 + dlls/d3drm/tests/d3drm.c | 98 +++++++++++++++++++++++++++++++++++++++++- 2 files changed, 97 insertions(+), 2 deletions(-)
diff --git a/dlls/d3drm/tests/Makefile.in b/dlls/d3drm/tests/Makefile.in index f403d0e..5393742 100644 --- a/dlls/d3drm/tests/Makefile.in +++ b/dlls/d3drm/tests/Makefile.in @@ -1,4 +1,5 @@ TESTDLL = d3drm.dll +IMPORTS = dxguid
C_SRCS = \ d3drm.c \ diff --git a/dlls/d3drm/tests/d3drm.c b/dlls/d3drm/tests/d3drm.c index 267bd2d..b965242 100644 --- a/dlls/d3drm/tests/d3drm.c +++ b/dlls/d3drm/tests/d3drm.c @@ -80,7 +80,7 @@ static char data_ok[] = "3; 3, 1, 2;;\n" "}\n";
-static void MeshBuilderTest(void) +static void test_MeshBuilder(void) { HRESULT hr; LPDIRECT3DRM pD3DRM; @@ -88,6 +88,7 @@ static void MeshBuilderTest(void) D3DRMLOADMEMORY info; int val; DWORD val1, val2, val3; + D3DVALUE valu, valv;
hr = pDirect3DRMCreate(&pD3DRM); ok(hr == D3DRM_OK, "Cannot get IDirect3DRM interface (hr = %x)\n", hr); @@ -122,17 +123,110 @@ static void MeshBuilderTest(void) todo_wine ok(val2 == 4, "Wrong number of normals %d (must be 4)\n", val2); todo_wine ok(val3 == 22, "Wrong number of face data bytes %d (must be 22)\n", val3);
+ valu = 1.23f; + valv = 3.21f; + hr = IDirect3DRMMeshBuilder_GetTextureCoordinates(pMeshBuilder, 1, &valu, &valv); + todo_wine ok(hr == D3DRM_OK, "Cannot get texture coordinates (hr = %x)\n", hr); + todo_wine ok(valu == 0.0f, "Wrong coordinate %f (must be 0.0)\n", valu); + todo_wine ok(valv == 0.0f, "Wrong coordinate %f (must be 0.0)\n", valv); + + valu = 1.23f; + valv = 3.21f; + hr = IDirect3DRMMeshBuilder_SetTextureCoordinates(pMeshBuilder, 1, valu, valv); + todo_wine ok(hr == D3DRM_OK, "Cannot set texture coordinates (hr = %x)\n", hr); + + valu = 0.0f; + valv = 0.0f; + hr = IDirect3DRMMeshBuilder_GetTextureCoordinates(pMeshBuilder, 1, &valu, &valv); + todo_wine ok(hr == D3DRM_OK, "Cannot get texture coordinates (hr = %x)\n", hr); + todo_wine ok(valu == 1.23f, "Wrong coordinate %f (must be 1.23)\n", valu); + todo_wine ok(valv == 3.21f, "Wrong coordinate %f (must be 3.21)\n", valv); + IDirect3DRMMeshBuilder_Release(pMeshBuilder);
IDirect3DRM_Release(pD3DRM); }
+static void test_MeshBuilder3(void) +{ + HRESULT hr; + LPDIRECT3DRM pD3DRM; + LPDIRECT3DRM3 pD3DRM3; + LPDIRECT3DRMMESHBUILDER3 pMeshBuilder3; + D3DRMLOADMEMORY info; + int val; + DWORD val1; + D3DVALUE valu, valv; + + hr = pDirect3DRMCreate(&pD3DRM); + ok(hr == D3DRM_OK, "Cannot get IDirect3DRM interface (hr = %x)\n", hr); + + hr = IDirect3DRM_QueryInterface(pD3DRM, &IID_IDirect3DRM3, (LPVOID*)&pD3DRM3); + if (FAILED(hr)) + { + win_skip("Cannot get IDirect3DRM3 interface (hr = %x), skipping tests\n", hr); + return; + } + + hr = IDirect3DRM_CreateMeshBuilder(pD3DRM3, &pMeshBuilder3); + ok(hr == D3DRM_OK, "Cannot get IDirect3DRMMeshBuilder3 interface (hr = %x)\n", hr); + + info.lpMemory = data_bad_version; + info.dSize = strlen(data_bad_version); + hr = IDirect3DRMMeshBuilder_Load(pMeshBuilder3, &info, NULL, D3DRMLOAD_FROMMEMORY, NULL, NULL); + todo_wine ok(hr == D3DRMERR_BADFILE, "Should have returned D3DRMERR_BADFILE (hr = %x)\n", hr); + + info.lpMemory = data_no_mesh; + info.dSize = strlen(data_no_mesh); + hr = IDirect3DRMMeshBuilder_Load(pMeshBuilder3, &info, NULL, D3DRMLOAD_FROMMEMORY, NULL, NULL); + todo_wine ok(hr == D3DRMERR_NOTFOUND, "Should have returned D3DRMERR_NOTFOUND (hr = %x)\n", hr); + + info.lpMemory = data_ok; + info.dSize = strlen(data_ok); + hr = IDirect3DRMMeshBuilder_Load(pMeshBuilder3, &info, NULL, D3DRMLOAD_FROMMEMORY, NULL, NULL); + todo_wine ok(hr == D3DRM_OK, "Cannot load mesh data (hr = %x)\n", hr); + + val = IDirect3DRMMeshBuilder_GetVertexCount(pMeshBuilder3); + todo_wine ok(val == 4, "Wrong number of vertices %d (must be 4)\n", val); + + val = IDirect3DRMMeshBuilder_GetFaceCount(pMeshBuilder3); + todo_wine ok(val == 3, "Wrong number of faces %d (must be 3)\n", val); + + hr = IDirect3DRMMeshBuilder3_GetVertices(pMeshBuilder3, 0, &val1, NULL); + todo_wine ok(hr == D3DRM_OK, "Cannot get vertices information (hr = %x)\n", hr); + todo_wine ok(val1 == 4, "Wrong number of vertices %d (must be 4)\n", val1); + + valu = 1.23f; + valv = 3.21f; + hr = IDirect3DRMMeshBuilder3_GetTextureCoordinates(pMeshBuilder3, 1, &valu, &valv); + todo_wine ok(hr == D3DRM_OK, "Cannot get texture coordinates (hr = %x)\n", hr); + todo_wine ok(valu == 0.0f, "Wrong coordinate %f (must be 0.0)\n", valu); + todo_wine ok(valv == 0.0f, "Wrong coordinate %f (must be 0.0)\n", valv); + + valu = 1.23f; + valv = 3.21f; + hr = IDirect3DRMMeshBuilder3_SetTextureCoordinates(pMeshBuilder3, 1, valu, valv); + todo_wine ok(hr == D3DRM_OK, "Cannot set texture coordinates (hr = %x)\n", hr); + + valu = 0.0f; + valv = 0.0f; + hr = IDirect3DRMMeshBuilder3_GetTextureCoordinates(pMeshBuilder3, 1, &valu, &valv); + todo_wine ok(hr == D3DRM_OK, "Cannot get texture coordinates (hr = %x)\n", hr); + todo_wine ok(valu == 1.23f, "Wrong coordinate %f (must be 1.23)\n", valu); + todo_wine ok(valv == 3.21f, "Wrong coordinate %f (must be 3.21)\n", valv); + + IDirect3DRMMeshBuilder_Release(pMeshBuilder3); + + IDirect3DRM_Release(pD3DRM3); +} + START_TEST(d3drm) { if (!InitFunctionPtrs()) return;
- MeshBuilderTest(); + test_MeshBuilder(); + test_MeshBuilder3();
FreeLibrary(d3drm_handle); }