windows.media.speech: Implement IInstalledVoicesStatic 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:10 +01:00 committed by Alexandre Julliard
parent f333672a97
commit f4dbded171
2 changed files with 93 additions and 4 deletions

View File

@ -29,7 +29,10 @@
#include "initguid.h" #include "initguid.h"
#include "activation.h" #include "activation.h"
#define WIDL_using_Windows_Foundation
#define WIDL_using_Windows_Foundation_Collections
#include "windows.foundation.h" #include "windows.foundation.h"
#define WIDL_using_Windows_Media_SpeechSynthesis
#include "windows.media.speechsynthesis.h" #include "windows.media.speechsynthesis.h"
WINE_DEFAULT_DEBUG_CHANNEL(speech); WINE_DEFAULT_DEBUG_CHANNEL(speech);
@ -46,6 +49,7 @@ static const char *debugstr_hstring(HSTRING hstr)
struct windows_media_speech struct windows_media_speech
{ {
IActivationFactory IActivationFactory_iface; IActivationFactory IActivationFactory_iface;
IInstalledVoicesStatic IInstalledVoicesStatic_iface;
LONG ref; LONG ref;
}; };
@ -54,9 +58,16 @@ static inline struct windows_media_speech *impl_from_IActivationFactory(IActivat
return CONTAINING_RECORD(iface, struct windows_media_speech, IActivationFactory_iface); return CONTAINING_RECORD(iface, struct windows_media_speech, IActivationFactory_iface);
} }
static inline struct windows_media_speech *impl_from_IInstalledVoicesStatic(IInstalledVoicesStatic *iface)
{
return CONTAINING_RECORD(iface, struct windows_media_speech, IInstalledVoicesStatic_iface);
}
static HRESULT STDMETHODCALLTYPE windows_media_speech_QueryInterface( static HRESULT STDMETHODCALLTYPE windows_media_speech_QueryInterface(
IActivationFactory *iface, REFIID iid, void **out) IActivationFactory *iface, REFIID iid, void **out)
{ {
struct windows_media_speech *impl = impl_from_IActivationFactory(iface);
TRACE("iface %p, iid %s, out %p stub!\n", iface, debugstr_guid(iid), out); TRACE("iface %p, iid %s, out %p stub!\n", iface, debugstr_guid(iid), out);
if (IsEqualGUID(iid, &IID_IUnknown) || if (IsEqualGUID(iid, &IID_IUnknown) ||
@ -69,6 +80,13 @@ static HRESULT STDMETHODCALLTYPE windows_media_speech_QueryInterface(
return S_OK; return S_OK;
} }
if (IsEqualGUID(iid, &IID_IInstalledVoicesStatic))
{
IUnknown_AddRef(iface);
*out = &impl->IInstalledVoicesStatic_iface;
return S_OK;
}
FIXME("%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid(iid)); FIXME("%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid(iid));
*out = NULL; *out = NULL;
return E_NOINTERFACE; return E_NOINTERFACE;
@ -133,9 +151,80 @@ static const struct IActivationFactoryVtbl activation_factory_vtbl =
windows_media_speech_ActivateInstance, windows_media_speech_ActivateInstance,
}; };
static HRESULT STDMETHODCALLTYPE installed_voices_static_QueryInterface(
IInstalledVoicesStatic *iface, REFIID iid, void **out)
{
struct windows_media_speech *impl = impl_from_IInstalledVoicesStatic(iface);
return windows_media_speech_QueryInterface(&impl->IActivationFactory_iface, iid, out);
}
static ULONG STDMETHODCALLTYPE installed_voices_static_AddRef(
IInstalledVoicesStatic *iface)
{
struct windows_media_speech *impl = impl_from_IInstalledVoicesStatic(iface);
return windows_media_speech_AddRef(&impl->IActivationFactory_iface);
}
static ULONG STDMETHODCALLTYPE installed_voices_static_Release(
IInstalledVoicesStatic *iface)
{
struct windows_media_speech *impl = impl_from_IInstalledVoicesStatic(iface);
return windows_media_speech_Release(&impl->IActivationFactory_iface);
}
static HRESULT STDMETHODCALLTYPE installed_voices_static_GetIids(
IInstalledVoicesStatic *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 installed_voices_static_GetRuntimeClassName(
IInstalledVoicesStatic *iface, HSTRING *class_name)
{
FIXME("iface %p, class_name %p stub!\n", iface, class_name);
return E_NOTIMPL;
}
static HRESULT STDMETHODCALLTYPE installed_voices_static_GetTrustLevel(
IInstalledVoicesStatic *iface, TrustLevel *trust_level)
{
FIXME("iface %p, trust_level %p stub!\n", iface, trust_level);
return E_NOTIMPL;
}
static HRESULT STDMETHODCALLTYPE installed_voices_static_get_AllVoices(
IInstalledVoicesStatic *iface, IVectorView_VoiceInformation **value)
{
FIXME("iface %p, value %p stub!\n", iface, value);
return E_NOTIMPL;
}
static HRESULT STDMETHODCALLTYPE installed_voices_static_get_DefaultVoice(
IInstalledVoicesStatic *iface, IVoiceInformation **value)
{
FIXME("iface %p, value %p stub!\n", iface, value);
return E_NOTIMPL;
}
static const struct IInstalledVoicesStaticVtbl installed_voices_static_vtbl =
{
installed_voices_static_QueryInterface,
installed_voices_static_AddRef,
installed_voices_static_Release,
/* IInspectable methods */
installed_voices_static_GetIids,
installed_voices_static_GetRuntimeClassName,
installed_voices_static_GetTrustLevel,
/* IInstalledVoicesStatic methods */
installed_voices_static_get_AllVoices,
installed_voices_static_get_DefaultVoice,
};
static struct windows_media_speech windows_media_speech = static struct windows_media_speech windows_media_speech =
{ {
{&activation_factory_vtbl}, {&activation_factory_vtbl},
{&installed_voices_static_vtbl},
1 1
}; };

View File

@ -75,8 +75,7 @@ static void test_SpeechSynthesizer(void)
ok(SUCCEEDED(hr), "IActivationFactory_QueryInterface IID_IAgileObject failed, hr %#x\n", hr); ok(SUCCEEDED(hr), "IActivationFactory_QueryInterface IID_IAgileObject failed, hr %#x\n", hr);
hr = IActivationFactory_QueryInterface(factory, &IID_IInstalledVoicesStatic, (void **)&voices_static); hr = IActivationFactory_QueryInterface(factory, &IID_IInstalledVoicesStatic, (void **)&voices_static);
todo_wine ok(SUCCEEDED(hr), "IActivationFactory_QueryInterface IID_IInstalledVoicesStatic failed, hr %#x\n", hr); ok(SUCCEEDED(hr), "IActivationFactory_QueryInterface IID_IInstalledVoicesStatic failed, hr %#x\n", hr);
if (FAILED(hr)) goto done;
hr = IInstalledVoicesStatic_QueryInterface(voices_static, &IID_IInspectable, (void **)&tmp_inspectable); hr = IInstalledVoicesStatic_QueryInterface(voices_static, &IID_IInspectable, (void **)&tmp_inspectable);
ok(SUCCEEDED(hr), "IInstalledVoicesStatic_QueryInterface IID_IInspectable failed, hr %#x\n", hr); ok(SUCCEEDED(hr), "IInstalledVoicesStatic_QueryInterface IID_IInspectable failed, hr %#x\n", hr);
@ -89,7 +88,8 @@ 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);
ok(SUCCEEDED(hr), "IInstalledVoicesStatic_get_AllVoices failed, hr %#x\n", hr); todo_wine 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);
@ -107,10 +107,10 @@ static void test_SpeechSynthesizer(void)
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);
done:
rc = IAgileObject_Release(agile_object); rc = IAgileObject_Release(agile_object);
ok(rc == 3, "IAgileObject_Release returned unexpected refcount %d\n", rc); ok(rc == 3, "IAgileObject_Release returned unexpected refcount %d\n", rc);
rc = IInspectable_Release(inspectable); rc = IInspectable_Release(inspectable);