
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, 76 insertions(+), 4 deletions(-)
diff --git a/dlls/windows.media.speech/tests/speech.c b/dlls/windows.media.speech/tests/speech.c
index 7c870901de9..9df71e2b6cb 100644
--- a/dlls/windows.media.speech/tests/speech.c
+++ b/dlls/windows.media.speech/tests/speech.c
@@ -779,18 +779,26 @@ static void test_ActivationFactory(void)
������static void test_SpeechSynthesizer(void)
������{
+������ ������ static const WCHAR *simple_ssml =
+������ ������ L"<speak version='1.0' xmlns='http://www.w3.org/2001/10/synthesis' xml:lang='en-US'>"
+������ ������ ������ ������ ������"Hello, how are you doing today?"
+������ ������ ������"</speak>";
+������ ������ static const WCHAR *simple_synth_text = L"Hello, how are you doing today?";
������ ������ ������static const WCHAR *speech_synthesizer_name = L"Windows.Media.SpeechSynthesis.SpeechSynthesizer";
������ ������ ������static const WCHAR *speech_synthesizer_name2 = L"windows.media.speechsynthesis.speechsynthesizer";
������ ������ ������static const WCHAR *unknown_class_name = L"Unknown.Class";
������ ������ ������IActivationFactory *factory = NULL, *factory2 = NULL;
+������ ������ IAsyncOperation_SpeechSynthesisStream *operation_ss_stream = NULL;
������ ������ ������IVectorView_VoiceInformation *voices = NULL;
������ ������ ������IInstalledVoicesStatic *voices_static = NULL;
+������ ������ ISpeechSynthesisStream *ss_stream = NULL;
������ ������ ������IVoiceInformation *voice;
������ ������ ������IInspectable *inspectable = NULL, *tmp_inspectable = NULL;
������ ������ ������IAgileObject *agile_object = NULL, *tmp_agile_object = NULL;
������ ������ ������ISpeechSynthesizer *synthesizer;
������ ������ ������ISpeechSynthesizer2 *synthesizer2;
������ ������ ������IClosable *closable;
+������ ������ struct async_inspectable_handler async_inspectable_handler;
������ ������ ������HMODULE hdll;
������ ������ ������HSTRING str, str2;
������ ������ ������HRESULT hr;
@@ -843,6 +851,7 @@ static void test_SpeechSynthesizer(void)
������ ������ ������ ������ ������FreeLibrary(hdll);
������ ������ ������}
+������ ������ /* Test static Synth ifaces: IActivationFactory, IInstalledVoicesStatic, etc. */
������ ������ ������hr = IActivationFactory_QueryInterface(factory, &IID_IInspectable, (void **)&inspectable);
������ ������ ������ok(hr == S_OK, "IActivationFactory_QueryInterface IID_IInspectable failed, hr %#lx\n", hr);
@@ -889,11 +898,24 @@ static void test_SpeechSynthesizer(void)
������ ������ ������IVectorView_VoiceInformation_Release(voices);
-������ ������ IInstalledVoicesStatic_Release(voices_static);
+������ ������ hr = IInstalledVoicesStatic_get_DefaultVoice(voices_static, &voice);
+������ ������ todo_wine ok(hr == S_OK, "IInstalledVoicesStatic_get_DefaultVoice failed, hr %#lx\n", hr);
+
+������ ������ if (hr == S_OK)
+������ ������ {
+������ ������ ������ ������ IVoiceInformation_get_Description(voice, &str2);
+������ ������ ������ ������ trace("SpeechSynthesizer default voice %s.\n", debugstr_hstring(str2));
+
+������ ������ ������ ������ WindowsDeleteString(str2);
+������ ������ ������ ������ ref = IVoiceInformation_Release(voice);
+������ ������ ������ ������ ok(ref == 0, "Got unexpected ref %lu.\n", ref);
+������ ������ }
+������ ������ IInstalledVoicesStatic_Release(voices_static);
������ ������ ������IAgileObject_Release(agile_object);
������ ������ ������IInspectable_Release(inspectable);
+������ ������ /* Test Synthesizer */
������ ������ ������hr = IActivationFactory_QueryInterface(factory, &IID_ISpeechSynthesizer, (void **)&synthesizer);
������ ������ ������ok(hr == E_NOINTERFACE, "Got unexpected hr %#lx.\n", hr);
@@ -903,13 +925,63 @@ static void test_SpeechSynthesizer(void)
������ ������ ������hr = IInspectable_QueryInterface(inspectable, &IID_ISpeechSynthesizer, (void **)&synthesizer);
������ ������ ������ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
+������ ������ /* Test SynthesizeTextToStreamAsync */
+������ ������ hr = WindowsCreateString(simple_synth_text, wcslen(simple_synth_text), &str);
+������ ������ ok(hr == S_OK, "WindowsCreateString failed, hr %#lx\n", hr);
+
+������ ������ hr = ISpeechSynthesizer_SynthesizeTextToStreamAsync(synthesizer, str, &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);
+������ ������ check_async_info((IInspectable *)operation_ss_stream, 1, Completed, S_OK);
+������ ������ check_interface(operation_ss_stream, &IID_IAgileObject, TRUE);
+
+������ ������ hr = IAsyncOperation_SpeechSynthesisStream_GetResults(operation_ss_stream, &ss_stream);
+������ ������ todo_wine ok(hr == S_OK, "IAsyncOperation_SpeechSynthesisStream_GetResults failed, hr %#lx\n", hr);
+
+������ ������ if (hr == S_OK && ss_stream)
+������ ������ {
+������ ������ ������ ������ ref = ISpeechSynthesisStream_Release(ss_stream);
+������ ������ ������ ������ todo_wine ok(ref == 0, "Got unexpected ref %lu.\n", ref);
+������ ������ }
+
+������ ������ IAsyncOperation_SpeechSynthesisStream_Release(operation_ss_stream);
+������ ������ WindowsDeleteString(str);
+
+������ ������ /* Test SynthesizeSsmlToStreamAsync */
+������ ������ hr = WindowsCreateString(simple_ssml, wcslen(simple_ssml), &str);
+������ ������ ok(hr == S_OK, "WindowsCreateString failed, hr %#lx\n", hr);
+
+������ ������ hr = ISpeechSynthesizer_SynthesizeSsmlToStreamAsync(synthesizer, str, &operation_ss_stream);
+������ ������ todo_wine ok(hr == S_OK, "ISpeechSynthesizer_SynthesizeSsmlToStreamAsync failed, hr %#lx\n", hr);
+������ ������ await_async_inspectable((IAsyncOperation_IInspectable *)operation_ss_stream,
+������ ������ ������ ������ ������ ������ ������ ������ ������ ������ ������ ������ ������ ������ ������&async_inspectable_handler,
+������ ������ ������ ������ ������ ������ ������ ������ ������ ������ ������ ������ ������ ������ ������&IID_IAsyncOperationCompletedHandler_SpeechSynthesisStream);
+������ ������ check_async_info((IInspectable *)operation_ss_stream, 2, Completed, S_OK);
+������ ������ check_interface(operation_ss_stream, &IID_IAgileObject, TRUE);
+
+������ ������ hr = IAsyncOperation_SpeechSynthesisStream_GetResults(operation_ss_stream, &ss_stream);
+������ ������ todo_wine ok(hr == S_OK, "IAsyncOperation_SpeechSynthesisStream_GetResults failed, hr %#lx\n", hr);
+
+������ ������ if (hr == S_OK && ss_stream)
+������ ������ {
+������ ������ ������ ������ ref = ISpeechSynthesisStream_Release(ss_stream);
+������ ������ ������ ������ ok(ref == 0, "Got unexpected ref %lu.\n", ref);
+������ ������ }
+
+������ ������ IAsyncOperation_SpeechSynthesisStream_Release(operation_ss_stream);
+
+skip_ss_stream:
+������ ������ WindowsDeleteString(str);
+
������ ������ ������hr = IInspectable_QueryInterface(inspectable, &IID_IClosable, (void **)&closable);
������ ������ ������ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
������ ������ ������hr = IInspectable_QueryInterface(inspectable, &IID_ISpeechSynthesizer2, (void **)&synthesizer2);
-������ ������ ok(hr == S_OK ||
-������ ������ ������ ������ ������ ������ broken(hr == E_NOINTERFACE), /* requires newer Windows */
-������ ������ ������ ������ ������ ������ "Got unexpected hr %#lx.\n", hr);
+������ ������ ok(hr == S_OK || broken(hr == E_NOINTERFACE), "Got unexpected hr %#lx.\n", hr); /* Requires Win10 >= 1703 */
������ ������ ������if (hr == S_OK)
������ ������ ������{
--
GitLab
https://gitlab.winehq.org/wine/wine/-/merge_requests/217