Commit b36871b8 authored by Bernhard Kölbl's avatar Bernhard Kölbl Committed by Alexandre Julliard

windows.media.speech/tests: Test the recognizer state.

parent 4e88f093
......@@ -1619,6 +1619,7 @@ static void test_Recognition(void)
struct iterator_hstring iterator_hstring;
struct iterable_hstring iterable_hstring;
EventRegistrationToken token = { .value = 0 };
SpeechRecognizerState recog_state;
HSTRING commands[3], hstr, tag;
HANDLE put_thread;
LONG ref, old_ref;
......@@ -1717,6 +1718,11 @@ static void test_Recognition(void)
ok(hr == S_OK, "ISpeechContinuousRecognitionSession_add_ResultGenerated failed, hr %#lx.\n", hr);
ok(token.value != 0xdeadbeef, "Got unexpexted token: %#I64x.\n", token.value);
recog_state = 0xdeadbeef;
hr = ISpeechRecognizer2_get_State(recognizer2, &recog_state);
todo_wine ok(hr == S_OK, "ISpeechRecognizer2_get_State failed, hr %#lx.\n", hr);
todo_wine ok(recog_state == SpeechRecognizerState_Idle, "recog_state was %u.\n", recog_state);
hr = ISpeechRecognizer_CompileConstraintsAsync(recognizer, &operation);
ok(hr == S_OK, "ISpeechRecognizer_CompileConstraintsAsync failed, hr %#lx.\n", hr);
await_async_inspectable((IAsyncOperation_IInspectable *)operation,
......@@ -1757,6 +1763,11 @@ static void test_Recognition(void)
IAsyncInfo_Release(info);
recog_state = 0xdeadbeef;
hr = ISpeechRecognizer2_get_State(recognizer2, &recog_state);
todo_wine ok(hr == S_OK, "ISpeechRecognizer2_get_State failed, hr %#lx.\n", hr);
todo_wine ok(recog_state == SpeechRecognizerState_Capturing, "recog_state was %u.\n", recog_state);
/*
* TODO: Use a loopback device together with prerecorded audio files to test the recognizer's functionality.
*/
......@@ -1767,9 +1778,20 @@ static void test_Recognition(void)
check_async_info((IInspectable *)action2, 3, Completed, S_OK);
IAsyncAction_Release(action2);
recog_state = 0xdeadbeef;
hr = ISpeechRecognizer2_get_State(recognizer2, &recog_state);
todo_wine ok(hr == S_OK, "ISpeechRecognizer2_get_State failed, hr %#lx.\n", hr);
todo_wine ok(recog_state == SpeechRecognizerState_Paused || /* Broken on Win10 1507 */
broken(recog_state == SpeechRecognizerState_Capturing) , "recog_state was %u.\n", recog_state);
hr = ISpeechContinuousRecognitionSession_Resume(session);
todo_wine ok(hr == S_OK, "ISpeechContinuousRecognitionSession_Resume failed, hr %#lx.\n", hr);
recog_state = 0xdeadbeef;
hr = ISpeechRecognizer2_get_State(recognizer2, &recog_state);
todo_wine ok(hr == S_OK, "ISpeechRecognizer2_get_State failed, hr %#lx.\n", hr);
todo_wine ok(recog_state == SpeechRecognizerState_Capturing, "recog_state was %u.\n", recog_state);
hr = ISpeechContinuousRecognitionSession_StopAsync(session, &action2);
ok(hr == S_OK, "ISpeechContinuousRecognitionSession_StopAsync failed, hr %#lx.\n", hr);
......@@ -1817,6 +1839,11 @@ static void test_Recognition(void)
IAsyncAction_Release(action2);
IAsyncAction_Release(action);
recog_state = 0xdeadbeef;
hr = ISpeechRecognizer2_get_State(recognizer2, &recog_state);
todo_wine ok(hr == S_OK, "ISpeechRecognizer2_get_State failed, hr %#lx.\n", hr);
todo_wine ok(recog_state == SpeechRecognizerState_Idle, "recog_state was %u.\n", recog_state);
hr = ISpeechContinuousRecognitionSession_remove_ResultGenerated(session, token);
ok(hr == S_OK, "ISpeechContinuousRecognitionSession_remove_ResultGenerated failed, hr %#lx.\n", hr);
......
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