From: Anton Baskanov baskanov@gmail.com
--- dlls/dmime/tests/dmime.c | 76 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 76 insertions(+)
diff --git a/dlls/dmime/tests/dmime.c b/dlls/dmime/tests/dmime.c index e1d88c11d62..6a8a3ef0a87 100644 --- a/dlls/dmime/tests/dmime.c +++ b/dlls/dmime/tests/dmime.c @@ -2511,11 +2511,26 @@ static void test_performance_pchannel(void)
static void test_performance_tool(void) { + static const DMUS_NOTE_PMSG note60 = + { + .dwSize = sizeof(DMUS_NOTE_PMSG), + .dwFlags = DMUS_PMSGF_REFTIME | DMUS_PMSGF_MUSICTIME | DMUS_PMSGF_TOOL_QUEUE, + .dwType = DMUS_PMSGT_NOTE, + .mtDuration = 1000, + .wMusicValue = 60, + .bVelocity = 127, + .bFlags = DMUS_NOTEF_NOTEON, + .bPlayModeFlags = DMUS_PLAYMODE_FIXED, + .bMidiValue = 60, + }; IDirectMusicPerformance *performance; IDirectMusicGraph *graph; IDirectMusicTool *tool; DWORD value, types[1]; + DMUS_NOTE_PMSG note; DMUS_PMSG msg = {0}; + REFERENCE_TIME rt; + MUSIC_TIME mt; HRESULT hr;
hr = CoCreateInstance(&CLSID_DirectMusicPerformance, NULL, CLSCTX_INPROC_SERVER, @@ -2546,6 +2561,67 @@ static void test_performance_tool(void) hr = IDirectMusicTool_Flush(tool, performance, &msg, 0); todo_wine ok(hr == S_OK, "got %#lx\n", hr);
+ hr = IDirectMusicPerformance_Init(performance, NULL, NULL, NULL); + ok(hr == S_OK, "got %#lx\n", hr); + + hr = IDirectMusicPerformance_AddPort(performance, NULL); + ok(hr == S_OK, "got %#lx\n", hr); + + hr = IDirectMusicPerformance_GetTime(performance, NULL, &mt); + ok(hr == S_OK, "got %#lx\n", hr); + hr = IDirectMusicPerformance_MusicToReferenceTime(performance, mt, &rt); + ok(hr == S_OK, "got %#lx\n", hr); + + note = note60; + note.rtTime = rt; + note.mtTime = mt; + note.bFlags = 0; + hr = IDirectMusicTool_ProcessPMsg(tool, performance, (DMUS_PMSG *)¬e); + ok(hr == DMUS_S_FREE, "got %#lx\n", hr); + + note = note60; + note.rtTime = rt; + note.mtTime = mt; + note.mtDuration = 0; + hr = IDirectMusicTool_ProcessPMsg(tool, performance, (DMUS_PMSG *)¬e); + ok(hr == DMUS_S_FREE, "got %#lx\n", hr); + + note = note60; + note.rtTime = rt; + note.mtTime = mt; + hr = IDirectMusicTool_ProcessPMsg(tool, performance, (DMUS_PMSG *)¬e); + todo_wine ok(hr == DMUS_S_REQUEUE, "got %#lx\n", hr); + ok(note.dwSize == sizeof(DMUS_NOTE_PMSG), "got %lu\n", note.dwSize); + todo_wine ok(llabs(note.rtTime - rt - 6503906) < 10, "got %I64d\n", note.rtTime - rt); + todo_wine ok(note.mtTime - mt == 999, "got %ld\n", note.mtTime - mt); + ok(note.dwFlags == (DMUS_PMSGF_REFTIME | DMUS_PMSGF_MUSICTIME | DMUS_PMSGF_TOOL_QUEUE), + "got %#lx\n", note.dwFlags); + ok(!note.dwPChannel, "got %lu\n", note.dwPChannel); + ok(!note.dwVirtualTrackID, "got %lu\n", note.dwVirtualTrackID); + ok(!note.pGraph, "got %p\n", note.pGraph); + ok(note.dwType == DMUS_PMSGT_NOTE, "got %#lx\n", note.dwType); + ok(!note.dwVoiceID, "got %lu\n", note.dwVoiceID); + ok(!note.dwGroupID, "got %lu\n", note.dwGroupID); + ok(!note.punkUser, "got %p\n", note.punkUser); + ok(note.mtDuration == 1000, "got %ld\n", note.mtDuration); + ok(note.wMusicValue == 60, "got %d\n", note.wMusicValue); + ok(!note.wMeasure, "got %d\n", note.wMeasure); + ok(!note.nOffset, "got %d\n", note.nOffset); + ok(!note.bBeat, "got %d\n", note.bBeat); + ok(!note.bGrid, "got %d\n", note.bGrid); + ok(note.bVelocity == 127, "got %d\n", note.bVelocity); + todo_wine ok(!note.bFlags, "got %#x\n", note.bFlags); + ok(!note.bTimeRange, "got %d\n", note.bTimeRange); + ok(!note.bDurRange, "got %d\n", note.bDurRange); + ok(!note.bVelRange, "got %d\n", note.bVelRange); + ok(note.bPlayModeFlags == DMUS_PLAYMODE_FIXED, "got %#x\n", note.bPlayModeFlags); + ok(!note.bSubChordLevel, "got %d\n", note.bSubChordLevel); + ok(note.bMidiValue == 60, "got %d\n", note.bMidiValue); + ok(!note.cTranspose, "got %d\n", note.cTranspose); + + hr = IDirectMusicPerformance_CloseDown(performance); + ok(hr == S_OK, "got %#lx\n", hr); + IDirectMusicGraph_Release(graph); IDirectMusicTool_Release(tool);