[PATCH 1/5] ddraw/tests: 64-bit ddraw only has DWORD surface pitch alignment in some cases.

Henri Verbeet hverbeet at codeweavers.com
Thu Jun 12 04:52:27 CDT 2014


This set supersedes patches 104985-104989.
---
 dlls/ddraw/tests/ddraw1.c |   32 +++++++++++++----------
 dlls/ddraw/tests/ddraw2.c |   32 +++++++++++++----------
 dlls/ddraw/tests/ddraw4.c |   62 +++++++++++++++++++++++++--------------------
 dlls/ddraw/tests/ddraw7.c |   62 +++++++++++++++++++++++++--------------------
 4 files changed, 106 insertions(+), 82 deletions(-)

diff --git a/dlls/ddraw/tests/ddraw1.c b/dlls/ddraw/tests/ddraw1.c
index c8f7d65..df74488 100644
--- a/dlls/ddraw/tests/ddraw1.c
+++ b/dlls/ddraw/tests/ddraw1.c
@@ -4503,28 +4503,29 @@ static void test_create_surface_pitch(void)
         DWORD pitch_in;
         HRESULT hr;
         DWORD flags_out;
-        DWORD pitch_out;
+        DWORD pitch_out32;
+        DWORD pitch_out64;
     }
     test_data[] =
     {
         {DDSCAPS_VIDEOMEMORY,   0,                              0,      DD_OK,
-                                DDSD_PITCH,                     0x100},
+                                DDSD_PITCH,                     0x100,  0x100},
         {DDSCAPS_VIDEOMEMORY,   DDSD_PITCH,                     0x104,  DD_OK,
-                                DDSD_PITCH,                     0x100},
+                                DDSD_PITCH,                     0x100,  0x100},
         {DDSCAPS_VIDEOMEMORY,   DDSD_PITCH,                     0x0f8,  DD_OK,
-                                DDSD_PITCH,                     0x100},
+                                DDSD_PITCH,                     0x100,  0x100},
         {DDSCAPS_VIDEOMEMORY,   DDSD_LPSURFACE | DDSD_PITCH,    0x100,  DDERR_INVALIDCAPS,
-                                0,                              0    },
+                                0,                              0,      0    },
         {DDSCAPS_SYSTEMMEMORY,  0,                              0,      DD_OK,
-                                DDSD_PITCH,                     0x100},
+                                DDSD_PITCH,                     0x100,  0x0fc},
         {DDSCAPS_SYSTEMMEMORY,  DDSD_PITCH,                     0x104,  DD_OK,
-                                DDSD_PITCH,                     0x100},
+                                DDSD_PITCH,                     0x100,  0x0fc},
         {DDSCAPS_SYSTEMMEMORY,  DDSD_PITCH,                     0x0f8,  DD_OK,
-                                DDSD_PITCH,                     0x100},
+                                DDSD_PITCH,                     0x100,  0x0fc},
         {DDSCAPS_SYSTEMMEMORY,  DDSD_LPSURFACE,                 0,      DDERR_INVALIDPARAMS,
-                                0,                              0    },
+                                0,                              0,      0    },
         {DDSCAPS_SYSTEMMEMORY,  DDSD_LPSURFACE | DDSD_PITCH,    0x100,  DDERR_INVALIDPARAMS,
-                                0,                              0    },
+                                0,                              0,      0    },
     };
     DWORD flags_mask = DDSD_PITCH | DDSD_LPSURFACE;
 
@@ -4566,9 +4567,14 @@ static void test_create_surface_pitch(void)
         ok((surface_desc.dwFlags & flags_mask) == test_data[i].flags_out,
                 "Test %u: Got unexpected flags %#x, expected %#x.\n",
                 i, surface_desc.dwFlags & flags_mask, test_data[i].flags_out);
-        ok(U1(surface_desc).lPitch == test_data[i].pitch_out,
-                "Test %u: Got unexpected pitch %u, expected %u.\n",
-                i, U1(surface_desc).lPitch, test_data[i].pitch_out);
+        if (sizeof(void *) != sizeof(DWORD) && test_data[i].pitch_out32 != test_data[i].pitch_out64)
+            todo_wine ok(U1(surface_desc).lPitch == test_data[i].pitch_out64,
+                    "Test %u: Got unexpected pitch %u, expected %u.\n",
+                    i, U1(surface_desc).lPitch, test_data[i].pitch_out64);
+        else
+            ok(U1(surface_desc).lPitch == test_data[i].pitch_out32,
+                    "Test %u: Got unexpected pitch %u, expected %u.\n",
+                    i, U1(surface_desc).lPitch, test_data[i].pitch_out32);
 
         IDirectDrawSurface_Release(surface);
     }
diff --git a/dlls/ddraw/tests/ddraw2.c b/dlls/ddraw/tests/ddraw2.c
index 23795d3..2ca7047 100644
--- a/dlls/ddraw/tests/ddraw2.c
+++ b/dlls/ddraw/tests/ddraw2.c
@@ -5579,28 +5579,29 @@ static void test_create_surface_pitch(void)
         DWORD pitch_in;
         HRESULT hr;
         DWORD flags_out;
-        DWORD pitch_out;
+        DWORD pitch_out32;
+        DWORD pitch_out64;
     }
     test_data[] =
     {
         {DDSCAPS_VIDEOMEMORY,   0,                              0,      DD_OK,
-                                DDSD_PITCH,                     0x100},
+                                DDSD_PITCH,                     0x100,  0x100},
         {DDSCAPS_VIDEOMEMORY,   DDSD_PITCH,                     0x104,  DD_OK,
-                                DDSD_PITCH,                     0x100},
+                                DDSD_PITCH,                     0x100,  0x100},
         {DDSCAPS_VIDEOMEMORY,   DDSD_PITCH,                     0x0f8,  DD_OK,
-                                DDSD_PITCH,                     0x100},
+                                DDSD_PITCH,                     0x100,  0x100},
         {DDSCAPS_VIDEOMEMORY,   DDSD_LPSURFACE | DDSD_PITCH,    0x100,  DDERR_INVALIDCAPS,
-                                0,                              0    },
+                                0,                              0,      0    },
         {DDSCAPS_SYSTEMMEMORY,  0,                              0,      DD_OK,
-                                DDSD_PITCH,                     0x100},
+                                DDSD_PITCH,                     0x100,  0x0fc},
         {DDSCAPS_SYSTEMMEMORY,  DDSD_PITCH,                     0x104,  DD_OK,
-                                DDSD_PITCH,                     0x100},
+                                DDSD_PITCH,                     0x100,  0x0fc},
         {DDSCAPS_SYSTEMMEMORY,  DDSD_PITCH,                     0x0f8,  DD_OK,
-                                DDSD_PITCH,                     0x100},
+                                DDSD_PITCH,                     0x100,  0x0fc},
         {DDSCAPS_SYSTEMMEMORY,  DDSD_LPSURFACE,                 0,      DDERR_INVALIDPARAMS,
-                                0,                              0    },
+                                0,                              0,      0    },
         {DDSCAPS_SYSTEMMEMORY,  DDSD_LPSURFACE | DDSD_PITCH,    0x100,  DDERR_INVALIDPARAMS,
-                                0,                              0    },
+                                0,                              0,      0    },
     };
     DWORD flags_mask = DDSD_PITCH | DDSD_LPSURFACE;
 
@@ -5642,9 +5643,14 @@ static void test_create_surface_pitch(void)
         ok((surface_desc.dwFlags & flags_mask) == test_data[i].flags_out,
                 "Test %u: Got unexpected flags %#x, expected %#x.\n",
                 i, surface_desc.dwFlags & flags_mask, test_data[i].flags_out);
-        ok(U1(surface_desc).lPitch == test_data[i].pitch_out,
-                "Test %u: Got unexpected pitch %u, expected %u.\n",
-                i, U1(surface_desc).lPitch, test_data[i].pitch_out);
+        if (sizeof(void *) != sizeof(DWORD) && test_data[i].pitch_out32 != test_data[i].pitch_out64)
+            todo_wine ok(U1(surface_desc).lPitch == test_data[i].pitch_out64,
+                    "Test %u: Got unexpected pitch %u, expected %u.\n",
+                    i, U1(surface_desc).lPitch, test_data[i].pitch_out64);
+        else
+            ok(U1(surface_desc).lPitch == test_data[i].pitch_out32,
+                    "Test %u: Got unexpected pitch %u, expected %u.\n",
+                    i, U1(surface_desc).lPitch, test_data[i].pitch_out32);
 
         IDirectDrawSurface_Release(surface);
     }
diff --git a/dlls/ddraw/tests/ddraw4.c b/dlls/ddraw/tests/ddraw4.c
index 464d955..ec53ae6 100644
--- a/dlls/ddraw/tests/ddraw4.c
+++ b/dlls/ddraw/tests/ddraw4.c
@@ -6474,34 +6474,35 @@ static void test_create_surface_pitch(void)
         DWORD pitch_in;
         HRESULT hr;
         DWORD flags_out;
-        DWORD pitch_out;
+        DWORD pitch_out32;
+        DWORD pitch_out64;
     }
     test_data[] =
     {
-        {DDSCAPS_VIDEOMEMORY,   0,                              0,      DD_OK,
-                                DDSD_PITCH,                     0x100},
-        {DDSCAPS_VIDEOMEMORY,   DDSD_PITCH,                     0x104,  DD_OK,
-                                DDSD_PITCH,                     0x100},
-        {DDSCAPS_VIDEOMEMORY,   DDSD_PITCH,                     0x0f8,  DD_OK,
-                                DDSD_PITCH,                     0x100},
-        {DDSCAPS_VIDEOMEMORY,   DDSD_LPSURFACE | DDSD_PITCH,    0x100,  DDERR_INVALIDCAPS,
-                                0,                              0    },
-        {DDSCAPS_SYSTEMMEMORY,  0,                              0,      DD_OK,
-                                DDSD_PITCH,                     0x100},
-        {DDSCAPS_SYSTEMMEMORY,  DDSD_PITCH,                     0x104,  DD_OK,
-                                DDSD_PITCH,                     0x100},
-        {DDSCAPS_SYSTEMMEMORY,  DDSD_PITCH,                     0x0f8,  DD_OK,
-                                DDSD_PITCH,                     0x100},
-        {DDSCAPS_SYSTEMMEMORY,  DDSD_LPSURFACE,                 0,      DDERR_INVALIDPARAMS,
-                                0,                              0    },
-        {DDSCAPS_SYSTEMMEMORY,  DDSD_LPSURFACE | DDSD_PITCH,    0x100,  DD_OK,
-                                DDSD_PITCH,                     0x100},
-        {DDSCAPS_SYSTEMMEMORY,  DDSD_LPSURFACE | DDSD_PITCH,    0x0fe,  DDERR_INVALIDPARAMS,
-                                0,                              0    },
-        {DDSCAPS_SYSTEMMEMORY,  DDSD_LPSURFACE | DDSD_PITCH,    0x0fc,  DD_OK,
-                                DDSD_PITCH,                     0x0fc},
-        {DDSCAPS_SYSTEMMEMORY,  DDSD_LPSURFACE | DDSD_PITCH,    0x0f8,  DDERR_INVALIDPARAMS,
-                                0,                              0    },
+        {DDSCAPS_VIDEOMEMORY,   0,                                              0,      DD_OK,
+                                DDSD_PITCH,                                     0x100,  0x100},
+        {DDSCAPS_VIDEOMEMORY,   DDSD_PITCH,                                     0x104,  DD_OK,
+                                DDSD_PITCH,                                     0x100,  0x100},
+        {DDSCAPS_VIDEOMEMORY,   DDSD_PITCH,                                     0x0f8,  DD_OK,
+                                DDSD_PITCH,                                     0x100,  0x100},
+        {DDSCAPS_VIDEOMEMORY,   DDSD_LPSURFACE | DDSD_PITCH,                    0x100,  DDERR_INVALIDCAPS,
+                                0,                                              0,      0    },
+        {DDSCAPS_SYSTEMMEMORY,  0,                                              0,      DD_OK,
+                                DDSD_PITCH,                                     0x100,  0x0fc},
+        {DDSCAPS_SYSTEMMEMORY,  DDSD_PITCH,                                     0x104,  DD_OK,
+                                DDSD_PITCH,                                     0x100,  0x0fc},
+        {DDSCAPS_SYSTEMMEMORY,  DDSD_PITCH,                                     0x0f8,  DD_OK,
+                                DDSD_PITCH,                                     0x100,  0x0fc},
+        {DDSCAPS_SYSTEMMEMORY,  DDSD_LPSURFACE,                                 0,      DDERR_INVALIDPARAMS,
+                                0,                                              0,      0    },
+        {DDSCAPS_SYSTEMMEMORY,  DDSD_LPSURFACE | DDSD_PITCH,                    0x100,  DD_OK,
+                                DDSD_PITCH,                                     0x100,  0x100},
+        {DDSCAPS_SYSTEMMEMORY,  DDSD_LPSURFACE | DDSD_PITCH,                    0x0fe,  DDERR_INVALIDPARAMS,
+                                0,                                              0,      0    },
+        {DDSCAPS_SYSTEMMEMORY,  DDSD_LPSURFACE | DDSD_PITCH,                    0x0fc,  DD_OK,
+                                DDSD_PITCH,                                     0x0fc,  0x0fc},
+        {DDSCAPS_SYSTEMMEMORY,  DDSD_LPSURFACE | DDSD_PITCH,                    0x0f8,  DDERR_INVALIDPARAMS,
+                                0,                                              0,      0    },
     };
     DWORD flags_mask = DDSD_PITCH | DDSD_LPSURFACE;
 
@@ -6543,9 +6544,14 @@ static void test_create_surface_pitch(void)
         ok((surface_desc.dwFlags & flags_mask) == test_data[i].flags_out,
                 "Test %u: Got unexpected flags %#x, expected %#x.\n",
                 i, surface_desc.dwFlags & flags_mask, test_data[i].flags_out);
-        ok(U1(surface_desc).lPitch == test_data[i].pitch_out,
-                "Test %u: Got unexpected pitch %u, expected %u.\n",
-                i, U1(surface_desc).lPitch, test_data[i].pitch_out);
+        if (sizeof(void *) != sizeof(DWORD) && test_data[i].pitch_out32 != test_data[i].pitch_out64)
+            todo_wine ok(U1(surface_desc).lPitch == test_data[i].pitch_out64,
+                    "Test %u: Got unexpected pitch %u, expected %u.\n",
+                    i, U1(surface_desc).lPitch, test_data[i].pitch_out64);
+        else
+            ok(U1(surface_desc).lPitch == test_data[i].pitch_out32,
+                    "Test %u: Got unexpected pitch %u, expected %u.\n",
+                    i, U1(surface_desc).lPitch, test_data[i].pitch_out32);
 
         IDirectDrawSurface4_Release(surface);
     }
diff --git a/dlls/ddraw/tests/ddraw7.c b/dlls/ddraw/tests/ddraw7.c
index 1c5bc1d..c90d89b 100644
--- a/dlls/ddraw/tests/ddraw7.c
+++ b/dlls/ddraw/tests/ddraw7.c
@@ -6297,34 +6297,35 @@ static void test_create_surface_pitch(void)
         DWORD pitch_in;
         HRESULT hr;
         DWORD flags_out;
-        DWORD pitch_out;
+        DWORD pitch_out32;
+        DWORD pitch_out64;
     }
     test_data[] =
     {
-        {DDSCAPS_VIDEOMEMORY,   0,                              0,      DD_OK,
-                                DDSD_PITCH,                     0x100},
-        {DDSCAPS_VIDEOMEMORY,   DDSD_PITCH,                     0x104,  DD_OK,
-                                DDSD_PITCH,                     0x100},
-        {DDSCAPS_VIDEOMEMORY,   DDSD_PITCH,                     0x0f8,  DD_OK,
-                                DDSD_PITCH,                     0x100},
-        {DDSCAPS_VIDEOMEMORY,   DDSD_LPSURFACE | DDSD_PITCH,    0x100,  DDERR_INVALIDCAPS,
-                                0,                              0    },
-        {DDSCAPS_SYSTEMMEMORY,  0,                              0,      DD_OK,
-                                DDSD_PITCH,                     0x100},
-        {DDSCAPS_SYSTEMMEMORY,  DDSD_PITCH,                     0x104,  DD_OK,
-                                DDSD_PITCH,                     0x100},
-        {DDSCAPS_SYSTEMMEMORY,  DDSD_PITCH,                     0x0f8,  DD_OK,
-                                DDSD_PITCH,                     0x100},
-        {DDSCAPS_SYSTEMMEMORY,  DDSD_LPSURFACE,                 0,      DDERR_INVALIDPARAMS,
-                                0,                              0    },
-        {DDSCAPS_SYSTEMMEMORY,  DDSD_LPSURFACE | DDSD_PITCH,    0x100,  DD_OK,
-                                DDSD_PITCH,                     0x100},
-        {DDSCAPS_SYSTEMMEMORY,  DDSD_LPSURFACE | DDSD_PITCH,    0x0fe,  DDERR_INVALIDPARAMS,
-                                0,                              0    },
-        {DDSCAPS_SYSTEMMEMORY,  DDSD_LPSURFACE | DDSD_PITCH,    0x0fc,  DD_OK,
-                                DDSD_PITCH,                     0x0fc},
-        {DDSCAPS_SYSTEMMEMORY,  DDSD_LPSURFACE | DDSD_PITCH,    0x0f8,  DDERR_INVALIDPARAMS,
-                                0,                              0    },
+        {DDSCAPS_VIDEOMEMORY,   0,                                              0,      DD_OK,
+                                DDSD_PITCH,                                     0x100,  0x100},
+        {DDSCAPS_VIDEOMEMORY,   DDSD_PITCH,                                     0x104,  DD_OK,
+                                DDSD_PITCH,                                     0x100,  0x100},
+        {DDSCAPS_VIDEOMEMORY,   DDSD_PITCH,                                     0x0f8,  DD_OK,
+                                DDSD_PITCH,                                     0x100,  0x100},
+        {DDSCAPS_VIDEOMEMORY,   DDSD_LPSURFACE | DDSD_PITCH,                    0x100,  DDERR_INVALIDCAPS,
+                                0,                                              0,      0    },
+        {DDSCAPS_SYSTEMMEMORY,  0,                                              0,      DD_OK,
+                                DDSD_PITCH,                                     0x100,  0x0fc},
+        {DDSCAPS_SYSTEMMEMORY,  DDSD_PITCH,                                     0x104,  DD_OK,
+                                DDSD_PITCH,                                     0x100,  0x0fc},
+        {DDSCAPS_SYSTEMMEMORY,  DDSD_PITCH,                                     0x0f8,  DD_OK,
+                                DDSD_PITCH,                                     0x100,  0x0fc},
+        {DDSCAPS_SYSTEMMEMORY,  DDSD_LPSURFACE,                                 0,      DDERR_INVALIDPARAMS,
+                                0,                                              0,      0    },
+        {DDSCAPS_SYSTEMMEMORY,  DDSD_LPSURFACE | DDSD_PITCH,                    0x100,  DD_OK,
+                                DDSD_PITCH,                                     0x100,  0x100},
+        {DDSCAPS_SYSTEMMEMORY,  DDSD_LPSURFACE | DDSD_PITCH,                    0x0fe,  DDERR_INVALIDPARAMS,
+                                0,                                              0,      0    },
+        {DDSCAPS_SYSTEMMEMORY,  DDSD_LPSURFACE | DDSD_PITCH,                    0x0fc,  DD_OK,
+                                DDSD_PITCH,                                     0x0fc,  0x0fc},
+        {DDSCAPS_SYSTEMMEMORY,  DDSD_LPSURFACE | DDSD_PITCH,                    0x0f8,  DDERR_INVALIDPARAMS,
+                                0,                                              0,      0    },
     };
     DWORD flags_mask = DDSD_PITCH | DDSD_LPSURFACE;
 
@@ -6366,9 +6367,14 @@ static void test_create_surface_pitch(void)
         ok((surface_desc.dwFlags & flags_mask) == test_data[i].flags_out,
                 "Test %u: Got unexpected flags %#x, expected %#x.\n",
                 i, surface_desc.dwFlags & flags_mask, test_data[i].flags_out);
-        ok(U1(surface_desc).lPitch == test_data[i].pitch_out,
-                "Test %u: Got unexpected pitch %u, expected %u.\n",
-                i, U1(surface_desc).lPitch, test_data[i].pitch_out);
+        if (sizeof(void *) != sizeof(DWORD) && test_data[i].pitch_out32 != test_data[i].pitch_out64)
+            todo_wine ok(U1(surface_desc).lPitch == test_data[i].pitch_out64,
+                    "Test %u: Got unexpected pitch %u, expected %u.\n",
+                    i, U1(surface_desc).lPitch, test_data[i].pitch_out64);
+        else
+            ok(U1(surface_desc).lPitch == test_data[i].pitch_out32,
+                    "Test %u: Got unexpected pitch %u, expected %u.\n",
+                    i, U1(surface_desc).lPitch, test_data[i].pitch_out32);
 
         IDirectDrawSurface7_Release(surface);
     }
-- 
1.7.10.4




More information about the wine-patches mailing list