Author: jgardou
Date: Wed Oct 31 14:08:31 2012
New Revision: 57655
URL: 
http://svn.reactos.org/svn/reactos?rev=57655&view=rev
Log:
[USER32_APITESTS]
- Add some more test for DrawIconEx and CreateIconFromResourceEx
Added:
    trunk/rostests/apitests/user32/CreateIconFromResourceEx.c   (with props)
    trunk/rostests/apitests/user32/DrawIconEx.c   (with props)
Modified:
    trunk/rostests/apitests/user32/CMakeLists.txt
    trunk/rostests/apitests/user32/testlist.c
Modified: trunk/rostests/apitests/user32/CMakeLists.txt
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/user32/CMakeList…
==============================================================================
--- trunk/rostests/apitests/user32/CMakeLists.txt [iso-8859-1] (original)
+++ trunk/rostests/apitests/user32/CMakeLists.txt [iso-8859-1] Wed Oct 31 14:08:31 2012
@@ -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
Added: trunk/rostests/apitests/user32/CreateIconFromResourceEx.c
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/user32/CreateIco…
==============================================================================
--- trunk/rostests/apitests/user32/CreateIconFromResourceEx.c (added)
+++ trunk/rostests/apitests/user32/CreateIconFromResourceEx.c [iso-8859-1] Wed Oct 31
14:08:31 2012
@@ -1,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);
+}
Propchange: trunk/rostests/apitests/user32/CreateIconFromResourceEx.c
------------------------------------------------------------------------------
    svn:eol-style = native
Added: trunk/rostests/apitests/user32/DrawIconEx.c
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/user32/DrawIconE…
==============================================================================
--- trunk/rostests/apitests/user32/DrawIconEx.c (added)
+++ trunk/rostests/apitests/user32/DrawIconEx.c [iso-8859-1] Wed Oct 31 14:08:31 2012
@@ -1,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);
+}
Propchange: trunk/rostests/apitests/user32/DrawIconEx.c
------------------------------------------------------------------------------
    svn:eol-style = native
Modified: trunk/rostests/apitests/user32/testlist.c
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/user32/testlist.…
==============================================================================
--- trunk/rostests/apitests/user32/testlist.c [iso-8859-1] (original)
+++ trunk/rostests/apitests/user32/testlist.c [iso-8859-1] Wed Oct 31 14:08:31 2012
@@ -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 @@
 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 },