Commit 1f5e2b78 authored by Michael Stefaniuc's avatar Michael Stefaniuc Committed by Alexandre Julliard

dmime/tests: Check all IDirectMusicTrack_IsParamSupported() types.

parent d65f1e55
......@@ -532,24 +532,62 @@ static void test_track(void)
CLSID classid;
ULARGE_INTEGER size;
HRESULT hr;
#define X(guid) &guid, #guid
const struct {
REFGUID type;
const char *name;
} param_types[] = {
{ X(GUID_BandParam) },
{ X(GUID_ChordParam) },
{ X(GUID_Clear_All_Bands) },
{ X(GUID_CommandParam) },
{ X(GUID_CommandParam2) },
{ X(GUID_CommandParamNext) },
{ X(GUID_ConnectToDLSCollection) },
{ X(GUID_Disable_Auto_Download) },
{ X(GUID_DisableTempo) },
{ X(GUID_DisableTimeSig) },
{ X(GUID_Download) },
{ X(GUID_DownloadToAudioPath) },
{ X(GUID_Enable_Auto_Download) },
{ X(GUID_EnableTempo) },
{ X(GUID_EnableTimeSig) },
{ X(GUID_IDirectMusicBand) },
{ X(GUID_IDirectMusicChordMap) },
{ X(GUID_IDirectMusicStyle) },
{ X(GUID_MuteParam) },
{ X(GUID_Play_Marker) },
{ X(GUID_RhythmParam) },
{ X(GUID_SeedVariations) },
{ X(GUID_StandardMIDIFile) },
{ X(GUID_TempoParam) },
{ X(GUID_TimeSignature) },
{ X(GUID_Unload) },
{ X(GUID_UnloadFromAudioPath) },
{ X(GUID_Valid_Start_Time) },
{ X(GUID_Variations) },
{ X(GUID_NULL) }
};
#undef X
#define X(class) &CLSID_ ## class, #class
const struct {
REFCLSID clsid;
const char *name;
BOOL has_param;
/* bitfield with supported param types */
unsigned int has_params;
} class[] = {
{ X(DirectMusicLyricsTrack), TRUE },
{ X(DirectMusicMarkerTrack), TRUE },
{ X(DirectMusicParamControlTrack), TRUE },
{ X(DirectMusicSegmentTriggerTrack), TRUE },
{ X(DirectMusicSeqTrack), FALSE },
{ X(DirectMusicSysExTrack), FALSE },
{ X(DirectMusicTempoTrack), TRUE },
{ X(DirectMusicTimeSigTrack), TRUE },
{ X(DirectMusicWaveTrack), TRUE }
{ X(DirectMusicLyricsTrack), 0 },
{ X(DirectMusicMarkerTrack), 0x8080000 },
{ X(DirectMusicParamControlTrack), 0 },
{ X(DirectMusicSegmentTriggerTrack), 0x3fffffff },
{ X(DirectMusicSeqTrack), ~0 }, /* param methods not implemented */
{ X(DirectMusicSysExTrack), ~0 }, /* param methods not implemented */
{ X(DirectMusicTempoTrack), 0x802100 },
{ X(DirectMusicTimeSigTrack), 0x1004200 },
{ X(DirectMusicWaveTrack), 0x6001c80 }
};
#undef X
unsigned int i;
unsigned int i, j;
for (i = 0; i < ARRAY_SIZE(class); i++) {
trace("Testing %s\n", class[i].name);
......@@ -558,7 +596,18 @@ static void test_track(void)
ok(hr == S_OK, "%s create failed: %08x, expected S_OK\n", class[i].name, hr);
/* IDirectMusicTrack */
if (!class[i].has_param) {
if (class[i].has_params != ~0) {
for (j = 0; j < ARRAY_SIZE(param_types); j++) {
hr = IDirectMusicTrack8_IsParamSupported(dmt, param_types[j].type);
if (class[i].has_params & (1 << j))
ok(hr == S_OK, "IsParamSupported(%s) failed: %08x, expected S_OK\n",
param_types[j].name, hr);
else
ok(hr == DMUS_E_TYPE_UNSUPPORTED,
"IsParamSupported(%s) failed: %08x, expected DMUS_E_TYPE_UNSUPPORTED\n",
param_types[j].name, hr);
}
} else {
hr = IDirectMusicTrack_GetParam(dmt, NULL, 0, NULL, NULL);
ok(hr == E_NOTIMPL, "IDirectMusicTrack_GetParam failed: %08x\n", hr);
hr = IDirectMusicTrack_SetParam(dmt, NULL, 0, NULL);
......@@ -569,13 +618,6 @@ static void test_track(void)
hr = IDirectMusicTrack_IsParamSupported(dmt, &GUID_IDirectMusicStyle);
ok(hr == E_NOTIMPL, "got: %08x\n", hr);
}
else {
hr = IDirectMusicTrack_IsParamSupported(dmt, &GUID_IDirectMusicStyle);
if (class[i].clsid == &CLSID_DirectMusicSegmentTriggerTrack)
ok(hr == S_OK, "got: %08x\n", hr);
else
ok(hr == DMUS_E_TYPE_UNSUPPORTED, "got: %08x\n", hr);
}
if (class[i].clsid != &CLSID_DirectMusicMarkerTrack &&
class[i].clsid != &CLSID_DirectMusicTimeSigTrack) {
hr = IDirectMusicTrack_AddNotificationType(dmt, NULL);
......@@ -591,7 +633,7 @@ static void test_track(void)
if (hr == S_OK) {
hr = IDirectMusicTrack8_PlayEx(dmt8, NULL, 0, 0, 0, 0, NULL, NULL, 0);
todo_wine ok(hr == E_POINTER, "IDirectMusicTrack8_PlayEx failed: %08x\n", hr);
if (!class[i].has_param) {
if (class[i].has_params == ~0) {
hr = IDirectMusicTrack8_GetParamEx(dmt8, NULL, 0, NULL, NULL, NULL, 0);
ok(hr == E_NOTIMPL, "IDirectMusicTrack8_GetParamEx failed: %08x\n", hr);
hr = IDirectMusicTrack8_SetParamEx(dmt8, NULL, 0, NULL, NULL, 0);
......
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