From 2fe8e29140fbec38a2c83b78b39e871e187e7ef5 Mon Sep 17 00:00:00 2001 From: Aaryaman Vasishta Date: Mon, 25 Apr 2016 21:59:40 +0530 Subject: [PATCH] d3drm/tests: Add tests for IDirect3DRMTexture{2-3}_InitFromImage. Signed-off-by: Aaryaman Vasishta Signed-off-by: Henri Verbeet Signed-off-by: Alexandre Julliard --- dlls/d3drm/tests/d3drm.c | 55 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) diff --git a/dlls/d3drm/tests/d3drm.c b/dlls/d3drm/tests/d3drm.c index 1c38ec89f4c..583dbeca7c5 100644 --- a/dlls/d3drm/tests/d3drm.c +++ b/dlls/d3drm/tests/d3drm.c @@ -1852,6 +1852,61 @@ static void test_Texture(void) ref4 = get_refcount((IUnknown *)d3drm3); ok(ref4 == ref1, "expected ref4 == ref1, got ref1 = %u, ref4 = %u.\n", ref1, ref4); + /* InitFromImage tests */ + d3drm_img = NULL; + hr = IDirect3DRM2_CreateObject(d3drm2, &CLSID_CDirect3DRMTexture, NULL, &IID_IDirect3DRMTexture2, (void **)&texture2); + ok(SUCCEEDED(hr), "Cannot get IDirect3DRMTexture2 interface (hr = %x).\n", hr); + ref2 = get_refcount((IUnknown *)texture2); + hr = IDirect3DRMTexture2_InitFromImage(texture2, NULL); + todo_wine ok(hr == D3DRMERR_BADOBJECT, "Expected hr == D3DRMERR_BADOBJECT, got %x.\n", hr); + ref3 = get_refcount((IUnknown *)texture2); + ok(ref3 == ref2, "expected ref3 == ref2, got ref2 = %u , ref3 = %u.\n", ref2, ref3); + hr = IDirect3DRMTexture2_InitFromImage(texture2, &initimg); + todo_wine ok(SUCCEEDED(hr), "Cannot initialize IDirect3DRMTexture2 from image (hr = %x).\n", hr); + ref2 = get_refcount((IUnknown *)d3drm1); + todo_wine ok(ref2 > ref1, "expected ref2 > ref1, got ref1 = %u , ref2 = %u.\n", ref1, ref2); + ref3 = get_refcount((IUnknown *)d3drm2); + ok(ref3 == ref1, "expected ref3 == ref1, got ref1 = %u , ref3 = %u.\n", ref1, ref3); + ref4 = get_refcount((IUnknown *)d3drm3); + ok(ref4 == ref1, "expected ref4 == ref1, got ref1 = %u , ref4 = %u.\n", ref1, ref4); + d3drm_img = IDirect3DRMTexture2_GetImage(texture2); + todo_wine ok(!!d3drm_img, "Failed to get image.\n"); + todo_wine ok(d3drm_img == &initimg, "Expected image returned == %p, got %p.\n", &initimg, d3drm_img); + IDirect3DRMTexture2_Release(texture2); + ref2 = get_refcount((IUnknown *)d3drm1); + ok(ref2 == ref1, "expected ref2 == ref1, got ref1 = %u, ref2 = %u.\n", ref1, ref2); + ref3 = get_refcount((IUnknown *)d3drm2); + ok(ref3 == ref1, "expected ref3 == ref1, got ref1 = %u, ref3 = %u.\n", ref1, ref3); + ref4 = get_refcount((IUnknown *)d3drm3); + ok(ref4 == ref1, "expected ref4 == ref1, got ref1 = %u, ref4 = %u.\n", ref1, ref4); + + d3drm_img = NULL; + hr = IDirect3DRM3_CreateObject(d3drm3, &CLSID_CDirect3DRMTexture, NULL, &IID_IDirect3DRMTexture3, (void **)&texture3); + ok(SUCCEEDED(hr), "Cannot get IDirect3DRMTexture3 interface (hr = %x).\n", hr); + ref2 = get_refcount((IUnknown *)texture3); + hr = IDirect3DRMTexture3_InitFromImage(texture3, NULL); + todo_wine ok(hr == D3DRMERR_BADOBJECT, "Expected hr == D3DRMERR_BADOBJECT, got %x.\n", hr); + ref3 = get_refcount((IUnknown *)texture3); + ok(ref3 == ref2, "expected ref3 == ref2, got ref2 = %u , ref3 = %u.\n", ref2, ref3); + hr = IDirect3DRMTexture3_InitFromImage(texture3, &initimg); + todo_wine ok(SUCCEEDED(hr), "Cannot initialize IDirect3DRMTexture3 from image (hr = %x).\n", hr); + ref2 = get_refcount((IUnknown *)d3drm1); + todo_wine ok(ref2 > ref1, "expected ref2 > ref1, got ref1 = %u , ref2 = %u.\n", ref1, ref2); + ref3 = get_refcount((IUnknown *)d3drm2); + ok(ref3 == ref1, "expected ref3 == ref1, got ref1 = %u , ref3 = %u.\n", ref1, ref3); + ref4 = get_refcount((IUnknown *)d3drm3); + ok(ref4 == ref1, "expected ref4 == ref1, got ref1 = %u , ref4 = %u.\n", ref1, ref4); + d3drm_img = IDirect3DRMTexture3_GetImage(texture3); + todo_wine ok(!!d3drm_img, "Failed to get image.\n"); + todo_wine ok(d3drm_img == &initimg, "Expected image returned == %p, got %p.\n", &initimg, d3drm_img); + IDirect3DRMTexture3_Release(texture3); + ref2 = get_refcount((IUnknown *)d3drm1); + ok(ref2 == ref1, "expected ref2 == ref1, got ref1 = %u, ref2 = %u.\n", ref1, ref2); + ref3 = get_refcount((IUnknown *)d3drm2); + ok(ref3 == ref1, "expected ref3 == ref1, got ref1 = %u, ref3 = %u.\n", ref1, ref3); + ref4 = get_refcount((IUnknown *)d3drm3); + ok(ref4 == ref1, "expected ref4 == ref1, got ref1 = %u, ref4 = %u.\n", ref1, ref4); + IDirect3DRM3_Release(d3drm3); IDirect3DRM2_Release(d3drm2); IDirect3DRM_Release(d3drm1);