[GDI32_WINETEST] Sync with Wine Staging 1.7.43.

svn path=/trunk/; revision=67916
This commit is contained in:
Amine Khaldi 2015-05-25 18:52:18 +00:00
parent a91416131e
commit cce4df4a3e
3 changed files with 136 additions and 11 deletions

View file

@ -56,8 +56,9 @@ static void test_bitmap_info(HBITMAP hbm, INT expected_depth, const BITMAPINFOHE
{
BITMAP bm;
BITMAP bma[2];
INT ret, width_bytes;
INT ret, width_bytes, i;
BYTE buf[512], buf_cmp[512];
INT test_size[] = {0 /*first value will be changed */, 0, -1, -1000, ~0, sizeof(buf)};
ret = GetObjectW(hbm, sizeof(bm), &bm);
ok(ret == sizeof(bm), "GetObject returned %d\n", ret);
@ -75,17 +76,28 @@ static void test_bitmap_info(HBITMAP hbm, INT expected_depth, const BITMAPINFOHE
assert(sizeof(buf) == sizeof(buf_cmp));
SetLastError(0xdeadbeef);
ret = GetBitmapBits(hbm, 0, NULL);
ok(ret == bm.bmWidthBytes * bm.bmHeight, "%d != %d\n", ret, bm.bmWidthBytes * bm.bmHeight);
test_size[0] = bm.bmWidthBytes * bm.bmHeight;
/* NULL output buffer with different count values */
for (i = 0; i < sizeof(test_size) / sizeof(test_size[0]); i++)
{
ret = GetBitmapBits(hbm, test_size[i], NULL);
ok(ret == bm.bmWidthBytes * bm.bmHeight, "%d != %d\n", ret, bm.bmWidthBytes * bm.bmHeight);
}
memset(buf_cmp, 0xAA, sizeof(buf_cmp));
memset(buf_cmp, 0, bm.bmWidthBytes * bm.bmHeight);
memset(buf, 0xAA, sizeof(buf));
ret = GetBitmapBits(hbm, sizeof(buf), buf);
ok(ret == bm.bmWidthBytes * bm.bmHeight, "%d != %d\n", ret, bm.bmWidthBytes * bm.bmHeight);
ok(!memcmp(buf, buf_cmp, sizeof(buf)),
"buffers do not match, depth %d\n", bmih->biBitCount);
/* Correct output buffer with different count values */
for (i = 0; i < sizeof(test_size) / sizeof(test_size[0]); i++)
{
int expect = i == 1 ? 0 : bm.bmWidthBytes * bm.bmHeight;
memset(buf, 0xAA, sizeof(buf));
ret = GetBitmapBits(hbm, test_size[i], buf);
ok(ret == expect, "Test[%d]: %d != %d\n", i, ret, expect);
if (expect)
ok(!memcmp(buf, buf_cmp, sizeof(buf)),
"Test[%d]: buffers do not match, depth %d\n", i, bmih->biBitCount);
}
/* test various buffer sizes for GetObject */
ret = GetObjectW(hbm, sizeof(*bma) * 2, bma);

View file

@ -3708,9 +3708,10 @@ static void test_text_metrics(const LOGFONTA *lf, const NEWTEXTMETRICA *ntm)
default_char = GET_BE_WORD(tt_os2.usDefaultChar);
break_char = GET_BE_WORD(tt_os2.usBreakChar);
trace("font %s charset %u: %x-%x (%x-%x) default %x break %x OS/2 version %u vendor %4.4s\n",
font_name, lf->lfCharSet, os2_first_char, os2_last_char, cmap_first, cmap_last,
default_char, break_char, version, (LPCSTR)&tt_os2.achVendID);
if (winetest_debug > 1)
trace("font %s charset %u: %x-%x (%x-%x) default %x break %x OS/2 version %u vendor %4.4s\n",
font_name, lf->lfCharSet, os2_first_char, os2_last_char, cmap_first, cmap_last,
default_char, break_char, version, (LPCSTR)&tt_os2.achVendID);
if (cmap_type == cmap_ms_symbol || (cmap_first >= 0xf000 && cmap_first < 0xf100))
{

View file

@ -191,9 +191,121 @@ static void test_halftone_palette(void)
ReleaseDC( 0, hdc );
}
static void test_system_palette_entries(void)
{
HDC hdc;
PALETTEENTRY entries[256];
PALETTEENTRY defpal[20];
int i, count;
hdc = GetDC(0);
if (!(GetDeviceCaps( hdc, RASTERCAPS ) & RC_PALETTE))
{
memset( defpal, 0xaa, sizeof(defpal) );
count = GetPaletteEntries( GetStockObject(DEFAULT_PALETTE), 0, 20, defpal );
ok( count == 20, "wrong size %u\n", count );
memset( entries, 0x55, sizeof(entries) );
count = GetSystemPaletteEntries( hdc, 0, 256, entries );
ok( count == 0, "wrong size %u\n", count);
for (i = 0; i < 10; i++)
{
ok( entries[i].peRed == defpal[i].peRed &&
entries[i].peGreen == defpal[i].peGreen &&
entries[i].peBlue == defpal[i].peBlue &&
!entries[i].peFlags,
"%u: wrong color %02x,%02x,%02x,%02x instead of %02x,%02x,%02x\n", i,
entries[i].peRed, entries[i].peGreen, entries[i].peBlue, entries[i].peFlags,
defpal[i].peRed, defpal[i].peGreen, defpal[i].peBlue );
}
for (i = 10; i < 246; ++i)
{
ok( !entries[i].peRed &&
!entries[i].peGreen &&
!entries[i].peBlue &&
!entries[i].peFlags,
"%u: wrong color %02x,%02x,%02x,%02x instead of 0,0,0\n", i,
entries[i].peRed, entries[i].peGreen, entries[i].peBlue, entries[i].peFlags);
}
for (i = 246; i < 256; i++)
{
int idx = i - 246 + 10;
ok( entries[i].peRed == defpal[idx].peRed &&
entries[i].peGreen == defpal[idx].peGreen &&
entries[i].peBlue == defpal[idx].peBlue &&
!entries[i].peFlags,
"%u: wrong color %02x,%02x,%02x,%02x instead of %02x,%02x,%02x\n", i,
entries[i].peRed, entries[i].peGreen, entries[i].peBlue, entries[i].peFlags,
defpal[idx].peRed, defpal[idx].peGreen, defpal[idx].peBlue );
}
memset( entries, 0x55, sizeof(entries) );
count = GetSystemPaletteEntries( hdc, 0, 10, entries );
ok( count == 0, "wrong size %u\n", count);
for (i = 0; i < 10; i++)
{
ok( entries[i].peRed == defpal[i].peRed &&
entries[i].peGreen == defpal[i].peGreen &&
entries[i].peBlue == defpal[i].peBlue &&
!entries[i].peFlags,
"%u: wrong color %02x,%02x,%02x,%02x instead of %02x,%02x,%02x\n", i,
entries[i].peRed, entries[i].peGreen, entries[i].peBlue, entries[i].peFlags,
defpal[i].peRed, defpal[i].peGreen, defpal[i].peBlue );
}
memset( entries, 0x55, sizeof(entries) );
count = GetSystemPaletteEntries( hdc, 10, 246, entries );
ok( count == 0, "wrong size %u\n", count);
for (i = 0; i < 236; ++i)
{
ok( !entries[i].peRed &&
!entries[i].peGreen &&
!entries[i].peBlue &&
!entries[i].peFlags,
"%u: wrong color %02x,%02x,%02x,%02x instead of 0,0,0\n", i,
entries[i].peRed, entries[i].peGreen, entries[i].peBlue, entries[i].peFlags);
}
for (i = 236; i < 246; i++)
{
int idx = i - 236 + 10;
ok( entries[i].peRed == defpal[idx].peRed &&
entries[i].peGreen == defpal[idx].peGreen &&
entries[i].peBlue == defpal[idx].peBlue &&
!entries[i].peFlags,
"%u: wrong color %02x,%02x,%02x,%02x instead of %02x,%02x,%02x\n", i,
entries[i].peRed, entries[i].peGreen, entries[i].peBlue, entries[i].peFlags,
defpal[idx].peRed, defpal[idx].peGreen, defpal[idx].peBlue );
}
memset( entries, 0x55, sizeof(entries) );
count = GetSystemPaletteEntries( hdc, 246, 10, entries );
ok( count == 0, "wrong size %u\n", count);
for (i = 0; i < 10; i++)
{
int idx = i + 10;
ok( entries[i].peRed == defpal[idx].peRed &&
entries[i].peGreen == defpal[idx].peGreen &&
entries[i].peBlue == defpal[idx].peBlue &&
!entries[i].peFlags,
"%u: wrong color %02x,%02x,%02x,%02x instead of %02x,%02x,%02x\n", i,
entries[i].peRed, entries[i].peGreen, entries[i].peBlue, entries[i].peFlags,
defpal[idx].peRed, defpal[idx].peGreen, defpal[idx].peBlue );
}
}
else
{
skip( "device is palette-based, skipping test\n" );
}
ReleaseDC( 0, hdc );
}
START_TEST(palette)
{
test_DIB_PAL_COLORS();
test_palette_entries();
test_halftone_palette();
test_system_palette_entries();
}