[USER32_APITESTS]

- Add some more test for DrawIconEx and CreateIconFromResourceEx

svn path=/trunk/; revision=57655
This commit is contained in:
Jérôme Gardou 2012-10-31 14:08:31 +00:00
parent ccb9c49a46
commit 5b99cd433d
4 changed files with 112 additions and 1 deletions

View file

@ -2,8 +2,10 @@
list(APPEND SOURCE
AttachThreadInput.c
helper.c
CreateIconFromResourceEx.c
DeferWindowPos.c
DestroyCursorIcon.c
DrawIconEx.c
desktop.c
GetIconInfo.c
GetKeyState.c

View file

@ -0,0 +1,48 @@
#include <stdio.h>
#include <wine/test.h>
#include <windows.h>
#include "resource.h"
START_TEST(CreateIconFromResourceEx)
{
HCURSOR hcur1, hcur2;
HMODULE hMod;
HRSRC hResource; // handle to FindResource
HRSRC hMem; // handle to LoadResource
BYTE *lpResource; // pointer to resource data
hMod = GetModuleHandle(NULL);
ok(hMod != NULL, "\n");
/* Create a shared cursor */
hcur1 = LoadCursor(hMod, "TESTCURSOR");
ok(hcur1 != NULL, "\n");
/* Create it manually using CreateIconFromResourceEx */
hResource = FindResourceA(hMod,
"TESTCURSOR",
RT_GROUP_CURSOR);
ok(hResource != NULL, "\n");
hMem = LoadResource(hMod, hResource);
ok(hMem != NULL, "\n");
lpResource = LockResource(hMem);
ok(lpResource != NULL, "\n");
/* MSDN states that LR_SHARED permits to not load twice the same cursor again.
* But CreateIconFromResourceEx still returns two different handles */
hcur2 = CreateIconFromResourceEx(lpResource, SizeofResource(hMod, hResource), FALSE, 0x00030000, 0, 0, LR_SHARED);
ok(hcur2 != NULL, "\n");
ok(hcur2 != hcur1, "\n");
hcur1 = CreateIconFromResourceEx(lpResource, SizeofResource(hMod, hResource), FALSE, 0x00030000, 0, 0, LR_SHARED);
ok(hcur1 != NULL, "\n");
ok(hcur2 != hcur1, "\n");
/* Try to destroy them multiple times (see DestroyCursor test) */
ok(DestroyCursor(hcur1), "\n");
ok(DestroyCursor(hcur1), "\n");
ok(DestroyCursor(hcur2), "\n");
ok(DestroyCursor(hcur2), "\n");
FreeResource(hResource);
}

View file

@ -0,0 +1,57 @@
#include <stdio.h>
#include <wine/test.h>
#include <windows.h>
#include "resource.h"
START_TEST(DrawIconEx)
{
HCURSOR hcursor;
HBITMAP hbmp;
ICONINFO ii;
HDC hdcScreen, hdc;
BOOL ret;
HBRUSH hbrush;
ZeroMemory(&ii, sizeof(ii));
ii.hbmMask = CreateBitmap(8, 16, 1, 1, NULL);
ok(ii.hbmMask != NULL, "\n");
hcursor = CreateIconIndirect(&ii);
ok(hcursor != NULL, "\n");
DeleteObject(ii.hbmMask);
hdcScreen = GetDC(0);
hbmp = CreateCompatibleBitmap(hdcScreen, 8, 8);
ok(hbmp != NULL, "\n");
hdc = CreateCompatibleDC(hdcScreen);
ok(hdc != NULL, "\n");
ReleaseDC(0, hdcScreen);
hbmp = SelectObject(hdc, hbmp);
ok(hbmp != NULL, "\n");
hbrush = GetStockObject(DKGRAY_BRUSH);
ok(hbrush != NULL, "\n");
ret = DrawIconEx(hdc, 0, 0, hcursor, 8, 8, 0, hbrush, DI_NORMAL);
ok(ret, "\n");
DestroyCursor(hcursor);
/* Try with color */
ii.hbmMask = CreateBitmap(8, 8, 1, 1, NULL);
ok(ii.hbmMask != NULL, "\n");
ii.hbmColor = CreateBitmap(8, 8, 16, 1, NULL);
ok(ii.hbmColor != NULL, "\n");
hcursor = CreateIconIndirect(&ii);
ok(hcursor != NULL, "\n");
DeleteObject(ii.hbmMask);
DeleteObject(ii.hbmColor);
ret = DrawIconEx(hdc, 0, 0, hcursor, 8, 8, 0, hbrush, DI_NORMAL);
ok(ret, "\n");
DestroyCursor(hcursor);
hbmp = SelectObject(hdc, hbmp);
DeleteObject(hbmp);
DeleteDC(hdc);
}

View file

@ -6,8 +6,10 @@
#include "wine/test.h"
extern void func_AttachThreadInput(void);
extern void func_CreateIconFromResourceEx(void);
extern void func_DeferWindowPos(void);
extern void func_DestroyCursorIcon(void);
extern void func_DrawIconEx(void);
extern void func_desktop(void);
extern void func_GetIconInfo(void);
extern void func_GetKeyState(void);
@ -28,9 +30,11 @@ extern void func_wsprintf(void);
const struct test winetest_testlist[] =
{
{ "AttachThreadInput", func_AttachThreadInput },
{ "desktop", func_desktop },
{ "CreateIconFromResourceEx", func_CreateIconFromResourceEx },
{ "DeferWindowPos", func_DeferWindowPos },
{ "DestroyCursorIcon", func_DestroyCursorIcon },
{ "DrawIconEx", func_DrawIconEx },
{ "desktop", func_desktop },
{ "GetIconInfo", func_GetIconInfo },
{ "GetKeyState", func_GetKeyState },
{ "GetPeekMessage", func_GetPeekMessage },