Commit 2e42ab15 authored by Alexandre Julliard's avatar Alexandre Julliard

gdi32/tests: Fix some test failures on Windows.

parent 8db263d2
...@@ -881,7 +881,7 @@ static void test_dib_formats(void) ...@@ -881,7 +881,7 @@ static void test_dib_formats(void)
HBITMAP hdib, hbmp; HBITMAP hdib, hbmp;
HDC hdc, memdc; HDC hdc, memdc;
UINT ret; UINT ret;
BOOL expect_ok; BOOL format_ok, expect_ok;
bi = HeapAlloc( GetProcessHeap(), 0, FIELD_OFFSET( BITMAPINFO, bmiColors[256] ) ); bi = HeapAlloc( GetProcessHeap(), 0, FIELD_OFFSET( BITMAPINFO, bmiColors[256] ) );
hdc = GetDC( 0 ); hdc = GetDC( 0 );
...@@ -927,6 +927,7 @@ static void test_dib_formats(void) ...@@ -927,6 +927,7 @@ static void test_dib_formats(void)
"GetDIBits succeeded for %u/%u/%u/%u\n", bpp, planes, compr, format ); "GetDIBits succeeded for %u/%u/%u/%u\n", bpp, planes, compr, format );
/* all functions check planes except GetDIBits with 0 lines */ /* all functions check planes except GetDIBits with 0 lines */
format_ok = expect_ok;
if (!planes) expect_ok = FALSE; if (!planes) expect_ok = FALSE;
memset( bi, 0, sizeof(bi->bmiHeader) ); memset( bi, 0, sizeof(bi->bmiHeader) );
bi->bmiHeader.biSize = sizeof(BITMAPINFOHEADER); bi->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
...@@ -1019,7 +1020,8 @@ static void test_dib_formats(void) ...@@ -1019,7 +1020,8 @@ static void test_dib_formats(void)
if (expect_ok || !bpp) if (expect_ok || !bpp)
ok( ret, "GetDIBits failed for %u/%u/%u/%u\n", bpp, planes, compr, format ); ok( ret, "GetDIBits failed for %u/%u/%u/%u\n", bpp, planes, compr, format );
else 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) ...@@ -1841,7 +1843,8 @@ static void test_GetDIBits(void)
broken(GetLastError() == 0xdeadbeef), /* winnt */ broken(GetLastError() == 0xdeadbeef), /* winnt */
"wrong error %u\n", GetLastError()); "wrong error %u\n", GetLastError());
ok(bi->bmiHeader.biSizeImage == 0, "expected 0, got %u\n", bi->bmiHeader.biSizeImage); 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)); memset(buf, 0xAA, sizeof(buf));
SetLastError(0xdeadbeef); SetLastError(0xdeadbeef);
...@@ -4365,7 +4368,8 @@ static void test_SetDIBits(void) ...@@ -4365,7 +4368,8 @@ static void test_SetDIBits(void)
int ent = (255 - idx) % pal->palNumEntries; int ent = (255 - idx) % pal->palNumEntries;
DWORD expect = idx >= info->bmiHeader.biClrUsed ? 0 : DWORD expect = idx >= info->bmiHeader.biClrUsed ? 0 :
(palent[ent].peRed << 16 | palent[ent].peGreen << 8 | palent[ent].peBlue); (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 ); memset( dib_bits, 0xaa, 64 * 4 );
......
...@@ -112,6 +112,8 @@ static void test_GetRandomRgn(void) ...@@ -112,6 +112,8 @@ static void test_GetRandomRgn(void)
GetRgnBox(hrgn, &ret_rc); GetRgnBox(hrgn, &ret_rc);
if(GetVersion() & 0x80000000) if(GetVersion() & 0x80000000)
OffsetRect(&window_rc, -window_rc.left, -window_rc.top); 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) || ok(EqualRect(&window_rc, &ret_rc) ||
broken(IsRectEmpty(&ret_rc)), /* win95 */ broken(IsRectEmpty(&ret_rc)), /* win95 */
"GetRandomRgn %d,%d - %d,%d\n", "GetRandomRgn %d,%d - %d,%d\n",
......
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