dmime/tests: Add more GetTrack() tests.

Signed-off-by: Michael Stefaniuc <mstefani@winehq.org>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Michael Stefaniuc 2019-12-08 18:53:51 +01:00 committed by Alexandre Julliard
parent e2f2ad0e81
commit 4649f2f1a0
1 changed files with 32 additions and 6 deletions

View File

@ -543,14 +543,17 @@ static void _add_track(IDirectMusicSegment8 *seg, REFCLSID class, const char *na
#define add_track(seg, class, group) _add_track(seg, &CLSID_DirectMusic ## class, #class, group)
static void _expect_track(IDirectMusicSegment8 *seg, REFCLSID expect, const char *name, DWORD group,
DWORD index)
DWORD index, BOOL ignore_guid)
{
IDirectMusicTrack *track;
IPersistStream *ps;
CLSID class;
HRESULT hr;
hr = IDirectMusicSegment8_GetTrack(seg, &GUID_NULL, group, index, &track);
if (ignore_guid)
hr = IDirectMusicSegment8_GetTrack(seg, &GUID_NULL, group, index, &track);
else
hr = IDirectMusicSegment8_GetTrack(seg, expect, group, index, &track);
if (!expect) {
ok(hr == DMUS_E_NOT_FOUND, "GetTrack failed: %08x, expected DMUS_E_NOT_FOUND\n", hr);
return;
@ -568,9 +571,12 @@ static void _expect_track(IDirectMusicSegment8 *seg, REFCLSID expect, const char
IDirectMusicTrack_Release(track);
}
#define expect_track(seg, class, group, index) _expect_track(seg, &CLSID_DirectMusic ## class, #class, group, index)
#define expect_track(seg, class, group, index) \
_expect_track(seg, &CLSID_DirectMusic ## class, #class, group, index, TRUE)
#define expect_guid_track(seg, class, group, index) \
_expect_track(seg, &CLSID_DirectMusic ## class, #class, group, index, FALSE)
static void test_track_identify(void)
static void test_gettrack(void)
{
IDirectMusicSegment8 *seg;
IDirectMusicTrack *track;
@ -586,7 +592,9 @@ static void test_track_identify(void)
add_track(seg, SegmentTriggerTrack, 0x2); /* idx 1 group 2 */
add_track(seg, SeqTrack, 0x1); /* idx 2 group 1 */
add_track(seg, TempoTrack, 0x7); /* idx 3 group 1, idx 2 group 2, idx 0 group 3 */
add_track(seg, WaveTrack, 0xffffffff); /* idx 4 group 1, idx 3 group 2, idx 1 group 3 */
/* Ignore GUID in GetTrack */
hr = IDirectMusicSegment8_GetTrack(seg, &GUID_NULL, 0, 0, &track);
ok(hr == DMUS_E_NOT_FOUND, "GetTrack failed: %08x, expected DMUS_E_NOT_FOUND\n", hr);
@ -594,12 +602,30 @@ static void test_track_identify(void)
expect_track(seg, ParamControlTrack, 0x1, 1);
expect_track(seg, SeqTrack, 0x1, 2);
expect_track(seg, TempoTrack, 0x1, 3);
_expect_track(seg, NULL, "", 0x1, 4);
expect_track(seg, WaveTrack, 0x1, 4);
_expect_track(seg, NULL, "", 0x1, 5, TRUE);
_expect_track(seg, NULL, "", 0x1, DMUS_SEG_ANYTRACK, TRUE);
expect_track(seg, ParamControlTrack, 0x2, 0);
expect_track(seg, WaveTrack, 0x80000000, 0);
expect_track(seg, SegmentTriggerTrack, 0x3, 2); /* groups 1+2 combined index */
expect_track(seg, SeqTrack, 0x3, 3); /* groups 1+2 combined index */
expect_track(seg, TempoTrack, 0x7, 4); /* groups 1+2+3 combined index */
expect_track(seg, TempoTrack, 0xffffffff, 4); /* all groups combined index */
_expect_track(seg, NULL, "", 0xffffffff, DMUS_SEG_ANYTRACK, TRUE);
/* Use the GUID in GetTrack */
hr = IDirectMusicSegment8_GetTrack(seg, &CLSID_DirectMusicLyricsTrack, 0, 0, &track);
ok(hr == DMUS_E_NOT_FOUND, "GetTrack failed: %08x, expected DMUS_E_NOT_FOUND\n", hr);
expect_guid_track(seg, LyricsTrack, 0x1, 0);
expect_guid_track(seg, ParamControlTrack, 0x1, 0);
expect_guid_track(seg, SeqTrack, 0x1, 0);
expect_guid_track(seg, TempoTrack, 0x1, 0);
expect_guid_track(seg, ParamControlTrack, 0x2, 0);
expect_guid_track(seg, SegmentTriggerTrack, 0x3, 0);
expect_guid_track(seg, SeqTrack, 0x3, 0);
expect_guid_track(seg, TempoTrack, 0x7, 0);
expect_guid_track(seg, TempoTrack, 0xffffffff, 0);
IDirectMusicSegment8_Release(seg);
}
@ -1090,7 +1116,7 @@ START_TEST(dmime)
test_audiopathconfig();
test_graph();
test_segment();
test_track_identify();
test_gettrack();
test_track();
test_parsedescriptor();