Signed-off-by: Giovanni Mascellani gmascellani@codeweavers.com --- dlls/mfplat/tests/mfplat.c | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-)
diff --git a/dlls/mfplat/tests/mfplat.c b/dlls/mfplat/tests/mfplat.c index 9a326ae5243..c9da9fecef4 100644 --- a/dlls/mfplat/tests/mfplat.c +++ b/dlls/mfplat/tests/mfplat.c @@ -6392,6 +6392,7 @@ static void test_MFCreateDXSurfaceBuffer(void) { IDirect3DSurface9 *backbuffer = NULL, *surface; IDirect3DSwapChain9 *swapchain; + D3DLOCKED_RECT locked_rect; DWORD length, max_length; IDirect3DDevice9 *device; IMF2DBuffer2 *_2dbuffer2; @@ -6464,9 +6465,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);