Release 1.3.7.
[wine/gsoc-2012-control.git] / dlls / dmime / tests / performance.c
bloba5a6c6ef9c0fee643d2cdffe4d593c3ec5fcfb60
1 /*
2 * Unit test suite for IDirectMusicPerformance
4 * Copyright 2010 Austin Lund
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 #include <stdarg.h>
22 #include <windef.h>
23 #include <initguid.h>
24 #include <wine/test.h>
25 #include <dmusici.h>
27 static IDirectMusicPerformance8 *idmusicperformance;
29 static HRESULT test_InitAudio(void)
31 IDirectSound *pDirectSound;
32 HRESULT hr;
34 pDirectSound = NULL;
35 hr = IDirectMusicPerformance8_InitAudio(idmusicperformance ,NULL,
36 &pDirectSound, NULL, DMUS_APATH_SHARED_STEREOPLUSREVERB, 128, DMUS_AUDIOF_ALL, NULL);
37 return hr;
40 static void test_PChannelInfo(void)
42 IDirectMusicPort *pDirectMusicPort;
43 HRESULT hr;
45 pDirectMusicPort = NULL;
46 hr = IDirectMusicPerformance8_PChannelInfo(idmusicperformance, 0, &pDirectMusicPort, NULL, NULL);
47 ok(hr == S_OK, "Failed to call PChannelInfo (%x)\n", hr);
48 ok(pDirectMusicPort != NULL, "IDirectMusicPort not set\n");
49 if (hr == S_OK && pDirectMusicPort != NULL)
50 IDirectMusicPort_Release(pDirectMusicPort);
53 static void test_GetDefaultAudioPath(void)
55 IDirectMusicAudioPath *pDirectMusicAudioPath;
56 HRESULT hr;
58 hr = IDirectMusicPerformance8_GetDefaultAudioPath(idmusicperformance, &pDirectMusicAudioPath);
59 ok(hr == S_OK, "Failed to call GetDefaultAudioPath (%x)\n", hr);
60 if (hr == S_OK)
61 IDirectMusicAudioPath_Release(pDirectMusicAudioPath);
64 static void test_CloseDown(void)
66 HRESULT hr;
68 hr = IDirectMusicPerformance8_CloseDown(idmusicperformance);
69 ok(hr == S_OK, "Failed to call CloseDown (%x)\n", hr);
72 START_TEST( performance )
74 HRESULT hr;
76 hr = CoInitialize(NULL);
77 if (FAILED(hr)) {
78 skip("Cannot initialize COM (%x)\n", hr);
79 return;
82 hr = CoCreateInstance(&CLSID_DirectMusicPerformance, NULL,
83 CLSCTX_INPROC_SERVER, &IID_IDirectMusicPerformance8, (LPVOID *)&idmusicperformance);
84 if (hr != S_OK) {
85 skip("Cannot create DirectMusicPerformance object (%x)\n", hr);
86 CoUninitialize();
87 return;
90 hr = test_InitAudio();
91 if (hr != S_OK) {
92 skip("InitAudio failed (%x)\n", hr);
93 return;
96 test_GetDefaultAudioPath();
97 test_PChannelInfo();
98 test_CloseDown();
100 IDirectMusicPerformance8_Release(idmusicperformance);
101 CoUninitialize();