diff --git a/dlls/dmime/tests/performance.c b/dlls/dmime/tests/performance.c index 5cb91a78387..6a8efcdf28a 100644 --- a/dlls/dmime/tests/performance.c +++ b/dlls/dmime/tests/performance.c @@ -489,151 +489,6 @@ static void test_COM(void) ok (refcount == 0, "refcount == %lu, expected 0\n", refcount); } -static void test_notification_type(void) -{ - static unsigned char rifffile[8+4+8+16+8+256] = "RIFF\x24\x01\x00\x00WAVE" /* header: 4 ("WAVE") + (8 + 16) (format segment) + (8 + 256) (data segment) = 0x124 */ - "fmt \x10\x00\x00\x00\x01\x00\x20\x00\xAC\x44\x00\x00\x10\xB1\x02\x00\x04\x00\x10\x00" /* format segment: PCM, 2 chan, 44100 Hz, 16 bits */ - "data\x00\x01\x00\x00"; /* 256 byte data segment (silence) */ - - IDirectMusicPerformance8 *perf; - IDirectMusic *music = NULL; - IDirectMusicSegment8 *prime_segment8; - IDirectMusicSegment8 *segment8 = NULL; - IDirectMusicLoader8 *loader; - IDirectMusicAudioPath8 *path; - IDirectMusicSegmentState *state; - IDirectSound *dsound = NULL; - HRESULT hr; - DWORD result; - HANDLE messages; - DMUS_NOTIFICATION_PMSG *msg; - BOOL found_end = FALSE; - DMUS_OBJECTDESC desc = {0}; - - hr = CoCreateInstance(&CLSID_DirectMusicPerformance, NULL, - CLSCTX_INPROC_SERVER, &IID_IDirectMusicPerformance8, (void**)&perf); - ok(hr == S_OK, "CoCreateInstance failed: %#lx\n", hr); - - hr = IDirectMusicPerformance8_InitAudio(perf, &music, &dsound, NULL, DMUS_APATH_DYNAMIC_STEREO, 64, DMUS_AUDIOF_ALL, NULL); - ok(music != NULL, "Didn't get IDirectMusic pointer\n"); - ok(dsound != NULL, "Didn't get IDirectSound pointer\n"); - - hr = CoCreateInstance(&CLSID_DirectMusicLoader, NULL, CLSCTX_INPROC_SERVER, &IID_IDirectMusicLoader8, (void**)&loader); - ok(hr == S_OK, "CoCreateInstance failed: %#lx\n", hr); - - messages = CreateEventA( NULL, FALSE, FALSE, NULL ); - - hr = IDirectMusicPerformance8_AddNotificationType(perf, &GUID_NOTIFICATION_SEGMENT); - ok(hr == S_OK, "Failed: %#lx\n", hr); - - hr = IDirectMusicPerformance8_SetNotificationHandle(perf, messages, 0); - ok(hr == S_OK, "Failed: %#lx\n", hr); - - hr = IDirectMusicPerformance8_GetDefaultAudioPath(perf, &path); - ok(hr == S_OK, "Failed: %#lx\n", hr); - ok(path != NULL, "Didn't get IDirectMusicAudioPath pointer\n"); - - desc.dwSize = sizeof(DMUS_OBJECTDESC); - desc.dwValidData = DMUS_OBJ_CLASS | DMUS_OBJ_MEMORY; - desc.guidClass = CLSID_DirectMusicSegment; - desc.pbMemData = rifffile; - desc.llMemLength = sizeof(rifffile); - hr = IDirectMusicLoader8_GetObject(loader, &desc, &IID_IDirectMusicSegment8, (void**)&prime_segment8); - ok(hr == S_OK, "Failed: %#lx\n", hr); - ok(prime_segment8 != NULL, "Didn't get IDirectMusicSegment pointer\n"); - - hr = IDirectMusicSegment8_Download(prime_segment8, (IUnknown*)path); - ok(hr == S_OK, "Download failed: %#lx\n", hr); - - hr = IDirectMusicPerformance8_PlaySegmentEx(perf, (IUnknown*)prime_segment8, - NULL, NULL, DMUS_SEGF_SECONDARY, 0, &state, NULL, (IUnknown*)path); - ok(hr == S_OK, "PlaySegmentEx failed: %#lx\n", hr); - ok(state != NULL, "Didn't get IDirectMusicSegmentState pointer\n"); - - while (!found_end) { - result = WaitForSingleObject(messages, 500); - todo_wine ok(result == WAIT_OBJECT_0, "Failed: %ld\n", result); - if (result != WAIT_OBJECT_0) - break; - - msg = NULL; - hr = IDirectMusicPerformance8_GetNotificationPMsg(perf, &msg); - ok(hr == S_OK, "Failed: %#lx\n", hr); - ok(msg != NULL, "Unexpected NULL pointer\n"); - if (FAILED(hr) || !msg) - break; - - trace("Notification: %ld\n", msg->dwNotificationOption); - - if (msg->dwNotificationOption == DMUS_NOTIFICATION_SEGEND || - msg->dwNotificationOption == DMUS_NOTIFICATION_SEGALMOSTEND) { - ok(msg->punkUser != NULL, "Unexpected NULL pointer\n"); - if (msg->punkUser) { - IDirectMusicSegmentState8 *segmentstate; - IDirectMusicSegment *segment; - - hr = IUnknown_QueryInterface(msg->punkUser, &IID_IDirectMusicSegmentState8, (void**)&segmentstate); - ok(hr == S_OK, "Failed: %#lx\n", hr); - - hr = IDirectMusicSegmentState8_GetSegment(segmentstate, &segment); - ok(hr == S_OK, "Failed: %#lx\n", hr); - if (FAILED(hr)) { - IDirectMusicSegmentState8_Release(segmentstate); - break; - } - - hr = IDirectMusicSegment_QueryInterface(segment, &IID_IDirectMusicSegment8, (void**)&segment8); - ok(hr == S_OK, "Failed: %#lx\n", hr); - - found_end = TRUE; - - IDirectMusicSegment_Release(segment); - IDirectMusicSegmentState8_Release(segmentstate); - } - } - - IDirectMusicPerformance8_FreePMsg(perf, (DMUS_PMSG*)msg); - } - todo_wine ok(prime_segment8 == segment8, "Wrong end segment\n"); - todo_wine ok(found_end, "Didn't receive DMUS_NOTIFICATION_SEGEND message\n"); - - CloseHandle(messages); - - if(segment8) - IDirectMusicSegment8_Release(segment8); - IDirectSound_Release(dsound); - IDirectMusicSegmentState_Release(state); - IDirectMusicAudioPath_Release(path); - IDirectMusicLoader8_Release(loader); - IDirectMusic_Release(music); - IDirectMusicPerformance8_Release(perf); -} - -static void test_performance_graph(void) -{ - HRESULT hr; - IDirectMusicPerformance8 *perf; - IDirectMusicGraph *graph = NULL, *graph2; - - create_performance(&perf, NULL, NULL, FALSE); - hr = IDirectMusicPerformance8_Init(perf, NULL, NULL, NULL); - ok(hr == S_OK, "Init failed: %#lx\n", hr); - - hr = IDirectMusicPerformance8_GetGraph(perf, NULL); - ok(hr == E_POINTER, "Failed: %#lx\n", hr); - - hr = IDirectMusicPerformance8_GetGraph(perf, &graph2); - ok(hr == DMUS_E_NOT_FOUND, "Failed: %#lx\n", hr); - ok(graph2 == NULL, "unexpected pointer.\n"); - - hr = IDirectMusicPerformance8_QueryInterface(perf, &IID_IDirectMusicGraph, (void**)&graph); - ok(hr == S_OK, "Failed: %#lx\n", hr); - - if (graph) - IDirectMusicGraph_Release(graph); - destroy_performance(perf, NULL, NULL); -} - START_TEST( performance ) { HRESULT hr; @@ -653,8 +508,6 @@ START_TEST( performance ) test_COM(); test_createport(); test_pchannel(); - test_notification_type(); - test_performance_graph(); CoUninitialize(); }