[PATCH 2/3] qcap/tests: Add tests for allocator management by the video capture filter.
Zebediah Figura
z.figura12 at gmail.com
Mon Jun 14 22:47:32 CDT 2021
Signed-off-by: Zebediah Figura <z.figura12 at gmail.com>
---
dlls/qcap/tests/videocapture.c | 38 ++++++++++++++++++++++++++++++++--
1 file changed, 36 insertions(+), 2 deletions(-)
diff --git a/dlls/qcap/tests/videocapture.c b/dlls/qcap/tests/videocapture.c
index 7733dfdc8ed..530b33a1e32 100644
--- a/dlls/qcap/tests/videocapture.c
+++ b/dlls/qcap/tests/videocapture.c
@@ -360,8 +360,9 @@ static void testfilter_init(struct testfilter *filter)
strmbase_sink_init(&filter->sink, &filter->filter, L"sink", &testsink_ops, NULL);
}
-static void test_filter_state(IMediaControl *control)
+static void test_filter_state(IMediaControl *control, IMemAllocator *allocator)
{
+ IMediaSample *sample;
OAFilterState state;
HRESULT hr;
@@ -369,6 +370,9 @@ static void test_filter_state(IMediaControl *control)
ok(hr == S_OK, "Got hr %#x.\n", hr);
ok(state == State_Stopped, "Got state %u.\n", state);
+ hr = IMemAllocator_GetBuffer(allocator, &sample, NULL, NULL, 0);
+ ok(hr == VFW_E_NOT_COMMITTED, "Got hr %#x.\n", hr);
+
hr = IMediaControl_Pause(control);
ok(hr == S_OK, "Got hr %#x.\n", hr);
@@ -376,6 +380,10 @@ static void test_filter_state(IMediaControl *control)
ok(hr == VFW_S_CANT_CUE, "Got hr %#x.\n", hr);
ok(state == State_Paused, "Got state %u.\n", state);
+ hr = IMemAllocator_GetBuffer(allocator, &sample, NULL, NULL, AM_GBF_NOWAIT);
+ ok(hr == S_OK, "Got hr %#x.\n", hr);
+ IMediaSample_Release(sample);
+
hr = IMediaControl_Run(control);
ok(hr == S_OK, "Got hr %#x.\n", hr);
@@ -397,6 +405,9 @@ static void test_filter_state(IMediaControl *control)
ok(hr == S_OK, "Got hr %#x.\n", hr);
ok(state == State_Stopped, "Got state %u.\n", state);
+ hr = IMemAllocator_GetBuffer(allocator, &sample, NULL, NULL, 0);
+ ok(hr == VFW_E_NOT_COMMITTED, "Got hr %#x.\n", hr);
+
hr = IMediaControl_Run(control);
ok(hr == S_OK, "Got hr %#x.\n", hr);
@@ -404,12 +415,33 @@ static void test_filter_state(IMediaControl *control)
ok(hr == S_OK, "Got hr %#x.\n", hr);
ok(state == State_Running, "Got state %u.\n", state);
+ hr = IMemAllocator_GetBuffer(allocator, &sample, NULL, NULL, AM_GBF_NOWAIT);
+ todo_wine ok(hr == VFW_E_TIMEOUT, "Got hr %#x.\n", hr);
+ if (hr == S_OK) IMediaSample_Release(sample);
+
hr = IMediaControl_Stop(control);
ok(hr == S_OK, "Got hr %#x.\n", hr);
hr = IMediaControl_GetState(control, 0, &state);
ok(hr == S_OK, "Got hr %#x.\n", hr);
ok(state == State_Stopped, "Got state %u.\n", state);
+
+ hr = IMemAllocator_GetBuffer(allocator, &sample, NULL, NULL, 0);
+ ok(hr == VFW_E_NOT_COMMITTED, "Got hr %#x.\n", hr);
+
+ /* Test committing the allocator before the capture filter does. */
+
+ hr = IMemAllocator_Commit(allocator);
+ ok(hr == S_OK, "Got hr %#x.\n", hr);
+
+ hr = IMediaControl_Pause(control);
+ todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr);
+
+ hr = IMemAllocator_Decommit(allocator);
+ ok(hr == S_OK, "Got hr %#x.\n", hr);
+
+ hr = IMediaControl_Stop(control);
+ ok(hr == S_OK, "Got hr %#x.\n", hr);
}
static void test_connect_pin(IBaseFilter *filter, IPin *source)
@@ -460,7 +492,9 @@ static void test_connect_pin(IBaseFilter *filter, IPin *source)
hr = IFilterGraph2_ConnectDirect(graph, source, &testsink.sink.pin.IPin_iface, &req_mt);
ok(hr == S_OK, "Got hr %#x.\n", hr);
- test_filter_state(control);
+ ok(!!testsink.sink.pAllocator, "Expected to be assigned an allocator.\n");
+
+ test_filter_state(control, testsink.sink.pAllocator);
hr = IPin_ConnectedTo(source, &peer);
ok(hr == S_OK, "Got hr %#x.\n", hr);
--
2.30.2
More information about the wine-devel
mailing list