Nikolay Sivov : shell32/tests: Test icon ids that are invalid on all systems.

Alexandre Julliard julliard at wine.codeweavers.com
Wed Sep 16 09:54:07 CDT 2015


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

Author: Nikolay Sivov <nsivov at codeweavers.com>
Date:   Wed Sep 16 12:43:48 2015 +0300

shell32/tests: Test icon ids that are invalid on all systems.

---

 dlls/shell32/tests/shelllink.c | 40 +++++++++-------------------------------
 include/shellapi.h             |  4 ++--
 2 files changed, 11 insertions(+), 33 deletions(-)

diff --git a/dlls/shell32/tests/shelllink.c b/dlls/shell32/tests/shelllink.c
index b258052..41fac48 100644
--- a/dlls/shell32/tests/shelllink.c
+++ b/dlls/shell32/tests/shelllink.c
@@ -993,7 +993,6 @@ static void test_SHGetStockIconInfo(void)
 {
     BYTE buffer[sizeof(SHSTOCKICONINFO) + 16];
     SHSTOCKICONINFO *sii = (SHSTOCKICONINFO *) buffer;
-    BOOL atleast_win7;
     HRESULT hr;
     INT i;
 
@@ -1007,11 +1006,11 @@ static void test_SHGetStockIconInfo(void)
     /* negative values are handled */
     memset(buffer, '#', sizeof(buffer));
     sii->cbSize = sizeof(SHSTOCKICONINFO);
-    hr = pSHGetStockIconInfo(-1, SHGSI_ICONLOCATION, sii);
+    hr = pSHGetStockIconInfo(SIID_INVALID, SHGSI_ICONLOCATION, sii);
     ok(hr == E_INVALIDARG, "-1: got 0x%x (expected E_INVALIDARG)\n", hr);
 
     /* max. id for vista is 140 (no definition exists for this value) */
-    for (i = 0; i <= 140; i++)
+    for (i = SIID_DOCNOASSOC; i <= SIID_CLUSTEREDDRIVE; i++)
     {
         memset(buffer, '#', sizeof(buffer));
         sii->cbSize = sizeof(SHSTOCKICONINFO);
@@ -1026,38 +1025,17 @@ static void test_SHGetStockIconInfo(void)
                   sii->iIcon, wine_dbgstr_w(sii->szPath));
     }
 
-    /* there are more icons since win7 */
-    memset(buffer, '#', sizeof(buffer));
-    sii->cbSize = sizeof(SHSTOCKICONINFO);
-    hr = pSHGetStockIconInfo(i, SHGSI_ICONLOCATION, sii);
-    atleast_win7 = (!hr);
-
-    for (; i < (SIID_MAX_ICONS + 25) ; i++)
+    /* test invalid icons indices that are invalid for all platforms */
+    for (i = SIID_MAX_ICONS; i < (SIID_MAX_ICONS + 25) ; i++)
     {
         memset(buffer, '#', sizeof(buffer));
         sii->cbSize = sizeof(SHSTOCKICONINFO);
         hr = pSHGetStockIconInfo(i, SHGSI_ICONLOCATION, sii);
-
-        if (atleast_win7 && (i == (SIID_MAX_ICONS - 1)) && broken(hr == E_INVALIDARG))
-        {
-            /* Off by one windows bug: there are SIID_MAX_ICONS icons from 0
-             * up to SIID_MAX_ICONS-1 on Windows 8, but the last one is missing
-             * on Windows 7.
-             */
-            trace("%3d: got E_INVALIDARG (windows bug: off by one)\n", i);
-        }
-        else if (atleast_win7 && (i < (SIID_MAX_ICONS)))
-        {
-            ok(hr == S_OK,
-                "%3d: got 0x%x, iSysImageIndex: 0x%x, iIcon: 0x%x (expected S_OK)\n",
-                i, hr, sii->iSysImageIndex, sii->iIcon);
-
-            if ((hr == S_OK) && (winetest_debug > 1))
-                trace("%3d: got iSysImageIndex %3d, iIcon %3d and %s\n", i, sii->iSysImageIndex,
-                      sii->iIcon, wine_dbgstr_w(sii->szPath));
-        }
-        else
-            ok(hr == E_INVALIDARG, "%3d: got 0x%x (expected E_INVALIDARG)\n", i, hr);
+        ok(hr == E_INVALIDARG, "%3d: got 0x%x (expected E_INVALIDARG)\n", i, hr);
+    todo_wine {
+        ok(sii->iSysImageIndex == -1, "%d: got iSysImageIndex %d\n", i, sii->iSysImageIndex);
+        ok(sii->iIcon == -1, "%d: got iIcon %d\n", i, sii->iIcon);
+    }
     }
 
     /* test more returned SHSTOCKICONINFO elements without extra flags */
diff --git a/include/shellapi.h b/include/shellapi.h
index 57454e3..b94626f 100644
--- a/include/shellapi.h
+++ b/include/shellapi.h
@@ -606,8 +606,8 @@ typedef enum SHSTOCKICONID
     SIID_MEDIABDR,
     SIID_MEDIABDRE,
     SIID_CLUSTEREDDRIVE,
-    /* Missing: 141 - 174 */
-    SIID_MAX_ICONS = 175
+    /* Missing: 141 - 177 */
+    SIID_MAX_ICONS = 178
 }SHSTOCKICONID;
 
 typedef struct _SHSTOCKICONINFO




More information about the wine-cvs mailing list