Commit a874f60c authored by Rémi Bernon's avatar Rémi Bernon Committed by Alexandre Julliard

dmime/tests: Test IDirectMusicPerformance time conversion.

parent cd5c9b80
......@@ -1601,6 +1601,96 @@ skip_graph2:
IDirectMusicTool_Release(tool);
}
static void test_performance_time(void)
{
IDirectMusicPerformance *performance;
REFERENCE_TIME init_time, time;
IReferenceClock *clock;
MUSIC_TIME music_time;
IDirectMusic *dmusic;
HRESULT hr;
hr = CoCreateInstance(&CLSID_DirectMusicPerformance, NULL, CLSCTX_INPROC_SERVER,
&IID_IDirectMusicPerformance, (void **)&performance);
ok(hr == S_OK, "got %#lx\n", hr);
hr = IDirectMusicPerformance_MusicToReferenceTime(performance, 0, NULL);
todo_wine ok(hr == E_POINTER, "got %#lx\n", hr);
time = 0xdeadbeef;
hr = IDirectMusicPerformance_MusicToReferenceTime(performance, 0, &time);
todo_wine ok(hr == DMUS_E_NO_MASTER_CLOCK, "got %#lx\n", hr);
todo_wine ok(time == 0, "got %I64d\n", time);
hr = IDirectMusicPerformance_ReferenceToMusicTime(performance, 0, NULL);
todo_wine ok(hr == E_POINTER, "got %#lx\n", hr);
music_time = 0xdeadbeef;
hr = IDirectMusicPerformance_ReferenceToMusicTime(performance, 0, &music_time);
todo_wine ok(hr == DMUS_E_NO_MASTER_CLOCK, "got %#lx\n", hr);
todo_wine ok(music_time == 0, "got %ld\n", music_time);
dmusic = NULL;
hr = IDirectMusicPerformance_Init(performance, &dmusic, NULL, NULL);
ok(hr == S_OK, "got %#lx\n", hr);
hr = IDirectMusic_GetMasterClock(dmusic, NULL, &clock);
ok(hr == S_OK, "got %#lx\n", hr);
IDirectMusic_Release(dmusic);
hr = IReferenceClock_GetTime(clock, &init_time);
ok(hr == S_OK, "got %#lx\n", hr);
IReferenceClock_Release(clock);
time = 0xdeadbeef;
hr = IDirectMusicPerformance_MusicToReferenceTime(performance, 0, &time);
ok(hr == S_OK, "got %#lx\n", hr);
ok(time - init_time <= 100 * 10000, "got %I64d\n", time - init_time);
init_time = time;
time = 0xdeadbeef;
hr = IDirectMusicPerformance_MusicToReferenceTime(performance, 1, &time);
ok(hr == S_OK, "got %#lx\n", hr);
todo_wine ok(time - init_time >= 6505, "got %I64d\n", time - init_time);
ok(time - init_time <= 6515, "got %I64d\n", time - init_time);
time = 0xdeadbeef;
hr = IDirectMusicPerformance_MusicToReferenceTime(performance, 1000, &time);
ok(hr == S_OK, "got %#lx\n", hr);
todo_wine ok(time - init_time >= 1000 * 6505, "got %I64d\n", time - init_time);
ok(time - init_time <= 1000 * 6515, "got %I64d\n", time - init_time);
time = 0xdeadbeef;
hr = IDirectMusicPerformance_MusicToReferenceTime(performance, 2000, &time);
ok(hr == S_OK, "got %#lx\n", hr);
todo_wine ok(time - init_time >= 2000 * 6505, "got %I64d\n", time - init_time);
ok(time - init_time <= 2000 * 6515, "got %I64d\n", time - init_time);
music_time = 0xdeadbeef;
hr = IDirectMusicPerformance_ReferenceToMusicTime(performance, init_time, &music_time);
ok(hr == S_OK, "got %#lx\n", hr);
todo_wine ok(music_time == 0, "got %ld\n", music_time);
music_time = 0xdeadbeef;
hr = IDirectMusicPerformance_ReferenceToMusicTime(performance, init_time + 1000 * 6510, &music_time);
ok(hr == S_OK, "got %#lx\n", hr);
todo_wine ok(music_time == 1000, "got %ld\n", music_time);
music_time = 0xdeadbeef;
hr = IDirectMusicPerformance_ReferenceToMusicTime(performance, init_time + 2000 * 6510, &music_time);
ok(hr == S_OK, "got %#lx\n", hr);
todo_wine ok(music_time == 2000, "got %ld\n", music_time);
time = 0xdeadbeef;
music_time = 0xdeadbeef;
hr = IDirectMusicPerformance_GetTime(performance, &time, &music_time);
ok(hr == S_OK, "got %#lx\n", hr);
todo_wine ok(time - init_time <= 200 * 10000, "got %I64d\n", time - init_time);
todo_wine ok(music_time == (time - init_time) / 6510, "got %ld\n", music_time);
hr = IDirectMusicPerformance_CloseDown(performance);
ok(hr == S_OK, "got %#lx\n", hr);
IDirectMusicPerformance_Release(performance);
}
START_TEST(dmime)
{
CoInitialize(NULL);
......@@ -1626,6 +1716,7 @@ START_TEST(dmime)
test_parsedescriptor();
test_performance_tool();
test_performance_graph();
test_performance_time();
CoUninitialize();
}
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