Vitaliy Margolen : user32/test: Add few tests for messages sent from SetForegroundWindow().

Alexandre Julliard julliard at wine.codeweavers.com
Fri Jun 1 06:44:37 CDT 2007


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

Author: Vitaliy Margolen <wine-patches at kievinfo.com>
Date:   Thu May 31 23:30:54 2007 -0600

user32/test: Add few tests for messages sent from SetForegroundWindow().

---

 dlls/user32/tests/msg.c |   33 +++++++++++++++++++++++++++++++++
 1 files changed, 33 insertions(+), 0 deletions(-)

diff --git a/dlls/user32/tests/msg.c b/dlls/user32/tests/msg.c
index aaa47e3..fee6b2c 100644
--- a/dlls/user32/tests/msg.c
+++ b/dlls/user32/tests/msg.c
@@ -9095,6 +9095,38 @@ static void test_nullCallback(void)
     DestroyWindow(hwnd);
 }
 
+static const struct message SetForegroundWindowSeq[] =
+{
+    { WM_NCACTIVATE, sent|wparam, 0 },
+    { WM_GETTEXT, sent|defwinproc|optional },
+    { WM_ACTIVATE, sent|wparam, 0 },
+    { WM_ACTIVATEAPP, sent|wparam, 0 },
+    { WM_KILLFOCUS, sent },
+    { 0 }
+};
+
+static void test_SetForegroundWindow(void)
+{
+    HWND hwnd;
+
+    hwnd = CreateWindowExA(0, "TestWindowClass", "Test SetForegroundWindow",
+                           WS_OVERLAPPEDWINDOW | WS_VISIBLE,
+                           100, 100, 200, 200, 0, 0, 0, NULL);
+    ok (hwnd != 0, "Failed to create overlapped window\n");
+    flush_sequence();
+
+    trace("SetForegroundWindow( 0 )\n");
+    SetForegroundWindow( 0 );
+    ok_sequence(WmEmptySeq, "SetForegroundWindow( 0 ) away from foreground top level window", FALSE);
+    trace("SetForegroundWindow( GetDesktopWindow() )\n");
+    SetForegroundWindow( GetDesktopWindow() );
+    ok_sequence(SetForegroundWindowSeq, "SetForegroundWindow( desktop ) away from "
+                                        "foreground top level window", TRUE);
+    trace("done\n");
+
+    DestroyWindow(hwnd);
+}
+
 START_TEST(msg)
 {
     BOOL ret;
@@ -9166,6 +9198,7 @@ START_TEST(msg)
     test_sys_menu();
     test_dialog_messages();
     test_nullCallback();
+    test_SetForegroundWindow();
 
     UnhookWindowsHookEx(hCBT_hook);
     if (pUnhookWinEvent)




More information about the wine-cvs mailing list