Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-cw
Commits
c6eca927
Commit
c6eca927
authored
Oct 23, 2023
by
Rémi Bernon
Committed by
Alexandre Julliard
Nov 09, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dmime/tests: Add helpers to scale and check music time with tempo.
Be flexible on the comparison to ignore rounding errors.
parent
2d1f46c2
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
8 deletions
+16
-8
dmime.c
dlls/dmime/tests/dmime.c
+16
-8
No files found.
dlls/dmime/tests/dmime.c
View file @
c6eca927
...
...
@@ -2671,6 +2671,17 @@ static void test_performance_graph(void)
IDirectMusicTool_Release
(
tool
);
}
static
double
scale_music_time
(
MUSIC_TIME
time
,
double
tempo
)
{
return
(
600000000
.
0
*
time
)
/
(
tempo
*
768
.
0
);
}
#define check_music_time(a, b) check_music_time_(__LINE__, a, b)
static
void
check_music_time_
(
int
line
,
MUSIC_TIME
time
,
MUSIC_TIME
expect
)
{
ok_
(
__FILE__
,
line
)(
abs
(
time
-
expect
)
<=
1
,
"got %ld, expected %ld
\n
"
,
time
,
expect
);
}
static
void
test_performance_time
(
void
)
{
IDirectMusicPerformance
*
performance
;
...
...
@@ -2720,29 +2731,26 @@ static void test_performance_time(void)
time
=
0xdeadbeef
;
hr
=
IDirectMusicPerformance_MusicToReferenceTime
(
performance
,
1
,
&
time
);
ok
(
hr
==
S_OK
,
"got %#lx
\n
"
,
hr
);
ok
(
time
-
init_time
>=
6505
,
"got %I64d
\n
"
,
time
-
init_time
);
ok
(
time
-
init_time
<=
6515
,
"got %I64d
\n
"
,
time
-
init_time
);
check_music_time
(
time
-
init_time
,
scale_music_time
(
1
,
120
));
time
=
0xdeadbeef
;
hr
=
IDirectMusicPerformance_MusicToReferenceTime
(
performance
,
1000
,
&
time
);
ok
(
hr
==
S_OK
,
"got %#lx
\n
"
,
hr
);
ok
(
time
-
init_time
>=
1000
*
6505
,
"got %I64d
\n
"
,
time
-
init_time
);
ok
(
time
-
init_time
<=
1000
*
6515
,
"got %I64d
\n
"
,
time
-
init_time
);
todo_wine
check_music_time
(
time
-
init_time
,
scale_music_time
(
1000
,
120
));
time
=
0xdeadbeef
;
hr
=
IDirectMusicPerformance_MusicToReferenceTime
(
performance
,
2000
,
&
time
);
ok
(
hr
==
S_OK
,
"got %#lx
\n
"
,
hr
);
ok
(
time
-
init_time
>=
2000
*
6505
,
"got %I64d
\n
"
,
time
-
init_time
);
ok
(
time
-
init_time
<=
2000
*
6515
,
"got %I64d
\n
"
,
time
-
init_time
);
todo_wine
check_music_time
(
time
-
init_time
,
scale_music_time
(
2000
,
120
));
music_time
=
0xdeadbeef
;
hr
=
IDirectMusicPerformance_ReferenceToMusicTime
(
performance
,
init_time
,
&
music_time
);
ok
(
hr
==
S_OK
,
"got %#lx
\n
"
,
hr
);
ok
(
music_time
==
0
,
"got %ld
\n
"
,
music_time
);
music_time
=
0xdeadbeef
;
hr
=
IDirectMusicPerformance_ReferenceToMusicTime
(
performance
,
init_time
+
1000
*
6510
,
&
music_time
);
hr
=
IDirectMusicPerformance_ReferenceToMusicTime
(
performance
,
init_time
+
scale_music_time
(
1000
,
120
)
,
&
music_time
);
ok
(
hr
==
S_OK
,
"got %#lx
\n
"
,
hr
);
ok
(
music_time
==
1000
,
"got %ld
\n
"
,
music_time
);
music_time
=
0xdeadbeef
;
hr
=
IDirectMusicPerformance_ReferenceToMusicTime
(
performance
,
init_time
+
2000
*
6510
,
&
music_time
);
hr
=
IDirectMusicPerformance_ReferenceToMusicTime
(
performance
,
init_time
+
scale_music_time
(
2000
,
120
)
,
&
music_time
);
ok
(
hr
==
S_OK
,
"got %#lx
\n
"
,
hr
);
ok
(
music_time
==
2000
,
"got %ld
\n
"
,
music_time
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment