v2: Add todo_wine(s) on failed tests (which will be removed on the next patch in this series) Signed-off-by: Aaryaman Vasishta jem456.vasishta@gmail.com --- dlls/d3drm/tests/d3drm.c | 74 ++++++++++++++++++++++++++++++++++++++-- 1 file changed, 72 insertions(+), 2 deletions(-)
diff --git a/dlls/d3drm/tests/d3drm.c b/dlls/d3drm/tests/d3drm.c index f78e098fec..e336b98b95 100644 --- a/dlls/d3drm/tests/d3drm.c +++ b/dlls/d3drm/tests/d3drm.c @@ -5572,6 +5572,7 @@ static void test_load_texture(void) char *filename; HRESULT hr; BOOL ret; + ULONG ref1, ref2; int i;
static const struct @@ -5595,6 +5596,7 @@ static void test_load_texture(void) ok(SUCCEEDED(hr), "Failed to get IDirect3DRM2 interface, hr %#x.\n", hr); hr = IDirect3DRM_QueryInterface(d3drm1, &IID_IDirect3DRM3, (void **)&d3drm3); ok(SUCCEEDED(hr), "Failed to get IDirect3DRM3 interface, hr %#x.\n", hr); + ref1 = get_refcount((IUnknown *)d3drm1);
for (i = 0; i < ARRAY_SIZE(tests); ++i) { @@ -5602,22 +5604,74 @@ static void test_load_texture(void)
hr = IDirect3DRM_LoadTexture(d3drm1, filename, &texture1); ok(SUCCEEDED(hr), "Test %u: Failed to load texture, hr %#x.\n", i, hr); + ref2 = get_refcount((IUnknown *)d3drm1); + todo_wine ok(ref2 > ref1, "Test %u: expected ref2 > ref1, got ref1 = %u, ref2 = %u.\n", i, ref1, ref2); + + hr = IDirect3DRMTexture_InitFromFile(texture1, filename); + todo_wine ok(hr == D3DRMERR_BADOBJECT, "Test %u: Expected hr == D3DRMERR_BADOBJECT, got %#x.\n", i, hr); + /* InitFromFile seems to AddRef IDirect3DRM even if it fails. */ + if (hr == D3DRMERR_BADOBJECT) + IDirect3DRM_Release(d3drm1); + d3drm_img = IDirect3DRMTexture_GetImage(texture1); + todo_wine ok(!!d3drm_img, "Test %u: Failed to get image.\n", i); + if (d3drm_img) + test_bitmap_data(i * 7, d3drm_img, FALSE, tests[i].w, tests[i].h, tests[i].palettized); + IDirect3DRMTexture_Release(texture1); + ref2 = get_refcount((IUnknown *)d3drm1); + ok(ref1 == ref2, "Test %u: expected ref1 == ref2, got ref1 = %u, ref2 = %u.\n", i, ref1, ref2); + hr = IDirect3DRM_CreateObject(d3drm1, &CLSID_CDirect3DRMTexture, NULL, &IID_IDirect3DRMTexture, (void **)&texture1); + ok(SUCCEEDED(hr), "Test %u: Failed to create texture, hr %#x.\n", i, hr); + hr = IDirect3DRMTexture_InitFromFile(texture1, NULL); + todo_wine ok(hr == D3DRMERR_BADOBJECT, "Test %u: Expected hr == D3DRMERR_BADOBJECT, got %#x.\n", i, hr); + hr = IDirect3DRMTexture_InitFromFile(texture1, ""); + todo_wine ok(hr == D3DRMERR_BADOBJECT, "Test %u: Expected hr == D3DRMERR_BADOBJECT, got %#x.\n", i, hr); + hr = IDirect3DRMTexture_InitFromFile(texture1, filename); + todo_wine ok(SUCCEEDED(hr), "Test %u: Failed to initialize texture from file, hr %#x.\n", i, hr); d3drm_img = IDirect3DRMTexture_GetImage(texture1); todo_wine ok(!!d3drm_img, "Test %u: Failed to get image.\n", i); if (d3drm_img) - test_bitmap_data(i * 4, d3drm_img, FALSE, tests[i].w, tests[i].h, tests[i].palettized); + test_bitmap_data(i * 7 + 1, d3drm_img, FALSE, tests[i].w, tests[i].h, tests[i].palettized); IDirect3DRMTexture_Release(texture1);
hr = IDirect3DRM2_LoadTexture(d3drm2, filename, &texture2); ok(SUCCEEDED(hr), "Test %u: Failed to load texture, hr %#x.\n", i, hr); + ref2 = get_refcount((IUnknown *)d3drm1); + todo_wine ok(ref2 > ref1, "Test %u: expected ref2 > ref1, got ref1 = %u, ref2 = %u.\n", i, ref1, ref2); + + hr = IDirect3DRMTexture2_InitFromFile(texture2, filename); + todo_wine ok(hr == D3DRMERR_BADOBJECT, "Test %u: Expected hr == D3DRMERR_BADOBJECT, got %#x.\n", i, hr); + if (hr == D3DRMERR_BADOBJECT) + IDirect3DRM_Release(d3drm1); d3drm_img = IDirect3DRMTexture2_GetImage(texture2); todo_wine ok(!!d3drm_img, "Test %u: Failed to get image.\n", i); if (d3drm_img) - test_bitmap_data(i * 4 + 1, d3drm_img, TRUE, tests[i].w, tests[i].h, tests[i].palettized); + test_bitmap_data(i * 7 + 2, d3drm_img, TRUE, tests[i].w, tests[i].h, tests[i].palettized); + IDirect3DRMTexture2_Release(texture2); + ref2 = get_refcount((IUnknown *)d3drm1); + ok(ref1 == ref2, "Test %u: expected ref1 == ref2, got ref1 = %u, ref2 = %u.\n", i, ref1, ref2); + hr = IDirect3DRM2_CreateObject(d3drm2, &CLSID_CDirect3DRMTexture, NULL, &IID_IDirect3DRMTexture2, (void **)&texture2); + ok(SUCCEEDED(hr), "Test %u: Failed to create texture, hr %#x.\n", i, hr); + hr = IDirect3DRMTexture2_InitFromFile(texture2, NULL); + todo_wine ok(hr == D3DRMERR_BADOBJECT, "Test %u: Expected hr == D3DRMERR_BADOBJECT, got %#x.\n", i, hr); + hr = IDirect3DRMTexture2_InitFromFile(texture2, ""); + todo_wine ok(hr == D3DRMERR_BADOBJECT, "Test %u: Expected hr == D3DRMERR_BADOBJECT, got %#x.\n", i, hr); + hr = IDirect3DRMTexture2_InitFromFile(texture2, filename); + todo_wine ok(SUCCEEDED(hr), "Test %u: Failed to initialize texture from file, hr %#x.\n", i, hr); + d3drm_img = IDirect3DRMTexture2_GetImage(texture2); + todo_wine ok(!!d3drm_img, "Test %u: Failed to get image.\n", i); + if (d3drm_img) + test_bitmap_data(i * 7 + 3, d3drm_img, TRUE, tests[i].w, tests[i].h, tests[i].palettized); IDirect3DRMTexture2_Release(texture2);
hr = IDirect3DRM3_LoadTexture(d3drm3, filename, &texture3); ok(SUCCEEDED(hr), "Test %u: Failed to load texture, hr %#x.\n", i, hr); + ref2 = get_refcount((IUnknown *)d3drm1); + todo_wine ok(ref2 > ref1, "Test %u: expected ref2 > ref1, got ref1 = %u, ref2 = %u.\n", i, ref1, ref2); + + hr = IDirect3DRMTexture3_InitFromFile(texture3, filename); + todo_wine ok(hr == D3DRMERR_BADOBJECT, "Test %u: Expected hr == D3DRMERR_BADOBJECT, got %#x.\n", i, hr); + if (hr == D3DRMERR_BADOBJECT) + IDirect3DRM_Release(d3drm1); d3drm_img = IDirect3DRMTexture3_GetImage(texture3); todo_wine ok(!!d3drm_img, "Test %u: Failed to get image.\n", i); if (d3drm_img) @@ -5632,6 +5686,22 @@ static void test_load_texture(void) test_bitmap_data(i * 4 + 3, d3drm_img, TRUE, tests[i].w, tests[i].h, tests[i].palettized); IDirect3DRMTexture_Release(texture1); IDirect3DRMTexture3_Release(texture3); + ref2 = get_refcount((IUnknown *)d3drm1); + ok(ref1 == ref2, "Test %u: expected ref1 == ref2, got ref1 = %u, ref2 = %u.\n", i, ref1, ref2); + + hr = IDirect3DRM3_CreateObject(d3drm3, &CLSID_CDirect3DRMTexture, NULL, &IID_IDirect3DRMTexture3, (void **)&texture3); + ok(SUCCEEDED(hr), "Test %u: Failed to create texture, hr %#x.\n", i, hr); + hr = IDirect3DRMTexture3_InitFromFile(texture3, NULL); + todo_wine ok(hr == D3DRMERR_BADOBJECT, "Test %u: Expected hr == D3DRMERR_BADOBJECT, got %#x.\n", i, hr); + hr = IDirect3DRMTexture3_InitFromFile(texture3, ""); + todo_wine ok(hr == D3DRMERR_BADOBJECT, "Test %u: Expected hr == D3DRMERR_BADOBJECT, got %#x.\n", i, hr); + hr = IDirect3DRMTexture3_InitFromFile(texture3, filename); + todo_wine ok(SUCCEEDED(hr), "Test %u: Failed to initialize texture from file, hr %#x.\n", i, hr); + d3drm_img = IDirect3DRMTexture3_GetImage(texture3); + todo_wine ok(!!d3drm_img, "Test %u: Failed to get image.\n", i); + if (d3drm_img) + test_bitmap_data(i * 7 + 6, d3drm_img, TRUE, tests[i].w, tests[i].h, tests[i].palettized); + IDirect3DRMTexture3_Release(texture3);
ret = DeleteFileA(filename); ok(ret, "Test %u: Failed to delete bitmap "%s".\n", i, filename);