Alexandre Julliard : taskschd/tests: Don' t depend on the directory lookup order.

Alexandre Julliard julliard at wine.codeweavers.com
Wed Dec 3 15:43:25 CST 2014


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

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Wed Dec  3 11:25:51 2014 +0100

taskschd/tests: Don't depend on the directory lookup order.

---

 dlls/taskschd/tests/scheduler.c | 26 ++++++++++++++++++--------
 1 file changed, 18 insertions(+), 8 deletions(-)

diff --git a/dlls/taskschd/tests/scheduler.c b/dlls/taskschd/tests/scheduler.c
index 74a5263..5e906ce 100644
--- a/dlls/taskschd/tests/scheduler.c
+++ b/dlls/taskschd/tests/scheduler.c
@@ -421,6 +421,7 @@ static void test_FolderCollection(void)
     IUnknown *unknown;
     IEnumVARIANT *enumvar;
     ULONG count, i;
+    BOOL is_first;
     VARIANT idx;
     static const int vt[] = { VT_I1, VT_I2, VT_I4, VT_I8, VT_UI1, VT_UI2, VT_UI4, VT_UI8, VT_INT, VT_UINT };
 
@@ -507,7 +508,8 @@ static void test_FolderCollection(void)
 
         hr = ITaskFolder_get_Path(subfolder, &bstr);
         ok(hr == S_OK, "get_Path error %#x\n", hr);
-        if (i == 1)
+        is_first = !lstrcmpW(bstr, Wine_Folder1);
+        if (is_first)
             ok(!lstrcmpW(bstr, Wine_Folder1), "expected \\Wine\\Folder1, got %s\n", wine_dbgstr_w(bstr));
         else
             ok(!lstrcmpW(bstr, Wine_Folder2), "expected \\Wine\\Folder2, got %s\n", wine_dbgstr_w(bstr));
@@ -515,7 +517,7 @@ static void test_FolderCollection(void)
 
         hr = ITaskFolder_get_Name(subfolder, &bstr);
         ok(hr == S_OK, "get_Name error %#x\n", hr);
-        if (i == 1)
+        if (is_first)
             ok(!lstrcmpW(bstr, Folder1), "expected Folder1, got %s\n", wine_dbgstr_w(bstr));
         else
             ok(!lstrcmpW(bstr, Folder2), "expected Folder2, got %s\n", wine_dbgstr_w(bstr));
@@ -530,7 +532,7 @@ static void test_FolderCollection(void)
 
         hr = ITaskFolder_get_Path(subfolder, &bstr);
         ok(hr == S_OK, "get_Path error %#x\n", hr);
-        if (i == 1)
+        if (is_first)
             ok(!lstrcmpW(bstr, Wine_Folder1), "expected \\Wine\\Folder1, got %s\n", wine_dbgstr_w(bstr));
         else
             ok(!lstrcmpW(bstr, Wine_Folder2), "expected \\Wine\\Folder2, got %s\n", wine_dbgstr_w(bstr));
@@ -538,7 +540,7 @@ static void test_FolderCollection(void)
 
         hr = ITaskFolder_get_Name(subfolder, &bstr);
         ok(hr == S_OK, "get_Name error %#x\n", hr);
-        if (i == 1)
+        if (is_first)
             ok(!lstrcmpW(bstr, Folder1), "expected Folder1, got %s\n", wine_dbgstr_w(bstr));
         else
             ok(!lstrcmpW(bstr, Folder2), "expected Folder2, got %s\n", wine_dbgstr_w(bstr));
@@ -591,11 +593,18 @@ static void test_FolderCollection(void)
     ok(count == 1, "expected 1, got %d\n", count);
     hr = ITaskFolder_get_Path((ITaskFolder *)V_DISPATCH(&var[0]), &bstr);
     ok(hr == S_OK, "get_Path error %#x\n", hr);
-    ok(!lstrcmpW(bstr, Wine_Folder2), "expected \\Wine\\Folder2, got %s\n", wine_dbgstr_w(bstr));
+    is_first = !lstrcmpW(bstr, Wine_Folder1);
+    if (is_first)
+        ok(!lstrcmpW(bstr, Wine_Folder1), "expected \\Wine\\Folder1, got %s\n", wine_dbgstr_w(bstr));
+    else
+        ok(!lstrcmpW(bstr, Wine_Folder2), "expected \\Wine\\Folder2, got %s\n", wine_dbgstr_w(bstr));
     SysFreeString(bstr);
     hr = ITaskFolder_get_Name((ITaskFolder *)V_DISPATCH(&var[0]), &bstr);
     ok(hr == S_OK, "get_Name error %#x\n", hr);
-    ok(!lstrcmpW(bstr, Folder2), "expected Folder2, got %s\n", wine_dbgstr_w(bstr));
+    if (is_first)
+        ok(!lstrcmpW(bstr, Folder1), "expected Folder1, got %s\n", wine_dbgstr_w(bstr));
+    else
+        ok(!lstrcmpW(bstr, Folder2), "expected Folder2, got %s\n", wine_dbgstr_w(bstr));
     IDispatch_Release(V_DISPATCH(&var[0]));
 
     memset(var, 0, sizeof(var));
@@ -628,7 +637,8 @@ static void test_FolderCollection(void)
 
         hr = ITaskFolder_get_Path(subfolder, &bstr);
         ok(hr == S_OK, "get_Path error %#x\n", hr);
-        if (i == 0)
+        is_first = !lstrcmpW(bstr, Wine_Folder1);
+        if (is_first)
             ok(!lstrcmpW(bstr, Wine_Folder1), "expected \\Wine\\Folder1, got %s\n", wine_dbgstr_w(bstr));
         else
             ok(!lstrcmpW(bstr, Wine_Folder2), "expected \\Wine\\Folder2, got %s\n", wine_dbgstr_w(bstr));
@@ -636,7 +646,7 @@ static void test_FolderCollection(void)
 
         hr = ITaskFolder_get_Name(subfolder, &bstr);
         ok(hr == S_OK, "get_Name error %#x\n", hr);
-        if (i == 0)
+        if (is_first)
             ok(!lstrcmpW(bstr, Folder1), "expected Folder1, got %s\n", wine_dbgstr_w(bstr));
         else
             ok(!lstrcmpW(bstr, Folder2), "expected Folder2, got %s\n", wine_dbgstr_w(bstr));




More information about the wine-cvs mailing list