[PATCH 5/5] d3d9: Use color_match() in the fog test.

Henri Verbeet hverbeet at codeweavers.com
Fri Jun 19 04:04:34 CDT 2009


---
 dlls/d3d9/tests/visual.c |   34 ++++++++++++++--------------------
 1 files changed, 14 insertions(+), 20 deletions(-)

diff --git a/dlls/d3d9/tests/visual.c b/dlls/d3d9/tests/visual.c
index fff1f88..44ae50e 100644
--- a/dlls/d3d9/tests/visual.c
+++ b/dlls/d3d9/tests/visual.c
@@ -774,8 +774,7 @@ struct sVertexT {
 static void fog_test(IDirect3DDevice9 *device)
 {
     HRESULT hr;
-    DWORD color;
-    BYTE r, g, b;
+    D3DCOLOR color;
     float start = 0.0f, end = 1.0f;
     D3DCAPS9 caps;
     int i;
@@ -909,13 +908,13 @@ static void fog_test(IDirect3DDevice9 *device)
     color = getPixelColor(device, 160, 360);
     ok(color == 0x00FF0000, "Untransformed vertex with no table or vertex fog has color %08x\n", color);
     color = getPixelColor(device, 160, 120);
-    ok(color == 0x0000FF00 || color == 0x0000FE00, "Untransformed vertex with linear vertex fog has color %08x\n", color);
+    ok(color_match(color, 0x0000ff00, 1), "Untransformed vertex with linear vertex fog has color %08x\n", color);
     color = getPixelColor(device, 480, 120);
     ok(color == 0x00FFFF00, "Transformed vertex with linear vertex fog has color %08x\n", color);
     if(caps.RasterCaps & D3DPRASTERCAPS_FOGTABLE)
     {
         color = getPixelColor(device, 480, 360);
-        ok(color == 0x0000FF00 || color == 0x0000FE00, "Transformed vertex with linear table fog has color %08x\n", color);
+        ok(color_match(color, 0x0000ff00, 1), "Transformed vertex with linear table fog has color %08x\n", color);
     }
     else
     {
@@ -979,9 +978,9 @@ static void fog_test(IDirect3DDevice9 *device)
     }
     IDirect3DDevice9_Present(device, NULL, NULL, NULL, NULL);
     color = getPixelColor(device, 160, 360);
-    ok(color == 0x0000FF00 || color == 0x0000FE00, "Untransformed vertex with vertex fog and z = 0.1 has color %08x\n", color);
+    ok(color_match(color, 0x0000ff00, 1), "Untransformed vertex with vertex fog and z = 0.1 has color %08x\n", color);
     color = getPixelColor(device, 160, 120);
-    ok(color == 0x0000FF00 || color == 0x0000FE00, "Untransformed vertex with vertex fog and z = 1.0 has color %08x\n", color);
+    ok(color_match(color, 0x0000ff00, 1), "Untransformed vertex with vertex fog and z = 1.0 has color %08x\n", color);
     color = getPixelColor(device, 480, 120);
     ok(color == 0x00FFFF00, "Transformed vertex with linear vertex fog has color %08x\n", color);
 
@@ -1026,21 +1025,16 @@ static void fog_test(IDirect3DDevice9 *device)
         }
         IDirect3DDevice9_Present(device, NULL, NULL, NULL, NULL);
         color = getPixelColor(device, 160, 360);
-        ok(color == 0x0000FF00 || color == 0x0000FE00, "Reversed %s fog: z=0.1 has color 0x%08x, expected 0x0000ff00 or 0x0000fe00\n", mode, color);
+        ok(color_match(color, 0x0000ff00, 1),
+                "Reversed %s fog: z=0.1 has color 0x%08x, expected 0x0000ff00 or 0x0000fe00\n", mode, color);
 
         color = getPixelColor(device, 160, 120);
-        r = (color & 0x00ff0000) >> 16;
-        g = (color & 0x0000ff00) >>  8;
-        b = (color & 0x000000ff);
-        ok(r == 0x00 && g >= 0x29 && g <= 0x2d && b >= 0xd2 && b <= 0xd6,
-           "Reversed %s fog: z=0.7 has color 0x%08x\n", mode, color);
+        ok(color_match(color, D3DCOLOR_ARGB(0x00, 0x00, 0x2b, 0xd4), 2),
+                "Reversed %s fog: z=0.7 has color 0x%08x\n", mode, color);
 
         color = getPixelColor(device, 480, 120);
-        r = (color & 0x00ff0000) >> 16;
-        g = (color & 0x0000ff00) >>  8;
-        b = (color & 0x000000ff);
-        ok(r == 0x00 && g >= 0xa8 && g <= 0xac && b >= 0x53 && b <= 0x57,
-           "Reversed %s fog: z=0.4 has color 0x%08x\n", mode, color);
+        ok(color_match(color, D3DCOLOR_ARGB(0x00, 0x00, 0xaa, 0x55), 2),
+                "Reversed %s fog: z=0.4 has color 0x%08x\n", mode, color);
 
         color = getPixelColor(device, 480, 360);
         ok(color == 0x000000ff, "Reversed %s fog: z=0.9 has color 0x%08x, expected 0x000000ff\n", mode, color);
@@ -6679,7 +6673,7 @@ static void fog_srgbwrite_test(IDirect3DDevice9 *device)
         1.0,    1.0,    0.1
     };
     HRESULT hr;
-    DWORD color;
+    D3DCOLOR color;
 
     IDirect3DDevice9_GetDirect3D(device, &d3d);
     /* Ask for srgb writing on D3DRTYPE_TEXTURE. Some Windows drivers do not report it on surfaces.
@@ -6747,8 +6741,8 @@ static void fog_srgbwrite_test(IDirect3DDevice9 *device)
     hr = IDirect3DDevice9_Present(device, NULL, NULL, NULL, NULL);
     ok(hr == D3D_OK, "IDirect3DDevice9_Present failed with %08x\n", hr);
     color = getPixelColor(device, 160, 360);
-    ok(color == 0x00808080 || color == 0x007f7f7f || color == 0x00818181,
-       "Fog with D3DRS_SRGBWRITEENABLE returned color 0x%08x, expected 0x00808080\n", color);
+    ok(color_match(color, 0x00808080, 1),
+            "Fog with D3DRS_SRGBWRITEENABLE returned color 0x%08x, expected 0x00808080\n", color);
 }
 
 static void alpha_test(IDirect3DDevice9 *device)
-- 
1.6.0.6




More information about the wine-patches mailing list