Module: wine Branch: master Commit: 069e93f715162e401a1fa49f31ce96e165799c6a URL: http://source.winehq.org/git/wine.git/?a=commit;h=069e93f715162e401a1fa49f31...
Author: André Hentschel nerv@dawncrow.de Date: Sun Jun 17 19:02:53 2012 +0200
d3drm: Implement IDirect3DRMDeviceX_GetClassName.
---
dlls/d3drm/device.c | 18 ++++++++++----- dlls/d3drm/tests/Makefile.in | 2 +- dlls/d3drm/tests/d3drm.c | 49 ++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 62 insertions(+), 7 deletions(-)
diff --git a/dlls/d3drm/device.c b/dlls/d3drm/device.c index 8dca026..60fbe98 100644 --- a/dlls/d3drm/device.c +++ b/dlls/d3drm/device.c @@ -191,13 +191,13 @@ static HRESULT WINAPI IDirect3DRMDevice2Impl_GetName(IDirect3DRMDevice2* iface, }
static HRESULT WINAPI IDirect3DRMDevice2Impl_GetClassName(IDirect3DRMDevice2* iface, - LPDWORD size, LPSTR name) + LPDWORD size, LPSTR name) { IDirect3DRMDeviceImpl *This = impl_from_IDirect3DRMDevice2(iface);
- FIXME("(%p/%p)->(%p, %p): stub\n", iface, This, size, name); + TRACE("(%p/%p)->(%p, %p)\n", iface, This, size, name);
- return E_NOTIMPL; + return IDirect3DRMDevice3_GetClassName(&This->IDirect3DRMDevice3_iface, size, name); }
/*** IDirect3DRMDevice methods ***/ @@ -613,13 +613,19 @@ static HRESULT WINAPI IDirect3DRMDevice3Impl_GetName(IDirect3DRMDevice3* iface, }
static HRESULT WINAPI IDirect3DRMDevice3Impl_GetClassName(IDirect3DRMDevice3* iface, - LPDWORD size, LPSTR name) + LPDWORD size, LPSTR name) { IDirect3DRMDeviceImpl *This = impl_from_IDirect3DRMDevice3(iface);
- FIXME("(%p/%p)->(%p, %p): stub\n", iface, This, size, name); + TRACE("(%p/%p)->(%p, %p)\n", iface, This, size, name);
- return E_NOTIMPL; + if (!size || *size < strlen("Device") || !name) + return E_INVALIDARG; + + strcpy(name, "Device"); + *size = sizeof("Device"); + + return D3DRM_OK; }
/*** IDirect3DRMDevice methods ***/ diff --git a/dlls/d3drm/tests/Makefile.in b/dlls/d3drm/tests/Makefile.in index 5393742..67571c0 100644 --- a/dlls/d3drm/tests/Makefile.in +++ b/dlls/d3drm/tests/Makefile.in @@ -1,5 +1,5 @@ TESTDLL = d3drm.dll -IMPORTS = dxguid +IMPORTS = dxguid ddraw user32
C_SRCS = \ d3drm.c \ diff --git a/dlls/d3drm/tests/d3drm.c b/dlls/d3drm/tests/d3drm.c index e975289..f304346 100644 --- a/dlls/d3drm/tests/d3drm.c +++ b/dlls/d3drm/tests/d3drm.c @@ -1080,6 +1080,54 @@ static void test_Texture(void) IDirect3DRM_Release(pD3DRM); }
+static void test_Device(void) +{ + HRESULT hr; + LPDIRECT3DRM pD3DRM; + LPDIRECTDRAWCLIPPER pClipper; + LPDIRECT3DRMDEVICE pDevice; + GUID driver; + HWND window; + RECT rc; + DWORD size; + CHAR cname[64] = {0}; + + window = CreateWindowA("static", "d3drm_test", WS_OVERLAPPEDWINDOW, 0, 0, 300, 200, 0, 0, 0, 0); + GetClientRect(window, &rc); + + hr = pDirect3DRMCreate(&pD3DRM); + ok(hr == D3DRM_OK, "Cannot get IDirect3DRM interface (hr = %x)\n", hr); + + hr = DirectDrawCreateClipper(0, &pClipper, NULL); + ok(hr == DD_OK, "Cannot get IDirectDrawClipper interface (hr = %x)\n", hr); + + hr = IDirectDrawClipper_SetHWnd(pClipper, 0, window); + ok(hr == DD_OK, "Cannot set HWnd to Clipper (hr = %x)\n", hr); + + memcpy(&driver, &IID_IDirect3DRGBDevice, sizeof(GUID)); + hr = IDirect3DRM3_CreateDeviceFromClipper(pD3DRM, pClipper, &driver, rc.right, rc.bottom, &pDevice); + ok(hr == D3DRM_OK, "Cannot get IDirect3DRMDevice interface (hr = %x)\n", hr); + + hr = IDirect3DRMDevice_GetClassName(pDevice, NULL, cname); + ok(hr == E_INVALIDARG, "GetClassName failed with %x\n", hr); + hr = IDirect3DRMDevice_GetClassName(pDevice, NULL, NULL); + ok(hr == E_INVALIDARG, "GetClassName failed with %x\n", hr); + size = 1; + hr = IDirect3DRMDevice_GetClassName(pDevice, &size, cname); + ok(hr == E_INVALIDARG, "GetClassName failed with %x\n", hr); + size = sizeof(cname); + hr = IDirect3DRMDevice_GetClassName(pDevice, &size, cname); + ok(hr == D3DRM_OK, "Cannot get classname (hr = %x)\n", hr); + ok(size == sizeof("Device"), "wrong size: %u\n", size); + ok(!strcmp(cname, "Device"), "Expected cname to be "Device", but got "%s"\n", cname); + + IDirect3DRMDevice_Release(pDevice); + IDirectDrawClipper_Release(pClipper); + + IDirect3DRM_Release(pD3DRM); + DestroyWindow(window); +} + static void test_frame_transform(void) { HRESULT hr; @@ -1145,6 +1193,7 @@ START_TEST(d3drm) test_MeshBuilder3(); test_Mesh(); test_Frame(); + test_Device(); test_Light(); test_Material2(); test_Texture();