gdi32/tests: Fix some test failures on Windows.

This commit is contained in:
Alexandre Julliard 2011-12-10 18:08:35 +01:00
parent 8db263d2eb
commit 2e42ab1527
2 changed files with 10 additions and 4 deletions

View File

@ -881,7 +881,7 @@ static void test_dib_formats(void)
HBITMAP hdib, hbmp;
HDC hdc, memdc;
UINT ret;
BOOL expect_ok;
BOOL format_ok, expect_ok;
bi = HeapAlloc( GetProcessHeap(), 0, FIELD_OFFSET( BITMAPINFO, bmiColors[256] ) );
hdc = GetDC( 0 );
@ -927,6 +927,7 @@ static void test_dib_formats(void)
"GetDIBits succeeded for %u/%u/%u/%u\n", bpp, planes, compr, format );
/* all functions check planes except GetDIBits with 0 lines */
format_ok = expect_ok;
if (!planes) expect_ok = FALSE;
memset( bi, 0, sizeof(bi->bmiHeader) );
bi->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
@ -1019,7 +1020,8 @@ static void test_dib_formats(void)
if (expect_ok || !bpp)
ok( ret, "GetDIBits failed for %u/%u/%u/%u\n", bpp, planes, compr, format );
else
ok( !ret, "GetDIBits succeeded for %u/%u/%u/%u\n", bpp, planes, compr, format );
ok( !ret || broken(format_ok && !planes), /* nt4 */
"GetDIBits succeeded for %u/%u/%u/%u\n", bpp, planes, compr, format );
}
}
}
@ -1841,7 +1843,8 @@ static void test_GetDIBits(void)
broken(GetLastError() == 0xdeadbeef), /* winnt */
"wrong error %u\n", GetLastError());
ok(bi->bmiHeader.biSizeImage == 0, "expected 0, got %u\n", bi->bmiHeader.biSizeImage);
ok(bi->bmiHeader.biClrUsed == 37, "wrong biClrUsed %u\n", bi->bmiHeader.biClrUsed);
ok(bi->bmiHeader.biClrUsed == 37 || broken(bi->bmiHeader.biClrUsed == 0),
"wrong biClrUsed %u\n", bi->bmiHeader.biClrUsed);
memset(buf, 0xAA, sizeof(buf));
SetLastError(0xdeadbeef);
@ -4365,7 +4368,8 @@ static void test_SetDIBits(void)
int ent = (255 - idx) % pal->palNumEntries;
DWORD expect = idx >= info->bmiHeader.biClrUsed ? 0 :
(palent[ent].peRed << 16 | palent[ent].peGreen << 8 | palent[ent].peBlue);
ok( dib_bits[i] == expect, "%d: got %08x instead of %08x\n", i, dib_bits[i], expect );
ok( dib_bits[i] == expect || broken(dib_bits[i] == 0), /* various Windows versions get some values wrong */
"%d: got %08x instead of %08x\n", i, dib_bits[i], expect );
}
memset( dib_bits, 0xaa, 64 * 4 );

View File

@ -112,6 +112,8 @@ static void test_GetRandomRgn(void)
GetRgnBox(hrgn, &ret_rc);
if(GetVersion() & 0x80000000)
OffsetRect(&window_rc, -window_rc.left, -window_rc.top);
/* the window may be partially obscured so the region may be smaller */
IntersectRect( &window_rc, &ret_rc, &ret_rc );
ok(EqualRect(&window_rc, &ret_rc) ||
broken(IsRectEmpty(&ret_rc)), /* win95 */
"GetRandomRgn %d,%d - %d,%d\n",