Hans Leidekker : user32/tests: Add more tests for PrivateExtractIcons.

Alexandre Julliard julliard at winehq.org
Tue Mar 25 14:27:43 CDT 2014


Module: wine
Branch: master
Commit: fb31e0fbe30f0d69058d3afa1b6f8f6af1d963f6
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=fb31e0fbe30f0d69058d3afa1b6f8f6af1d963f6

Author: Hans Leidekker <hans at codeweavers.com>
Date:   Tue Mar 25 12:52:03 2014 +0100

user32/tests: Add more tests for PrivateExtractIcons.

---

 dlls/user32/tests/resource.c |   29 ++++++++++++++++++++++++++---
 1 file changed, 26 insertions(+), 3 deletions(-)

diff --git a/dlls/user32/tests/resource.c b/dlls/user32/tests/resource.c
index 2313595..9cb7380 100644
--- a/dlls/user32/tests/resource.c
+++ b/dlls/user32/tests/resource.c
@@ -333,11 +333,30 @@ static void test_accel2(void)
 static void test_PrivateExtractIcons(void) {
     const CHAR szShell32Dll[] = "shell32.dll";
     HICON ahIcon[256];
-    UINT aIconId[256];
-    UINT cIcons, cIcons2;
+    UINT i, aIconId[256], cIcons, cIcons2;
 
     if (!pPrivateExtractIconsA) return;
-    
+
+    cIcons = pPrivateExtractIconsA("", 0, 16, 16, ahIcon, aIconId, 1, 0);
+    ok(cIcons == ~0u, "got %u\n", cIcons);
+
+    cIcons = pPrivateExtractIconsA("notepad.exe", 0, 16, 16, NULL, NULL, 1, 0);
+    ok(cIcons == 1 || broken(cIcons == 2) /* win2k */, "got %u\n", cIcons);
+
+    ahIcon[0] = (HICON)0xdeadbeef;
+    cIcons = pPrivateExtractIconsA("notepad.exe", 0, 16, 16, ahIcon, NULL, 1, 0);
+    ok(cIcons == 1, "got %u\n", cIcons);
+    ok(ahIcon[0] != (HICON)0xdeadbeef, "icon not set\n");
+    DestroyIcon(ahIcon[0]);
+
+    ahIcon[0] = (HICON)0xdeadbeef;
+    aIconId[0] = 0xdeadbeef;
+    cIcons = pPrivateExtractIconsA("notepad.exe", 0, 16, 16, ahIcon, aIconId, 1, 0);
+    ok(cIcons == 1, "got %u\n", cIcons);
+    ok(ahIcon[0] != (HICON)0xdeadbeef, "icon not set\n");
+    ok(aIconId[0] != 0xdeadbeef, "id not set\n");
+    DestroyIcon(ahIcon[0]);
+
     cIcons = pPrivateExtractIconsA(szShell32Dll, 0, 16, 16, NULL, NULL, 0, 0);
     cIcons2 = pPrivateExtractIconsA(szShell32Dll, 4, MAKELONG(32,16), MAKELONG(32,16), 
                                    NULL, NULL, 256, 0);
@@ -350,14 +369,18 @@ static void test_PrivateExtractIcons(void) {
 
     cIcons = pPrivateExtractIconsA(szShell32Dll, 0, 16, 16, ahIcon, aIconId, 3, 0);
     ok(cIcons == 3, "Three icons requested got cIcons=%d\n", cIcons);
+    for (i = 0; i < cIcons; i++) DestroyIcon(ahIcon[i]);
 
     /* count must be a multiple of two when getting two sizes */
     cIcons = pPrivateExtractIconsA(szShell32Dll, 0, MAKELONG(16,32), MAKELONG(16,32),
                                    ahIcon, aIconId, 3, 0);
     ok(cIcons == 0 /* vista */ || cIcons == 4, "Three icons requested got cIcons=%d\n", cIcons);
+    for (i = 0; i < cIcons; i++) DestroyIcon(ahIcon[i]);
+
     cIcons = pPrivateExtractIconsA(szShell32Dll, 0, MAKELONG(16,32), MAKELONG(16,32),
                                    ahIcon, aIconId, 4, 0);
     ok(cIcons == 4, "Four icons requested got cIcons=%d\n", cIcons);
+    for (i = 0; i < cIcons; i++) DestroyIcon(ahIcon[i]);
 }
 
 static void test_LoadImage(void)




More information about the wine-cvs mailing list