[v2] d3d9/tests: Use todo_wine_if() in tests

Frédéric Delanoy frederic.delanoy at gmail.com
Tue Feb 16 16:16:01 CST 2016


Signed-off-by: Frédéric Delanoy <frederic.delanoy at gmail.com>
---
 dlls/d3d9/tests/d3d9ex.c | 10 ++--------
 dlls/d3d9/tests/device.c | 24 +++++-------------------
 dlls/d3d9/tests/visual.c | 22 ++++------------------
 3 files changed, 11 insertions(+), 45 deletions(-)

diff --git a/dlls/d3d9/tests/d3d9ex.c b/dlls/d3d9/tests/d3d9ex.c
index 99ba823..b74ae47 100644
--- a/dlls/d3d9/tests/d3d9ex.c
+++ b/dlls/d3d9/tests/d3d9ex.c
@@ -2869,12 +2869,9 @@ static void test_window_style(void)
         ok(SUCCEEDED(hr), "Failed to reset device, hr %#x.\n", hr);
 
         style = GetWindowLongA(device_window, GWL_STYLE);
-        if (tests[i].style_flags & WS_VISIBLE)
+        todo_wine_if (!(tests[i].style_flags & WS_VISIBLE))
             ok(style == device_style, "Expected device window style %#x, got %#x, i=%u.\n",
                     device_style, style, i);
-        else
-            todo_wine ok(style == device_style, "Expected device window style %#x, got %#x, i=%u.\n",
-                    device_style, style, i);
         style = GetWindowLongA(device_window, GWL_EXSTYLE);
         todo_wine ok(style == device_exstyle, "Expected device window extended style %#x, got %#x, i=%u.\n",
                 device_exstyle, style, i);
@@ -2890,12 +2887,9 @@ static void test_window_style(void)
         ok(ref == 0, "The device was not properly freed: refcount %u.\n", ref);
 
         style = GetWindowLongA(device_window, GWL_STYLE);
-        if (device_style & WS_VISIBLE)
+        todo_wine_if (!(device_style & WS_VISIBLE))
             ok(style == device_style, "Expected device window style %#x, got %#x, i=%u.\n",
                 device_style, style, i);
-        else
-            todo_wine ok(style == device_style, "Expected device window style %#x, got %#x, i=%u.\n",
-                    device_style, style, i);
         style = GetWindowLongA(device_window, GWL_EXSTYLE);
         todo_wine ok(style == device_exstyle, "Expected device window extended style %#x, got %#x, i=%u.\n",
                 device_exstyle, style, i);
diff --git a/dlls/d3d9/tests/device.c b/dlls/d3d9/tests/device.c
index 5bf7121..f31a7cd 100644
--- a/dlls/d3d9/tests/device.c
+++ b/dlls/d3d9/tests/device.c
@@ -668,11 +668,7 @@ static void test_fvf_decl_conversion(void)
         hr = IDirect3DDevice9_GetFVF(device, &fvf);
         ok(SUCCEEDED(hr), "Test %u: Failed to get FVF, hr %#x.\n", i, hr);
 
-        if (decl_to_fvf_tests[i].todo)
-            todo_wine ok(fvf == decl_to_fvf_tests[i].fvf,
-                    "Test %u: Got unexpected FVF %#x, expected %#x.\n",
-                    i, fvf, decl_to_fvf_tests[i].fvf);
-        else
+        todo_wine_if (decl_to_fvf_tests[i].todo)
             ok(fvf == decl_to_fvf_tests[i].fvf,
                     "Test %u: Got unexpected FVF %#x, expected %#x.\n",
                     i, fvf, decl_to_fvf_tests[i].fvf);
@@ -3681,10 +3677,8 @@ static void test_wndproc(void)
          * But sometimes focus-follows-mouse WMs also temporarily drop window focus, which makes
          * mark the device lost, then not reset, causing the test to succeed for the wrong reason. */
         hr = IDirect3DDevice9_TestCooperativeLevel(device);
-        if (hr == D3DERR_DEVICENOTRESET)
+        todo_wine_if (hr != D3DERR_DEVICENOTRESET)
             ok(hr == D3DERR_DEVICENOTRESET, "Got unexpected hr %#x.\n", hr);
-        else
-            todo_wine ok(hr == D3DERR_DEVICENOTRESET, "Got unexpected hr %#x.\n", hr);
 
         expect_messages = tests[i].focus_loss_messages;
         /* SetForegroundWindow is a poor replacement for the user pressing alt-tab or
@@ -4483,18 +4477,12 @@ static void test_window_style(void)
 
         style = GetWindowLongA(device_window, GWL_STYLE);
         expected_style = device_style | tests[i].style;
-        if (tests[i].device_flags & CREATE_DEVICE_NOWINDOWCHANGES)
-            todo_wine ok(style == expected_style, "Expected device window style %#x, got %#x, i=%u.\n",
-                    expected_style, style, i);
-        else
+        todo_wine_if (tests[i].device_flags & CREATE_DEVICE_NOWINDOWCHANGES)
             ok(style == expected_style, "Expected device window style %#x, got %#x, i=%u.\n",
                     expected_style, style, i);
         style = GetWindowLongA(device_window, GWL_EXSTYLE);
         expected_style = device_exstyle | tests[i].exstyle;
-        if (tests[i].device_flags & CREATE_DEVICE_NOWINDOWCHANGES)
-            todo_wine ok(style == expected_style, "Expected device window extended style %#x, got %#x, i=%u.\n",
-                    expected_style, style, i);
-        else
+        todo_wine_if (tests[i].device_flags & CREATE_DEVICE_NOWINDOWCHANGES)
             ok(style == expected_style, "Expected device window extended style %#x, got %#x, i=%u.\n",
                     expected_style, style, i);
 
@@ -8873,9 +8861,7 @@ static void test_update_volumetexture(void)
         ok(SUCCEEDED(hr), "Failed to create volume texture, hr %#x, case %u.\n", hr, i);
 
         hr = IDirect3DDevice9_UpdateTexture(device, (IDirect3DBaseTexture9 *)src, (IDirect3DBaseTexture9 *)dst);
-        if (FAILED(hr))
-            todo_wine ok(SUCCEEDED(hr), "Failed to update texture, hr %#x, case %u.\n", hr, i);
-        else
+        todo_wine_if (FAILED(hr))
             ok(SUCCEEDED(hr), "Failed to update texture, hr %#x, case %u.\n", hr, i);
 
         IDirect3DVolumeTexture9_Release(src);
diff --git a/dlls/d3d9/tests/visual.c b/dlls/d3d9/tests/visual.c
index 8b56dbe..274777b 100644
--- a/dlls/d3d9/tests/visual.c
+++ b/dlls/d3d9/tests/visual.c
@@ -1450,15 +1450,11 @@ static void color_fill_test(void)
         ok(SUCCEEDED(hr), "Failed to create surface, hr %#x, fmt=%s.\n", hr, formats[i].name);
 
         hr = IDirect3DDevice9_ColorFill(device, surface, NULL, 0xdeadbeef);
-        if (formats[i].flags & TODO_FILL_RETURN)
-            todo_wine ok(SUCCEEDED(hr), "Failed to color fill, hr %#x, fmt=%s.\n", hr, formats[i].name);
-        else
+        todo_wine_if (formats[i].flags & TODO_FILL_RETURN)
             ok(SUCCEEDED(hr), "Failed to color fill, hr %#x, fmt=%s.\n", hr, formats[i].name);
 
         hr = IDirect3DDevice9_ColorFill(device, surface, &rect, 0xdeadbeef);
-        if (formats[i].flags & TODO_FILL_RETURN)
-            todo_wine ok(SUCCEEDED(hr), "Failed to color fill, hr %#x, fmt=%s.\n", hr, formats[i].name);
-        else
+        todo_wine_if (formats[i].flags & TODO_FILL_RETURN)
             ok(SUCCEEDED(hr), "Failed to color fill, hr %#x, fmt=%s.\n", hr, formats[i].name);
 
         if (SUCCEEDED(hr))
@@ -8472,14 +8468,7 @@ static void test_shademode(void)
          * functionality being available. */
         /* PHONG should be the same as GOURAUD, since no hardware implements
          * this. */
-        if (tests[i].todo)
-        {
-            todo_wine ok(color_match(color0, tests[i].color0, 1), "Test %u shading has color0 %08x, expected %08x.\n",
-                    i, color0, tests[i].color0);
-            todo_wine ok(color_match(color1, tests[i].color1, 1), "Test %u shading has color1 %08x, expected %08x.\n",
-                    i, color1, tests[i].color1);
-        }
-        else
+        todo_wine_if (tests[i].todo)
         {
             ok(color_match(color0, tests[i].color0, 1), "Test %u shading has color0 %08x, expected %08x.\n",
                     i, color0, tests[i].color0);
@@ -18123,10 +18112,7 @@ static void test_fog_interpolation(void)
         color = getPixelColor(device, 0, 240);
         ok(color_match(color, 0x000000ff, 2), "Got unexpected color 0x%08x, case %u.\n", color, i);
         color = getPixelColor(device, 320, 240);
-        if (tests[i].todo)
-            todo_wine ok(color_match(color, tests[i].middle_color, 2),
-                    "Got unexpected color 0x%08x, case %u.\n", color, i);
-        else
+        todo_wine_if (tests[i].todo)
             ok(color_match(color, tests[i].middle_color, 2),
                     "Got unexpected color 0x%08x, case %u.\n", color, i);
         color = getPixelColor(device, 639, 240);
-- 
2.7.1




More information about the wine-patches mailing list