Commit f9c2d8e2 authored by Maarten Lankhorst's avatar Maarten Lankhorst Committed by Alexandre Julliard

quartz: Add some more tests and fix wine to pass them.

parent 810a933f
......@@ -599,7 +599,8 @@ static HRESULT WINAPI DSoundRender_GetSyncSource(IBaseFilter * iface, IReference
EnterCriticalSection(&This->csFilter);
{
*ppClock = This->pClock;
IReferenceClock_AddRef(This->pClock);
if (This->pClock)
IReferenceClock_AddRef(This->pClock);
}
LeaveCriticalSection(&This->csFilter);
......
......@@ -36,7 +36,12 @@ static const struct IEnumPinsVtbl IEnumPinsImpl_Vtbl;
HRESULT IEnumPinsImpl_Construct(const ENUMPINDETAILS * pDetails, IEnumPins ** ppEnum)
{
IEnumPinsImpl * pEnumPins = CoTaskMemAlloc(sizeof(IEnumPinsImpl));
IEnumPinsImpl * pEnumPins;
if (!ppEnum)
return E_POINTER;
pEnumPins = CoTaskMemAlloc(sizeof(IEnumPinsImpl));
if (!pEnumPins)
{
*ppEnum = NULL;
......@@ -109,6 +114,12 @@ static HRESULT WINAPI IEnumPinsImpl_Next(IEnumPins * iface, ULONG cPins, IPin **
TRACE("(%u, %p, %p)\n", cPins, ppPins, pcFetched);
if (!ppPins)
return E_POINTER;
if (cPins > 1 && !pcFetched)
return E_INVALIDARG;
if (cFetched > 0)
{
ULONG i;
......
......@@ -463,7 +463,8 @@ static HRESULT WINAPI NullRenderer_GetSyncSource(IBaseFilter * iface, IReference
EnterCriticalSection(&This->csFilter);
{
*ppClock = This->pClock;
IReferenceClock_AddRef(This->pClock);
if (This->pClock)
IReferenceClock_AddRef(This->pClock);
}
LeaveCriticalSection(&This->csFilter);
......
......@@ -50,11 +50,21 @@ static void rungraph(void)
HRESULT hr;
IMediaControl* pmc;
IMediaEvent* pme;
IMediaFilter* pmf;
HANDLE hEvent;
hr = IGraphBuilder_QueryInterface(pgraph, &IID_IMediaControl, (LPVOID*)&pmc);
ok(hr==S_OK, "Cannot get IMediaControl interface returned: %x\n", hr);
hr = IGraphBuilder_QueryInterface(pgraph, &IID_IMediaFilter, (LPVOID*)&pmf);
ok(hr==S_OK, "Cannot get IMediaFilter interface returned: %x\n", hr);
IMediaControl_Stop(pmc);
IMediaFilter_SetSyncSource(pmf, NULL);
IMediaFilter_Release(pmf);
hr = IMediaControl_Run(pmc);
ok(hr==S_FALSE, "Cannot run the graph returned: %x\n", hr);
......@@ -64,6 +74,8 @@ static void rungraph(void)
hr = IMediaControl_Stop(pmc);
ok(hr==S_OK || hr == S_FALSE, "Cannot stop the graph returned: %x\n", hr);
IGraphBuilder_SetDefaultSyncSource(pgraph);
Sleep(10);
trace("stop -> pause\n");
hr = IMediaControl_Pause(pmc);
......@@ -97,7 +109,6 @@ static void rungraph(void)
hr = IMediaControl_Run(pmc);
ok(hr==S_OK || hr == S_FALSE, "Cannot start the graph returned: %x\n", hr);
hr = IGraphBuilder_QueryInterface(pgraph, &IID_IMediaEvent, (LPVOID*)&pme);
ok(hr==S_OK, "Cannot get IMediaEvent interface returned: %x\n", hr);
......@@ -107,7 +118,7 @@ static void rungraph(void)
/* WaitForSingleObject(hEvent, INFINITE); */
Sleep(20000);
hr = IMediaControl_Release(pme);
hr = IMediaEvent_Release(pme);
ok(hr==2, "Releasing mediaevent returned: %x\n", hr);
hr = IMediaControl_Stop(pmc);
......
......@@ -86,6 +86,69 @@ static void test_query_interface(void)
RELEASE_EXPECT(pVideoWindow, 1);
}
static void test_pin(IPin *pin)
{
IMemInputPin *mpin = NULL;
IPin_QueryInterface(pin, &IID_IMemInputPin, (void **)&mpin);
ok(mpin != NULL, "No IMemInputPin found!\n");
if (mpin)
{
ok(IMemInputPin_ReceiveCanBlock(mpin) == S_OK, "Receive can't block for pin!\n");
IMemInputPin_Release(mpin);
}
/* TODO */
}
static void test_basefilter(void)
{
IEnumPins *pin_enum = NULL;
IBaseFilter *base = NULL;
IPin *pins[2];
ULONG ref;
HRESULT hr;
IUnknown_QueryInterface(pVideoRenderer, &IID_IBaseFilter, (void *)&base);
if (base == NULL)
{
/* test_query_interface handles this case */
skip("No IBaseFilter\n");
return;
}
hr = IBaseFilter_EnumPins(base, NULL);
ok(hr == E_POINTER, "hr = %08x and not E_POINTER\n", hr);
hr= IBaseFilter_EnumPins(base, &pin_enum);
ok(hr == S_OK, "hr = %08x and not S_OK\n", hr);
hr = IEnumPins_Next(pin_enum, 1, NULL, NULL);
ok(hr == E_POINTER, "hr = %08x and not E_POINTER\n", hr);
hr = IEnumPins_Next(pin_enum, 2, pins, NULL);
ok(hr == E_INVALIDARG, "hr = %08x and not E_INVALIDARG\n", hr);
pins[0] = (void *)0xdead;
pins[1] = (void *)0xdeed;
hr = IEnumPins_Next(pin_enum, 2, pins, &ref);
ok(hr == S_FALSE, "hr = %08x instead of S_FALSE\n", hr);
ok(pins[0] != (void *)0xdead && pins[0] != NULL, "pins[0] = %p\n", pins[0]);
if (pins[0] != (void *)0xdead && pins[0] != NULL)
{
test_pin(pins[0]);
IPin_Release(pins[0]);
}
ok(pins[1] == (void *)0xdeed, "pins[1] = %p\n", pins[1]);
ref = IEnumPins_Release(pin_enum);
ok(ref == 0, "ref is %u and not 0!\n", ref);
IBaseFilter_Release(base);
}
START_TEST(videorenderer)
{
CoInitialize(NULL);
......@@ -93,6 +156,7 @@ START_TEST(videorenderer)
return;
test_query_interface();
test_basefilter();
release_video_renderer();
}
......@@ -424,7 +424,8 @@ static HRESULT WINAPI TransformFilter_GetSyncSource(IBaseFilter * iface, IRefere
EnterCriticalSection(&This->csFilter);
{
*ppClock = This->pClock;
IReferenceClock_AddRef(This->pClock);
if (This->pClock)
IReferenceClock_AddRef(This->pClock);
}
LeaveCriticalSection(&This->csFilter);
......
......@@ -754,7 +754,8 @@ static HRESULT WINAPI VideoRenderer_GetSyncSource(IBaseFilter * iface, IReferenc
EnterCriticalSection(&This->csFilter);
{
*ppClock = This->pClock;
IReferenceClock_AddRef(This->pClock);
if (This->pClock)
IReferenceClock_AddRef(This->pClock);
}
LeaveCriticalSection(&This->csFilter);
......
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