Commit 61ad9174 authored by Shaun Ren's avatar Shaun Ren Committed by Alexandre Julliard

sapi: Implement ISpVoice::WaitUntilDone.

parent b89c5361
......@@ -548,6 +548,12 @@ static void test_spvoice(void)
ok(stream_num == 1, "got %lu.\n", stream_num);
ok(duration > 800 && duration < 3000, "took %lu ms.\n", duration);
start = GetTickCount();
hr = ISpVoice_WaitUntilDone(voice, INFINITE);
duration = GetTickCount() - start;
ok(hr == S_OK, "got %#lx.\n", hr);
ok(duration < 200, "took %lu ms.\n", duration);
reset_engine_params(&test_engine);
stream_num = 0xdeadbeef;
start = GetTickCount();
......@@ -557,7 +563,14 @@ static void test_spvoice(void)
todo_wine ok(stream_num == 1, "got %lu.\n", stream_num);
ok(duration < 500, "took %lu ms.\n", duration);
Sleep(200);
hr = ISpVoice_WaitUntilDone(voice, 100);
ok(hr == S_FALSE, "got %#lx.\n", hr);
hr = ISpVoice_WaitUntilDone(voice, INFINITE);
duration = GetTickCount() - start;
ok(hr == S_OK, "got %#lx.\n", hr);
ok(duration > 800 && duration < 3000, "took %lu ms.\n", duration);
ok(test_engine.speak_called, "ISpTTSEngine::Speak was not called.\n");
ok(test_engine.flags == SPF_NLP_SPEAK_PUNC, "got %#lx.\n", test_engine.flags);
ok(test_engine.frag_list != NULL, "frag_list is NULL.\n");
......@@ -568,8 +581,6 @@ static void test_spvoice(void)
ok(test_engine.rate == 0, "got %ld.\n", test_engine.rate);
ok(test_engine.volume == 100, "got %d.\n", test_engine.volume);
Sleep(2000);
reset_engine_params(&test_engine);
hr = ISpVoice_Speak(voice, test_text, SPF_DEFAULT | SPF_ASYNC, NULL);
ok(hr == S_OK, "got %#lx.\n", hr);
......
......@@ -1073,9 +1073,16 @@ static HRESULT WINAPI spvoice_GetVolume(ISpVoice *iface, USHORT *volume)
static HRESULT WINAPI spvoice_WaitUntilDone(ISpVoice *iface, ULONG timeout)
{
FIXME("(%p, %ld): stub.\n", iface, timeout);
struct speech_voice *This = impl_from_ISpVoice(iface);
HRESULT hr;
return E_NOTIMPL;
TRACE("(%p, %ld).\n", iface, timeout);
hr = async_wait_queue_empty(&This->queue, timeout);
if (hr == WAIT_OBJECT_0) return S_OK;
else if (hr == WAIT_TIMEOUT) return S_FALSE;
return hr;
}
static HRESULT WINAPI spvoice_SetSyncSpeakTimeout(ISpVoice *iface, ULONG timeout)
......
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