Commit 924fad9d authored by Dmitry Timoshkov's avatar Dmitry Timoshkov Committed by Alexandre Julliard

gdi32: ExtSelectClipRgn(hdc, 0, RGN_DIFF) is supposed to fail.

parent 9974a3e8
......@@ -148,14 +148,21 @@ INT nulldrv_ExtSelectClipRgn( PHYSDEV dev, HRGN rgn, INT mode )
if (!rgn)
{
if (mode != RGN_COPY)
switch (mode)
{
case RGN_COPY:
if (dc->hClipRgn) DeleteObject( dc->hClipRgn );
dc->hClipRgn = 0;
ret = SIMPLEREGION;
break;
case RGN_DIFF:
return ERROR;
default:
FIXME("Unimplemented: hrgn NULL in mode: %d\n", mode);
return ERROR;
}
if (dc->hClipRgn) DeleteObject( dc->hClipRgn );
dc->hClipRgn = 0;
ret = SIMPLEREGION;
}
else
{
......
......@@ -2,6 +2,7 @@
* Unit test suite for clipping
*
* Copyright 2005 Huw Davies
* Copyright 2008,2011,2013 Dmitry Timoshkov
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
......@@ -388,6 +389,12 @@ static void test_memory_dc_clipping(void)
ret = GetClipRgn(hdc, hrgn);
ok(ret == 0, "expected 0, got %d\n", ret);
ret = ExtSelectClipRgn(hdc, 0, RGN_DIFF);
ok(ret == 0, "expected 0, got %d\n", ret);
ret = GetClipRgn(hdc, hrgn);
ok(ret == 0, "expected 0, got %d\n", ret);
SelectObject(hdc, hbmp);
ret = ExtSelectClipRgn(hdc, hrgn_empty, RGN_DIFF);
......@@ -409,6 +416,17 @@ static void test_memory_dc_clipping(void)
ret = RectVisible( hdc, &rc );
ok( ret, "RectVisible failed for %d,%d-%d,%d\n", rc.left, rc.top, rc.right, rc.bottom );
ret = ExtSelectClipRgn(hdc, 0, RGN_DIFF);
ok(ret == 0, "expected 0, got %d\n", ret);
ret = GetClipRgn(hdc, hrgn);
ok(ret == 1, "expected 1, got %d\n", ret);
ret = GetRgnBox(hrgn, &rc);
ok(ret == SIMPLEREGION, "expected SIMPLEREGION, got %d\n", ret);
ok(rc.left == 0 && rc.top == 0 && rc.right == 100 && rc.bottom == 100,
"expected 0,0-100,100, got %d,%d-%d,%d\n", rc.left, rc.top, rc.right, rc.bottom);
DeleteDC(hdc);
DeleteObject(hrgn);
DeleteObject(hrgn_empty);
......@@ -441,6 +459,12 @@ static void test_window_dc_clipping(void)
ret = GetClipRgn(hdc, hrgn);
ok(ret == 0, "expected 0, got %d\n", ret);
ret = ExtSelectClipRgn(hdc, 0, RGN_DIFF);
ok(ret == 0, "expected 0, got %d\n", ret);
ret = GetClipRgn(hdc, hrgn);
ok(ret == 0, "expected 0, got %d\n", ret);
ret = ExtSelectClipRgn(hdc, hrgn_empty, RGN_DIFF);
ok(ret == SIMPLEREGION || (ret == COMPLEXREGION && GetSystemMetrics(SM_CMONITORS) > 1),
"expected SIMPLEREGION, got %d\n", ret);
......@@ -462,6 +486,18 @@ static void test_window_dc_clipping(void)
ret = RectVisible( hdc, &rc );
ok( ret, "RectVisible failed for %d,%d-%d,%d\n", rc.left, rc.top, rc.right, rc.bottom );
ret = ExtSelectClipRgn(hdc, 0, RGN_DIFF);
ok(ret == 0, "expected 0, got %d\n", ret);
ret = GetClipRgn(hdc, hrgn);
ok(ret == 1, "expected 1, got %d\n", ret);
ret = GetRgnBox(hrgn, &rc);
ok(ret == SIMPLEREGION, "expected SIMPLEREGION, got %d\n", ret);
ok(rc.left == 0 && rc.top == 0 && rc.right == screen_width && rc.bottom == screen_height,
"expected 0,0-%d,%d, got %d,%d-%d,%d\n", screen_width, screen_height,
rc.left, rc.top, rc.right, rc.bottom);
ret = ExtSelectClipRgn(hdc, 0, RGN_COPY);
ok(ret == SIMPLEREGION || (ret == COMPLEXREGION && GetSystemMetrics(SM_CMONITORS) > 1),
"expected SIMPLEREGION, got %d\n", ret);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment