[PATCH] comctl32/tests: Simplify tests using todo_wine_if()

Nikolay Sivov nsivov at codeweavers.com
Wed Feb 10 04:37:01 CST 2016


Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
---
 dlls/comctl32/tests/header.c   |  6 +-----
 dlls/comctl32/tests/listview.c | 35 ++++-------------------------------
 dlls/comctl32/tests/monthcal.c |  7 +------
 3 files changed, 6 insertions(+), 42 deletions(-)

diff --git a/dlls/comctl32/tests/header.c b/dlls/comctl32/tests/header.c
index 2c1320b..f37b72b 100644
--- a/dlls/comctl32/tests/header.c
+++ b/dlls/comctl32/tests/header.c
@@ -1721,11 +1721,7 @@ static void check_orderarray(HWND hwnd, DWORD start, DWORD set, DWORD expected,
     for(i = 1; i<=count; i++)
         array |= order[i-1]<<(4*(count-i));
 
-    if (todo) {
-    todo_wine
-        ok_(__FILE__, line)(array == expected, "Expected %x, got %x\n", expected, array);
-    }
-    else
+    todo_wine_if(todo)
         ok_(__FILE__, line)(array == expected, "Expected %x, got %x\n", expected, array);
 }
 
diff --git a/dlls/comctl32/tests/listview.c b/dlls/comctl32/tests/listview.c
index a6910d2..400c51a 100644
--- a/dlls/comctl32/tests/listview.c
+++ b/dlls/comctl32/tests/listview.c
@@ -790,16 +790,7 @@ static void test_lvm_hittest_(HWND hwnd, INT x, INT y, INT item, UINT flags, UIN
 
     ret = SendMessageA(hwnd, LVM_HITTEST, 0, (LPARAM)&lpht);
 
-    if (todo_item)
-    {
-        todo_wine
-        {
-            ok_(__FILE__, line)(ret == item, "Expected %d retval, got %d\n", item, ret);
-            ok_(__FILE__, line)(lpht.iItem == item, "Expected %d item, got %d\n", item, lpht.iItem);
-            ok_(__FILE__, line)(lpht.iSubItem == 10, "Expected subitem not overwrited\n");
-        }
-    }
-    else
+    todo_wine_if(todo_item)
     {
         ok_(__FILE__, line)(ret == item, "Expected %d retval, got %d\n", item, ret);
         ok_(__FILE__, line)(lpht.iItem == item, "Expected %d item, got %d\n", item, lpht.iItem);
@@ -832,34 +823,16 @@ static void test_lvm_subitemhittest_(HWND hwnd, INT x, INT y, INT item, INT subi
 
     ret = SendMessageA(hwnd, LVM_SUBITEMHITTEST, 0, (LPARAM)&lpht);
 
-    if (todo_item)
-    {
-        todo_wine
-        {
-            ok_(__FILE__, line)(ret == item, "Expected %d retval, got %d\n", item, ret);
-            ok_(__FILE__, line)(lpht.iItem == item, "Expected %d item, got %d\n", item, lpht.iItem);
-        }
-    }
-    else
+    todo_wine_if(todo_item)
     {
         ok_(__FILE__, line)(ret == item, "Expected %d retval, got %d\n", item, ret);
         ok_(__FILE__, line)(lpht.iItem == item, "Expected %d item, got %d\n", item, lpht.iItem);
     }
 
-    if (todo_subitem)
-    {
-        todo_wine
-            ok_(__FILE__, line)(lpht.iSubItem == subitem, "Expected subitem %d, got %d\n", subitem, lpht.iSubItem);
-    }
-    else
+    todo_wine_if(todo_subitem)
         ok_(__FILE__, line)(lpht.iSubItem == subitem, "Expected subitem %d, got %d\n", subitem, lpht.iSubItem);
 
-    if (todo_flags)
-    {
-        todo_wine
-            ok_(__FILE__, line)(lpht.flags == flags, "Expected flags 0x%x, got 0x%x\n", flags, lpht.flags);
-    }
-    else
+    todo_wine_if(todo_flags)
         ok_(__FILE__, line)(lpht.flags == flags, "Expected flags 0x%x, got 0x%x\n", flags, lpht.flags);
 }
 
diff --git a/dlls/comctl32/tests/monthcal.c b/dlls/comctl32/tests/monthcal.c
index b22db1c..c0d296a 100644
--- a/dlls/comctl32/tests/monthcal.c
+++ b/dlls/comctl32/tests/monthcal.c
@@ -1182,14 +1182,9 @@ if (0)
                 if (sizeof(title_hits) / sizeof(title_hits[0]) <= title_index)
                     break;
 
-                if (title_hits[title_index].todo) {
-                    todo_wine
+                todo_wine_if(title_hits[title_index].todo)
                     ok(title_hits[title_index].ht == res, "Expected %x, got %x, pos %d\n",
                                                           title_hits[title_index].ht, res, x);
-                } else {
-                    ok(title_hits[title_index].ht == res, "Expected %x, got %x, pos %d\n",
-                                                          title_hits[title_index].ht, res, x);
-                }
             }
             old_res = res;
         }
-- 
2.7.0




More information about the wine-patches mailing list