Stefan Dösinger : ddraw: Test invalid buffer lock parameters.

Alexandre Julliard julliard at winehq.org
Fri Jan 29 10:56:35 CST 2010


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

Author: Stefan Dösinger <stefan at codeweavers.com>
Date:   Wed Jan 27 23:15:23 2010 +0100

ddraw: Test invalid buffer lock parameters.

---

 dlls/ddraw/tests/d3d.c |   53 ++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 53 insertions(+), 0 deletions(-)

diff --git a/dlls/ddraw/tests/d3d.c b/dlls/ddraw/tests/d3d.c
index 5f08929..2d17487 100644
--- a/dlls/ddraw/tests/d3d.c
+++ b/dlls/ddraw/tests/d3d.c
@@ -3172,6 +3172,58 @@ done:
     UnregisterClassA("d3d7_test_wndproc_wc", GetModuleHandleA(NULL));
 }
 
+static void VertexBufferLockRest(void)
+{
+    D3DVERTEXBUFFERDESC desc;
+    IDirect3DVertexBuffer7 *buffer;
+    HRESULT hr;
+    unsigned int i;
+    void *data;
+    const struct
+    {
+        DWORD flags;
+        const char *debug_string;
+        HRESULT result;
+    }
+    test_data[] =
+    {
+        {0,                                         "(none)",                                       D3D_OK },
+        {DDLOCK_WAIT,                               "DDLOCK_WAIT",                                  D3D_OK },
+        {DDLOCK_EVENT,                              "DDLOCK_EVENT",                                 D3D_OK },
+        {DDLOCK_READONLY,                           "DDLOCK_READONLY",                              D3D_OK },
+        {DDLOCK_WRITEONLY,                          "DDLOCK_WRITEONLY",                             D3D_OK },
+        {DDLOCK_NOSYSLOCK,                          "DDLOCK_NOSYSLOCK",                             D3D_OK },
+        {DDLOCK_NOOVERWRITE,                        "DDLOCK_NOOVERWRITE",                           D3D_OK },
+        {DDLOCK_DISCARDCONTENTS,                    "DDLOCK_DISCARDCONTENTS",                       D3D_OK },
+
+        {DDLOCK_READONLY | DDLOCK_WRITEONLY,        "DDLOCK_READONLY | DDLOCK_WRITEONLY",           D3D_OK },
+        {DDLOCK_READONLY | DDLOCK_DISCARDCONTENTS,  "DDLOCK_READONLY | DDLOCK_DISCARDCONTENTS",     D3D_OK },
+        {0xdeadbeef,                                "0xdeadbeef",                                   D3D_OK },
+    };
+
+    memset(&desc, 0 , sizeof(desc));
+    desc.dwSize = sizeof(desc);
+    desc.dwCaps = 0;
+    desc.dwFVF = D3DFVF_XYZ;
+    desc.dwNumVertices = 64;
+    hr = IDirect3D7_CreateVertexBuffer(lpD3D, &desc, &buffer, 0);
+    ok(hr == D3D_OK, "IDirect3D7_CreateVertexBuffer failed, 0x%08x\n", hr);
+
+    for(i = 0; i < (sizeof(test_data) / sizeof(*test_data)); i++)
+    {
+        hr = IDirect3DVertexBuffer7_Lock(buffer, test_data[i].flags, &data, NULL);
+        ok(hr == test_data[i].result, "Lock flags %s returned 0x%08x, expected 0x%08x\n",
+            test_data[i].debug_string, hr, test_data[i].result);
+        if(SUCCEEDED(hr))
+        {
+            hr = IDirect3DVertexBuffer7_Unlock(buffer);
+            ok(hr == D3D_OK, "IDirect3DVertexBuffer7_Unlock failed, 0x%08x\n", hr);
+        }
+    }
+
+    IDirect3DVertexBuffer7_Release(buffer);
+}
+
 START_TEST(d3d)
 {
     init_function_pointers();
@@ -3196,6 +3248,7 @@ START_TEST(d3d)
         D3D7_OldRenderStateTest();
         DeviceLoadTest();
         SetRenderTargetTest();
+        VertexBufferLockRest();
         ReleaseDirect3D();
     }
 




More information about the wine-cvs mailing list