From: Bernhard Kölbl besentv@gmail.com
Signed-off-by: Bernhard Kölbl besentv@gmail.com --- dlls/windows.media.speech/tests/speech.c | 1 - 1 file changed, 1 deletion(-)
diff --git a/dlls/windows.media.speech/tests/speech.c b/dlls/windows.media.speech/tests/speech.c index 33da6828dc2..e5dbc289840 100644 --- a/dlls/windows.media.speech/tests/speech.c +++ b/dlls/windows.media.speech/tests/speech.c @@ -1135,7 +1135,6 @@ static void test_SpeechRecognizer(void) ok(!WaitForSingleObject(compilation_handler.event_finished, 5000), "Wait for event_finished failed.\n");
todo_wine ok(compilation_handler.ref == 3, "Got unexpected ref %lu.\n", compilation_handler.ref); - todo_wine check_refcount(operation, 3);
handler = (void*)0xdeadbeef; old_ref = compilation_handler.ref;
From: Bernhard Kölbl besentv@gmail.com
Signed-off-by: Bernhard Kölbl besentv@gmail.com --- dlls/windows.media.speech/async.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-)
diff --git a/dlls/windows.media.speech/async.c b/dlls/windows.media.speech/async.c index 79510d61dc7..eceda4338b3 100644 --- a/dlls/windows.media.speech/async.c +++ b/dlls/windows.media.speech/async.c @@ -231,11 +231,12 @@ static const struct IAsyncOperation_IInspectableVtbl async_inspectable_vtbl =
/* * - * IAsyncInfo + * IAsyncInfo for IAsyncOperation<IInspectable*> * */
-DEFINE_IINSPECTABLE(async_inspectable_info, IAsyncInfo, struct async_inspectable, IAsyncOperation_IInspectable_iface) +DEFINE_IINSPECTABLE_(async_inspectable_info, IAsyncInfo, struct async_inspectable, + async_inspectable_impl_from_IAsyncInfo, IAsyncInfo_iface, &impl->IAsyncOperation_IInspectable_iface)
static HRESULT WINAPI async_inspectable_info_get_Id( IAsyncInfo *iface, UINT32 *id ) { @@ -245,7 +246,7 @@ static HRESULT WINAPI async_inspectable_info_get_Id( IAsyncInfo *iface, UINT32 *
static HRESULT WINAPI async_inspectable_info_get_Status( IAsyncInfo *iface, AsyncStatus *status ) { - struct async_inspectable *impl = impl_from_IAsyncInfo(iface); + struct async_inspectable *impl = async_inspectable_impl_from_IAsyncInfo(iface); HRESULT hr = S_OK;
TRACE("iface %p, status %p.\n", iface, status); @@ -261,7 +262,7 @@ static HRESULT WINAPI async_inspectable_info_get_Status( IAsyncInfo *iface, Asyn
static HRESULT WINAPI async_inspectable_info_get_ErrorCode( IAsyncInfo *iface, HRESULT *error_code ) { - struct async_inspectable *impl = impl_from_IAsyncInfo(iface); + struct async_inspectable *impl = async_inspectable_impl_from_IAsyncInfo(iface); HRESULT hr = S_OK;
TRACE("iface %p, error_code %p.\n", iface, error_code); @@ -278,7 +279,7 @@ static HRESULT WINAPI async_inspectable_info_get_ErrorCode( IAsyncInfo *iface, H
static HRESULT WINAPI async_inspectable_info_Cancel( IAsyncInfo *iface ) { - struct async_inspectable *impl = impl_from_IAsyncInfo(iface); + struct async_inspectable *impl = async_inspectable_impl_from_IAsyncInfo(iface); HRESULT hr = S_OK;
TRACE("iface %p.\n", iface); @@ -295,7 +296,7 @@ static HRESULT WINAPI async_inspectable_info_Cancel( IAsyncInfo *iface )
static HRESULT WINAPI async_inspectable_info_Close( IAsyncInfo *iface ) { - struct async_inspectable *impl = impl_from_IAsyncInfo(iface); + struct async_inspectable *impl = async_inspectable_impl_from_IAsyncInfo(iface); HRESULT hr = S_OK;
TRACE("iface %p.\n", iface);
From: Bernhard Kölbl besentv@gmail.com
So it can be used more generic.
Signed-off-by: Bernhard Kölbl besentv@gmail.com --- dlls/windows.media.speech/tests/speech.c | 84 ++++++++++++------------ 1 file changed, 42 insertions(+), 42 deletions(-)
diff --git a/dlls/windows.media.speech/tests/speech.c b/dlls/windows.media.speech/tests/speech.c index e5dbc289840..99304e57865 100644 --- a/dlls/windows.media.speech/tests/speech.c +++ b/dlls/windows.media.speech/tests/speech.c @@ -54,11 +54,7 @@ #define impl_from_IHandler_RecognitionCompleted impl_from_ITypedEventHandler_SpeechContinuousRecognitionSession_SpeechContinuousRecognitionCompletedEventArgs #define IHandler_RecognitionCompleted_iface ITypedEventHandler_SpeechContinuousRecognitionSession_SpeechContinuousRecognitionCompletedEventArgs_iface
-#define IAsyncHandler_Compilation IAsyncOperationCompletedHandler_SpeechRecognitionCompilationResult -#define IAsyncHandler_CompilationVtbl IAsyncOperationCompletedHandler_SpeechRecognitionCompilationResultVtbl -#define IID_IAsyncHandler_Compilation IID_IAsyncOperationCompletedHandler_SpeechRecognitionCompilationResult -#define impl_from_IAsyncHandler_Compilation impl_from_IAsyncOperationCompletedHandler_SpeechRecognitionCompilationResult -#define IAsyncHandler_Compilation_iface IAsyncOperationCompletedHandler_SpeechRecognitionCompilationResult_iface +#define IAsyncHandler_IInspectable_iface IAsyncOperationCompletedHandler_IInspectable_iface
HRESULT WINAPI (*pDllGetActivationFactory)(HSTRING, IActivationFactory **); static BOOL is_win10_1507 = FALSE; @@ -234,9 +230,10 @@ static HRESULT WINAPI recognition_result_handler_create_static( struct recogniti return S_OK; }
-struct compilation_handler +struct async_inspectable_handler { - IAsyncHandler_Compilation IAsyncHandler_Compilation_iface; + IAsyncOperationCompletedHandler_IInspectable IAsyncHandler_IInspectable_iface; + const GUID *iid; LONG ref;
HANDLE event_block; @@ -244,18 +241,20 @@ struct compilation_handler DWORD thread_id; };
-static inline struct compilation_handler *impl_from_IAsyncHandler_Compilation( IAsyncHandler_Compilation *iface ) +static inline struct async_inspectable_handler *impl_from_IAsyncOperationCompletedHandler_IInspectable( IAsyncOperationCompletedHandler_IInspectable *iface ) { - return CONTAINING_RECORD(iface, struct compilation_handler, IAsyncHandler_Compilation_iface); + return CONTAINING_RECORD(iface, struct async_inspectable_handler, IAsyncHandler_IInspectable_iface); }
-HRESULT WINAPI compilation_handler_QueryInterface( IAsyncHandler_Compilation *iface, - REFIID iid, - void **out ) +HRESULT WINAPI async_inspectable_handler_QueryInterface( IAsyncOperationCompletedHandler_IInspectable *iface, + REFIID iid, + void **out ) { + struct async_inspectable_handler *impl = impl_from_IAsyncOperationCompletedHandler_IInspectable(iface); + if (IsEqualGUID(iid, &IID_IUnknown) || IsEqualGUID(iid, &IID_IAgileObject) || - IsEqualGUID(iid, &IID_IAsyncHandler_Compilation)) + IsEqualGUID(iid, impl->iid)) { IUnknown_AddRef(iface); *out = iface; @@ -267,27 +266,27 @@ HRESULT WINAPI compilation_handler_QueryInterface( IAsyncHandler_Compilation *if return E_NOINTERFACE; }
-ULONG WINAPI compilation_handler_AddRef( IAsyncHandler_Compilation *iface ) +ULONG WINAPI async_inspectable_handler_AddRef( IAsyncOperationCompletedHandler_IInspectable *iface ) { - struct compilation_handler *impl = impl_from_IAsyncHandler_Compilation(iface); + struct async_inspectable_handler *impl = impl_from_IAsyncOperationCompletedHandler_IInspectable(iface); ULONG ref = InterlockedIncrement(&impl->ref); return ref; }
-ULONG WINAPI compilation_handler_Release( IAsyncHandler_Compilation *iface ) +ULONG WINAPI async_inspectable_handler_Release( IAsyncOperationCompletedHandler_IInspectable *iface ) { - struct compilation_handler *impl = impl_from_IAsyncHandler_Compilation(iface); + struct async_inspectable_handler *impl = impl_from_IAsyncOperationCompletedHandler_IInspectable(iface); ULONG ref = InterlockedDecrement(&impl->ref); return ref; }
-HRESULT WINAPI compilation_handler_Invoke( IAsyncHandler_Compilation *iface, - IAsyncOperation_SpeechRecognitionCompilationResult *info, - AsyncStatus status ) +HRESULT WINAPI async_inspectable_handler_Invoke( IAsyncOperationCompletedHandler_IInspectable *iface, + IAsyncOperation_IInspectable *sender, + AsyncStatus status ) { - struct compilation_handler *impl = impl_from_IAsyncHandler_Compilation(iface); + struct async_inspectable_handler *impl = impl_from_IAsyncOperationCompletedHandler_IInspectable(iface); DWORD id = GetCurrentThreadId(); - trace("Iface %p, info %p, status %d.\n", iface, info, status); + trace("Iface %p, sender %p, status %d.\n", iface, sender, status); trace("Caller thread id %lu callback thread id %lu.\n", impl->thread_id, id);
/* Signal finishing of the handler. */ @@ -298,20 +297,21 @@ HRESULT WINAPI compilation_handler_Invoke( IAsyncHandler_Compilation *iface, return S_OK; }
-static const struct IAsyncHandler_CompilationVtbl compilation_handler_vtbl = +static const struct IAsyncOperationCompletedHandler_IInspectableVtbl asnyc_inspectable_handler_vtbl = { /* IUnknown methods */ - compilation_handler_QueryInterface, - compilation_handler_AddRef, - compilation_handler_Release, - /* IAsyncOperationCompletedHandler<SpeechRecognitionCompilationResult* > methods */ - compilation_handler_Invoke + async_inspectable_handler_QueryInterface, + async_inspectable_handler_AddRef, + async_inspectable_handler_Release, + /* IAsyncOperationCompletedHandler<IInspectable* > methods */ + async_inspectable_handler_Invoke };
-static HRESULT WINAPI compilation_handler_create_static( struct compilation_handler *impl ) +static HRESULT WINAPI async_inspectable_handler_create_static( struct async_inspectable_handler *impl, const GUID *iid ) { - impl->IAsyncHandler_Compilation_iface.lpVtbl = &compilation_handler_vtbl; + impl->IAsyncOperationCompletedHandler_IInspectable_iface.lpVtbl = &asnyc_inspectable_handler_vtbl; + impl->iid = iid; impl->ref = 1;
return S_OK; @@ -817,8 +817,8 @@ static void test_VoiceInformation(void)
struct put_completed_thread_param { - IAsyncOperationCompletedHandler_SpeechRecognitionCompilationResult *handler; - IAsyncOperation_SpeechRecognitionCompilationResult *operation; + IAsyncOperationCompletedHandler_IInspectable *handler; + IAsyncOperation_IInspectable *operation; };
static DWORD WINAPI put_completed_thread(void *arg) @@ -826,7 +826,7 @@ static DWORD WINAPI put_completed_thread(void *arg) struct put_completed_thread_param *param = arg; HRESULT hr;
- hr = IAsyncOperation_SpeechRecognitionCompilationResult_put_Completed(param->operation, param->handler); + hr = IAsyncOperation_IInspectable_put_Completed(param->operation, param->handler); ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
return 0; @@ -850,9 +850,9 @@ static void test_SpeechRecognizer(void) ILanguage *language = NULL; IAsyncInfo *info = NULL; struct put_completed_thread_param put_completed_param; + struct async_inspectable_handler compilation_handler; struct completed_event_handler completed_handler; struct recognition_result_handler result_handler; - struct compilation_handler compilation_handler; SpeechRecognitionResultStatus result_status; EventRegistrationToken token = { .value = 0 }; AsyncStatus async_status; @@ -972,7 +972,7 @@ static void test_SpeechRecognizer(void) ref = IVector_ISpeechRecognitionConstraint_Release(constraints); ok(ref == 1, "Got unexpected ref %lu.\n", ref);
- compilation_handler_create_static(&compilation_handler); + async_inspectable_handler_create_static(&compilation_handler, &IID_IAsyncOperationCompletedHandler_SpeechRecognitionCompilationResult); compilation_handler.event_finished = CreateEventW(NULL, FALSE, FALSE, NULL); compilation_handler.thread_id = GetCurrentThreadId();
@@ -991,7 +991,7 @@ static void test_SpeechRecognizer(void) ok(hr == E_ILLEGAL_METHOD_CALL, "Got unexpected hr %#lx.\n", hr); ok(compilation_result == (void*)0xdeadbeef, "Compilation result had value %p.\n", compilation_result);
- hr = IAsyncOperation_SpeechRecognitionCompilationResult_put_Completed(operation, &compilation_handler.IAsyncHandler_Compilation_iface); + hr = IAsyncOperation_IInspectable_put_Completed((IAsyncOperation_IInspectable *) operation, &compilation_handler.IAsyncHandler_IInspectable_iface); ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
ok(!WaitForSingleObject(compilation_handler.event_finished, 1000), "Wait for event_finished failed.\n"); @@ -1072,7 +1072,7 @@ static void test_SpeechRecognizer(void) IAsyncOperation_SpeechRecognitionCompilationResult_Release(operation);
/* Test if AsyncOperation is started immediately. */ - compilation_handler_create_static(&compilation_handler); + async_inspectable_handler_create_static(&compilation_handler, &IID_IAsyncOperationCompletedHandler_SpeechRecognitionCompilationResult); compilation_handler.event_finished = CreateEventW(NULL, FALSE, FALSE, NULL); compilation_handler.thread_id = GetCurrentThreadId();
@@ -1090,7 +1090,7 @@ static void test_SpeechRecognizer(void) ok(hr == S_OK, "IAsyncInfo_get_Status failed, hr %#lx.\n", hr); ok(async_status != AsyncStatus_Closed, "Status was %#x.\n", async_status);
- hr = IAsyncOperation_SpeechRecognitionCompilationResult_put_Completed(operation, &compilation_handler.IAsyncHandler_Compilation_iface); + hr = IAsyncOperation_IInspectable_put_Completed((IAsyncOperation_IInspectable *) operation, &compilation_handler.IAsyncHandler_IInspectable_iface); ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
ok(!WaitForSingleObject(compilation_handler.event_finished, 1000), "Wait for event_finished failed.\n"); @@ -1117,7 +1117,7 @@ static void test_SpeechRecognizer(void) hr = IInspectable_QueryInterface(inspectable, &IID_ISpeechRecognizer, (void **)&recognizer); ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
- compilation_handler_create_static(&compilation_handler); + async_inspectable_handler_create_static(&compilation_handler, &IID_IAsyncOperationCompletedHandler_SpeechRecognitionCompilationResult); compilation_handler.event_block = CreateEventW(NULL, FALSE, FALSE, NULL); compilation_handler.event_finished = CreateEventW(NULL, FALSE, FALSE, NULL); compilation_handler.thread_id = GetCurrentThreadId(); @@ -1128,8 +1128,8 @@ static void test_SpeechRecognizer(void) hr = ISpeechRecognizer_CompileConstraintsAsync(recognizer, &operation); ok(hr == S_OK, "ISpeechRecognizer_CompileConstraintsAsync failed, hr %#lx.\n", hr);
- put_completed_param.handler = &compilation_handler.IAsyncHandler_Compilation_iface; - put_completed_param.operation = operation; + put_completed_param.handler = &compilation_handler.IAsyncHandler_IInspectable_iface; + put_completed_param.operation = (IAsyncOperation_IInspectable *)operation; put_thread = CreateThread(NULL, 0, put_completed_thread, &put_completed_param, 0, NULL);
ok(!WaitForSingleObject(compilation_handler.event_finished, 5000), "Wait for event_finished failed.\n"); @@ -1140,7 +1140,7 @@ static void test_SpeechRecognizer(void) old_ref = compilation_handler.ref; hr = IAsyncOperation_SpeechRecognitionCompilationResult_get_Completed(operation, &handler); ok(hr == S_OK, "IAsyncOperation_SpeechRecognitionCompilationResult_get_Completed failed, hr %#lx.\n", hr); - todo_wine ok(handler == &compilation_handler.IAsyncHandler_Compilation_iface, "Handler was %p.\n", handler); + todo_wine ok(handler == (void *)&compilation_handler.IAsyncHandler_IInspectable_iface, "Handler was %p.\n", handler);
ref = compilation_handler.ref - old_ref; todo_wine ok(ref == 1, "The ref was increased by %lu.\n", ref);
From: Bernhard Kölbl besentv@gmail.com
Signed-off-by: Bernhard Kölbl besentv@gmail.com --- dlls/windows.media.speech/tests/speech.c | 43 ++++++++++++------------ 1 file changed, 22 insertions(+), 21 deletions(-)
diff --git a/dlls/windows.media.speech/tests/speech.c b/dlls/windows.media.speech/tests/speech.c index 99304e57865..1d7d91b62bd 100644 --- a/dlls/windows.media.speech/tests/speech.c +++ b/dlls/windows.media.speech/tests/speech.c @@ -307,7 +307,6 @@ static const struct IAsyncOperationCompletedHandler_IInspectableVtbl asnyc_inspe async_inspectable_handler_Invoke };
- static HRESULT WINAPI async_inspectable_handler_create_static( struct async_inspectable_handler *impl, const GUID *iid ) { impl->IAsyncOperationCompletedHandler_IInspectable_iface.lpVtbl = &asnyc_inspectable_handler_vtbl; @@ -317,6 +316,22 @@ static HRESULT WINAPI async_inspectable_handler_create_static( struct async_insp return S_OK; }
+#define await_async_inspectable(operation, handler, iid) await_async_inspectable_(__LINE__, operation, handler, iid) +static void await_async_inspectable_( unsigned int line, IAsyncOperation_IInspectable *operation, struct async_inspectable_handler *handler, const GUID *handler_iid ) +{ + HRESULT hr; + + async_inspectable_handler_create_static(handler, handler_iid); + handler->event_block = NULL; + handler->event_finished = CreateEventW(NULL, FALSE, FALSE, NULL); + ok_(__FILE__, line)(!!handler->event_finished, "event_finished wasn't created.\n"); + + hr = IAsyncOperation_IInspectable_put_Completed(operation, &handler->IAsyncHandler_IInspectable_iface); + ok_(__FILE__, line)(hr == S_OK, "IAsyncOperation_IInspectable_put_Completed failed, hr %#lx.\n", hr); + ok_(__FILE__, line)(!WaitForSingleObject(handler->event_finished , 5000), "Wait for event_finished failed.\n"); + CloseHandle(handler->event_finished); +} + struct iterator_hstring { IIterator_HSTRING IIterator_HSTRING_iface; @@ -972,10 +987,6 @@ static void test_SpeechRecognizer(void) ref = IVector_ISpeechRecognitionConstraint_Release(constraints); ok(ref == 1, "Got unexpected ref %lu.\n", ref);
- async_inspectable_handler_create_static(&compilation_handler, &IID_IAsyncOperationCompletedHandler_SpeechRecognitionCompilationResult); - compilation_handler.event_finished = CreateEventW(NULL, FALSE, FALSE, NULL); - compilation_handler.thread_id = GetCurrentThreadId(); - hr = ISpeechRecognizer_CompileConstraintsAsync(recognizer, &operation); ok(hr == S_OK, "ISpeechRecognizer_CompileConstraintsAsync failed, hr %#lx.\n", hr);
@@ -991,11 +1002,9 @@ static void test_SpeechRecognizer(void) ok(hr == E_ILLEGAL_METHOD_CALL, "Got unexpected hr %#lx.\n", hr); ok(compilation_result == (void*)0xdeadbeef, "Compilation result had value %p.\n", compilation_result);
- hr = IAsyncOperation_IInspectable_put_Completed((IAsyncOperation_IInspectable *) operation, &compilation_handler.IAsyncHandler_IInspectable_iface); - ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr); - - ok(!WaitForSingleObject(compilation_handler.event_finished, 1000), "Wait for event_finished failed.\n"); - CloseHandle(compilation_handler.event_finished); + await_async_inspectable((IAsyncOperation_IInspectable *)operation, + &compilation_handler, + &IID_IAsyncOperationCompletedHandler_SpeechRecognitionCompilationResult);
hr = IAsyncOperation_SpeechRecognitionCompilationResult_put_Completed(operation, NULL); ok(hr == E_ILLEGAL_DELEGATE_ASSIGNMENT, "Got unexpected hr %#lx.\n", hr); @@ -1072,12 +1081,6 @@ static void test_SpeechRecognizer(void) IAsyncOperation_SpeechRecognitionCompilationResult_Release(operation);
/* Test if AsyncOperation is started immediately. */ - async_inspectable_handler_create_static(&compilation_handler, &IID_IAsyncOperationCompletedHandler_SpeechRecognitionCompilationResult); - compilation_handler.event_finished = CreateEventW(NULL, FALSE, FALSE, NULL); - compilation_handler.thread_id = GetCurrentThreadId(); - - ok(compilation_handler.event_finished != NULL, "Finished event wasn't created.\n"); - hr = ISpeechRecognizer_CompileConstraintsAsync(recognizer, &operation); ok(hr == S_OK, "ISpeechRecognizer_CompileConstraintsAsync failed, hr %#lx.\n", hr); check_interface(operation, &IID_IAgileObject, TRUE); @@ -1090,11 +1093,9 @@ static void test_SpeechRecognizer(void) ok(hr == S_OK, "IAsyncInfo_get_Status failed, hr %#lx.\n", hr); ok(async_status != AsyncStatus_Closed, "Status was %#x.\n", async_status);
- hr = IAsyncOperation_IInspectable_put_Completed((IAsyncOperation_IInspectable *) operation, &compilation_handler.IAsyncHandler_IInspectable_iface); - ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr); - - ok(!WaitForSingleObject(compilation_handler.event_finished, 1000), "Wait for event_finished failed.\n"); - CloseHandle(compilation_handler.event_finished); + await_async_inspectable((IAsyncOperation_IInspectable *)operation, + &compilation_handler, + &IID_IAsyncOperationCompletedHandler_SpeechRecognitionCompilationResult);
async_status = 0xdeadbeef; hr = IAsyncInfo_get_Status(info, &async_status);
From: Bernhard Kölbl besentv@gmail.com
Signed-off-by: Bernhard Kölbl besentv@gmail.com --- dlls/windows.media.speech/tests/speech.c | 80 +++++++++++++----------- 1 file changed, 42 insertions(+), 38 deletions(-)
diff --git a/dlls/windows.media.speech/tests/speech.c b/dlls/windows.media.speech/tests/speech.c index 1d7d91b62bd..6f33e8d1983 100644 --- a/dlls/windows.media.speech/tests/speech.c +++ b/dlls/windows.media.speech/tests/speech.c @@ -332,6 +332,39 @@ static void await_async_inspectable_( unsigned int line, IAsyncOperation_IInspec CloseHandle(handler->event_finished); }
+#define check_async_info(obj, exp_id, exp_status, exp_hr) check_asnyc_info_(__LINE__, obj, exp_id, exp_status, exp_hr) +static void check_asnyc_info_( unsigned int line, IInspectable *async_obj, UINT32 expect_id, AsyncStatus expect_status, HRESULT expect_hr) +{ + IAsyncInfo *async_info; + AsyncStatus async_status; + UINT32 async_id; + HRESULT hr, async_hr; + + hr = IInspectable_QueryInterface(async_obj, &IID_IAsyncInfo, (void **)&async_info); + ok_(__FILE__, line)(hr == S_OK, "Got unexpected hr %#lx.\n", hr); + + async_id = 0xdeadbeef; + hr = IAsyncInfo_get_Id(async_info, &async_id); + if (expect_status < 4) todo_wine ok_(__FILE__, line)(hr == S_OK, "IAsyncInfo_get_Id returned %#lx\n", hr); + else todo_wine ok_(__FILE__, line)(hr == E_ILLEGAL_METHOD_CALL, "IAsyncInfo_get_Id returned %#lx\n", hr); + todo_wine ok_(__FILE__, line)(async_id == expect_id, "got async_id %#x\n", async_id); + + async_status = 0xdeadbeef; + hr = IAsyncInfo_get_Status(async_info, &async_status); + if (expect_status < 4) ok_(__FILE__, line)(hr == S_OK, "IAsyncInfo_get_Status returned %#lx\n", hr); + else ok_(__FILE__, line)(hr == E_ILLEGAL_METHOD_CALL, "IAsyncInfo_get_Status returned %#lx\n", hr); + ok_(__FILE__, line)(async_status == expect_status, "got async_status %#x\n", async_status); + + async_hr = 0xdeadbeef; + hr = IAsyncInfo_get_ErrorCode(async_info, &async_hr); + if (expect_status < 4) ok_(__FILE__, line)(hr == S_OK, "IAsyncInfo_get_ErrorCode returned %#lx\n", hr); + else ok_(__FILE__, line)(hr == E_ILLEGAL_METHOD_CALL, "IAsyncInfo_get_ErrorCode returned %#lx\n", hr); + if (expect_status < 4) todo_wine_if(FAILED(expect_hr)) ok_(__FILE__, line)(async_hr == expect_hr, "got async_hr %#lx\n", async_hr); + else ok_(__FILE__, line)(async_hr == E_ILLEGAL_METHOD_CALL, "got async_hr %#lx\n", async_hr); + + IAsyncInfo_Release(async_info); +} + struct iterator_hstring { IIterator_HSTRING IIterator_HSTRING_iface; @@ -873,9 +906,8 @@ static void test_SpeechRecognizer(void) AsyncStatus async_status; HSTRING hstr, hstr_lang; HANDLE put_thread; - HRESULT hr, error_code; - UINT32 id; LONG ref, old_ref; + HRESULT hr;
hr = RoInitialize(RO_INIT_MULTITHREADED); ok(hr == S_OK, "RoInitialize failed, hr %#lx.\n", hr); @@ -1005,6 +1037,7 @@ static void test_SpeechRecognizer(void) await_async_inspectable((IAsyncOperation_IInspectable *)operation, &compilation_handler, &IID_IAsyncOperationCompletedHandler_SpeechRecognitionCompilationResult); + check_async_info((IInspectable *)operation, 1, Completed, S_OK);
hr = IAsyncOperation_SpeechRecognitionCompilationResult_put_Completed(operation, NULL); ok(hr == E_ILLEGAL_DELEGATE_ASSIGNMENT, "Got unexpected hr %#lx.\n", hr); @@ -1031,43 +1064,17 @@ static void test_SpeechRecognizer(void) hr = IAsyncOperation_SpeechRecognitionCompilationResult_QueryInterface(operation, &IID_IAsyncInfo, (void **)&info); ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
- id = 0xdeadbeef; - hr = IAsyncInfo_get_Id(info, &id); - todo_wine ok(hr == S_OK, "IAsyncInfo_get_Id failed, hr %#lx.\n", hr); - todo_wine ok(id != 0xdeadbeef, "Id was %#x.\n", id); - - async_status = 0xdeadbeef; - hr = IAsyncInfo_get_Status(info, &async_status); - ok(hr == S_OK, "IAsyncInfo_get_Status failed, hr %#lx.\n", hr); - ok(async_status == Completed, "Status was %#x.\n", async_status); - - error_code = 0xdeadbeef; - hr = IAsyncInfo_get_ErrorCode(info, &error_code); - ok(hr == S_OK, "IAsyncInfo_get_ErrorCode failed, hr %#lx.\n", hr); - ok(error_code == S_OK, "ErrorCode was %#lx.\n", error_code); - hr = IAsyncInfo_Cancel(info); ok(hr == S_OK, "IAsyncInfo_Cancel failed, hr %#lx.\n", hr); - - async_status = 0xdeadbeef; - hr = IAsyncInfo_get_Status(info, &async_status); - ok(hr == S_OK, "IAsyncInfo_get_Status failed, hr %#lx.\n", hr); - ok(async_status == Completed, "Status was %#x.\n", async_status); + check_async_info((IInspectable *)operation, 1, Completed, S_OK);
hr = IAsyncInfo_Close(info); ok(hr == S_OK, "IAsyncInfo_Close failed, hr %#lx.\n", hr); + check_async_info((IInspectable *)operation, 1, AsyncStatus_Closed, S_OK); + hr = IAsyncInfo_Close(info); ok(hr == S_OK, "IAsyncInfo_Close failed, hr %#lx.\n", hr); - - async_status = 0xdeadbeef; - hr = IAsyncInfo_get_Status(info, &async_status); - ok(hr == E_ILLEGAL_METHOD_CALL, "IAsyncInfo_get_Status failed, hr %#lx.\n", hr); - ok(async_status == AsyncStatus_Closed, "Status was %#x.\n", async_status); - - error_code = 0xdeadbeef; - hr = IAsyncInfo_get_ErrorCode(info, &error_code); - ok(hr == E_ILLEGAL_METHOD_CALL, "IAsyncInfo_get_ErrorCode failed, hr %#lx.\n", hr); - ok(error_code == E_ILLEGAL_METHOD_CALL, "ErrorCode was %#lx.\n", error_code); + check_async_info((IInspectable *)operation, 1, AsyncStatus_Closed, S_OK);
IAsyncInfo_Release(info);
@@ -1092,17 +1099,13 @@ static void test_SpeechRecognizer(void) hr = IAsyncInfo_get_Status(info, &async_status); ok(hr == S_OK, "IAsyncInfo_get_Status failed, hr %#lx.\n", hr); ok(async_status != AsyncStatus_Closed, "Status was %#x.\n", async_status); + IAsyncInfo_Release(info);
await_async_inspectable((IAsyncOperation_IInspectable *)operation, &compilation_handler, &IID_IAsyncOperationCompletedHandler_SpeechRecognitionCompilationResult); + check_async_info((IInspectable *)operation, 2, Completed, S_OK);
- async_status = 0xdeadbeef; - hr = IAsyncInfo_get_Status(info, &async_status); - ok(hr == S_OK, "IAsyncInfo_get_Status failed, hr %#lx.\n", hr); - ok(async_status == Completed, "Status was %#x.\n", async_status); - - IAsyncInfo_Release(info); IAsyncOperation_SpeechRecognitionCompilationResult_Release(operation);
ref = ISpeechRecognizer_Release(recognizer); @@ -1155,6 +1158,7 @@ static void test_SpeechRecognizer(void)
SetEvent(compilation_handler.event_block); ok(!WaitForSingleObject(put_thread, 1000), "Wait for block_thread failed.\n"); + check_async_info((IInspectable *)operation, 1, AsyncStatus_Closed, S_OK);
CloseHandle(put_thread); CloseHandle(compilation_handler.event_block);
From: Bernhard Kölbl besentv@gmail.com
Signed-off-by: Bernhard Kölbl besentv@gmail.com --- dlls/windows.media.speech/tests/speech.c | 347 +++++++++++++++++++++++ 1 file changed, 347 insertions(+)
diff --git a/dlls/windows.media.speech/tests/speech.c b/dlls/windows.media.speech/tests/speech.c index 6f33e8d1983..6fd683109b4 100644 --- a/dlls/windows.media.speech/tests/speech.c +++ b/dlls/windows.media.speech/tests/speech.c @@ -230,6 +230,99 @@ static HRESULT WINAPI recognition_result_handler_create_static( struct recogniti return S_OK; }
+struct async_void_handler +{ + IAsyncActionCompletedHandler IAsyncActionCompletedHandler_iface; + LONG ref; + + HANDLE event_block; + HANDLE event_finished; +}; + +static inline struct async_void_handler *impl_from_IAsyncActionCompletedHandler(IAsyncActionCompletedHandler *iface) +{ + return CONTAINING_RECORD(iface, struct async_void_handler, IAsyncActionCompletedHandler_iface); +} + +HRESULT WINAPI async_void_handler_QueryInterface( IAsyncActionCompletedHandler *iface, REFIID iid, void **out ) +{ + if (IsEqualGUID(iid, &IID_IUnknown) || + IsEqualGUID(iid, &IID_IAgileObject) || + IsEqualGUID(iid, &IID_IAsyncActionCompletedHandler)) + { + IUnknown_AddRef(iface); + *out = iface; + return S_OK; + } + + trace("%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid(iid)); + *out = NULL; + return E_NOINTERFACE; +} + +ULONG WINAPI async_void_handler_AddRef( IAsyncActionCompletedHandler *iface ) +{ + struct async_void_handler *impl = impl_from_IAsyncActionCompletedHandler(iface); + ULONG ref = InterlockedIncrement(&impl->ref); + return ref; +} + +ULONG WINAPI async_void_handler_Release( IAsyncActionCompletedHandler *iface ) +{ + struct async_void_handler *impl = impl_from_IAsyncActionCompletedHandler(iface); + ULONG ref = InterlockedDecrement(&impl->ref); + return ref; +} + +HRESULT WINAPI async_void_handler_Invoke( IAsyncActionCompletedHandler *iface, IAsyncAction *sender, AsyncStatus status ) +{ + struct async_void_handler *impl = impl_from_IAsyncActionCompletedHandler(iface); + + trace("iface %p, sender %p, status %d.\n", iface, sender, status); + + /* Signal finishing of the handler. */ + if (impl->event_finished) SetEvent(impl->event_finished); + /* Block handler until event is set. */ + if (impl->event_block) WaitForSingleObject(impl->event_block, INFINITE); + + return S_OK; +} + +static const struct IAsyncActionCompletedHandlerVtbl async_void_handler_vtbl = +{ + /* IUnknown methods */ + async_void_handler_QueryInterface, + async_void_handler_AddRef, + async_void_handler_Release, + /* IAsyncActionCompletedHandler methods */ + async_void_handler_Invoke +}; + + +static HRESULT WINAPI async_void_handler_create_static( struct async_void_handler *impl ) +{ + impl->IAsyncActionCompletedHandler_iface.lpVtbl = &async_void_handler_vtbl; + impl->ref = 1; + + return S_OK; +} + +#define await_async_void(operation, handler) await_async_void_(__LINE__, operation, handler) +static void await_async_void_( unsigned int line, IAsyncAction *action, struct async_void_handler *handler ) +{ + HRESULT hr; + + async_void_handler_create_static(handler); + handler->event_block = NULL; + handler->event_finished = CreateEventW(NULL, FALSE, FALSE, NULL); + ok_(__FILE__, line)(!!handler->event_finished, "event_finished wasn't created.\n"); + + hr = IAsyncAction_put_Completed(action, &handler->IAsyncActionCompletedHandler_iface); + ok_(__FILE__, line)(hr == S_OK, "IAsyncAction_put_Completed failed, hr %#lx.\n", hr); + ok_(__FILE__, line)(!WaitForSingleObject(handler->event_finished , 5000), "Wait for event_finished failed.\n"); + CloseHandle(handler->event_finished); +} + struct async_inspectable_handler { IAsyncOperationCompletedHandler_IInspectable IAsyncHandler_IInspectable_iface; @@ -1339,6 +1432,259 @@ done: RoUninitialize(); }
+struct action_put_completed_thread_param +{ + IAsyncActionCompletedHandler *handler; + IAsyncAction *action; +}; + +static DWORD WINAPI action_put_completed_thread(void *arg) +{ + struct action_put_completed_thread_param *param = arg; + HRESULT hr; + + hr = IAsyncAction_put_Completed(param->action, param->handler); + ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr); + + return 0; +} + +static void test_Recognition(void) +{ + static const WCHAR *list_constraint_name = L"Windows.Media.SpeechRecognition.SpeechRecognitionListConstraint"; + static const WCHAR *recognizer_name = L"Windows.Media.SpeechRecognition.SpeechRecognizer"; + static const WCHAR *speech_constraint_tag = L"test_message"; + static const WCHAR *speech_constraints[] = { L"This is a test.", L"Number 5!", L"What time is it?" }; + ISpeechRecognitionListConstraintFactory *listconstraint_factory = NULL; + IAsyncOperation_SpeechRecognitionCompilationResult *operation = NULL; + IVector_ISpeechRecognitionConstraint *constraints = NULL; + ISpeechContinuousRecognitionSession *session = NULL; + ISpeechRecognitionListConstraint *listconstraint = NULL; + ISpeechRecognitionConstraint *constraint = NULL; + ISpeechRecognizer *recognizer = NULL; + ISpeechRecognizer2 *recognizer2 = NULL; + IAsyncActionCompletedHandler *handler = NULL; + IAsyncAction *action = NULL, *action2 = NULL; + IInspectable *inspectable = NULL; + IAsyncInfo *info = NULL; + struct async_inspectable_handler compilation_handler; + struct action_put_completed_thread_param put_param; + struct recognition_result_handler result_handler; + struct async_void_handler action_handler; + struct iterator_hstring iterator_hstring; + struct iterable_hstring iterable_hstring; + EventRegistrationToken token = { .value = 0 }; + HSTRING commands[3], hstr, tag; + HANDLE put_thread; + LONG ref, old_ref; + HRESULT hr; + UINT32 i; + BOOL set; + + hr = RoInitialize(RO_INIT_MULTITHREADED); + ok(hr == S_OK, "RoInitialize failed, hr %#lx.\n", hr); + + for (i = 0; i < ARRAY_SIZE(commands); i++) + { + hr = WindowsCreateString(speech_constraints[i], wcslen(speech_constraints[i]), &commands[i]); + ok(hr == S_OK, "WindowsCreateString failed, hr %#lx.\n", hr); + } + + /* The create functions for ListConstraint are broken on Win10 1507 x32 - abort early.*/ + if (broken(is_win10_1507 && (sizeof(void*) == 4))) + { + win_skip("SpeechRecognitionListConstraint object creation broken on Win10 1507 x32!\n"); + goto done; + } + + hr = WindowsCreateString(recognizer_name, wcslen(recognizer_name), &hstr); + ok(hr == S_OK, "WindowsCreateString failed, hr %#lx.\n", hr); + + hr = RoActivateInstance(hstr, &inspectable); + ok(hr == S_OK || broken(hr == SPERR_WINRT_INTERNAL_ERROR || hr == REGDB_E_CLASSNOTREG), "Got unexpected hr %#lx.\n", hr); + WindowsDeleteString(hstr); + + if (FAILED(hr)) /* Win 8 and 8.1 and Win10 without enabled SR. */ + { + win_skip("SpeechRecognizer cannot be activated!\n"); + goto done; + } + + hr = WindowsCreateString(list_constraint_name, wcslen(list_constraint_name), &hstr); + ok(hr == S_OK, "WindowsCreateString failed, hr %#lx.\n", hr); + + hr = RoGetActivationFactory(hstr, &IID_ISpeechRecognitionListConstraintFactory, (void **)&listconstraint_factory); + ok(hr == S_OK || broken(hr == REGDB_E_CLASSNOTREG), "RoGetActivationFactory failed, hr %#lx.\n", hr); + WindowsDeleteString(hstr); + + hr = WindowsCreateString(speech_constraint_tag, wcslen(speech_constraint_tag), &tag); + ok(hr == S_OK, "WindowsCreateString failed, hr %#lx.\n", hr); + + iterator_hstring_create_static(&iterator_hstring, commands, ARRAY_SIZE(commands)); + iterable_hstring_create_static(&iterable_hstring, &iterator_hstring); + hr = ISpeechRecognitionListConstraintFactory_CreateWithTag(listconstraint_factory, &iterable_hstring.IIterable_HSTRING_iface, tag, &listconstraint); + ok(hr == S_OK, "ISpeechRecognitionListConstraintFactory_Create failed, hr %#lx.\n", hr); + WindowsDeleteString(tag); + + ref = ISpeechRecognitionListConstraintFactory_Release(listconstraint_factory); + ok(ref == 1, "Got unexpected ref %lu.\n", ref); + + hr = ISpeechRecognitionListConstraint_QueryInterface(listconstraint, &IID_ISpeechRecognitionConstraint, (void **)&constraint); + ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr); + + hr = ISpeechRecognitionConstraint_put_IsEnabled(constraint, TRUE); + ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr); + + hr = IInspectable_QueryInterface(inspectable, &IID_ISpeechRecognizer, (void **)&recognizer); + ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr); + + hr = IInspectable_QueryInterface(inspectable, &IID_ISpeechRecognizer2, (void **)&recognizer2); + ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr); + + hr = ISpeechRecognizer2_get_ContinuousRecognitionSession(recognizer2, &session); + ok(hr == S_OK, "ISpeechRecognizer2_get_ContinuousRecognitionSession failed, hr %#lx.\n", hr); + + hr = ISpeechRecognizer_get_Constraints(recognizer, &constraints); + ok(hr == S_OK, "ISpeechContinuousRecognitionSession_get_Constraints failed, hr %#lx.\n", hr); + + hr = IVector_ISpeechRecognitionConstraint_Clear(constraints); + ok(hr == S_OK, "IVector_ISpeechRecognitionConstraint_Clear failed, hr %#lx.\n", hr); + + hr = IVector_ISpeechRecognitionConstraint_Append(constraints, constraint); + ok(hr == S_OK, "IVector_ISpeechRecognitionConstraint_Append failed, hr %#lx.\n", hr); + + ref = IVector_ISpeechRecognitionConstraint_Release(constraints); + ok(ref == 1, "Got unexpected ref %lu.\n", ref); + + ref = ISpeechRecognitionConstraint_Release(constraint); + ok(ref == 2, "Got unexpected ref %lu.\n", ref); + + ref = ISpeechRecognitionListConstraint_Release(listconstraint); + ok(ref == 1, "Got unexpected ref %lu.\n", ref); + + token.value = 0xdeadbeef; + recognition_result_handler_create_static(&result_handler); + hr = ISpeechContinuousRecognitionSession_add_ResultGenerated(session, &result_handler.IHandler_RecognitionResult_iface, &token); + ok(hr == S_OK, "ISpeechContinuousRecognitionSession_add_ResultGenerated failed, hr %#lx.\n", hr); + ok(token.value != 0xdeadbeef, "Got unexpexted token: %#I64x.\n", token.value); + + hr = ISpeechRecognizer_CompileConstraintsAsync(recognizer, &operation); + ok(hr == S_OK, "ISpeechRecognizer_CompileConstraintsAsync failed, hr %#lx.\n", hr); + await_async_inspectable((IAsyncOperation_IInspectable *)operation, + &compilation_handler, + &IID_IAsyncOperationCompletedHandler_SpeechRecognitionCompilationResult); + + IAsyncOperation_IInspectable_Release((IAsyncOperation_IInspectable *)operation); + + hr = ISpeechContinuousRecognitionSession_StartAsync(session, &action); + todo_wine ok(hr == S_OK, "ISpeechContinuousRecognitionSession_StartAsync failed, hr %#lx.\n", hr); + + if (FAILED(hr)) goto skip_action; + + await_async_void(action, &action_handler); + check_async_info((IInspectable *)action, 1, Completed, S_OK); + + handler = (void *)0xdeadbeef; + hr = IAsyncAction_get_Completed(action, &handler); + todo_wine ok(hr == S_OK, "IAsyncAction_put_Completed failed, hr %#lx.\n", hr); + todo_wine ok(handler == NULL, "Handler was %p.\n", handler); + + hr = IAsyncAction_QueryInterface(action, &IID_IAsyncInfo, (void **)&info); + todo_wine ok(hr == S_OK, "IAsyncAction_QueryInterface failed, hr %#lx.\n", hr); + + hr = IAsyncInfo_Cancel(info); + todo_wine ok(hr == S_OK, "IAsyncInfo_Cancel failed, hr %#lx.\n", hr); + check_async_info((IInspectable *)action, 1, Completed, S_OK); + + hr = IAsyncInfo_Close(info); + todo_wine ok(hr == S_OK, "IAsyncInfo_Close failed, hr %#lx.\n", hr); + check_async_info((IInspectable *)action, 1, AsyncStatus_Closed, S_OK); + + hr = IAsyncInfo_Close(info); + todo_wine ok(hr == S_OK, "IAsyncInfo_Close failed, hr %#lx.\n", hr); + check_async_info((IInspectable *)action, 1, AsyncStatus_Closed, S_OK); + + hr = IAsyncInfo_Cancel(info); + todo_wine ok(hr == S_OK, "IAsyncInfo_Cancel failed, hr %#lx.\n", hr); + check_async_info((IInspectable *)action, 1, AsyncStatus_Closed, S_OK); + + IAsyncInfo_Release(info); + + /* + * TODO: Use a loopback device together with prerecorded audio files to test the recognizer's functionality. + */ + + hr = ISpeechContinuousRecognitionSession_StopAsync(session, &action2); + todo_wine ok(hr == S_OK, "ISpeechContinuousRecognitionSession_StopAsync failed, hr %#lx.\n", hr); + + async_void_handler_create_static(&action_handler); + action_handler.event_block = CreateEventW(NULL, FALSE, FALSE, NULL); + action_handler.event_finished = CreateEventW(NULL, FALSE, FALSE, NULL); + ok(!!action_handler.event_block, "Block event wasn't created.\n"); + ok(!!action_handler.event_finished, "Finished event wasn't created.\n"); + + /* Check if IAsyncInfo_Close is non blocking. */ + put_param.handler = &action_handler.IAsyncActionCompletedHandler_iface; + put_param.action = action2; + put_thread = CreateThread(NULL, 0, action_put_completed_thread, &put_param, 0, NULL); + todo_wine ok(!WaitForSingleObject(action_handler.event_finished , 5000), "Wait for event_finished failed.\n"); + + handler = (void *)0xdeadbeef; + old_ref = action_handler.ref; + hr = IAsyncAction_get_Completed(action2, &handler); + todo_wine ok(hr == S_OK, "IAsyncAction_get_Completed failed, hr %#lx.\n", hr); + + todo_wine ok(handler == &action_handler.IAsyncActionCompletedHandler_iface || /* Broken on 1507. */ + broken(handler != NULL && handler != (void *)0xdeadbeef), "Handler was %p.\n", handler); + + ref = action_handler.ref - old_ref; + todo_wine ok(ref == 1, "The ref was increased by %lu.\n", ref); + IAsyncActionCompletedHandler_Release(handler); + + hr = IAsyncAction_QueryInterface(action2, &IID_IAsyncInfo, (void **)&info); + todo_wine ok(hr == S_OK, "IAsyncAction_QueryInterface failed, hr %#lx.\n", hr); + + hr = IAsyncInfo_Close(info); /* If IAsyncInfo_Close would wait for the handler to finish, the test would get stuck here. */ + todo_wine ok(hr == S_OK, "IAsyncInfo_Close failed, hr %#lx.\n", hr); + check_async_info((IInspectable *)action2, 3, AsyncStatus_Closed, S_OK); + + set = SetEvent(action_handler.event_block); + todo_wine ok(set == TRUE, "Event 'event_block' wasn't set.\n"); + todo_wine ok(!WaitForSingleObject(put_thread , 1000), "Wait for put_thread failed.\n"); + IAsyncInfo_Release(info); + + CloseHandle(action_handler.event_finished); + CloseHandle(action_handler.event_block); + CloseHandle(put_thread); + + todo_wine ok(action != action2, "actions were the same!\n"); + + IAsyncAction_Release(action2); + IAsyncAction_Release(action); + +skip_action: + hr = ISpeechContinuousRecognitionSession_remove_ResultGenerated(session, token); + ok(hr == S_OK, "ISpeechContinuousRecognitionSession_remove_ResultGenerated failed, hr %#lx.\n", hr); + + ref = ISpeechContinuousRecognitionSession_Release(session); + ok(ref == 1, "Got unexpected ref %lu.\n", ref); + + ref = ISpeechRecognizer2_Release(recognizer2); + ok(ref == 2, "Got unexpected ref %lu.\n", ref); + + ref = ISpeechRecognizer_Release(recognizer); + ok(ref == 1, "Got unexpected ref %lu.\n", ref); + + ref = IInspectable_Release(inspectable); + ok(!ref, "Got unexpected ref %lu.\n", ref); + +done: + for (i = 0; i < ARRAY_SIZE(commands); i++) + WindowsDeleteString(commands[i]); + + RoUninitialize(); +} + START_TEST(speech) { test_ActivationFactory(); @@ -1346,4 +1692,5 @@ START_TEST(speech) test_VoiceInformation(); test_SpeechRecognizer(); test_SpeechRecognitionListConstraint(); + test_Recognition(); }
Rémi Bernon (@rbernon) commented about dlls/windows.media.speech/tests/speech.c:
CloseHandle(handler->event_finished);
}
+#define check_async_info(obj, exp_id, exp_status, exp_hr) check_asnyc_info_(__LINE__, obj, exp_id, exp_status, exp_hr) +static void check_asnyc_info_( unsigned int line, IInspectable *async_obj, UINT32 expect_id, AsyncStatus expect_status, HRESULT expect_hr)
s/check_asnyc_info_/check_async_info_/
Rémi Bernon (@rbernon) commented about dlls/windows.media.speech/tests/speech.c:
- hr = IAsyncInfo_get_Id(async_info, &async_id);
- if (expect_status < 4) todo_wine ok_(__FILE__, line)(hr == S_OK, "IAsyncInfo_get_Id returned %#lx\n", hr);
- else todo_wine ok_(__FILE__, line)(hr == E_ILLEGAL_METHOD_CALL, "IAsyncInfo_get_Id returned %#lx\n", hr);
- todo_wine ok_(__FILE__, line)(async_id == expect_id, "got async_id %#x\n", async_id);
- async_status = 0xdeadbeef;
- hr = IAsyncInfo_get_Status(async_info, &async_status);
- if (expect_status < 4) ok_(__FILE__, line)(hr == S_OK, "IAsyncInfo_get_Status returned %#lx\n", hr);
- else ok_(__FILE__, line)(hr == E_ILLEGAL_METHOD_CALL, "IAsyncInfo_get_Status returned %#lx\n", hr);
- ok_(__FILE__, line)(async_status == expect_status, "got async_status %#x\n", async_status);
- async_hr = 0xdeadbeef;
- hr = IAsyncInfo_get_ErrorCode(async_info, &async_hr);
- if (expect_status < 4) ok_(__FILE__, line)(hr == S_OK, "IAsyncInfo_get_ErrorCode returned %#lx\n", hr);
- else ok_(__FILE__, line)(hr == E_ILLEGAL_METHOD_CALL, "IAsyncInfo_get_ErrorCode returned %#lx\n", hr);
- if (expect_status < 4) todo_wine_if(FAILED(expect_hr)) ok_(__FILE__, line)(async_hr == expect_hr, "got async_hr %#lx\n", async_hr);
The todo_wine_if here doesn't seem required, it was useful for dinput tests where we don't return the same error codes as native.
This merge request was approved by Rémi Bernon.