--- dlls/d3drm/tests/d3drm.c | 64 +++++++++++++++++++++++++++++----------- 1 file changed, 46 insertions(+), 18 deletions(-)
diff --git a/dlls/d3drm/tests/d3drm.c b/dlls/d3drm/tests/d3drm.c index 4ed90ca682..27805f4f08 100644 --- a/dlls/d3drm/tests/d3drm.c +++ b/dlls/d3drm/tests/d3drm.c @@ -5598,6 +5598,40 @@ static void test_load_texture(void) ok(SUCCEEDED(hr), "Failed to get IDirect3DRM3 interface, hr %#x.\n", hr); ref1 = get_refcount((IUnknown *)d3drm1);
+ /* Test all failures together */ + texture1 = (IDirect3DRMTexture *)0xdeadbeef; + hr = IDirect3DRM_LoadTexture(d3drm1, NULL, &texture1); + ok(hr == D3DRMERR_BADVALUE, "Expected hr == D3DRMERR_BADVALUE, got %#x.\n", hr); + ok(!texture1, "Expected texture returned == NULL, got %p.\n", texture1); + texture1 = (IDirect3DRMTexture *)0xdeadbeef; + hr = IDirect3DRM_LoadTexture(d3drm1, "", &texture1); + ok(!texture1, "Expected texture returned == NULL, got %p.\n", texture1); + ok(hr == D3DRMERR_FILENOTFOUND, "Expected hr == D3DRMERR_FILENOTFOUND, got %#x.\n", hr); + hr = IDirect3DRM_LoadTexture(d3drm1, NULL, NULL); + ok(hr == D3DRMERR_BADVALUE, "Expected hr == D3DRMERR_BADVALUE, got %#x.\n", hr); + + texture2 = (IDirect3DRMTexture2 *)0xdeadbeef; + hr = IDirect3DRM2_LoadTexture(d3drm2, NULL, &texture2); + ok(hr == D3DRMERR_FILENOTFOUND, "Expected hr == D3DRMERR_FILENOTFOUND, got %#x.\n", hr); + ok(!texture2, "Expected texture returned == NULL, got %p.\n", texture2); + texture2 = (IDirect3DRMTexture2 *)0xdeadbeef; + hr = IDirect3DRM2_LoadTexture(d3drm2, "", &texture2); + ok(!texture2, "Expected texture returned == NULL, got %p.\n", texture2); + ok(hr == D3DRMERR_FILENOTFOUND, "Expected hr == D3DRMERR_FILENOTFOUND, got %#x.\n", hr); + hr = IDirect3DRM2_LoadTexture(d3drm2, NULL, NULL); + ok(hr == D3DRMERR_BADVALUE, "Expected hr == D3DRMERR_BADVALUE, got %#x.\n", hr); + + texture3 = (IDirect3DRMTexture3 *)0xdeadbeef; + hr = IDirect3DRM3_LoadTexture(d3drm3, NULL, &texture3); + ok(hr == D3DRMERR_FILENOTFOUND, "Expected hr == D3DRMERR_FILENOTFOUND, got %#x.\n", hr); + ok(!texture3, "Expected texture returned == NULL, got %p.\n", texture3); + texture3 = (IDirect3DRMTexture3 *)0xdeadbeef; + hr = IDirect3DRM_LoadTexture(d3drm3, "", &texture3); + ok(hr == D3DRMERR_FILENOTFOUND, "Expected hr == D3DRMERR_FILENOTFOUND, got %#x.\n", hr); + ok(!texture3, "Expected texture returned == NULL, got %p.\n", texture3); + hr = IDirect3DRM3_LoadTexture(d3drm3, NULL, NULL); + ok(hr == D3DRMERR_BADVALUE, "Expected hr == D3DRMERR_BADVALUE, got %#x.\n", hr); + for (i = 0; i < ARRAY_SIZE(tests); ++i) { filename = create_bitmap(tests[i].w, tests[i].h, tests[i].palettized); @@ -5605,17 +5639,16 @@ 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); + 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); + 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 (FAILED(hr)) IDirect3DRM_Release(d3drm1); d3drm_img = IDirect3DRMTexture_GetImage(texture1); 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); + 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); @@ -5635,16 +5668,14 @@ static void test_load_texture(void) 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); + 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 (FAILED(hr)) - IDirect3DRM_Release(d3drm1); + ok(hr == D3DRMERR_BADOBJECT, "Test %u: Expected hr == D3DRMERR_BADOBJECT, got %#x.\n", i, hr); + IDirect3DRM_Release(d3drm1); d3drm_img = IDirect3DRMTexture2_GetImage(texture2); ok(!!d3drm_img, "Test %u: Failed to get image.\n", i); - if (d3drm_img) - test_bitmap_data(i * 7 + 2, 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); @@ -5664,24 +5695,21 @@ static void test_load_texture(void) 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); + 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 (FAILED(hr)) - IDirect3DRM_Release(d3drm1); + ok(hr == D3DRMERR_BADOBJECT, "Test %u: Expected hr == D3DRMERR_BADOBJECT, got %#x.\n", i, hr); + IDirect3DRM_Release(d3drm1); d3drm_img = IDirect3DRMTexture3_GetImage(texture3); ok(!!d3drm_img, "Test %u: Failed to get image.\n", i); - if (d3drm_img) - test_bitmap_data(i * 4 + 2, d3drm_img, TRUE, tests[i].w, tests[i].h, tests[i].palettized); + test_bitmap_data(i * 4 + 2, d3drm_img, TRUE, tests[i].w, tests[i].h, tests[i].palettized); /* Test whether querying a version 1 texture from version 3 causes a * change in the loading behavior. */ hr = IDirect3DRMTexture3_QueryInterface(texture3, &IID_IDirect3DRMTexture, (void **)&texture1); ok(SUCCEEDED(hr), "Failed to get IDirect3DRMTexture interface, hr %#x.\n", hr); d3drm_img = IDirect3DRMTexture_GetImage(texture1); ok(!!d3drm_img, "Test %u: Failed to get image.\n", i); - if (d3drm_img) - test_bitmap_data(i * 4 + 3, d3drm_img, TRUE, tests[i].w, tests[i].h, tests[i].palettized); + 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);