Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/quartz/tests/dsoundrender.c | 66 ++++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+)
diff --git a/dlls/quartz/tests/dsoundrender.c b/dlls/quartz/tests/dsoundrender.c index 0d48bec879..dcaedd512d 100644 --- a/dlls/quartz/tests/dsoundrender.c +++ b/dlls/quartz/tests/dsoundrender.c @@ -146,6 +146,7 @@ static void test_interfaces(void)
todo_wine check_interface(filter, &IID_IAMFilterMiscFlags, FALSE); check_interface(filter, &IID_IBasicVideo, FALSE); + check_interface(filter, &IID_IDispatch, FALSE); check_interface(filter, &IID_IKsPropertySet, FALSE); check_interface(filter, &IID_IPin, FALSE); check_interface(filter, &IID_IQualProp, FALSE); @@ -336,6 +337,70 @@ static void test_pin_info(void) ok(!ref, "Got outstanding refcount %d.\n", ref); }
+static void test_basic_audio(void) +{ + IBaseFilter *filter = create_dsound_render(); + LONG balance, volume; + ITypeInfo *typeinfo; + IBasicAudio *audio; + TYPEATTR *typeattr; + ULONG ref, count; + HRESULT hr; + + hr = IBaseFilter_QueryInterface(filter, &IID_IBasicAudio, (void **)&audio); + ok(hr == S_OK, "Got hr %#x.\n", hr); + + hr = IBasicAudio_get_Balance(audio, NULL); + ok(hr == E_POINTER, "Got hr %#x.\n", hr); + + hr = IBasicAudio_get_Balance(audio, &balance); + if (hr != VFW_E_MONO_AUDIO_HW) + { + ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(balance == 0, "Got balance %d.\n", balance); + + hr = IBasicAudio_put_Balance(audio, DSBPAN_LEFT - 1); + ok(hr == E_INVALIDARG, "Got hr %#x.\n", hr); + + hr = IBasicAudio_put_Balance(audio, DSBPAN_LEFT); + ok(hr == S_OK, "Got hr %#x.\n", hr); + + hr = IBasicAudio_get_Balance(audio, &balance); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(balance == DSBPAN_LEFT, "Got balance %d.\n", balance); + } + + hr = IBasicAudio_get_Volume(audio, &volume); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(volume == 0, "Got volume %d.\n", volume); + + hr = IBasicAudio_put_Volume(audio, DSBVOLUME_MIN - 1); + ok(hr == E_INVALIDARG, "Got hr %#x.\n", hr); + + hr = IBasicAudio_put_Volume(audio, DSBVOLUME_MIN); + ok(hr == S_OK, "Got hr %#x.\n", hr); + + hr = IBasicAudio_get_Volume(audio, &volume); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(volume == DSBVOLUME_MIN, "Got volume %d.\n", volume); + + hr = IBasicAudio_GetTypeInfoCount(audio, &count); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(count == 1, "Got count %u.\n", count); + + hr = IBasicAudio_GetTypeInfo(audio, 0, 0, &typeinfo); + ok(hr == S_OK, "Got hr %#x.\n", hr); + hr = ITypeInfo_GetTypeAttr(typeinfo, &typeattr); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(typeattr->typekind == TKIND_DISPATCH, "Got kind %u.\n", typeattr->typekind); + ok(IsEqualGUID(&typeattr->guid, &IID_IBasicAudio), "Got IID %s.\n", wine_dbgstr_guid(&typeattr->guid)); + ITypeInfo_Release(typeinfo); + + IBasicAudio_Release(audio); + ref = IBaseFilter_Release(filter); + ok(!ref, "Got outstanding refcount %d.\n", ref); +} + static void test_pin(IPin *pin) { IMemInputPin *mpin = NULL; @@ -415,6 +480,7 @@ START_TEST(dsoundrender) test_enum_pins(); test_find_pin(); test_pin_info(); + test_basic_audio(); test_basefilter();
CoUninitialize();
To match the Wine source file.
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/quartz/tests/Makefile.in | 2 +- dlls/quartz/tests/{referenceclock.c => systemclock.c} | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) rename dlls/quartz/tests/{referenceclock.c => systemclock.c} (99%)
diff --git a/dlls/quartz/tests/Makefile.in b/dlls/quartz/tests/Makefile.in index 61f53b6197..f4c56c14eb 100644 --- a/dlls/quartz/tests/Makefile.in +++ b/dlls/quartz/tests/Makefile.in @@ -12,7 +12,7 @@ C_SRCS = \ memallocator.c \ misc.c \ mpegsplit.c \ - referenceclock.c \ + systemclock.c \ videorenderer.c \ waveparser.c
diff --git a/dlls/quartz/tests/referenceclock.c b/dlls/quartz/tests/systemclock.c similarity index 99% rename from dlls/quartz/tests/referenceclock.c rename to dlls/quartz/tests/systemclock.c index 4721675c05..c051565b5b 100644 --- a/dlls/quartz/tests/referenceclock.c +++ b/dlls/quartz/tests/systemclock.c @@ -105,7 +105,7 @@ static void test_IReferenceClock_SystemClock(void) } }
-START_TEST(referenceclock) +START_TEST(systemclock) { CoInitialize(NULL);
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/quartz/tests/systemclock.c | 55 +++++++++++++++++++++------------ 1 file changed, 35 insertions(+), 20 deletions(-)
diff --git a/dlls/quartz/tests/systemclock.c b/dlls/quartz/tests/systemclock.c index c051565b5b..5b82a441c2 100644 --- a/dlls/quartz/tests/systemclock.c +++ b/dlls/quartz/tests/systemclock.c @@ -1,5 +1,5 @@ /* - * Unit tests for Direct Show functions - IReferenceClock + * System clock unit tests * * Copyright (C) 2007 Alex VillacĂs Lasso * @@ -19,30 +19,45 @@ */
#define COBJMACROS - -#include "wine/test.h" -#include "uuids.h" #include "dshow.h" -#include "control.h" +#include "wine/test.h"
-static void test_IReferenceClock_query_interface(const char * clockdesc, IReferenceClock * pClock) +static IReferenceClock *create_system_clock(void) { - HRESULT hr; - IUnknown *pF; + IReferenceClock *filter = NULL; + HRESULT hr = CoCreateInstance(&CLSID_SystemClock, NULL, CLSCTX_INPROC_SERVER, + &IID_IReferenceClock, (void **)&filter); + ok(hr == S_OK, "Got hr %#x.\n", hr); + return filter; +} + +#define check_interface(a, b, c) check_interface_(__LINE__, a, b, c) +static void check_interface_(unsigned int line, void *iface_ptr, REFIID iid, BOOL supported) +{ + IUnknown *iface = iface_ptr; + HRESULT hr, expected_hr; + IUnknown *unk; + + expected_hr = supported ? S_OK : E_NOINTERFACE; + + hr = IUnknown_QueryInterface(iface, iid, (void **)&unk); + ok_(__FILE__, line)(hr == expected_hr, "Got hr %#x, expected %#x.\n", hr, expected_hr); + if (SUCCEEDED(hr)) + IUnknown_Release(unk); +} + +static void test_interfaces(void) +{ + IReferenceClock *clock = create_system_clock(); + ULONG ref;
- hr = IReferenceClock_QueryInterface(pClock, &IID_IUnknown, (void**)&pF); - ok(hr == S_OK, "IReferenceClock_QueryInterface returned %x\n", hr); - ok(pF != NULL, "pF is NULL\n"); - if (SUCCEEDED(hr)) IUnknown_Release(pF); + check_interface(clock, &IID_IReferenceClock, TRUE); + check_interface(clock, &IID_IUnknown, TRUE);
- hr = IReferenceClock_QueryInterface(pClock, &IID_IDirectDraw, (void**)&pF); - ok(hr == E_NOINTERFACE, "IReferenceClock_QueryInterface returned %x\n", hr); - ok(pF == NULL, "pF is not NULL\n"); + check_interface(clock, &IID_IDirectDraw, FALSE);
- hr = IReferenceClock_QueryInterface(pClock, &IID_IReferenceClock, (void**)&pF); - ok(hr == S_OK, "IReferenceClock_QueryInterface returned %x\n", hr); - ok(pF != NULL, "pF is NULL\n"); - if (SUCCEEDED(hr)) IUnknown_Release(pF); + ref = IReferenceClock_Release(clock); + ok(!ref, "Got outstanding refcount %d.\n", ref); }
/* The following method expects a reference clock that will keep ticking for @@ -99,7 +114,6 @@ static void test_IReferenceClock_SystemClock(void) ok(hr == S_OK, "Unable to create reference clock from system clock %x\n", hr); if (hr == S_OK) { - test_IReferenceClock_query_interface("SystemClock", pReferenceClock); test_IReferenceClock_methods("SystemClock", pReferenceClock); IReferenceClock_Release(pReferenceClock); } @@ -109,6 +123,7 @@ START_TEST(systemclock) { CoInitialize(NULL);
+ test_interfaces(); test_IReferenceClock_SystemClock();
CoUninitialize();
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/quartz/tests/systemclock.c | 78 +++++++++++---------------------- 1 file changed, 25 insertions(+), 53 deletions(-)
diff --git a/dlls/quartz/tests/systemclock.c b/dlls/quartz/tests/systemclock.c index 5b82a441c2..1aa7783c2e 100644 --- a/dlls/quartz/tests/systemclock.c +++ b/dlls/quartz/tests/systemclock.c @@ -60,63 +60,35 @@ static void test_interfaces(void) ok(!ref, "Got outstanding refcount %d.\n", ref); }
-/* The following method expects a reference clock that will keep ticking for - * at least 5 seconds since its creation. This method assumes no other methods - * were called on the IReferenceClock interface since its creation. - */ -static void test_IReferenceClock_methods(const char * clockdesc, IReferenceClock * pClock) +static void test_get_time(void) { + IReferenceClock *clock = create_system_clock(); + REFERENCE_TIME time1, time2; HRESULT hr; - REFERENCE_TIME time1; - REFERENCE_TIME time2; - LONG diff; - - /* Test response from invalid (NULL) argument */ - hr = IReferenceClock_GetTime(pClock, NULL); - ok (hr == E_POINTER, "%s - Expected E_POINTER (0x%08x), got 0x%08x\n", clockdesc, E_POINTER, hr); - - /* Test response for valid value - try 1 */ - /* TODO: test whether Windows actually returns S_FALSE in its first invocation */ - time1 = (REFERENCE_TIME)0xdeadbeef; - hr = IReferenceClock_GetTime(pClock, &time1); - ok (hr == S_FALSE || hr == S_OK, "%s - Expected S_OK or S_FALSE, got 0x%08x\n", clockdesc, hr); - ok (time1 != 0xdeadbeef, "%s - value was NOT changed on return!\n", clockdesc); - - /* Test response for valid value - try 2 */ - time2 = (REFERENCE_TIME)0xdeadbeef; - hr = IReferenceClock_GetTime(pClock, &time2); - ok (hr == S_FALSE || hr == S_OK, "%s - Expected S_OK or S_FALSE, got 0x%08x\n", clockdesc, hr); - ok (time2 != 0xdeadbeef, "%s - value was NOT changed on return!\n", clockdesc); - - /* In case the second invocation managed to return S_FALSE, MSDN says the - returned time is the same as the previous one. */ - ok ((hr != S_FALSE || time1 == time2), "%s - returned S_FALSE, but values not equal!\n", clockdesc); - - time1 = time2; - Sleep(1000); /* Sleep for at least 1 second */ - hr = IReferenceClock_GetTime(pClock, &time2); - /* After a 1-second sleep, there is no excuse to get S_FALSE (see TODO above) */ - ok (hr == S_OK, "%s - Expected S_OK, got 0x%08x\n", clockdesc, hr); - - /* FIXME: How much deviation should be allowed after a sleep? */ - /* 0.3% is common, and 0.4% is sometimes observed. */ - diff = time2 - time1; - ok (9940000 <= diff && diff <= 10240000, "%s - Expected difference around 10000000, got %u\n", clockdesc, diff); + ULONG ref;
-} + hr = IReferenceClock_GetTime(clock, NULL); + ok(hr == E_POINTER, "Got hr %#x.\n", hr);
-static void test_IReferenceClock_SystemClock(void) -{ - IReferenceClock * pReferenceClock; - HRESULT hr; + hr = IReferenceClock_GetTime(clock, &time1); + time2 = GetTickCount64() * 10000; + todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(time1 % 10000 == 0, "Expected no less than 1ms coarseness, but got time %s.\n", + wine_dbgstr_longlong(time1)); + todo_wine ok(abs(time1 - time2) < 20 * 10000, "Expected about %s, got %s.\n", + wine_dbgstr_longlong(time2), wine_dbgstr_longlong(time1));
- hr = CoCreateInstance(&CLSID_SystemClock, NULL, CLSCTX_INPROC_SERVER, &IID_IReferenceClock, (LPVOID*)&pReferenceClock); - ok(hr == S_OK, "Unable to create reference clock from system clock %x\n", hr); - if (hr == S_OK) - { - test_IReferenceClock_methods("SystemClock", pReferenceClock); - IReferenceClock_Release(pReferenceClock); - } + hr = IReferenceClock_GetTime(clock, &time2); + ok(hr == (time2 == time1 ? S_FALSE : S_OK), "Got hr %#x.\n", hr); + + Sleep(100); + hr = IReferenceClock_GetTime(clock, &time2); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(time2 - time1 > 98 * 10000, "Expected about %s, but got %s.\n", + wine_dbgstr_longlong(time1 + 98 * 10000), wine_dbgstr_longlong(time2)); + + ref = IReferenceClock_Release(clock); + ok(!ref, "Got outstanding refcount %d.\n", ref); }
START_TEST(systemclock) @@ -124,7 +96,7 @@ START_TEST(systemclock) CoInitialize(NULL);
test_interfaces(); - test_IReferenceClock_SystemClock(); + test_get_time();
CoUninitialize(); }
Hi,
While running your changed tests on Windows, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=49233
Your paranoid android.
=== wxppro (32 bit report) ===
quartz: systemclock: Timeout
=== w2003std (32 bit report) ===
quartz: systemclock: Timeout
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/quartz/systemclock.c | 38 ++++++++++++++++----------------- dlls/quartz/tests/systemclock.c | 4 ++-- 2 files changed, 21 insertions(+), 21 deletions(-)
diff --git a/dlls/quartz/systemclock.c b/dlls/quartz/systemclock.c index 1638e1117e..c809ce4bfc 100644 --- a/dlls/quartz/systemclock.c +++ b/dlls/quartz/systemclock.c @@ -44,8 +44,7 @@ typedef struct SystemClockImpl { HANDLE adviseThread; DWORD adviseThreadId; BOOL adviseThreadActive; - REFERENCE_TIME lastRefTime; - DWORD lastTimeTickCount; + REFERENCE_TIME last_time; CRITICAL_SECTION safe;
SystemClockAdviseEntry* pSingleShotAdvise; @@ -240,26 +239,28 @@ static ULONG WINAPI SystemClockImpl_Release(IReferenceClock* iface) { return ref; }
-static HRESULT WINAPI SystemClockImpl_GetTime(IReferenceClock* iface, REFERENCE_TIME* pTime) { - SystemClockImpl *This = impl_from_IReferenceClock(iface); - DWORD curTimeTickCount; - HRESULT hr = S_OK; +static HRESULT WINAPI SystemClockImpl_GetTime(IReferenceClock *iface, REFERENCE_TIME *time) +{ + SystemClockImpl *clock = impl_from_IReferenceClock(iface); + REFERENCE_TIME ret; + HRESULT hr;
- TRACE("(%p, %p)\n", This, pTime); + TRACE("clock %p, time %p.\n", clock, time);
- if (NULL == pTime) { - return E_POINTER; - } + if (!time) { + return E_POINTER; + }
- curTimeTickCount = GetTickCount(); + ret = GetTickCount64() * 10000;
- EnterCriticalSection(&This->safe); - if (This->lastTimeTickCount == curTimeTickCount) hr = S_FALSE; - This->lastRefTime += (REFERENCE_TIME) (DWORD) (curTimeTickCount - This->lastTimeTickCount) * (REFERENCE_TIME) 10000; - This->lastTimeTickCount = curTimeTickCount; - *pTime = This->lastRefTime; - LeaveCriticalSection(&This->safe); - return hr; + EnterCriticalSection(&clock->safe); + + hr = (ret == clock->last_time) ? S_FALSE : S_OK; + *time = clock->last_time = ret; + + LeaveCriticalSection(&clock->safe); + + return hr; }
static HRESULT WINAPI SystemClockImpl_AdviseTime(IReferenceClock* iface, REFERENCE_TIME rtBaseTime, REFERENCE_TIME rtStreamTime, HEVENT hEvent, DWORD_PTR* pdwAdviseCookie) { @@ -389,7 +390,6 @@ HRESULT QUARTZ_CreateSystemClock(IUnknown * pUnkOuter, LPVOID * ppv) { obj->IReferenceClock_iface.lpVtbl = &SystemClock_Vtbl; obj->ref = 0; /* will be inited by QueryInterface */
- obj->lastTimeTickCount = GetTickCount(); InitializeCriticalSection(&obj->safe); obj->safe.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": SystemClockImpl.safe");
diff --git a/dlls/quartz/tests/systemclock.c b/dlls/quartz/tests/systemclock.c index 1aa7783c2e..c4d1b3defc 100644 --- a/dlls/quartz/tests/systemclock.c +++ b/dlls/quartz/tests/systemclock.c @@ -72,10 +72,10 @@ static void test_get_time(void)
hr = IReferenceClock_GetTime(clock, &time1); time2 = GetTickCount64() * 10000; - todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(hr == S_OK, "Got hr %#x.\n", hr); ok(time1 % 10000 == 0, "Expected no less than 1ms coarseness, but got time %s.\n", wine_dbgstr_longlong(time1)); - todo_wine ok(abs(time1 - time2) < 20 * 10000, "Expected about %s, got %s.\n", + ok(abs(time1 - time2) < 20 * 10000, "Expected about %s, got %s.\n", wine_dbgstr_longlong(time2), wine_dbgstr_longlong(time1));
hr = IReferenceClock_GetTime(clock, &time2);
Hi,
While running your changed tests on Windows, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=49234
Your paranoid android.
=== wxppro (32 bit report) ===
quartz: systemclock: Timeout
=== w2003std (32 bit report) ===
quartz: systemclock: Timeout
=== debian9 (32 bit report) ===
quartz: dsoundrender.c:395: Test failed: Got kind 3.
=== debian9 (32 bit Chinese:China report) ===
quartz: dsoundrender.c:395: Test failed: Got kind 3.
=== debian9 (32 bit WoW report) ===
quartz: dsoundrender.c:395: Test failed: Got kind 3.
=== debian9 (64 bit WoW report) ===
quartz: dsoundrender.c:395: Test failed: Got kind 3.
Hi,
While running your changed tests on Windows, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=49230
Your paranoid android.
=== debian9 (32 bit report) ===
quartz: dsoundrender.c:395: Test failed: Got kind 3.
=== debian9 (32 bit French report) ===
quartz: dsoundrender.c:395: Test failed: Got kind 3.
=== debian9 (32 bit Japanese:Japan report) ===
quartz: dsoundrender.c:395: Test failed: Got kind 3.
=== debian9 (32 bit Chinese:China report) ===
quartz: dsoundrender.c:395: Test failed: Got kind 3.
=== debian9 (32 bit WoW report) ===
quartz: dsoundrender.c:395: Test failed: Got kind 3.
=== debian9 (64 bit WoW report) ===
quartz: dsoundrender.c:395: Test failed: Got kind 3.