windows.media.speech: Implement IInstalledVoicesStatic::AllVoices stub.

Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Rémi Bernon 2021-03-12 12:31:11 +01:00 committed by Alexandre Julliard
parent f4dbded171
commit af8b935892
2 changed files with 126 additions and 7 deletions

View File

@ -46,6 +46,125 @@ static const char *debugstr_hstring(HSTRING hstr)
return wine_dbgstr_wn(str, len); return wine_dbgstr_wn(str, len);
} }
struct voice_information_vector
{
IVectorView_VoiceInformation IVectorView_VoiceInformation_iface;
LONG ref;
};
static inline struct voice_information_vector *impl_from_IVectorView_VoiceInformation(IVectorView_VoiceInformation *iface)
{
return CONTAINING_RECORD(iface, struct voice_information_vector, IVectorView_VoiceInformation_iface);
}
static HRESULT STDMETHODCALLTYPE vector_view_voice_information_QueryInterface(
IVectorView_VoiceInformation *iface, REFIID iid, void **out)
{
TRACE("iface %p, iid %s, out %p stub!\n", iface, debugstr_guid(iid), out);
if (IsEqualGUID(iid, &IID_IUnknown) ||
IsEqualGUID(iid, &IID_IInspectable) ||
IsEqualGUID(iid, &IID_IVectorView_VoiceInformation))
{
IUnknown_AddRef(iface);
*out = iface;
return S_OK;
}
WARN("%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid(iid));
*out = NULL;
return E_NOINTERFACE;
}
static ULONG STDMETHODCALLTYPE vector_view_voice_information_AddRef(
IVectorView_VoiceInformation *iface)
{
struct voice_information_vector *impl = impl_from_IVectorView_VoiceInformation(iface);
ULONG ref = InterlockedIncrement(&impl->ref);
TRACE("iface %p, ref %u.\n", iface, ref);
return ref;
}
static ULONG STDMETHODCALLTYPE vector_view_voice_information_Release(
IVectorView_VoiceInformation *iface)
{
struct voice_information_vector *impl = impl_from_IVectorView_VoiceInformation(iface);
ULONG ref = InterlockedDecrement(&impl->ref);
TRACE("iface %p, ref %u.\n", iface, ref);
return ref;
}
static HRESULT STDMETHODCALLTYPE vector_view_voice_information_GetIids(
IVectorView_VoiceInformation *iface, ULONG *iid_count, IID **iids)
{
FIXME("iface %p, iid_count %p, iids %p stub!\n", iface, iid_count, iids);
return E_NOTIMPL;
}
static HRESULT STDMETHODCALLTYPE vector_view_voice_information_GetRuntimeClassName(
IVectorView_VoiceInformation *iface, HSTRING *class_name)
{
FIXME("iface %p, class_name %p stub!\n", iface, class_name);
return E_NOTIMPL;
}
static HRESULT STDMETHODCALLTYPE vector_view_voice_information_GetTrustLevel(
IVectorView_VoiceInformation *iface, TrustLevel *trust_level)
{
FIXME("iface %p, trust_level %p stub!\n", iface, trust_level);
return E_NOTIMPL;
}
static HRESULT STDMETHODCALLTYPE vector_view_voice_information_GetAt(
IVectorView_VoiceInformation *iface, ULONG index, IVoiceInformation **value)
{
FIXME("iface %p, index %#x, value %p stub!\n", iface, index, value);
return E_NOTIMPL;
}
static HRESULT STDMETHODCALLTYPE vector_view_voice_information_get_Size(
IVectorView_VoiceInformation *iface, ULONG *value)
{
FIXME("iface %p, value %p stub!\n", iface, value);
return E_NOTIMPL;
}
static HRESULT STDMETHODCALLTYPE vector_view_voice_information_IndexOf(
IVectorView_VoiceInformation *iface, IVoiceInformation *element, ULONG *index, BOOLEAN *value)
{
FIXME("iface %p, element %p, index %p, value %p stub!\n", iface, element, index, value);
return E_NOTIMPL;
}
static HRESULT STDMETHODCALLTYPE vector_view_voice_information_GetMany(
IVectorView_VoiceInformation *iface, ULONG start_index, IVoiceInformation **items, UINT *value)
{
FIXME("iface %p, start_index %#x, items %p, value %p stub!\n", iface, start_index, items, value);
return E_NOTIMPL;
}
static const struct IVectorView_VoiceInformationVtbl vector_view_voice_information_vtbl =
{
vector_view_voice_information_QueryInterface,
vector_view_voice_information_AddRef,
vector_view_voice_information_Release,
/* IInspectable methods */
vector_view_voice_information_GetIids,
vector_view_voice_information_GetRuntimeClassName,
vector_view_voice_information_GetTrustLevel,
/* IVectorView<VoiceInformation> methods */
vector_view_voice_information_GetAt,
vector_view_voice_information_get_Size,
vector_view_voice_information_IndexOf,
vector_view_voice_information_GetMany,
};
static struct voice_information_vector all_voices =
{
{&vector_view_voice_information_vtbl},
0
};
struct windows_media_speech struct windows_media_speech
{ {
IActivationFactory IActivationFactory_iface; IActivationFactory IActivationFactory_iface;
@ -196,8 +315,10 @@ static HRESULT STDMETHODCALLTYPE installed_voices_static_GetTrustLevel(
static HRESULT STDMETHODCALLTYPE installed_voices_static_get_AllVoices( static HRESULT STDMETHODCALLTYPE installed_voices_static_get_AllVoices(
IInstalledVoicesStatic *iface, IVectorView_VoiceInformation **value) IInstalledVoicesStatic *iface, IVectorView_VoiceInformation **value)
{ {
FIXME("iface %p, value %p stub!\n", iface, value); TRACE("iface %p, value %p.\n", iface, value);
return E_NOTIMPL; *value = &all_voices.IVectorView_VoiceInformation_iface;
IVectorView_VoiceInformation_AddRef(*value);
return S_OK;
} }
static HRESULT STDMETHODCALLTYPE installed_voices_static_get_DefaultVoice( static HRESULT STDMETHODCALLTYPE installed_voices_static_get_DefaultVoice(

View File

@ -88,8 +88,7 @@ static void test_SpeechSynthesizer(void)
IAgileObject_Release(tmp_agile_object); IAgileObject_Release(tmp_agile_object);
hr = IInstalledVoicesStatic_get_AllVoices(voices_static, &voices); hr = IInstalledVoicesStatic_get_AllVoices(voices_static, &voices);
todo_wine ok(SUCCEEDED(hr), "IInstalledVoicesStatic_get_AllVoices failed, hr %#x\n", hr); ok(SUCCEEDED(hr), "IInstalledVoicesStatic_get_AllVoices failed, hr %#x\n", hr);
if (FAILED(hr)) goto done;
hr = IVectorView_VoiceInformation_QueryInterface(voices, &IID_IInspectable, (void **)&tmp_inspectable); hr = IVectorView_VoiceInformation_QueryInterface(voices, &IID_IInspectable, (void **)&tmp_inspectable);
ok(SUCCEEDED(hr), "IVectorView_VoiceInformation_QueryInterface voices failed, hr %#x\n", hr); ok(SUCCEEDED(hr), "IVectorView_VoiceInformation_QueryInterface voices failed, hr %#x\n", hr);
@ -101,13 +100,12 @@ static void test_SpeechSynthesizer(void)
size = 0xdeadbeef; size = 0xdeadbeef;
hr = IVectorView_VoiceInformation_get_Size(voices, &size); hr = IVectorView_VoiceInformation_get_Size(voices, &size);
ok(SUCCEEDED(hr), "IVectorView_VoiceInformation_QueryInterface voices failed, hr %#x\n", hr); todo_wine ok(SUCCEEDED(hr), "IVectorView_VoiceInformation_QueryInterface voices failed, hr %#x\n", hr);
ok(size != 0 && size != 0xdeadbeef, "IVectorView_VoiceInformation_get_Size returned %u\n", size); todo_wine ok(size != 0 && size != 0xdeadbeef, "IVectorView_VoiceInformation_get_Size returned %u\n", size);
rc = IVectorView_VoiceInformation_Release(voices); rc = IVectorView_VoiceInformation_Release(voices);
ok(rc == 0, "IVectorView_VoiceInformation_Release returned unexpected refcount %d\n", rc); ok(rc == 0, "IVectorView_VoiceInformation_Release returned unexpected refcount %d\n", rc);
done:
rc = IInstalledVoicesStatic_Release(voices_static); rc = IInstalledVoicesStatic_Release(voices_static);
ok(rc == 4, "IInstalledVoicesStatic_Release returned unexpected refcount %d\n", rc); ok(rc == 4, "IInstalledVoicesStatic_Release returned unexpected refcount %d\n", rc);