dmusic/tests: Introduce compare_time helper.
Signed-off-by: Jacek Caban <jacek@codeweavers.com> Signed-off-by: Michael Stefaniuc <mstefani@winehq.org> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
e48fabff52
commit
5dd670c7c5
|
@ -30,6 +30,12 @@
|
||||||
#include "dmusicf.h"
|
#include "dmusicf.h"
|
||||||
#include "dmksctrl.h"
|
#include "dmksctrl.h"
|
||||||
|
|
||||||
|
static BOOL compare_time(REFERENCE_TIME x, REFERENCE_TIME y, unsigned int max_diff)
|
||||||
|
{
|
||||||
|
REFERENCE_TIME diff = x > y ? x - y : y - x;
|
||||||
|
return diff <= max_diff;
|
||||||
|
}
|
||||||
|
|
||||||
static void test_dmusic(void)
|
static void test_dmusic(void)
|
||||||
{
|
{
|
||||||
IDirectMusic *dmusic = NULL;
|
IDirectMusic *dmusic = NULL;
|
||||||
|
@ -800,7 +806,7 @@ static void test_master_clock(void)
|
||||||
hr = IReferenceClock_GetTime(clock, &time1);
|
hr = IReferenceClock_GetTime(clock, &time1);
|
||||||
ok(hr == S_OK, "Got hr %#x.\n", hr);
|
ok(hr == S_OK, "Got hr %#x.\n", hr);
|
||||||
time2 = counter.QuadPart * 10000000.0 / freq.QuadPart;
|
time2 = counter.QuadPart * 10000000.0 / freq.QuadPart;
|
||||||
ok(abs(time1 - time2) < 20 * 10000, "Expected about %s, got %s.\n",
|
ok(compare_time(time1, time2, 20 * 10000), "Expected about %s, got %s.\n",
|
||||||
wine_dbgstr_longlong(time2), wine_dbgstr_longlong(time1));
|
wine_dbgstr_longlong(time2), wine_dbgstr_longlong(time1));
|
||||||
|
|
||||||
hr = IReferenceClock_GetTime(clock, &time2);
|
hr = IReferenceClock_GetTime(clock, &time2);
|
||||||
|
|
Loading…
Reference in New Issue