Piotr Caban : user32: Test error returned in out of timers case.

Alexandre Julliard julliard at wine.codeweavers.com
Tue Jan 26 10:32:52 CST 2016


Module: wine
Branch: master
Commit: 7b3c7af8134506479498df8ef343e67fd2e9d919
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=7b3c7af8134506479498df8ef343e67fd2e9d919

Author: Piotr Caban <piotr at codeweavers.com>
Date:   Mon Jan 25 09:59:57 2016 +0100

user32: Test error returned in out of timers case.

Signed-off-by: Piotr Caban <piotr at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/user32/tests/msg.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/dlls/user32/tests/msg.c b/dlls/user32/tests/msg.c
index 7d6c99a..cdc0364 100644
--- a/dlls/user32/tests/msg.c
+++ b/dlls/user32/tests/msg.c
@@ -8763,9 +8763,11 @@ static void test_timers(void)
 
 static void test_timers_no_wnd(void)
 {
+    static UINT_PTR ids[0xffff];
     UINT_PTR id, id2;
     DWORD start;
     MSG msg;
+    int i;
 
     count = 0;
     id = SetTimer(NULL, 0, 100, callback_count);
@@ -8800,6 +8802,18 @@ static void test_timers_no_wnd(void)
        count, TIMER_COUNT_EXPECTED);
     KillTimer(NULL, id);
     /* Note: SetSystemTimer doesn't support a NULL window, see test_timers */
+
+    /* Check what happens when we're running out of timers */
+    for (i=0; i<sizeof(ids)/sizeof(ids[0]); i++)
+    {
+        SetLastError(0xdeadbeef);
+        ids[i] = SetTimer(NULL, 0, USER_TIMER_MAXIMUM, tfunc);
+        if (!ids[i]) break;
+    }
+    ok(i != sizeof(ids)/sizeof(ids[0]), "all timers were created successfully\n");
+    ok(GetLastError()==ERROR_NO_MORE_USER_HANDLES || broken(GetLastError()==0xdeadbeef),
+            "GetLastError() = %d\n", GetLastError());
+    while (i > 0) KillTimer(NULL, ids[--i]);
 }
 
 static void test_timers_exception(DWORD code)




More information about the wine-cvs mailing list