Author: jgardou Date: Tue Nov 6 14:27:03 2012 New Revision: 57681
URL: http://svn.reactos.org/svn/reactos?rev=57681&view=rev Log: [USER32_APITEST] - Test behaviour with icons handle from foreign process
Modified: trunk/rostests/apitests/user32/LoadImage.c
Modified: trunk/rostests/apitests/user32/LoadImage.c URL: http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/user32/LoadImage.... ============================================================================== --- trunk/rostests/apitests/user32/LoadImage.c [iso-8859-1] (original) +++ trunk/rostests/apitests/user32/LoadImage.c [iso-8859-1] Tue Nov 6 14:27:03 2012 @@ -21,10 +21,48 @@ if (argc >= 3) { HANDLE arg; + HICON hCopy; + HBITMAP hbmp; + HDC hdc, hdcScreen; + ICONINFO ii;
sscanf (test_argv[2], "%lu", (ULONG_PTR*) &arg);
ok(handle != arg, "Got same handles\n"); + + /* Try copying it */ + hCopy = CopyIcon(arg); + ok(hCopy != NULL, "\n"); + ok(DestroyIcon(hCopy), "\n"); + + hCopy = CopyImage(arg, IMAGE_CURSOR, 0, 0, 0); + ok(hCopy != NULL, "\n"); + ok(DestroyIcon(hCopy), "\n"); + + hCopy = CopyImage(arg, IMAGE_CURSOR, 0, 0, LR_COPYFROMRESOURCE); + ok(hCopy != NULL, "\n"); + ok(DestroyIcon(hCopy), "\n"); + + /* Try various usual functions */ + hdcScreen = CreateDCW(L"DISPLAY", NULL, NULL, NULL); + ok(hdcScreen != NULL, "\n"); + hdc = CreateCompatibleDC(hdcScreen); + ok(hdc != NULL, "\n"); + hbmp = CreateCompatibleBitmap(hdcScreen, 64, 64); + ok(hbmp != NULL, "\n"); + hbmp = SelectObject(hdc, hbmp); + ok(hbmp != NULL, "\n"); + + ok(DrawIcon(hdc, 0, 0, arg), "\n"); + hbmp = SelectObject(hdc, hbmp); + DeleteObject(hbmp); + DeleteDC(hdc); + DeleteDC(hdcScreen); + + ok(GetIconInfo(arg, &ii), "\n"); + ok(ii.hbmMask != NULL, "\n"); + DeleteObject(ii.hbmMask); + if(ii.hbmColor) DeleteObject(ii.hbmColor);
return; } @@ -35,4 +73,4 @@ si.cb = sizeof(si); CreateProcessA( NULL, path, NULL, NULL, TRUE, 0, NULL, NULL, &si, &pi ); WaitForSingleObject (pi.hProcess, INFINITE); -} +}