[PATCH 1/2] gdi32/tests: Don't treat a return value of COMPLEXREGION from IntersectClipRect() as broken.

Zebediah Figura z.figura12 at gmail.com
Tue Dec 31 11:57:51 CST 2019


On 12/30/19 8:12 PM, Dmitry Timoshkov wrote:
> Zebediah Figura <z.figura12 at gmail.com> wrote:
> 
>>       ret = IntersectClipRect(hdc, 0, 0, 50, 50);
>> -    if (ret == COMPLEXREGION)
>> -    {
>> -        /* XP returns COMPLEXREGION although dump_region reports only 1 rect */
>> -        trace("Windows BUG: IntersectClipRect returned %d instead of SIMPLEREGION\n", ret);
>> -        /* let's make sure that it's a simple region */
>> -        ret = GetClipRgn(hdc, hrgn);
>> -        ok(ret == 1, "GetClipRgn returned %d instead of 1\n", ret);
>> -        dump_region(hrgn);
>> -    }
>> -    else
>> -        ok(ret == SIMPLEREGION, "IntersectClipRect returned %d instead of SIMPLEREGION\n", ret);
>> +    todo_wine ok(ret == COMPLEXREGION, "wrong region type %d\n", ret);
>> +    ret = GetClipRgn(hdc, hrgn);
>> +    ok(ret == 1, "GetClipRgn returned %d instead of 1\n", ret);
>> +    ret = GetRegionData(hrgn, sizeof(buffer), rgndata);
>> +    ok(ret == sizeof(RGNDATAHEADER) + sizeof(RECT), "got %u\n", ret);
>> +    ok(rgndata->rdh.nCount == 1, "got %u rectangles\n", rgndata->rdh.nCount);
> 
> Even if every Windows version returns broken result doesn't make it
> legitimate to return COMPLEXREGION when the region contains only 1
> rectangle. This is clearly broken.
> 

Windows does many things that are nonsensical, buggy, or contradicting 
their own documentation or other parts of the code. This seems nothing 
new. If sufficiently motivated one could even argue that a simple region 
is a special case of a complex region (I wouldn't actually be that 
surprised if such reasoning led a Windows programmer to just always 
return COMPLEXREGION because it was easier for them). Are we abandoning 
the idea of bug-for-bug compatibility now?

I'm not arguing that we have to return COMPLEXREGION to satisfy the test 
(I certainly have no intention of writing such a patch), but our tests 
document the behaviour of Windows functions, not their documentation; 
that's why they exist.



More information about the wine-devel mailing list