Reece Dunn : shlwapi/tests: Loop over the STGM access modes when testing the SHCreateStreamOnFile methods .

Alexandre Julliard julliard at winehq.org
Tue Apr 1 06:51:33 CDT 2008


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

Author: Reece Dunn <msclrhd at googlemail.com>
Date:   Mon Mar 31 08:32:18 2008 +0100

shlwapi/tests: Loop over the STGM access modes when testing the SHCreateStreamOnFile methods.

---

 dlls/shlwapi/tests/istream.c |   42 ++++++++++++++++++++++--------------------
 1 files changed, 22 insertions(+), 20 deletions(-)

diff --git a/dlls/shlwapi/tests/istream.c b/dlls/shlwapi/tests/istream.c
index 5a50838..df83786 100644
--- a/dlls/shlwapi/tests/istream.c
+++ b/dlls/shlwapi/tests/istream.c
@@ -529,6 +529,12 @@ static void test_SHCreateStreamOnFileEx(DWORD mode, DWORD stgm)
 
 START_TEST(istream)
 {
+    static const DWORD stgm_access[] = {
+        STGM_READ,
+        STGM_WRITE,
+        STGM_READWRITE
+    };
+
     static const DWORD stgm_flags[] = {
         0,
         STGM_CONVERT,
@@ -539,6 +545,8 @@ START_TEST(istream)
         STGM_TRANSACTED | STGM_CONVERT | STGM_DELETEONRELEASE
     };
 
+    int i, j;
+
     hShlwapi = GetModuleHandleA("shlwapi.dll");
 
     pSHCreateStreamOnFileA = (void*)GetProcAddress(hShlwapi, "SHCreateStreamOnFileA");
@@ -546,30 +554,24 @@ START_TEST(istream)
     pSHCreateStreamOnFileEx = (void*)GetProcAddress(hShlwapi, "SHCreateStreamOnFileEx");
 
     if (!pSHCreateStreamOnFileA)
-        printf("SHCreateStreamOnFileA not found... skipping tests.\n");
-    else {
-        test_SHCreateStreamOnFileA(STGM_READ);
-        test_SHCreateStreamOnFileA(STGM_WRITE);
-        test_SHCreateStreamOnFileA(STGM_READWRITE);
-    }
+        printf("SHCreateStreamOnFileA not found... those tests will be skipped.\n");
 
     if (!pSHCreateStreamOnFileW)
-        printf("SHCreateStreamOnFileW not found... skipping tests.\n");
-    else {
-        test_SHCreateStreamOnFileW(STGM_READ);
-        test_SHCreateStreamOnFileW(STGM_WRITE);
-        test_SHCreateStreamOnFileW(STGM_READWRITE);
-    }
+        printf("SHCreateStreamOnFileW not found... those tests will be skipped.\n");
 
     if (!pSHCreateStreamOnFileEx)
-        printf("SHCreateStreamOnFileEx not found... skipping tests.\n");
-    else {
-        int i;
-
-        for (i = 0; i != sizeof(stgm_flags)/sizeof(stgm_flags[0]); i++) {
-            test_SHCreateStreamOnFileEx(STGM_READ, stgm_flags[i]);
-            test_SHCreateStreamOnFileEx(STGM_WRITE, stgm_flags[i]);
-            test_SHCreateStreamOnFileEx(STGM_READWRITE, stgm_flags[i]);
+        printf("SHCreateStreamOnFileEx not found... those tests will be skipped.\n");
+
+    for (i = 0; i != sizeof(stgm_access)/sizeof(stgm_access[0]); i++) {
+        if (pSHCreateStreamOnFileA)
+            test_SHCreateStreamOnFileA(stgm_access[i]);
+
+        if (pSHCreateStreamOnFileW)
+            test_SHCreateStreamOnFileW(stgm_access[i]);
+
+        if (pSHCreateStreamOnFileEx) {
+            for (j = 0; j != sizeof(stgm_flags)/sizeof(stgm_flags[0]); j++)
+                test_SHCreateStreamOnFileEx(stgm_access[i], stgm_flags[j]);
         }
     }
 }




More information about the wine-cvs mailing list