Commit 3bbb208f authored by Alexandre Julliard's avatar Alexandre Julliard

user32/tests: Add tests for small sizes of cursor bitmaps.

parent f7a4cabb
...@@ -2116,7 +2116,7 @@ HICON WINAPI CreateIconIndirect(PICONINFO iconinfo) ...@@ -2116,7 +2116,7 @@ HICON WINAPI CreateIconIndirect(PICONINFO iconinfo)
width = bmpXor.bmWidth; width = bmpXor.bmWidth;
height = bmpXor.bmHeight; height = bmpXor.bmHeight;
if (bmpXor.bmPlanes * bmpXor.bmBitsPixel != 1) if (bmpXor.bmPlanes * bmpXor.bmBitsPixel != 1 || bmpAnd.bmPlanes * bmpAnd.bmBitsPixel != 1)
{ {
color = CreateCompatibleBitmap( screen_dc, width, height ); color = CreateCompatibleBitmap( screen_dc, width, height );
mask = CreateBitmap( width, height, 1, 1, NULL ); mask = CreateBitmap( width, height, 1, 1, NULL );
......
...@@ -696,7 +696,7 @@ static void test_initial_cursor(void) ...@@ -696,7 +696,7 @@ static void test_initial_cursor(void)
ok(error == 0xdeadbeef, "Last error: 0x%08x\n", error); ok(error == 0xdeadbeef, "Last error: 0x%08x\n", error);
} }
static void test_icon_info_dbg(HICON hIcon, UINT exp_cx, UINT exp_cy, UINT exp_bpp, int line) static void test_icon_info_dbg(HICON hIcon, UINT exp_cx, UINT exp_cy, UINT exp_mask_cy, UINT exp_bpp, int line)
{ {
ICONINFO info; ICONINFO info;
DWORD ret; DWORD ret;
...@@ -736,13 +736,13 @@ static void test_icon_info_dbg(HICON hIcon, UINT exp_cx, UINT exp_cy, UINT exp_b ...@@ -736,13 +736,13 @@ static void test_icon_info_dbg(HICON hIcon, UINT exp_cx, UINT exp_cy, UINT exp_b
ok_(__FILE__, line)(bmMask.bmBitsPixel == 1, "bmMask.bmBitsPixel = %d\n", bmMask.bmBitsPixel); ok_(__FILE__, line)(bmMask.bmBitsPixel == 1, "bmMask.bmBitsPixel = %d\n", bmMask.bmBitsPixel);
ok_(__FILE__, line)(bmMask.bmWidth == exp_cx, "bmMask.bmWidth = %d\n", bmMask.bmWidth); ok_(__FILE__, line)(bmMask.bmWidth == exp_cx, "bmMask.bmWidth = %d\n", bmMask.bmWidth);
ok_(__FILE__, line)(bmMask.bmHeight == exp_cy, "bmMask.bmHeight = %d\n", bmMask.bmHeight); ok_(__FILE__, line)(bmMask.bmHeight == exp_mask_cy, "bmMask.bmHeight = %d\n", bmMask.bmHeight);
} }
else else
{ {
ok_(__FILE__, line)(bmMask.bmBitsPixel == 1, "bmMask.bmBitsPixel = %d\n", bmMask.bmBitsPixel); ok_(__FILE__, line)(bmMask.bmBitsPixel == 1, "bmMask.bmBitsPixel = %d\n", bmMask.bmBitsPixel);
ok_(__FILE__, line)(bmMask.bmWidth == exp_cx, "bmMask.bmWidth = %d\n", bmMask.bmWidth); ok_(__FILE__, line)(bmMask.bmWidth == exp_cx, "bmMask.bmWidth = %d\n", bmMask.bmWidth);
ok_(__FILE__, line)(bmMask.bmHeight == exp_cy * 2, "bmMask.bmHeight = %d\n", bmMask.bmHeight); ok_(__FILE__, line)(bmMask.bmHeight == exp_mask_cy, "bmMask.bmHeight = %d\n", bmMask.bmHeight);
} }
if (pGetIconInfoExA) if (pGetIconInfoExA)
{ {
...@@ -777,7 +777,7 @@ static void test_icon_info_dbg(HICON hIcon, UINT exp_cx, UINT exp_cy, UINT exp_b ...@@ -777,7 +777,7 @@ static void test_icon_info_dbg(HICON hIcon, UINT exp_cx, UINT exp_cy, UINT exp_b
} }
} }
#define test_icon_info(a,b,c,d) test_icon_info_dbg((a),(b),(c),(d),__LINE__) #define test_icon_info(a,b,c,d,e) test_icon_info_dbg((a),(b),(c),(d),(e),__LINE__)
static void test_CreateIcon(void) static void test_CreateIcon(void)
{ {
...@@ -789,6 +789,7 @@ static void test_CreateIcon(void) ...@@ -789,6 +789,7 @@ static void test_CreateIcon(void)
HDC hdc; HDC hdc;
void *bits; void *bits;
UINT display_bpp; UINT display_bpp;
int i;
hdc = GetDC(0); hdc = GetDC(0);
display_bpp = GetDeviceCaps(hdc, BITSPIXEL); display_bpp = GetDeviceCaps(hdc, BITSPIXEL);
...@@ -800,12 +801,12 @@ static void test_CreateIcon(void) ...@@ -800,12 +801,12 @@ static void test_CreateIcon(void)
hIcon = CreateIcon(0, 16, 16, 1, 1, bmp_bits, bmp_bits); hIcon = CreateIcon(0, 16, 16, 1, 1, bmp_bits, bmp_bits);
ok(hIcon != 0, "CreateIcon failed\n"); ok(hIcon != 0, "CreateIcon failed\n");
test_icon_info(hIcon, 16, 16, 1); test_icon_info(hIcon, 16, 16, 32, 1);
DestroyIcon(hIcon); DestroyIcon(hIcon);
hIcon = CreateIcon(0, 16, 16, 1, display_bpp, bmp_bits, bmp_bits); hIcon = CreateIcon(0, 16, 16, 1, display_bpp, bmp_bits, bmp_bits);
ok(hIcon != 0, "CreateIcon failed\n"); ok(hIcon != 0, "CreateIcon failed\n");
test_icon_info(hIcon, 16, 16, display_bpp); test_icon_info(hIcon, 16, 16, 16, display_bpp);
DestroyIcon(hIcon); DestroyIcon(hIcon);
hbmMask = CreateBitmap(16, 16, 1, 1, bmp_bits); hbmMask = CreateBitmap(16, 16, 1, 1, bmp_bits);
...@@ -840,7 +841,7 @@ static void test_CreateIcon(void) ...@@ -840,7 +841,7 @@ static void test_CreateIcon(void)
info.hbmColor = hbmColor; info.hbmColor = hbmColor;
hIcon = CreateIconIndirect(&info); hIcon = CreateIconIndirect(&info);
ok(hIcon != 0, "CreateIconIndirect failed\n"); ok(hIcon != 0, "CreateIconIndirect failed\n");
test_icon_info(hIcon, 16, 16, display_bpp); test_icon_info(hIcon, 16, 16, 16, display_bpp);
DestroyIcon(hIcon); DestroyIcon(hIcon);
DeleteObject(hbmMask); DeleteObject(hbmMask);
...@@ -857,11 +858,27 @@ static void test_CreateIcon(void) ...@@ -857,11 +858,27 @@ static void test_CreateIcon(void)
SetLastError(0xdeadbeaf); SetLastError(0xdeadbeaf);
hIcon = CreateIconIndirect(&info); hIcon = CreateIconIndirect(&info);
ok(hIcon != 0, "CreateIconIndirect failed\n"); ok(hIcon != 0, "CreateIconIndirect failed\n");
test_icon_info(hIcon, 16, 16, 1); test_icon_info(hIcon, 16, 16, 32, 1);
DestroyIcon(hIcon); DestroyIcon(hIcon);
DeleteObject(hbmMask); DeleteObject(hbmMask);
DeleteObject(hbmColor);
for (i = 0; i <= 4; i++)
{
hbmMask = CreateBitmap(1, i, 1, 1, bmp_bits);
ok(hbmMask != 0, "CreateBitmap failed\n");
info.fIcon = TRUE;
info.xHotspot = 0;
info.yHotspot = 0;
info.hbmMask = hbmMask;
info.hbmColor = 0;
SetLastError(0xdeadbeaf);
hIcon = CreateIconIndirect(&info);
ok(hIcon != 0, "CreateIconIndirect failed\n");
test_icon_info(hIcon, 1, i / 2, max(i,1), 1);
DestroyIcon(hIcon);
DeleteObject(hbmMask);
}
/* test creating an icon from a DIB section */ /* test creating an icon from a DIB section */
...@@ -890,7 +907,7 @@ static void test_CreateIcon(void) ...@@ -890,7 +907,7 @@ static void test_CreateIcon(void)
SetLastError(0xdeadbeaf); SetLastError(0xdeadbeaf);
hIcon = CreateIconIndirect(&info); hIcon = CreateIconIndirect(&info);
ok(hIcon != 0, "CreateIconIndirect failed\n"); ok(hIcon != 0, "CreateIconIndirect failed\n");
test_icon_info(hIcon, 32, 32, 8); test_icon_info(hIcon, 32, 32, 32, 8);
DestroyIcon(hIcon); DestroyIcon(hIcon);
DeleteObject(hbmColor); DeleteObject(hbmColor);
...@@ -908,7 +925,7 @@ static void test_CreateIcon(void) ...@@ -908,7 +925,7 @@ static void test_CreateIcon(void)
SetLastError(0xdeadbeaf); SetLastError(0xdeadbeaf);
hIcon = CreateIconIndirect(&info); hIcon = CreateIconIndirect(&info);
ok(hIcon != 0, "CreateIconIndirect failed\n"); ok(hIcon != 0, "CreateIconIndirect failed\n");
test_icon_info(hIcon, 32, 32, 8); test_icon_info(hIcon, 32, 32, 32, 8);
DestroyIcon(hIcon); DestroyIcon(hIcon);
DeleteObject(hbmColor); DeleteObject(hbmColor);
...@@ -926,7 +943,7 @@ static void test_CreateIcon(void) ...@@ -926,7 +943,7 @@ static void test_CreateIcon(void)
SetLastError(0xdeadbeaf); SetLastError(0xdeadbeaf);
hIcon = CreateIconIndirect(&info); hIcon = CreateIconIndirect(&info);
ok(hIcon != 0, "CreateIconIndirect failed\n"); ok(hIcon != 0, "CreateIconIndirect failed\n");
test_icon_info(hIcon, 32, 32, 8); test_icon_info(hIcon, 32, 32, 32, 8);
DestroyIcon(hIcon); DestroyIcon(hIcon);
DeleteObject(hbmMask); DeleteObject(hbmMask);
......
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