-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA256
Am 2016-04-24 um 06:40 schrieb Aaryaman Vasishta:
- size = 1;
- hr = IDirect3DRMTexture_GetClassName(texture1, &size, cname);
- ok(hr == E_INVALIDARG, "GetClassName failed with %x\n", hr);
- size = sizeof(cname);
- hr = IDirect3DRMTexture_GetClassName(texture1, &size, cname);
- ok(SUCCEEDED(hr), "Cannot get classname (hr = %x)\n", hr);
- ok(size == sizeof("Texture"), "wrong size: %u\n", size);
sizeof("Texture") is confusing IMHO. I had to look up the C rules on string literals to make sure it does what you want :-) . Though I'm not sure if its better than strlen("Texture") + 1, so it's your call.
However, the current implementation in d3drm_texture3_GetClassName confuses the two. I recommend adding a test for sizeof("Texture") - 1 and an exactly matching size.
On Sun, Apr 24, 2016 at 3:43 PM, Stefan Dösinger stefandoesinger@gmail.com wrote:
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA256
Am 2016-04-24 um 06:40 schrieb Aaryaman Vasishta:
- size = 1;
- hr = IDirect3DRMTexture_GetClassName(texture1, &size, cname);
- ok(hr == E_INVALIDARG, "GetClassName failed with %x\n", hr);
- size = sizeof(cname);
- hr = IDirect3DRMTexture_GetClassName(texture1, &size, cname);
- ok(SUCCEEDED(hr), "Cannot get classname (hr = %x)\n", hr);
- ok(size == sizeof("Texture"), "wrong size: %u\n", size);
sizeof("Texture") is confusing IMHO. I had to look up the C rules on string literals to make sure it does what you want :-) . Though I'm not sure if its better than strlen("Texture") + 1, so it's your call.
However, the current implementation in d3drm_texture3_GetClassName confuses the two. I recommend adding a test for sizeof("Texture") - 1 and an exactly matching size.
I hadn't really paid attention to that since the plan was to just extend
the existing tests to version 2 and 3. But I will add these tests as you want. By exactly matching size, did you mean sizeof("Texture") itself? Isn't that already there? I might have missed something here.
Cheers, Aaryaman
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA256
Am 2016-04-24 um 11:38 schrieb Aaryaman Vasishta:
By exactly matching size, did you mean sizeof("Texture") itself? Isn't that already there? I might have missed something here.
What you have is
size = <huge>; GetClassName(size, buffer); ok(HR == OK); ok(size == sizeof("Texture"));
what I mean is size = sizeof("Texture") - 1; // or strlen("Texture"); GetClassname(size, buffer); ok(hr == ERROR); ok(size == ???);
what I mean is size = sizeof("Texture"); GetClassname(size, buffer); ok(hr == OK); ok(size == sizeof("Texture"));