sapi/tests: Enable compilation with long types.
[wine.git] / dlls / sapi / tests / stream.c
blobea2608eed363b231e7b28661bb95067a2fca945f
1 /*
2 * Speech API (SAPI) stream tests.
4 * Copyright 2020 Gijs Vermeulen
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
21 #define COBJMACROS
23 #include "sapiddk.h"
24 #include "sperror.h"
26 #include "wine/test.h"
28 #define EXPECT_REF(obj,ref) _expect_ref((IUnknown*)obj, ref, __LINE__)
29 static void _expect_ref(IUnknown *obj, ULONG ref, int line)
31 ULONG rc;
32 IUnknown_AddRef(obj);
33 rc = IUnknown_Release(obj);
34 ok_(__FILE__,line)(rc == ref, "Unexpected refcount %ld, expected %ld.\n", rc, ref);
37 static void test_interfaces(void)
39 ISpStream *speech_stream;
40 IDispatch *dispatch;
41 IUnknown *unk;
42 HRESULT hr;
44 hr = CoCreateInstance(&CLSID_SpStream, NULL, CLSCTX_INPROC_SERVER,
45 &IID_ISpStream, (void **)&speech_stream);
46 ok(hr == S_OK, "Failed to create ISpeechVoice interface: %#lx.\n", hr);
47 EXPECT_REF(speech_stream, 1);
49 hr = CoCreateInstance(&CLSID_SpStream, NULL, CLSCTX_INPROC_SERVER,
50 &IID_IUnknown, (void **)&unk);
51 ok(hr == S_OK, "Failed to create IUnknown interface: %#lx.\n", hr);
52 EXPECT_REF(unk, 1);
53 EXPECT_REF(speech_stream, 1);
54 IUnknown_Release(unk);
56 hr = CoCreateInstance(&CLSID_SpStream, NULL, CLSCTX_INPROC_SERVER,
57 &IID_IDispatch, (void **)&dispatch);
58 ok(hr == E_NOINTERFACE, "Succeeded to create IDispatch interface: %#lx.\n", hr);
59 ok(!dispatch, "Expected NULL dispatch, got %p.", dispatch);
61 ISpStream_Release(speech_stream);
64 START_TEST(stream)
66 CoInitialize(NULL);
67 test_interfaces();
68 CoUninitialize();