kernel32/tests: Test deleting a timer right after creating it.

This commit is contained in:
Francois Gouget 2012-07-03 10:03:07 +02:00 committed by Alexandre Julliard
parent b887e7a963
commit d31b6335f2
1 changed files with 17 additions and 3 deletions

View File

@ -704,11 +704,11 @@ static void CALLBACK timer_queue_cb6(PVOID p, BOOLEAN timedOut)
static void test_timer_queue(void) static void test_timer_queue(void)
{ {
HANDLE q, t1, t2, t3, t4, t5; HANDLE q, t0, t1, t2, t3, t4, t5;
int n1, n2, n3, n4, n5; int n0, n1, n2, n3, n4, n5;
struct timer_queue_data1 d1, d2, d3, d4; struct timer_queue_data1 d1, d2, d3, d4;
HANDLE e, et1, et2; HANDLE e, et1, et2;
BOOL ret; BOOL ret, ret0;
if (!pChangeTimerQueueTimer || !pCreateTimerQueue || !pCreateTimerQueueTimer if (!pChangeTimerQueueTimer || !pCreateTimerQueue || !pCreateTimerQueueTimer
|| !pDeleteTimerQueueEx || !pDeleteTimerQueueTimer) || !pDeleteTimerQueueEx || !pDeleteTimerQueueTimer)
@ -731,6 +731,18 @@ static void test_timer_queue(void)
q = pCreateTimerQueue(); q = pCreateTimerQueue();
ok(q != NULL, "CreateTimerQueue\n"); ok(q != NULL, "CreateTimerQueue\n");
/* Not called. */
t0 = NULL;
n0 = 0;
ret = pCreateTimerQueueTimer(&t0, q, timer_queue_cb1, &n0, 0,
300, 0);
ok(ret, "CreateTimerQueueTimer\n");
ok(t0 != NULL, "CreateTimerQueueTimer\n");
ret0 = pDeleteTimerQueueTimer(q, t0, NULL);
ok((!ret0 && GetLastError() == ERROR_IO_PENDING) ||
broken(ret0), /* Win 2000 & XP & 2003 */
"DeleteTimerQueueTimer ret=%d le=%u\n", ret0, GetLastError());
/* Called once. */ /* Called once. */
t1 = NULL; t1 = NULL;
n1 = 0; n1 = 0;
@ -784,6 +796,8 @@ static void test_timer_queue(void)
ret = pDeleteTimerQueueEx(q, INVALID_HANDLE_VALUE); ret = pDeleteTimerQueueEx(q, INVALID_HANDLE_VALUE);
ok(ret, "DeleteTimerQueueEx\n"); ok(ret, "DeleteTimerQueueEx\n");
todo_wine
ok(n0 == 1 || broken(ret0 && n0 == 0), "Timer callback 0 expected 1 got %d\n", n0);
ok(n1 == 1, "Timer callback 1 expected 1 got %d\n", n1); ok(n1 == 1, "Timer callback 1 expected 1 got %d\n", n1);
ok(n2 < n3, "Timer callback 2 & 3 expected %d < %d\n", n2, n3); ok(n2 < n3, "Timer callback 2 & 3 expected %d < %d\n", n2, n3);
ok(n4 == 0, "Timer callback 4 expected 0 got %d\n", n4); ok(n4 == 0, "Timer callback 4 expected 0 got %d\n", n4);