2021-03-12 12:31:09 +01:00
|
|
|
/*
|
|
|
|
* Copyright 2021 Rémi Bernon for CodeWeavers
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
|
|
|
*/
|
|
|
|
#define COBJMACROS
|
|
|
|
#include <stdarg.h>
|
|
|
|
|
|
|
|
#include "windef.h"
|
|
|
|
#include "winbase.h"
|
|
|
|
#include "winerror.h"
|
|
|
|
#include "winstring.h"
|
|
|
|
|
|
|
|
#include "initguid.h"
|
|
|
|
#include "roapi.h"
|
|
|
|
|
|
|
|
#define WIDL_using_Windows_Foundation
|
|
|
|
#define WIDL_using_Windows_Foundation_Collections
|
|
|
|
#include "windows.foundation.h"
|
2022-03-09 18:45:34 +01:00
|
|
|
#define WIDL_using_Windows_Media_SpeechRecognition
|
|
|
|
#include "windows.media.speechrecognition.h"
|
2021-03-12 12:31:09 +01:00
|
|
|
#define WIDL_using_Windows_Media_SpeechSynthesis
|
|
|
|
#include "windows.media.speechsynthesis.h"
|
|
|
|
|
|
|
|
#include "wine/test.h"
|
|
|
|
|
2021-11-30 13:55:24 +01:00
|
|
|
HRESULT WINAPI (*pDllGetActivationFactory)(HSTRING, IActivationFactory **);
|
|
|
|
|
2022-03-09 18:45:34 +01:00
|
|
|
static inline LONG get_ref(IUnknown *obj)
|
|
|
|
{
|
|
|
|
IUnknown_AddRef(obj);
|
|
|
|
return IUnknown_Release(obj);
|
|
|
|
}
|
|
|
|
|
|
|
|
#define check_refcount(obj, exp) check_refcount_(__LINE__, obj, exp)
|
|
|
|
static inline void check_refcount_(unsigned int line, void *obj, LONG exp)
|
|
|
|
{
|
|
|
|
LONG ref = get_ref(obj);
|
2022-03-10 11:47:51 +01:00
|
|
|
ok_(__FILE__, line)(exp == ref, "Unexpected refcount %lu, expected %lu\n", ref, exp);
|
2022-03-09 18:45:34 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
#define check_interface(obj, iid, exp) check_interface_(__LINE__, obj, iid, exp)
|
|
|
|
static void check_interface_(unsigned int line, void *obj, const IID *iid, BOOL supported)
|
|
|
|
{
|
|
|
|
IUnknown *iface = obj;
|
|
|
|
HRESULT hr, expected_hr;
|
|
|
|
IUnknown *unk;
|
|
|
|
|
|
|
|
expected_hr = supported ? S_OK : E_NOINTERFACE;
|
|
|
|
|
|
|
|
hr = IUnknown_QueryInterface(iface, iid, (void **)&unk);
|
2022-03-10 11:47:51 +01:00
|
|
|
ok_(__FILE__, line)(hr == expected_hr, "Got hr %#lx, expected %#lx.\n", hr, expected_hr);
|
2022-03-09 18:45:34 +01:00
|
|
|
if (SUCCEEDED(hr))
|
|
|
|
IUnknown_Release(unk);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void test_ActivationFactory(void)
|
|
|
|
{
|
|
|
|
static const WCHAR *synthesizer_name = L"Windows.Media.SpeechSynthesis.SpeechSynthesizer";
|
|
|
|
static const WCHAR *recognizer_name = L"Windows.Media.SpeechRecognition.SpeechRecognizer";
|
|
|
|
static const WCHAR *garbage_name = L"Some.Garbage.Class";
|
|
|
|
IActivationFactory *factory = NULL, *factory2 = NULL, *factory3 = NULL, *factory4 = NULL;
|
|
|
|
ISpeechRecognizerStatics2 *recognizer_statics2 = NULL;
|
|
|
|
HSTRING str, str2, str3;
|
|
|
|
HMODULE hdll;
|
|
|
|
HRESULT hr;
|
|
|
|
ULONG ref;
|
|
|
|
|
|
|
|
hr = RoInitialize(RO_INIT_MULTITHREADED);
|
2022-03-10 11:47:51 +01:00
|
|
|
ok(hr == S_OK, "RoInitialize failed, hr %#lx.\n", hr);
|
2022-03-09 18:45:34 +01:00
|
|
|
|
|
|
|
hr = WindowsCreateString(synthesizer_name, wcslen(synthesizer_name), &str);
|
2022-03-10 11:47:51 +01:00
|
|
|
ok(hr == S_OK, "WindowsCreateString failed, hr %#lx.\n", hr);
|
2022-03-09 18:45:34 +01:00
|
|
|
|
|
|
|
hr = WindowsCreateString(recognizer_name, wcslen(recognizer_name), &str2);
|
2022-03-10 11:47:51 +01:00
|
|
|
ok(hr == S_OK, "WindowsCreateString failed, hr %#lx.\n", hr);
|
2022-03-09 18:45:34 +01:00
|
|
|
|
|
|
|
hr = WindowsCreateString(garbage_name, wcslen(garbage_name), &str3);
|
2022-03-10 11:47:51 +01:00
|
|
|
ok(hr == S_OK, "WindowsCreateString failed, hr %#lx.\n", hr);
|
2022-03-09 18:45:34 +01:00
|
|
|
|
|
|
|
hr = RoGetActivationFactory(str, &IID_IActivationFactory, (void **)&factory);
|
2022-03-10 11:47:51 +01:00
|
|
|
ok(hr == S_OK, "RoGetActivationFactory failed, hr %#lx.\n", hr);
|
2022-03-09 18:45:34 +01:00
|
|
|
|
|
|
|
check_refcount(factory, 2);
|
|
|
|
|
|
|
|
check_interface(factory, &IID_IInspectable, TRUE);
|
|
|
|
check_interface(factory, &IID_IAgileObject, TRUE);
|
|
|
|
check_interface(factory, &IID_IInstalledVoicesStatic, TRUE);
|
|
|
|
check_interface(factory, &IID_ISpeechRecognizerFactory, FALSE);
|
|
|
|
check_interface(factory, &IID_ISpeechRecognizerStatics, FALSE);
|
|
|
|
check_interface(factory, &IID_ISpeechRecognizerStatics2, FALSE);
|
|
|
|
|
|
|
|
hr = RoGetActivationFactory(str, &IID_IActivationFactory, (void **)&factory2);
|
2022-03-10 11:47:51 +01:00
|
|
|
ok(hr == S_OK, "RoGetActivationFactory failed, hr %#lx.\n", hr);
|
2022-03-09 18:45:34 +01:00
|
|
|
ok(factory == factory2, "Factories pointed at factory %p factory2 %p.\n", factory, factory2);
|
|
|
|
check_refcount(factory2, 3);
|
|
|
|
|
|
|
|
hr = RoGetActivationFactory(str2, &IID_IActivationFactory, (void **)&factory3);
|
2022-03-10 11:47:51 +01:00
|
|
|
todo_wine ok(hr == S_OK || broken(hr == REGDB_E_CLASSNOTREG), "Got unexpected hr %#lx.\n", hr);
|
2022-03-09 18:45:34 +01:00
|
|
|
|
|
|
|
if (hr == S_OK) /* Win10+ only */
|
|
|
|
{
|
|
|
|
check_refcount(factory3, 2);
|
|
|
|
ok(factory != factory3, "Factories pointed at factory %p factory3 %p.\n", factory, factory3);
|
|
|
|
|
|
|
|
check_interface(factory3, &IID_IInspectable, TRUE);
|
|
|
|
check_interface(factory3, &IID_IAgileObject, TRUE);
|
|
|
|
check_interface(factory3, &IID_ISpeechRecognizerFactory, TRUE);
|
|
|
|
check_interface(factory3, &IID_ISpeechRecognizerStatics, TRUE);
|
|
|
|
|
|
|
|
hr = IActivationFactory_QueryInterface(factory3, &IID_ISpeechRecognizerStatics2, (void **)&recognizer_statics2);
|
2022-03-10 11:47:51 +01:00
|
|
|
ok(hr == S_OK || broken(hr == E_NOINTERFACE), "IActivationFactory_QueryInterface failed, hr %#lx.\n", hr);
|
2022-03-09 18:45:34 +01:00
|
|
|
|
|
|
|
if (hr == S_OK) /* ISpeechRecognizerStatics2 not available in Win10 1507 */
|
|
|
|
{
|
|
|
|
ref = ISpeechRecognizerStatics2_Release(recognizer_statics2);
|
2022-03-10 11:47:51 +01:00
|
|
|
ok(ref == 2, "Got unexpected refcount: %lu.\n", ref);
|
2022-03-09 18:45:34 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
check_interface(factory3, &IID_IInstalledVoicesStatic, FALSE);
|
|
|
|
|
|
|
|
ref = IActivationFactory_Release(factory3);
|
2022-03-10 11:47:51 +01:00
|
|
|
ok(ref == 1, "Got unexpected refcount: %lu.\n", ref);
|
2022-03-09 18:45:34 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
hdll = LoadLibraryW(L"windows.media.speech.dll");
|
|
|
|
|
|
|
|
if(hdll)
|
|
|
|
{
|
|
|
|
pDllGetActivationFactory = (void *)GetProcAddress(hdll, "DllGetActivationFactory");
|
|
|
|
ok(!!pDllGetActivationFactory, "DllGetActivationFactory not found.\n");
|
|
|
|
|
|
|
|
hr = pDllGetActivationFactory(str3, &factory4);
|
2022-03-10 11:47:51 +01:00
|
|
|
ok((hr == CLASS_E_CLASSNOTAVAILABLE), "Got unexpected hr %#lx.\n", hr);
|
2022-03-09 18:45:34 +01:00
|
|
|
FreeLibrary(hdll);
|
|
|
|
}
|
|
|
|
|
|
|
|
hr = RoGetActivationFactory(str3, &IID_IActivationFactory, (void **)&factory4);
|
2022-03-10 11:47:51 +01:00
|
|
|
ok((hr == REGDB_E_CLASSNOTREG), "RoGetActivationFactory failed, hr %#lx.\n", hr);
|
2022-03-09 18:45:34 +01:00
|
|
|
|
|
|
|
ref = IActivationFactory_Release(factory2);
|
2022-03-10 11:47:51 +01:00
|
|
|
ok(ref == 2, "Got unexpected refcount: %lu.\n", ref);
|
2022-03-09 18:45:34 +01:00
|
|
|
|
|
|
|
ref = IActivationFactory_Release(factory);
|
2022-03-10 11:47:51 +01:00
|
|
|
ok(ref == 1, "Got unexpected refcount: %lu.\n", ref);
|
2022-03-09 18:45:34 +01:00
|
|
|
|
|
|
|
WindowsDeleteString(str);
|
|
|
|
WindowsDeleteString(str2);
|
|
|
|
WindowsDeleteString(str3);
|
|
|
|
|
|
|
|
RoUninitialize();
|
|
|
|
}
|
|
|
|
|
2021-03-12 12:31:09 +01:00
|
|
|
static void test_SpeechSynthesizer(void)
|
|
|
|
{
|
|
|
|
static const WCHAR *speech_synthesizer_name = L"Windows.Media.SpeechSynthesis.SpeechSynthesizer";
|
2021-11-30 13:55:24 +01:00
|
|
|
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;
|
2021-03-12 12:31:09 +01:00
|
|
|
IVectorView_VoiceInformation *voices = NULL;
|
|
|
|
IInstalledVoicesStatic *voices_static = NULL;
|
2021-03-23 11:23:16 +01:00
|
|
|
IVoiceInformation *voice;
|
2021-03-12 12:31:09 +01:00
|
|
|
IInspectable *inspectable = NULL, *tmp_inspectable = NULL;
|
|
|
|
IAgileObject *agile_object = NULL, *tmp_agile_object = NULL;
|
2021-11-30 13:55:24 +01:00
|
|
|
ISpeechSynthesizer *synthesizer;
|
|
|
|
IClosable *closable;
|
|
|
|
HMODULE hdll;
|
|
|
|
HSTRING str, str2;
|
2021-03-12 12:31:09 +01:00
|
|
|
HRESULT hr;
|
2021-03-23 11:23:17 +01:00
|
|
|
UINT32 size;
|
2021-11-30 13:55:24 +01:00
|
|
|
ULONG ref;
|
2021-03-12 12:31:09 +01:00
|
|
|
|
2021-04-22 03:35:01 +02:00
|
|
|
hr = RoInitialize(RO_INIT_MULTITHREADED);
|
2022-03-10 11:47:51 +01:00
|
|
|
ok(hr == S_OK, "RoInitialize failed, hr %#lx\n", hr);
|
2021-03-12 12:31:09 +01:00
|
|
|
|
2021-04-22 03:35:01 +02:00
|
|
|
hr = WindowsCreateString(speech_synthesizer_name, wcslen(speech_synthesizer_name), &str);
|
2022-03-10 11:47:51 +01:00
|
|
|
ok(hr == S_OK, "WindowsCreateString failed, hr %#lx\n", hr);
|
2021-03-12 12:31:09 +01:00
|
|
|
|
2021-11-30 13:55:24 +01:00
|
|
|
hdll = LoadLibraryW(L"windows.media.speech.dll");
|
|
|
|
if (hdll)
|
|
|
|
{
|
|
|
|
pDllGetActivationFactory = (void *)GetProcAddress(hdll, "DllGetActivationFactory");
|
|
|
|
ok(!!pDllGetActivationFactory, "DllGetActivationFactory not found.\n");
|
|
|
|
|
|
|
|
hr = WindowsCreateString(unknown_class_name, wcslen(unknown_class_name), &str2);
|
2022-03-10 11:47:51 +01:00
|
|
|
ok(hr == S_OK, "WindowsCreateString failed, hr %#lx\n", hr);
|
2021-11-30 13:55:24 +01:00
|
|
|
|
|
|
|
hr = pDllGetActivationFactory(str2, &factory);
|
2022-03-10 11:47:51 +01:00
|
|
|
ok(hr == CLASS_E_CLASSNOTAVAILABLE, "Got unexpected hr %#lx.\n", hr);
|
2021-11-30 13:55:24 +01:00
|
|
|
|
|
|
|
WindowsDeleteString(str2);
|
|
|
|
|
|
|
|
hr = WindowsCreateString(speech_synthesizer_name2, wcslen(speech_synthesizer_name2), &str2);
|
2022-03-10 11:47:51 +01:00
|
|
|
ok(hr == S_OK, "WindowsCreateString failed, hr %#lx\n", hr);
|
2021-11-30 13:55:24 +01:00
|
|
|
|
|
|
|
hr = pDllGetActivationFactory(str2, &factory2);
|
2022-03-10 11:47:51 +01:00
|
|
|
ok(hr == CLASS_E_CLASSNOTAVAILABLE, "Got unexpected hr %#lx.\n", hr);
|
2021-11-30 13:55:24 +01:00
|
|
|
|
|
|
|
WindowsDeleteString(str2);
|
|
|
|
|
|
|
|
hr = pDllGetActivationFactory(str, &factory2);
|
2022-03-10 11:47:51 +01:00
|
|
|
ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
|
2021-11-30 13:55:24 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2022-03-10 11:47:51 +01:00
|
|
|
win_skip("Failed to load library, err %lu.\n", GetLastError());
|
2021-11-30 13:55:24 +01:00
|
|
|
}
|
|
|
|
|
2021-04-22 03:35:01 +02:00
|
|
|
hr = RoGetActivationFactory(str, &IID_IActivationFactory, (void **)&factory);
|
2022-03-10 11:47:51 +01:00
|
|
|
ok(hr == S_OK, "RoGetActivationFactory failed, hr %#lx\n", hr);
|
2021-03-12 12:31:09 +01:00
|
|
|
|
2021-11-30 13:55:24 +01:00
|
|
|
if (hdll)
|
|
|
|
{
|
|
|
|
ok(factory == factory2, "Got unexpected factory %p, factory2 %p.\n", factory, factory2);
|
|
|
|
IActivationFactory_Release(factory2);
|
|
|
|
FreeLibrary(hdll);
|
|
|
|
}
|
|
|
|
|
2021-03-12 12:31:09 +01:00
|
|
|
hr = IActivationFactory_QueryInterface(factory, &IID_IInspectable, (void **)&inspectable);
|
2022-03-10 11:47:51 +01:00
|
|
|
ok(hr == S_OK, "IActivationFactory_QueryInterface IID_IInspectable failed, hr %#lx\n", hr);
|
2021-03-12 12:31:09 +01:00
|
|
|
|
|
|
|
hr = IActivationFactory_QueryInterface(factory, &IID_IAgileObject, (void **)&agile_object);
|
2022-03-10 11:47:51 +01:00
|
|
|
ok(hr == S_OK, "IActivationFactory_QueryInterface IID_IAgileObject failed, hr %#lx\n", hr);
|
2021-03-12 12:31:09 +01:00
|
|
|
|
|
|
|
hr = IActivationFactory_QueryInterface(factory, &IID_IInstalledVoicesStatic, (void **)&voices_static);
|
2022-03-10 11:47:51 +01:00
|
|
|
ok(hr == S_OK, "IActivationFactory_QueryInterface IID_IInstalledVoicesStatic failed, hr %#lx\n", hr);
|
2021-03-12 12:31:09 +01:00
|
|
|
|
|
|
|
hr = IInstalledVoicesStatic_QueryInterface(voices_static, &IID_IInspectable, (void **)&tmp_inspectable);
|
2022-03-10 11:47:51 +01:00
|
|
|
ok(hr == S_OK, "IInstalledVoicesStatic_QueryInterface IID_IInspectable failed, hr %#lx\n", hr);
|
2021-03-12 12:31:09 +01:00
|
|
|
ok(tmp_inspectable == inspectable, "IInstalledVoicesStatic_QueryInterface IID_IInspectable returned %p, expected %p\n", tmp_inspectable, inspectable);
|
|
|
|
IInspectable_Release(tmp_inspectable);
|
|
|
|
|
|
|
|
hr = IInstalledVoicesStatic_QueryInterface(voices_static, &IID_IAgileObject, (void **)&tmp_agile_object);
|
2022-03-10 11:47:51 +01:00
|
|
|
ok(hr == S_OK, "IInstalledVoicesStatic_QueryInterface IID_IAgileObject failed, hr %#lx\n", hr);
|
2021-03-12 12:31:09 +01:00
|
|
|
ok(tmp_agile_object == agile_object, "IInstalledVoicesStatic_QueryInterface IID_IAgileObject returned %p, expected %p\n", tmp_agile_object, agile_object);
|
|
|
|
IAgileObject_Release(tmp_agile_object);
|
|
|
|
|
|
|
|
hr = IInstalledVoicesStatic_get_AllVoices(voices_static, &voices);
|
2022-03-10 11:47:51 +01:00
|
|
|
ok(hr == S_OK, "IInstalledVoicesStatic_get_AllVoices failed, hr %#lx\n", hr);
|
2021-03-12 12:31:09 +01:00
|
|
|
|
|
|
|
hr = IVectorView_VoiceInformation_QueryInterface(voices, &IID_IInspectable, (void **)&tmp_inspectable);
|
2022-03-10 11:47:51 +01:00
|
|
|
ok(hr == S_OK, "IVectorView_VoiceInformation_QueryInterface voices failed, hr %#lx\n", hr);
|
2021-03-12 12:31:09 +01:00
|
|
|
ok(tmp_inspectable != inspectable, "IVectorView_VoiceInformation_QueryInterface voices returned %p, expected %p\n", tmp_inspectable, inspectable);
|
|
|
|
IInspectable_Release(tmp_inspectable);
|
|
|
|
|
|
|
|
hr = IVectorView_VoiceInformation_QueryInterface(voices, &IID_IAgileObject, (void **)&tmp_agile_object);
|
2022-03-10 11:47:51 +01:00
|
|
|
ok(hr == E_NOINTERFACE, "IVectorView_VoiceInformation_QueryInterface voices failed, hr %#lx\n", hr);
|
2021-03-12 12:31:09 +01:00
|
|
|
|
|
|
|
size = 0xdeadbeef;
|
|
|
|
hr = IVectorView_VoiceInformation_get_Size(voices, &size);
|
2022-03-10 11:47:51 +01:00
|
|
|
ok(hr == S_OK, "IVectorView_VoiceInformation_get_Size voices failed, hr %#lx\n", hr);
|
2021-03-12 12:31:11 +01:00
|
|
|
todo_wine ok(size != 0 && size != 0xdeadbeef, "IVectorView_VoiceInformation_get_Size returned %u\n", size);
|
2021-03-12 12:31:09 +01:00
|
|
|
|
2021-03-23 11:23:18 +01:00
|
|
|
voice = (IVoiceInformation *)0xdeadbeef;
|
|
|
|
hr = IVectorView_VoiceInformation_GetAt(voices, size, &voice);
|
2022-03-10 11:47:51 +01:00
|
|
|
ok(hr == E_BOUNDS, "IVectorView_VoiceInformation_GetAt failed, hr %#lx\n", hr);
|
2021-03-23 11:23:18 +01:00
|
|
|
ok(voice == NULL, "IVectorView_VoiceInformation_GetAt returned %p\n", voice);
|
|
|
|
|
2021-03-23 11:23:16 +01:00
|
|
|
hr = IVectorView_VoiceInformation_GetMany(voices, size, 1, &voice, &size);
|
2022-03-10 11:47:51 +01:00
|
|
|
ok(hr == S_OK, "IVectorView_VoiceInformation_GetMany failed, hr %#lx\n", hr);
|
2021-03-23 11:23:16 +01:00
|
|
|
ok(size == 0, "IVectorView_VoiceInformation_GetMany returned count %u\n", size);
|
|
|
|
|
2021-03-18 09:58:43 +01:00
|
|
|
IVectorView_VoiceInformation_Release(voices);
|
2021-03-12 12:31:09 +01:00
|
|
|
|
2021-03-18 09:58:43 +01:00
|
|
|
IInstalledVoicesStatic_Release(voices_static);
|
2021-03-12 12:31:09 +01:00
|
|
|
|
2021-03-18 09:58:43 +01:00
|
|
|
IAgileObject_Release(agile_object);
|
|
|
|
IInspectable_Release(inspectable);
|
2021-03-12 12:31:09 +01:00
|
|
|
|
2021-11-30 13:55:24 +01:00
|
|
|
hr = IActivationFactory_QueryInterface(factory, &IID_ISpeechSynthesizer, (void **)&synthesizer);
|
2022-03-10 11:47:51 +01:00
|
|
|
ok(hr == E_NOINTERFACE, "Got unexpected hr %#lx.\n", hr);
|
2021-11-30 13:55:24 +01:00
|
|
|
|
|
|
|
hr = RoActivateInstance(str, &inspectable);
|
2022-03-10 11:47:51 +01:00
|
|
|
ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
|
2021-11-30 13:55:24 +01:00
|
|
|
|
|
|
|
hr = IInspectable_QueryInterface(inspectable, &IID_ISpeechSynthesizer, (void **)&synthesizer);
|
2022-03-10 11:47:51 +01:00
|
|
|
ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
|
2021-11-30 13:55:24 +01:00
|
|
|
|
|
|
|
hr = IInspectable_QueryInterface(inspectable, &IID_IClosable, (void **)&closable);
|
2022-03-10 11:47:51 +01:00
|
|
|
ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
|
2021-11-30 13:55:24 +01:00
|
|
|
|
|
|
|
ref = IClosable_Release(closable);
|
2022-03-10 11:47:51 +01:00
|
|
|
ok(ref == 2, "Got unexpected ref %lu.\n", ref);
|
2021-11-30 13:55:24 +01:00
|
|
|
|
|
|
|
ref = ISpeechSynthesizer_Release(synthesizer);
|
2022-03-10 11:47:51 +01:00
|
|
|
ok(ref == 1, "Got unexpected ref %lu.\n", ref);
|
2021-11-30 13:55:24 +01:00
|
|
|
|
|
|
|
ref = IInspectable_Release(inspectable);
|
2022-03-10 11:47:51 +01:00
|
|
|
ok(!ref, "Got unexpected ref %lu.\n", ref);
|
2021-11-30 13:55:24 +01:00
|
|
|
|
|
|
|
IActivationFactory_Release(factory);
|
2021-04-22 03:35:01 +02:00
|
|
|
WindowsDeleteString(str);
|
2021-03-12 12:31:09 +01:00
|
|
|
|
2021-04-22 03:35:01 +02:00
|
|
|
RoUninitialize();
|
2021-03-12 12:31:09 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static void test_VoiceInformation(void)
|
|
|
|
{
|
|
|
|
static const WCHAR *voice_information_name = L"Windows.Media.SpeechSynthesis.VoiceInformation";
|
|
|
|
|
|
|
|
IActivationFactory *factory = NULL;
|
|
|
|
HSTRING str;
|
|
|
|
HRESULT hr;
|
|
|
|
|
2021-04-22 03:35:01 +02:00
|
|
|
hr = RoInitialize(RO_INIT_MULTITHREADED);
|
2022-03-10 11:47:51 +01:00
|
|
|
ok(hr == S_OK, "RoInitialize failed, hr %#lx\n", hr);
|
2021-03-12 12:31:09 +01:00
|
|
|
|
2021-04-22 03:35:01 +02:00
|
|
|
hr = WindowsCreateString(voice_information_name, wcslen(voice_information_name), &str);
|
2022-03-10 11:47:51 +01:00
|
|
|
ok(hr == S_OK, "WindowsCreateString failed, hr %#lx\n", hr);
|
2021-03-12 12:31:09 +01:00
|
|
|
|
2021-04-22 03:35:01 +02:00
|
|
|
hr = RoGetActivationFactory(str, &IID_IActivationFactory, (void **)&factory);
|
2022-03-10 11:47:51 +01:00
|
|
|
ok(hr == REGDB_E_CLASSNOTREG, "RoGetActivationFactory returned unexpected hr %#lx\n", hr);
|
2021-03-12 12:31:09 +01:00
|
|
|
|
2021-04-22 03:35:01 +02:00
|
|
|
WindowsDeleteString(str);
|
2021-03-12 12:31:09 +01:00
|
|
|
|
2021-04-22 03:35:01 +02:00
|
|
|
RoUninitialize();
|
2021-03-12 12:31:09 +01:00
|
|
|
}
|
|
|
|
|
2021-03-18 09:58:43 +01:00
|
|
|
START_TEST(speech)
|
2021-03-12 12:31:09 +01:00
|
|
|
{
|
2022-03-09 18:45:34 +01:00
|
|
|
test_ActivationFactory();
|
2021-03-12 12:31:09 +01:00
|
|
|
test_SpeechSynthesizer();
|
|
|
|
test_VoiceInformation();
|
|
|
|
}
|