Commit ee16e714 authored by Giovanni Mascellani's avatar Giovanni Mascellani Committed by Alexandre Julliard

mfplat/tests: Test locking flags for D3D9 buffers.

parent ef4441a2
...@@ -6647,6 +6647,8 @@ static void test_MFCreateDXSurfaceBuffer(void) ...@@ -6647,6 +6647,8 @@ static void test_MFCreateDXSurfaceBuffer(void)
hr = IMFMediaBuffer_QueryInterface(buffer, &IID_IMF2DBuffer2, (void **)&_2dbuffer2); hr = IMFMediaBuffer_QueryInterface(buffer, &IID_IMF2DBuffer2, (void **)&_2dbuffer2);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
/* Lock flags are ignored, so writing is allowed when locking for
* reading and viceversa. */
hr = IMF2DBuffer2_Lock2DSize(_2dbuffer2, MF2DBuffer_LockFlags_Read, &data, &pitch, &data2, &length); hr = IMF2DBuffer2_Lock2DSize(_2dbuffer2, MF2DBuffer_LockFlags_Read, &data, &pitch, &data2, &length);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(data == data2, "Unexpected scanline pointer.\n"); ok(data == data2, "Unexpected scanline pointer.\n");
...@@ -6664,9 +6666,72 @@ static void test_MFCreateDXSurfaceBuffer(void) ...@@ -6664,9 +6666,72 @@ static void test_MFCreateDXSurfaceBuffer(void)
hr = IMFMediaBuffer_Unlock(buffer); hr = IMFMediaBuffer_Unlock(buffer);
ok(hr == S_OK || broken(broken_test), "Unexpected hr %#lx.\n", hr); ok(hr == S_OK || broken(broken_test), "Unexpected hr %#lx.\n", hr);
/* Also, flags incompatibilities are not taken into account even
* if a buffer is already locked. */
hr = IMF2DBuffer2_Lock2DSize(_2dbuffer2, MF2DBuffer_LockFlags_ReadWrite, &data, &pitch, &data2, &length); hr = IMF2DBuffer2_Lock2DSize(_2dbuffer2, MF2DBuffer_LockFlags_ReadWrite, &data, &pitch, &data2, &length);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
IMF2DBuffer2_Unlock2D(_2dbuffer2); hr = IMF2DBuffer2_Lock2DSize(_2dbuffer2, MF2DBuffer_LockFlags_ReadWrite, &data, &pitch, &data2, &length);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = IMF2DBuffer2_Lock2DSize(_2dbuffer2, MF2DBuffer_LockFlags_Read, &data, &pitch, &data2, &length);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = IMF2DBuffer2_Lock2DSize(_2dbuffer2, MF2DBuffer_LockFlags_Write, &data, &pitch, &data2, &length);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = IMF2DBuffer_Lock2D(_2dbuffer, &data, &pitch);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = IMF2DBuffer2_Unlock2D(_2dbuffer2);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = IMF2DBuffer2_Unlock2D(_2dbuffer2);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = IMF2DBuffer2_Unlock2D(_2dbuffer2);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = IMF2DBuffer2_Unlock2D(_2dbuffer2);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = IMF2DBuffer2_Unlock2D(_2dbuffer2);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = IMF2DBuffer2_Lock2DSize(_2dbuffer2, MF2DBuffer_LockFlags_Read, &data, &pitch, &data2, &length);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = IMF2DBuffer2_Lock2DSize(_2dbuffer2, MF2DBuffer_LockFlags_Read, &data, &pitch, &data2, &length);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = IMF2DBuffer2_Lock2DSize(_2dbuffer2, MF2DBuffer_LockFlags_ReadWrite, &data, &pitch, &data2, &length);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = IMF2DBuffer2_Lock2DSize(_2dbuffer2, MF2DBuffer_LockFlags_Write, &data, &pitch, &data2, &length);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = IMF2DBuffer_Lock2D(_2dbuffer, &data, &pitch);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = IMF2DBuffer2_Unlock2D(_2dbuffer2);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = IMF2DBuffer2_Unlock2D(_2dbuffer2);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = IMF2DBuffer2_Unlock2D(_2dbuffer2);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = IMF2DBuffer2_Unlock2D(_2dbuffer2);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = IMF2DBuffer2_Unlock2D(_2dbuffer2);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
/* Except when originally locking for writing. */
hr = IMF2DBuffer2_Lock2DSize(_2dbuffer2, MF2DBuffer_LockFlags_Write, &data, &pitch, &data2, &length);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = IMF2DBuffer2_Lock2DSize(_2dbuffer2, MF2DBuffer_LockFlags_Write, &data, &pitch, &data2, &length);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = IMF2DBuffer2_Lock2DSize(_2dbuffer2, MF2DBuffer_LockFlags_ReadWrite, &data, &pitch, &data2, &length);
todo_wine
ok(hr == HRESULT_FROM_WIN32(ERROR_WAS_LOCKED), "Unexpected hr %#lx.\n", hr);
hr = IMF2DBuffer2_Lock2DSize(_2dbuffer2, MF2DBuffer_LockFlags_Read, &data, &pitch, &data2, &length);
todo_wine
ok(hr == HRESULT_FROM_WIN32(ERROR_WAS_LOCKED), "Unexpected hr %#lx.\n", hr);
hr = IMF2DBuffer_Lock2D(_2dbuffer, &data, &pitch);
todo_wine
ok(hr == HRESULT_FROM_WIN32(ERROR_WAS_LOCKED), "Unexpected hr %#lx.\n", hr);
hr = IMF2DBuffer2_Unlock2D(_2dbuffer2);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = IMF2DBuffer2_Unlock2D(_2dbuffer2);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = IMF2DBuffer2_Unlock2D(_2dbuffer2);
todo_wine
ok(hr == HRESULT_FROM_WIN32(ERROR_WAS_UNLOCKED), "Unexpected hr %#lx.\n", hr);
IMF2DBuffer2_Release(_2dbuffer2); IMF2DBuffer2_Release(_2dbuffer2);
......
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