On Sun, Apr 24, 2016 at 3:39 PM, Stefan Dösinger <stefandoesinger@gmail.com> wrote:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Hi,

I think it'd be a good idea to add some lines testing InitFromImage on
a texture that was created with CreateTexture and trying to call
InitFromImage twice (with the first call succeeding).

Am 2016-04-24 um 06:46 schrieb Aaryaman Vasishta:
> +    /* 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);
Did you forget IDirect3DRM::CreateObject(Texture1), or is there a
reason why it is omitted?
InitFromImage only exists for versions 2 and 3, so the tests for that were added accordingly, there wasn't any need for a CreateObject(Texture1) in this case.

> +    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);
You're not testing the reference count of d3drm1/2/3. My guess is that
you plan to add this later since the InitFrom() increments it, and not
the create. Is my understanding of your plans correct?
No you're right, I should've added refcount tests for d3drm1/2/3 as well. Even though InitFrom* is not implemented at this point, it's still a good idea to keep them as todo's and removing them when I send the implementation for InitFromImage. What do you think?

InitFrom* does increment the refcount, whereas CreateObject doesn't seem to. I think it was meant to be like that as every object creatable by CreateObject has a corresponding init method, which I guess increments the refcount when called.
I will resend this patch with the changes.

Cheers,
Aaryaman