[USER32_APITEST]
authorThomas Faber <thomas.faber@reactos.org>
Fri, 24 Oct 2014 09:16:04 +0000 (09:16 +0000)
committerThomas Faber <thomas.faber@reactos.org>
Fri, 24 Oct 2014 09:16:04 +0000 (09:16 +0000)
- Add a test for SendMessageTimeout failure case
- Remove a pointless (and broken) memset (Coverity)
CORE-8699

svn path=/trunk/; revision=64948

rostests/apitests/user32/CMakeLists.txt
rostests/apitests/user32/SendMessageTimeout.c [new file with mode: 0644]
rostests/apitests/user32/SetCursorPos.c
rostests/apitests/user32/testlist.c

index e65e9b9..cccad1a 100644 (file)
@@ -19,6 +19,7 @@ list(APPEND SOURCE
     RealGetWindowClass.c
     ScrollDC.c
     ScrollWindowEx.c
+    SendMessageTimeout.c
     SetActiveWindow.c
     SetCursorPos.c
     SystemParametersInfo.c
diff --git a/rostests/apitests/user32/SendMessageTimeout.c b/rostests/apitests/user32/SendMessageTimeout.c
new file mode 100644 (file)
index 0000000..7cf82d6
--- /dev/null
@@ -0,0 +1,40 @@
+/*
+ * PROJECT:         ReactOS API tests
+ * LICENSE:         LGPLv2.1+ - See COPYING.LIB in the top level directory
+ * PURPOSE:         Test for SendMessageTimeout
+ * PROGRAMMERS:     Thomas Faber <thomas.faber@reactos.org>
+ */
+
+#include <apitest.h>
+#include <winuser.h>
+
+static
+void
+TestSendMessageTimeout(HWND hWnd, UINT Msg)
+{
+    LRESULT ret;
+    DWORD_PTR result;
+
+    ret = SendMessageTimeoutW(hWnd, Msg, 0, 0, SMTO_NORMAL, 0, NULL);
+    ok(ret == 0, "ret = %Id\n", ret);
+
+    result = 0x55555555;
+    ret = SendMessageTimeoutW(hWnd, Msg, 0, 0, SMTO_NORMAL, 0, &result);
+    ok(ret == 0, "ret = %Id\n", ret);
+    ok(result == 0, "result = %Iu\n", result);
+
+    ret = SendMessageTimeoutA(hWnd, Msg, 0, 0, SMTO_NORMAL, 0, NULL);
+    ok(ret == 0, "ret = %Id\n", ret);
+
+    result = 0x55555555;
+    ret = SendMessageTimeoutA(hWnd, Msg, 0, 0, SMTO_NORMAL, 0, &result);
+    ok(ret == 0, "ret = %Id\n", ret);
+    ok(result == 0, "result = %Iu\n", result);
+}
+
+START_TEST(SendMessageTimeout)
+{
+    TestSendMessageTimeout(NULL, WM_USER);
+    TestSendMessageTimeout(NULL, WM_PAINT);
+    TestSendMessageTimeout(NULL, WM_GETICON);
+}
index 8e429fa..b93deb1 100644 (file)
@@ -95,8 +95,6 @@ void Test_SetCursorPos()
     MSG msg;
     int i;
 
-    memset(results, sizeof(results), 0);
-
     hMouseHookLL = SetWindowsHookEx(WH_MOUSE_LL, MouseLLHookProc, GetModuleHandleA( NULL ), 0);
     hMouseHook = SetWindowsHookExW(WH_MOUSE, MouseHookProc, GetModuleHandleW( NULL ), GetCurrentThreadId());
     ok(hMouseHook!=NULL,"failed to set hook\n");
index bc2ccb2..fcf5ccf 100644 (file)
@@ -21,6 +21,7 @@ extern void func_LookupIconIdFromDirectoryEx(void);
 extern void func_RealGetWindowClass(void);
 extern void func_ScrollDC(void);
 extern void func_ScrollWindowEx(void);
+extern void func_SendMessageTimeout(void);
 extern void func_SetActiveWindow(void);
 extern void func_SetCursorPos(void);
 extern void func_SystemParametersInfo(void);
@@ -48,6 +49,7 @@ const struct test winetest_testlist[] =
     { "RealGetWindowClass", func_RealGetWindowClass },
     { "ScrollDC", func_ScrollDC },
     { "ScrollWindowEx", func_ScrollWindowEx },
+    { "SendMessageTimeout", func_SendMessageTimeout },
     { "SetActiveWindow", func_SetActiveWindow },
     { "SetCursorPos", func_SetCursorPos },
     { "SystemParametersInfo", func_SystemParametersInfo },