mirror of
https://github.com/reactos/reactos.git
synced 2025-05-29 05:58:13 +00:00
[USER32_APITEST]
Add tests for GetIconInfo. svn path=/trunk/; revision=50405
This commit is contained in:
parent
8bf0247095
commit
93fc2852cd
4 changed files with 198 additions and 0 deletions
|
@ -7,6 +7,7 @@ list(APPEND SOURCE
|
||||||
ScrollDC.c
|
ScrollDC.c
|
||||||
ScrollWindowEx.c
|
ScrollWindowEx.c
|
||||||
GetSystemMetrics.c
|
GetSystemMetrics.c
|
||||||
|
GetIconInfo.c
|
||||||
testlist.c)
|
testlist.c)
|
||||||
|
|
||||||
add_executable(user32_apitest ${SOURCE})
|
add_executable(user32_apitest ${SOURCE})
|
||||||
|
|
194
rostests/apitests/user32/GetIconInfo.c
Normal file
194
rostests/apitests/user32/GetIconInfo.c
Normal file
|
@ -0,0 +1,194 @@
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <wine/test.h>
|
||||||
|
#include <windows.h>
|
||||||
|
|
||||||
|
|
||||||
|
// FIXME user32
|
||||||
|
|
||||||
|
void
|
||||||
|
Test_GetIconInfo(BOOL fIcon)
|
||||||
|
{
|
||||||
|
HICON hicon;
|
||||||
|
ICONINFO iconinfo, iconinfo2;
|
||||||
|
BITMAP bitmap;
|
||||||
|
|
||||||
|
iconinfo.fIcon = fIcon;
|
||||||
|
iconinfo.xHotspot = 0;
|
||||||
|
iconinfo.yHotspot = 0;
|
||||||
|
iconinfo.hbmMask = NULL;
|
||||||
|
iconinfo.hbmColor = NULL;
|
||||||
|
|
||||||
|
hicon = CreateIconIndirect(&iconinfo);
|
||||||
|
ok(hicon == 0, "should fail\n");
|
||||||
|
|
||||||
|
iconinfo.hbmMask = CreateBitmap(8, 16, 1, 1, NULL);
|
||||||
|
hicon = CreateIconIndirect(&iconinfo);
|
||||||
|
ok(hicon != 0, "should not fail\n");
|
||||||
|
|
||||||
|
ok(GetIconInfo(hicon, &iconinfo2), "\n");
|
||||||
|
ok(iconinfo2.fIcon == iconinfo.fIcon, "\n");
|
||||||
|
if (fIcon)
|
||||||
|
{
|
||||||
|
ok(iconinfo2.xHotspot == 4, "%ld\n", iconinfo2.xHotspot);
|
||||||
|
ok(iconinfo2.yHotspot == 4, "%ld\n", iconinfo2.yHotspot);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ok(iconinfo2.xHotspot == 0, "%ld\n", iconinfo2.xHotspot);
|
||||||
|
ok(iconinfo2.yHotspot == 0, "%ld\n", iconinfo2.yHotspot);
|
||||||
|
}
|
||||||
|
ok(iconinfo2.hbmMask != NULL, "\n");
|
||||||
|
ok(iconinfo2.hbmMask != iconinfo.hbmMask, "\n");
|
||||||
|
ok(iconinfo2.hbmColor == NULL, "\n");
|
||||||
|
|
||||||
|
ok(GetIconInfo(hicon, &iconinfo2), "\n");
|
||||||
|
ok(iconinfo2.fIcon == iconinfo.fIcon, "\n");
|
||||||
|
if (fIcon)
|
||||||
|
{
|
||||||
|
ok(iconinfo2.xHotspot == 4, "%ld\n", iconinfo2.xHotspot);
|
||||||
|
ok(iconinfo2.yHotspot == 4, "%ld\n", iconinfo2.yHotspot);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ok(iconinfo2.xHotspot == 0, "%ld\n", iconinfo2.xHotspot);
|
||||||
|
ok(iconinfo2.yHotspot == 0, "%ld\n", iconinfo2.yHotspot);
|
||||||
|
}
|
||||||
|
ok(iconinfo2.hbmMask != NULL, "\n");
|
||||||
|
ok(iconinfo2.hbmMask != iconinfo.hbmMask, "\n");
|
||||||
|
ok(iconinfo2.hbmColor == NULL, "\n");
|
||||||
|
|
||||||
|
iconinfo.hbmColor = CreateBitmap(2, 2, 1, 1, NULL);
|
||||||
|
hicon = CreateIconIndirect(&iconinfo);
|
||||||
|
ok(hicon != 0, "should not fail\n");
|
||||||
|
|
||||||
|
ok(GetIconInfo(hicon, &iconinfo2), "\n");
|
||||||
|
ok(iconinfo2.fIcon == iconinfo.fIcon, "\n");
|
||||||
|
if (fIcon)
|
||||||
|
{
|
||||||
|
ok(iconinfo2.xHotspot == 4, "%ld\n", iconinfo2.xHotspot);
|
||||||
|
ok(iconinfo2.yHotspot == 8, "%ld\n", iconinfo2.yHotspot);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ok(iconinfo2.xHotspot == 0, "%ld\n", iconinfo2.xHotspot);
|
||||||
|
ok(iconinfo2.yHotspot == 0, "%ld\n", iconinfo2.yHotspot);
|
||||||
|
}
|
||||||
|
ok(iconinfo2.hbmMask != NULL, "\n");
|
||||||
|
ok(iconinfo2.hbmMask != iconinfo.hbmMask, "\n");
|
||||||
|
ok(iconinfo2.hbmColor != NULL, "\n");
|
||||||
|
ok(iconinfo2.hbmMask != iconinfo.hbmColor, "\n");
|
||||||
|
|
||||||
|
ok(GetObject(iconinfo2.hbmMask, sizeof(bitmap), &bitmap), "GetObject failed\n");
|
||||||
|
ok(bitmap.bmType == 0, "\n");
|
||||||
|
ok(bitmap.bmWidth == 8, "\n");
|
||||||
|
ok(bitmap.bmHeight == 16, "\n");
|
||||||
|
ok(bitmap.bmWidthBytes == 2, "\n");
|
||||||
|
ok(bitmap.bmPlanes == 1, "\n");
|
||||||
|
ok(bitmap.bmBitsPixel == 1, "\n");
|
||||||
|
ok(bitmap.bmBits == NULL, "\n");
|
||||||
|
|
||||||
|
ok(GetObject(iconinfo2.hbmColor, sizeof(bitmap), &bitmap), "GetObject failed\n");
|
||||||
|
ok(bitmap.bmType == 0, "\n");
|
||||||
|
ok(bitmap.bmWidth == 8, "\n");
|
||||||
|
ok(bitmap.bmHeight == 16, "\n");
|
||||||
|
ok(bitmap.bmWidthBytes == 8 * bitmap.bmBitsPixel / 8, "\n");
|
||||||
|
ok(bitmap.bmPlanes == 1, "\n");
|
||||||
|
ok(bitmap.bmBitsPixel == 32, "\n");
|
||||||
|
ok(bitmap.bmBits == NULL, "\n");
|
||||||
|
|
||||||
|
DeleteObject(iconinfo.hbmMask);
|
||||||
|
iconinfo.hbmMask = NULL;
|
||||||
|
hicon = CreateIconIndirect(&iconinfo);
|
||||||
|
ok(hicon == 0, "should fail\n");
|
||||||
|
|
||||||
|
DeleteObject(iconinfo.hbmColor);
|
||||||
|
iconinfo.hbmColor = CreateCompatibleBitmap(GetDC(0), 16, 16);
|
||||||
|
hicon = CreateIconIndirect(&iconinfo);
|
||||||
|
ok(hicon == 0, "should fail\n");
|
||||||
|
|
||||||
|
iconinfo.hbmMask = CreateCompatibleBitmap(GetDC(0), 8, 16);
|
||||||
|
hicon = CreateIconIndirect(&iconinfo);
|
||||||
|
ok(hicon != 0, "should not fail\n");
|
||||||
|
|
||||||
|
ok(GetIconInfo(hicon, &iconinfo2), "\n");
|
||||||
|
|
||||||
|
ok(GetObject(iconinfo2.hbmMask, sizeof(bitmap), &bitmap), "GetObject failed\n");
|
||||||
|
ok(bitmap.bmType == 0, "\n");
|
||||||
|
ok(bitmap.bmWidth == 8, "%ld\n", bitmap.bmWidth);
|
||||||
|
ok(bitmap.bmHeight == 16, "%ld\n", bitmap.bmHeight);
|
||||||
|
ok(bitmap.bmWidthBytes == 2, "%ld\n", bitmap.bmWidthBytes);
|
||||||
|
ok(bitmap.bmPlanes == 1, "%d\n", bitmap.bmPlanes);
|
||||||
|
ok(bitmap.bmBitsPixel == 1, "%d\n", bitmap.bmBitsPixel);
|
||||||
|
ok(bitmap.bmBits == NULL, "\n");
|
||||||
|
|
||||||
|
ok(GetObject(iconinfo2.hbmColor, sizeof(bitmap), &bitmap), "GetObject failed\n");
|
||||||
|
ok(bitmap.bmType == 0, "\n");
|
||||||
|
ok(bitmap.bmWidth == 8, "%ld\n", bitmap.bmWidth);
|
||||||
|
ok(bitmap.bmHeight == 16, "%ld\n", bitmap.bmHeight);
|
||||||
|
ok(bitmap.bmWidthBytes == 32, "%ld\n", bitmap.bmWidthBytes);
|
||||||
|
ok(bitmap.bmPlanes == 1, "%d\n", bitmap.bmPlanes);
|
||||||
|
ok(bitmap.bmBitsPixel == 32, "%d\n", bitmap.bmBitsPixel);
|
||||||
|
ok(bitmap.bmBits == NULL, "\n");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
START_TEST(GetIconInfo)
|
||||||
|
{
|
||||||
|
HCURSOR hcursor;
|
||||||
|
ICONINFO iconinfo2;
|
||||||
|
BITMAP bitmap;
|
||||||
|
DWORD data[] = {0, 0, 0, 0, 0, 0};
|
||||||
|
|
||||||
|
Test_GetIconInfo(0);
|
||||||
|
Test_GetIconInfo(1);
|
||||||
|
|
||||||
|
hcursor = LoadCursor(NULL, IDC_APPSTARTING);
|
||||||
|
ok(hcursor != 0, "should not fail\n");
|
||||||
|
ok(GetIconInfo(hcursor, &iconinfo2), "\n");
|
||||||
|
ok(iconinfo2.fIcon == 0, "\n");
|
||||||
|
ok(iconinfo2.xHotspot == 0, "%ld\n", iconinfo2.xHotspot);
|
||||||
|
ok(iconinfo2.yHotspot == 8, "%ld\n", iconinfo2.yHotspot);
|
||||||
|
ok(iconinfo2.hbmMask != NULL, "\n");
|
||||||
|
ok(iconinfo2.hbmColor != NULL, "\n");
|
||||||
|
|
||||||
|
ok(GetObject(iconinfo2.hbmMask, sizeof(bitmap), &bitmap), "GetObject failed\n");
|
||||||
|
ok(bitmap.bmType == 0, "\n");
|
||||||
|
ok(bitmap.bmWidth == 32, "%ld\n", bitmap.bmWidth);
|
||||||
|
ok(bitmap.bmHeight == 32, "\n");
|
||||||
|
ok(bitmap.bmWidthBytes == 4, "\n");
|
||||||
|
ok(bitmap.bmPlanes == 1, "\n");
|
||||||
|
ok(bitmap.bmBitsPixel == 1, "\n");
|
||||||
|
ok(bitmap.bmBits == NULL, "\n");
|
||||||
|
|
||||||
|
ok(GetObject(iconinfo2.hbmColor, sizeof(bitmap), &bitmap), "GetObject failed\n");
|
||||||
|
ok(bitmap.bmType == 0, "\n");
|
||||||
|
ok(bitmap.bmWidth == 32, "\n");
|
||||||
|
ok(bitmap.bmHeight == 32, "\n");
|
||||||
|
ok(bitmap.bmWidthBytes == 32 * bitmap.bmBitsPixel / 8, "\n");
|
||||||
|
ok(bitmap.bmPlanes == 1, "\n");
|
||||||
|
ok(bitmap.bmBitsPixel == 32, "\n");
|
||||||
|
ok(bitmap.bmBits == NULL, "\n");
|
||||||
|
|
||||||
|
hcursor = CreateCursor(NULL, 1, 2, 4, 4, data, data);
|
||||||
|
ok(hcursor != 0, "should not fail\n");
|
||||||
|
ok(GetIconInfo(hcursor, &iconinfo2), "\n");
|
||||||
|
ok(iconinfo2.fIcon == 0, "\n");
|
||||||
|
ok(iconinfo2.xHotspot == 1, "%ld\n", iconinfo2.xHotspot);
|
||||||
|
ok(iconinfo2.yHotspot == 2, "%ld\n", iconinfo2.yHotspot);
|
||||||
|
ok(iconinfo2.hbmMask != NULL, "\n");
|
||||||
|
ok(iconinfo2.hbmColor == NULL, "\n");
|
||||||
|
|
||||||
|
ok(GetObject(iconinfo2.hbmMask, sizeof(bitmap), &bitmap), "GetObject failed\n");
|
||||||
|
ok(bitmap.bmType == 0, "\n");
|
||||||
|
ok(bitmap.bmWidth == 4, "%ld\n", bitmap.bmWidth);
|
||||||
|
ok(bitmap.bmHeight == 8, "%ld\n", bitmap.bmHeight);
|
||||||
|
ok(bitmap.bmWidthBytes == 2, "%ld\n", bitmap.bmWidthBytes);
|
||||||
|
ok(bitmap.bmPlanes == 1, "\n");
|
||||||
|
ok(bitmap.bmBitsPixel == 1, "\n");
|
||||||
|
ok(bitmap.bmBits == NULL, "\n");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -10,6 +10,7 @@ extern void func_RealGetWindowClass(void);
|
||||||
extern void func_ScrollDC(void);
|
extern void func_ScrollDC(void);
|
||||||
extern void func_ScrollWindowEx(void);
|
extern void func_ScrollWindowEx(void);
|
||||||
extern void func_GetSystemMetrics(void);
|
extern void func_GetSystemMetrics(void);
|
||||||
|
extern void func_GetIconInfo(void);
|
||||||
|
|
||||||
const struct test winetest_testlist[] =
|
const struct test winetest_testlist[] =
|
||||||
{
|
{
|
||||||
|
@ -18,6 +19,7 @@ const struct test winetest_testlist[] =
|
||||||
{ "ScrollDC", func_ScrollDC },
|
{ "ScrollDC", func_ScrollDC },
|
||||||
{ "ScrollWindowEx", func_ScrollWindowEx },
|
{ "ScrollWindowEx", func_ScrollWindowEx },
|
||||||
{ "GetSystemMetrics", func_GetSystemMetrics },
|
{ "GetSystemMetrics", func_GetSystemMetrics },
|
||||||
|
{ "GetIconInfo", func_GetIconInfo },
|
||||||
|
|
||||||
{ 0, 0 }
|
{ 0, 0 }
|
||||||
};
|
};
|
||||||
|
|
|
@ -14,6 +14,7 @@
|
||||||
<file>ScrollDC.c</file>
|
<file>ScrollDC.c</file>
|
||||||
<file>ScrollWindowEx.c</file>
|
<file>ScrollWindowEx.c</file>
|
||||||
<file>GetSystemMetrics.c</file>
|
<file>GetSystemMetrics.c</file>
|
||||||
|
<file>GetIconInfo.c</file>
|
||||||
|
|
||||||
</module>
|
</module>
|
||||||
</group>
|
</group>
|
||||||
|
|
Loading…
Reference in a new issue