Bernhard Kölbl : windows.media.speech: Return IAsyncOperation from synthesizer_SynthesizeTextToStreamAsync.

Alexandre Julliard julliard at winehq.org
Tue Jun 14 15:56:51 CDT 2022


Module: wine
Branch: master
Commit: d8637c9b3781bb7e68968b83a207c6f5294c9af4
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=d8637c9b3781bb7e68968b83a207c6f5294c9af4

Author: Bernhard Kölbl <besentv at gmail.com>
Date:   Tue Jun  7 21:53:35 2022 +0200

windows.media.speech: Return IAsyncOperation from synthesizer_SynthesizeTextToStreamAsync.

Based on a patch by Connor McAdams <cmcadams at codeweavers.com>

Signed-off-by: Bernhard Kölbl <besentv at gmail.com>

---

 dlls/windows.media.speech/synthesizer.c  |  8 +++++++-
 dlls/windows.media.speech/tests/speech.c | 11 +++++------
 2 files changed, 12 insertions(+), 7 deletions(-)

diff --git a/dlls/windows.media.speech/synthesizer.c b/dlls/windows.media.speech/synthesizer.c
index e8c9f0a280d..3a77fc62234 100644
--- a/dlls/windows.media.speech/synthesizer.c
+++ b/dlls/windows.media.speech/synthesizer.c
@@ -241,11 +241,17 @@ static HRESULT WINAPI synthesizer_GetTrustLevel( ISpeechSynthesizer *iface, Trus
     return E_NOTIMPL;
 }
 
+static HRESULT CALLBACK text_to_stream_operation( IInspectable *invoker, IInspectable **result )
+{
+    return S_OK;
+}
+
 static HRESULT WINAPI synthesizer_SynthesizeTextToStreamAsync( ISpeechSynthesizer *iface, HSTRING text,
                                                                IAsyncOperation_SpeechSynthesisStream **operation )
 {
     FIXME("iface %p, text %p, operation %p stub.\n", iface, text, operation);
-    return E_NOTIMPL;
+    return async_operation_inspectable_create(&IID_IAsyncOperation_SpeechSynthesisStream, NULL,
+                                              text_to_stream_operation, (IAsyncOperation_IInspectable **)operation);
 }
 
 static HRESULT WINAPI synthesizer_SynthesizeSsmlToStreamAsync( ISpeechSynthesizer *iface, HSTRING ssml,
diff --git a/dlls/windows.media.speech/tests/speech.c b/dlls/windows.media.speech/tests/speech.c
index e6f8a32bb80..c9898b2cc03 100644
--- a/dlls/windows.media.speech/tests/speech.c
+++ b/dlls/windows.media.speech/tests/speech.c
@@ -933,13 +933,11 @@ static void test_SpeechSynthesizer(void)
     ok(hr == S_OK, "WindowsCreateString failed, hr %#lx\n", hr);
 
     hr = ISpeechSynthesizer_SynthesizeTextToStreamAsync(synthesizer, NULL, &operation_ss_stream);
-    todo_wine ok(hr == S_OK, "ISpeechSynthesizer_SynthesizeTextToStreamAsync failed, hr %#lx\n", hr);
-    if(FAILED(hr)) goto skip_ss_stream;
-
+    ok(hr == S_OK, "ISpeechSynthesizer_SynthesizeTextToStreamAsync failed, hr %#lx\n", hr);
     IAsyncOperation_SpeechSynthesisStream_Release(operation_ss_stream);
 
     hr = ISpeechSynthesizer_SynthesizeTextToStreamAsync(synthesizer, str, &operation_ss_stream);
-    todo_wine ok(hr == S_OK, "ISpeechSynthesizer_SynthesizeTextToStreamAsync failed, hr %#lx\n", hr);
+    ok(hr == S_OK, "ISpeechSynthesizer_SynthesizeTextToStreamAsync failed, hr %#lx\n", hr);
 
     await_async_inspectable((IAsyncOperation_IInspectable *)operation_ss_stream,
                              &async_inspectable_handler,
@@ -974,6 +972,8 @@ static void test_SpeechSynthesizer(void)
 
     hr = ISpeechSynthesizer_SynthesizeSsmlToStreamAsync(synthesizer, str2, &operation_ss_stream);
     todo_wine ok(hr == S_OK, "ISpeechSynthesizer_SynthesizeSsmlToStreamAsync failed, hr %#lx\n", hr);
+    if(FAILED(hr)) goto skip_ss_stream;
+
     await_async_inspectable((IAsyncOperation_IInspectable *)operation_ss_stream,
                              &async_inspectable_handler,
                              &IID_IAsyncOperationCompletedHandler_SpeechSynthesisStream);
@@ -1019,9 +1019,8 @@ static void test_SpeechSynthesizer(void)
     }
     else todo_wine ok(operation_ss_stream == NULL, "operation_ss_stream had value %p.\n", operation_ss_stream);
 
-    WindowsDeleteString(str2);
-
 skip_ss_stream:
+    WindowsDeleteString(str2);
     WindowsDeleteString(str);
 
     hr = IInspectable_QueryInterface(inspectable, &IID_IClosable, (void **)&closable);




More information about the wine-cvs mailing list