winmm/tests: Allow more margin in the test_asyncWAVE() playback check.
fgouget at codeweavers.com
Mon Jan 21 21:20:20 CST 2013
This should make this test more reliable when running on VMs where small timing delays are more likely, while better checking that the sound is not played too fast.
Also clean up the test to make its intent clearer.
dlls/winmm/tests/mci.c | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/dlls/winmm/tests/mci.c b/dlls/winmm/tests/mci.c
index ce06d07..b0cd798 100644
@@ -967,7 +967,7 @@ static void test_asyncWAVE(HWND hwnd)
/* Give Wine's asynchronous thread time to start up. Furthermore,
* it uses 3 buffers per second, so that the positions reported
* will be 333ms, 667ms etc. at best. */
- Sleep(100); /* milliseconds */
+ Sleep(500); /* milliseconds */
/* Do not query time format as string because result depends on locale! */
parm.status.dwItem = MCI_STATUS_TIME_FORMAT;
@@ -981,11 +981,12 @@ static void test_asyncWAVE(HWND hwnd)
err = mciSendString("status mysound position", buf, sizeof(buf), hwnd);
ok(!err,"mci status position returned %s\n", dbg_mcierr(err));
- ok(strcmp(buf,"2000"), "mci status position: %s, expected 2000\n", buf);
- trace("position after Sleep: %sms\n",buf);
+ trace("position after Sleep: %sms\n", buf);
p2 = atoi(buf);
- /* Some machines reach 79ms only during the 100ms sleep. */
- ok(p2>=67,"not enough time elapsed %ums\n",p2);
+ /* Check that the 2s sound plays at a normal pace, giving a wide margin to
+ * account for timing granularity and whatnot.
+ ok(400 <= p2 && p2 <= 600, "%ums is not in the expected 400-600ms range\n", p2);
err = mciSendString("pause mysound wait", NULL, 0, hwnd);
More information about the wine-patches