diff --git a/dlls/d3drm/tests/d3drm.c b/dlls/d3drm/tests/d3drm.c index dbfd7d1b428..e9752894e1c 100644 --- a/dlls/d3drm/tests/d3drm.c +++ b/dlls/d3drm/tests/d3drm.c @@ -1041,6 +1041,45 @@ static void test_Material2(void) IDirect3DRM_Release(pD3DRM); } +static void test_Texture(void) +{ + HRESULT hr; + LPDIRECT3DRM pD3DRM; + LPDIRECT3DRMTEXTURE pTexture; + D3DRMIMAGE initimg = { + 2, 2, 1, 1, 32, + TRUE, 2 * sizeof(DWORD), NULL, NULL, + 0x000000ff, 0x0000ff00, 0x00ff0000, 0xff000000, 0, NULL + }; + DWORD pixel[4] = { 20000, 30000, 10000, 0 }; + DWORD size; + CHAR cname[64] = {0}; + + hr = pDirect3DRMCreate(&pD3DRM); + ok(hr == D3DRM_OK, "Cannot get IDirect3DRM interface (hr = %x)\n", hr); + + initimg.buffer1 = &pixel; + hr = IDirect3DRM_CreateTexture(pD3DRM, &initimg, &pTexture); + ok(hr == D3DRM_OK, "Cannot get IDirect3DRMTexture interface (hr = %x)\n", hr); + + hr = IDirect3DRMTexture_GetClassName(pTexture, NULL, cname); + ok(hr == E_INVALIDARG, "GetClassName failed with %x\n", hr); + hr = IDirect3DRMTexture_GetClassName(pTexture, NULL, NULL); + ok(hr == E_INVALIDARG, "GetClassName failed with %x\n", hr); + size = 1; + hr = IDirect3DRMTexture_GetClassName(pTexture, &size, cname); + ok(hr == E_INVALIDARG, "GetClassName failed with %x\n", hr); + size = sizeof(cname); + hr = IDirect3DRMTexture_GetClassName(pTexture, &size, cname); + ok(hr == D3DRM_OK, "Cannot get classname (hr = %x)\n", hr); + ok(size == sizeof("Texture"), "wrong size: %u\n", size); + ok(!strcmp(cname, "Texture"), "Expected cname to be \"Texture\", but got \"%s\"\n", cname); + + IDirect3DRMTexture_Release(pTexture); + + IDirect3DRM_Release(pD3DRM); +} + static void test_frame_transform(void) { HRESULT hr; @@ -1108,6 +1147,7 @@ START_TEST(d3drm) test_Frame(); test_Light(); test_Material2(); + test_Texture(); test_frame_transform(); test_d3drm_load(); diff --git a/dlls/d3drm/texture.c b/dlls/d3drm/texture.c index 44a9061b2d7..cfa7e8586bf 100644 --- a/dlls/d3drm/texture.c +++ b/dlls/d3drm/texture.c @@ -160,9 +160,11 @@ static HRESULT WINAPI IDirect3DRMTexture2Impl_GetName(IDirect3DRMTexture2* iface static HRESULT WINAPI IDirect3DRMTexture2Impl_GetClassName(IDirect3DRMTexture2* iface, LPDWORD size, LPSTR name) { - FIXME("(%p)->(%p, %p): stub\n", iface, size, name); + IDirect3DRMTextureImpl *This = impl_from_IDirect3DRMTexture2(iface); - return E_NOTIMPL; + TRACE("(%p/%p)->(%p, %p)\n", iface, This, size, name); + + return IDirect3DRMTexture3_GetClassName(&This->IDirect3DRMTexture3_iface, size, name); } /*** IDirect3DRMTexture3 methods ***/ @@ -522,9 +524,17 @@ static HRESULT WINAPI IDirect3DRMTexture3Impl_GetName(IDirect3DRMTexture3* iface static HRESULT WINAPI IDirect3DRMTexture3Impl_GetClassName(IDirect3DRMTexture3* iface, LPDWORD size, LPSTR name) { - FIXME("(%p)->(%p, %p): stub\n", iface, size, name); + IDirect3DRMTextureImpl *This = impl_from_IDirect3DRMTexture3(iface); - return E_NOTIMPL; + TRACE("(%p/%p)->(%p, %p)\n", iface, This, size, name); + + if (!size || *size < strlen("Texture") || !name) + return E_INVALIDARG; + + strcpy(name, "Texture"); + *size = sizeof("Texture"); + + return D3DRM_OK; } /*** IDirect3DRMTexture3 methods ***/