Commit 2fe8e291 authored by Aaryaman Vasishta's avatar Aaryaman Vasishta Committed by Alexandre Julliard

d3drm/tests: Add tests for IDirect3DRMTexture{2-3}_InitFromImage.

parent c64ce8cd
......@@ -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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment