[2/2] oleacc: implemented GetRoleText[A/W] with tests (try3)

Dmitry Timoshkov dmitry at codeweavers.com
Mon Oct 6 04:54:12 CDT 2008


"Nikolay Sivov" <bunglehead at gmail.com> wrote:

First of all there is no need to send the configure.ac patch separately.

> +    /* zero role number - not documented */
> +    ret = GetRoleTextA(0, NULL, 0);
> +    ok(ret > 0, "GetRoleTextA doesn't return length for zero role number, got %d\n", ret);
> +    ret = GetRoleTextW(0, NULL, 0);
> +    ok(ret > 0, "GetRoleTextW doesn't return length for zero role number, got %d\n", ret);
> +
> +    /* NULL buffer, return length */
> +    ret = GetRoleTextA(ROLE_SYSTEM_TITLEBAR, NULL, 0);
> +    ok(ret > 0, "GetRoleTextA doesn't return length on NULL buffer, got %d\n", ret);
> +    ret = GetRoleTextA(ROLE_SYSTEM_TITLEBAR, NULL, 1);
> +    ok(ret > 0, "GetRoleTextA doesn't return length on NULL buffer, got %d\n", ret);
> +    ret = GetRoleTextW(ROLE_SYSTEM_TITLEBAR, NULL, 0);
> +    ok(ret > 0, "GetRoleTextW doesn't return length on NULL buffer, got %d\n", ret);
> +    ret = GetRoleTextW(ROLE_SYSTEM_TITLEBAR, NULL, 1);
> +    ok(ret > 0, "GetRoleTextW doesn't return length on NULL buffer, got %d\n", ret);

If you mean that the above tests do test that the returned value is the length
of the string that's not true, ret > 0 doesn't mean anything.

> +    /* use bigger buffer */
> +    ret = GetRoleTextA(ROLE_SYSTEM_TITLEBAR, NULL, 0);
> +    buff = HeapAlloc(GetProcessHeap(), 0, 2*ret);
> +    buff[2*ret-1] = '*';
> +    ret = GetRoleTextA(ROLE_SYSTEM_TITLEBAR, buff, 2*ret);
> +    ok(buff[2*ret-1] == '*', "GetRoleTextA shouldn't fill buffer with NULLs\n");
> +    HeapFree(GetProcessHeap(), 0, buff);
> +
> +    ret = GetRoleTextW(ROLE_SYSTEM_TITLEBAR, NULL, 0);
> +    buffW = HeapAlloc(GetProcessHeap(), 0, 2*ret*sizeof(WCHAR));
> +    buffW[2*ret-1] = '*';
> +    ret = GetRoleTextW(ROLE_SYSTEM_TITLEBAR, buffW, 2*ret);
> +    ok(buffW[2*ret-1] == '*', "GetRoleTextW shouldn't fill buffer with NULLs\n");
> +    HeapFree(GetProcessHeap(), 0, buffW);
> +}

You are confusing yourself in the above tests. What that 2*ret and
2*ret*sizeof(WCHAR) above values are supposed to mean? Besides you never
check the 'ret' for a presumably expected result.

-- 
Dmitry.



More information about the wine-devel mailing list