Re: [PATCH 2/3] d3drm/tests: Replace test_Texture.
-----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. -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAEBCAAGBQJXHJxZAAoJEN0/YqbEcdMwMAkP/0JEXejefj/awhnJGh5zQlg9 07gvcDjH+KvsHYbJsWOA8GE3+JcUJrqpHA8nqO2Uxmy1mg26EECNtRFTjfWJ4oQM iHcVgVurTb6rx6UZpcLkoy/BQ4fvWQFtWxfL2J9ZDO2TVt+0oeGSurkv5ywylTmq 5RZa5lFhnaeMyWw6hbtXNwsPXMhi+tDdHZTYVakJGRa72deO23ZrWuzbHzMfnlDx /SnGnSnFF9JcWLkLQMqeiQ+Q2Ztn+PHo15EjAye3hk1gvVYKx5xx7+Hef9l4/1dG Cqc2I+4GwE86FmrBkqT1noF6HDo4+6evHi+JrW6d0WFH7I/k3D+5SUtaqtBRtraC AuS4Kwsqri4wpVeqz6zsX8BsneQHQzkB87EXEC81d7W6fTPAYT1YoQp2zDPxP32G lIwd3bxtdyYA91dNTCGx8arKEpBXhuKqh0ahI8FrRBiuZ20JVIvosiVBxpWHYsiV 9X3smnaiYrL6sZTPtbcHbcs5shbuycpzm05EB5noSbc+P6ur5/q4Q9nSH86OYAIr mJBZWg6pE9N1zcko6KTmB//z7NGYms8knxVQYGVgtRgZaNk8+mVaeedgdbnrIMFj xsdTX8UGtOAs7mJ6E496xq4P7bMxK5B0BSoChtaJV3ZeS9wLD/JId/1Z7l/DvVwn 0EDb2DPmwv7EbEWz7cAH =MI19 -----END PGP SIGNATURE-----
On Sun, Apr 24, 2016 at 3:43 PM, Stefan Dösinger <stefandoesinger(a)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")); -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAEBCAAGBQJXHMX7AAoJEN0/YqbEcdMwY0EP/2+s7ipkmnTXBJIonvAD5aWn 5tvySdprGsvhcCJWwG1oOxdBJP+50D7eixS952E7JBLKYK6gby6g7bYOf2N3vEJ3 mqArdePbCBSo+aQg5jgT9zSLhiBzPgphYJuh5b/8dj9dfSQaqKQj2+wC8EY1xQd5 1t5vx2flOqiQ1fcQS1ywVQm8jhfSHqSJTL3xN0m4CmxCpF+FfFcEf30vAlVI3W0o Z1Hdl8LLgth8Zg+VOSVUxaxbEUgM/QS7ganT3+ICYVUNZ65UiSE3tXqYgYRzmdgo 27OCx0u7apodUV0rRApwhrEJqujl2/OYCCVD6Gj2ejA/9AoaJCGBwlGsCaarCEWG OPpiVUoIJfLk2u8AblgyXr12ux1abgRp31SBPH4ToAR9iy3FSvr8iKBTRifpNzrw tXeyFoDdtBsR9Br+D+WRJ7WXllmU6Y3LgDcbi56T/N0oumWlWZO+pWvaVIP9Cf0u SvtHgWy0j6K0lK4PEr5ok/yJAwNV7WMYDcwQgG5Vr7/aTj6fmj3fZFffZ9IrPqHW ANaU7Wm5z+4KLAeE7cbYv8miLcrMXWlBFc8MiZxjzdaI4VSoPsEOfR0R2Tb77rSh tC9wUg/bTlhw8rZWPI3MNXtFOl1JZO7xSTWloqiYw4GN8tft24QMTbxNZZuTCCKX gayjF4/rKP2SQQBjf+ob =+f75 -----END PGP SIGNATURE-----
participants (2)
-
Aaryaman Vasishta -
Stefan Dösinger