Commit 474a20a0 authored by Jactry Zeng's avatar Jactry Zeng Committed by Alexandre Julliard

sapi: Implement ISpeechVoice stub.

parent 1491453e
......@@ -5,7 +5,8 @@ EXTRADLLFLAGS = -mno-cygwin
C_SRCS = \
main.c \
token.c
token.c \
tts.c
IDL_SRCS = \
sapi_classes.idl \
......
......@@ -106,6 +106,7 @@ static const struct IClassFactoryVtbl class_factory_vtbl =
};
static struct class_factory data_key_cf = { { &class_factory_vtbl }, data_key_create };
static struct class_factory speech_voice_cf = { { &class_factory_vtbl }, speech_voice_create };
static struct class_factory token_category_cf = { { &class_factory_vtbl }, token_category_create };
static struct class_factory token_enum_cf = { { &class_factory_vtbl }, token_enum_create };
......@@ -124,6 +125,8 @@ HRESULT WINAPI DllGetClassObject( REFCLSID clsid, REFIID iid, void **obj )
cf = &token_category_cf.IClassFactory_iface;
else if (IsEqualCLSID( clsid, &CLSID_SpObjectTokenEnum ))
cf = &token_enum_cf.IClassFactory_iface;
else if (IsEqualCLSID( clsid, &CLSID_SpVoice ))
cf = &speech_voice_cf.IClassFactory_iface;
if (!cf) return CLASS_E_CLASSNOTAVAILABLE;
......
......@@ -50,3 +50,16 @@ coclass SpObjectTokenEnum
interface ISpObjectTokenEnumBuilder;
[default] interface IEnumSpObjectTokens;
}
[
uuid(96749377-3391-11d2-9ee3-00c04f797396),
helpstring("Speech Voice"),
progid("SAPI.SpVoice.1"),
vi_progid("SAPI.SpVoice"),
threading(both)
]
coclass SpVoice
{
interface ISpVoice;
[default] interface ISpeechVoice;
}
......@@ -21,6 +21,7 @@
#include "wine/heap.h"
HRESULT data_key_create( IUnknown *outer, REFIID iid, void **obj ) DECLSPEC_HIDDEN;
HRESULT speech_voice_create( IUnknown *outer, REFIID iid, void **obj ) DECLSPEC_HIDDEN;
HRESULT token_category_create( IUnknown *outer, REFIID iid, void **obj ) DECLSPEC_HIDDEN;
HRESULT token_enum_create( IUnknown *outer, REFIID iid, void **obj ) DECLSPEC_HIDDEN;
......
......@@ -2,4 +2,5 @@ TESTDLL = sapi.dll
IMPORTS = ole32 user32 advapi32
C_SRCS = \
token.c
token.c \
tts.c
/*
* Speech API (SAPI) text-to-speech tests.
*
* Copyright 2019 Jactry Zeng 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 "sapiddk.h"
#include "sperror.h"
#include "wine/test.h"
#define EXPECT_REF(obj,ref) _expect_ref((IUnknown*)obj, ref, __LINE__)
static void _expect_ref(IUnknown *obj, ULONG ref, int line)
{
ULONG rc;
IUnknown_AddRef(obj);
rc = IUnknown_Release(obj);
ok_(__FILE__,line)(rc == ref, "Unexpected refcount %d, expected %d.\n", rc, ref);
}
static void test_interfaces(void)
{
ISpeechVoice *speech_voice;
IDispatch *dispatch;
IUnknown *unk;
HRESULT hr;
hr = CoCreateInstance(&CLSID_SpVoice, NULL, CLSCTX_INPROC_SERVER,
&IID_ISpeechVoice, (void **)&speech_voice);
ok(hr == S_OK, "Failed to create ISpeechVoice interface: %#x.\n", hr);
EXPECT_REF(speech_voice, 1);
hr = CoCreateInstance(&CLSID_SpVoice, NULL, CLSCTX_INPROC_SERVER,
&IID_IDispatch, (void **)&dispatch);
ok(hr == S_OK, "Failed to create IDispatch interface: %#x.\n", hr);
EXPECT_REF(dispatch, 1);
EXPECT_REF(speech_voice, 1);
IDispatch_Release(dispatch);
hr = CoCreateInstance(&CLSID_SpVoice, NULL, CLSCTX_INPROC_SERVER,
&IID_IUnknown, (void **)&unk);
ok(hr == S_OK, "Failed to create IUnknown interface: %#x.\n", hr);
EXPECT_REF(unk, 1);
EXPECT_REF(speech_voice, 1);
IUnknown_Release(unk);
ISpeechVoice_Release(speech_voice);
}
START_TEST(tts)
{
CoInitialize(NULL);
test_interfaces();
CoUninitialize();
}
This diff is collapsed. Click to expand it.
......@@ -839,7 +839,7 @@ interface ISpVoice : ISpEventSource
[out] SPVOICESTATUS *status,
[out, string] WCHAR **bookmark);
HRESULT Skip([in,string] WCHAR* type, [in] long items, [out] ULONG *skipped);
HRESULT Skip([in,string] const WCHAR *type, [in] long items, [out] ULONG *skipped);
HRESULT SetPriority([in] SPVPRIORITY priority);
HRESULT GetPriority([out] SPVPRIORITY* priority);
......@@ -1047,4 +1047,13 @@ library SpeechLib
/*[default] interface ISpeechRecognizer;*/
interface ISpRecognizer;
};
[
uuid(96749377-3391-11d2-9ee3-00c04f797396)
]
coclass SpVoice
{
interface ISpVoice;
[default] interface ISpeechVoice;
};
}
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