Commit 0d63116b authored by Giovanni Mascellani's avatar Giovanni Mascellani Committed by Alexandre Julliard

mfplat/tests: Test interaction between Lock() and LockRect().

parent fc940d58
......@@ -6398,6 +6398,7 @@ static void test_MFCreateDXSurfaceBuffer(void)
{
IDirect3DSurface9 *backbuffer = NULL, *surface;
IDirect3DSwapChain9 *swapchain;
D3DLOCKED_RECT locked_rect;
DWORD length, max_length;
IDirect3DDevice9 *device;
IMF2DBuffer2 *_2dbuffer2;
......@@ -6470,9 +6471,32 @@ static void test_MFCreateDXSurfaceBuffer(void)
ok(hr == S_OK, "Failed to get length, hr %#lx.\n", hr);
ok(length == 2 * max_length, "Unexpected length %lu.\n", length);
hr = IDirect3DSurface9_LockRect(backbuffer, &locked_rect, NULL, 0);
ok(hr == S_OK, "Failed to lock back buffer, hr %#lx.\n", hr);
/* Cannot lock while the surface is locked. */
hr = IMFMediaBuffer_Lock(buffer, &data, NULL, &length);
ok(hr == D3DERR_INVALIDCALL, "Unexpected hr %#lx.\n", hr);
hr = IDirect3DSurface9_UnlockRect(backbuffer);
ok(hr == S_OK, "Failed to unlock back buffer, hr %#lx.\n", hr);
hr = IMFMediaBuffer_Lock(buffer, &data, NULL, &length);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(length == max_length, "Unexpected length %lu instead of %lu.\n", length, max_length);
/* You can lock the surface while the media buffer is locked. */
hr = IDirect3DSurface9_LockRect(backbuffer, &locked_rect, NULL, 0);
ok(hr == S_OK, "Failed to lock back buffer, hr %#lx.\n", hr);
hr = IMFMediaBuffer_Lock(buffer, &data, NULL, &length);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(length == max_length, "Unexpected length.\n");
hr = IMFMediaBuffer_Unlock(buffer);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = IDirect3DSurface9_UnlockRect(backbuffer);
ok(hr == S_OK, "Failed to unlock back buffer, hr %#lx.\n", hr);
/* Unlock twice. */
hr = IMFMediaBuffer_Unlock(buffer);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment