[3/3] user32: Implemented GetWindowRgnBox with tests

Nikolay Sivov bunglehead at gmail.com
Thu Apr 2 02:44:47 CDT 2009


Paul Vriens wrote:
> Nikolay Sivov wrote:
>> IE8 requested this.
>>
>> Changelog:
>>     - Implemented GetWindowRgnBox with tests
>>
>> +static void test_winregion()
>> +{
>> +    HWND hwnd;
>> +    RECT r;
>> +    int ret;
>> +    HRGN hrgn;
>> +
>> +    hwnd = CreateWindowExA(0, "static", NULL, WS_VISIBLE, 10, 10, 
>> 10, 10, NULL, 0, 0, NULL);
>> +    if (pGetWindowRgnBox)
>> +    {
>> +        /* NULL prect */
>> +        SetLastError(0xdeadbeef);
>> +        ret = pGetWindowRgnBox(hwnd, NULL);
>> +        ok( ret == ERROR, "Expected ERROR, got %d\n", ret);
>> +        ok( GetLastError() == 0xdeadbeef, "Expected , got %d\n", 
>> GetLastError());
>> +
>> +        hrgn = CreateRectRgn(2, 3, 10, 15);
>> +        ok( hrgn != NULL, "Region creation failed\n");
>> +        if (hrgn)
>> +        {
>> +            SetWindowRgn(hwnd, hrgn, FALSE);
>> +
>> +            SetLastError(0xdeadbeef);
>> +            ret = pGetWindowRgnBox(hwnd, NULL);
>> +            ok( ret == ERROR, "Expected ERROR, got %d\n", ret);
>> +            ok( GetLastError() == 0xdeadbeef, "Expected , got %d\n", 
>> GetLastError());
>> +
>> +            r.left = r.top = r.right = r.bottom = 0;
>> +            ret = pGetWindowRgnBox(hwnd, &r);
>> +            ok( ret == SIMPLEREGION, "Expected SIMPLEREGION, got 
>> %d\n", ret);
>> +            ok( r.left == 2 && r.top == 3 && r.right == 10 && 
>> r.bottom == 15,
>> +               "Expected (2,3,10,15), got (%d,%d,%d,%d)\n", r.left, 
>> r.top,
>> +                                                            r.right, 
>> r.bottom);
>> +            DeleteObject(hrgn);
>> +        }
>> +    }
>> +    else
>> +        win_skip("GetWindowRgnBox not supported\n");
>> +
>> +    DestroyWindow(hwnd);
>> +}
>> +
>
> Why not test for pGetWindowRgnBox at the beginning and return when not 
> available (including the win_skip() of course). That will get rid of 
> the big indented block.
>
It makes sense. I'll resend. Thanks for reviewing.



More information about the wine-devel mailing list