Piotr Caban : user32/tests: Add initial WindowFromPoint tests.

Alexandre Julliard julliard at wine.codeweavers.com
Mon Sep 29 13:35:41 CDT 2014


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

Author: Piotr Caban <piotr at codeweavers.com>
Date:   Mon Sep 29 18:02:13 2014 +0200

user32/tests: Add initial WindowFromPoint tests.

---

 dlls/user32/tests/win.c | 39 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 39 insertions(+)

diff --git a/dlls/user32/tests/win.c b/dlls/user32/tests/win.c
index bf9bb2c..f59c1dc 100644
--- a/dlls/user32/tests/win.c
+++ b/dlls/user32/tests/win.c
@@ -7200,6 +7200,44 @@ todo_wine
     ok(ret, "UnregisterClass(my_window) failed\n");
 }
 
+static void test_window_from_point(void)
+{
+    HWND hwnd, child, win;
+    POINT pt;
+
+    hwnd = CreateWindowExA(0, "MainWindowClass", NULL, WS_POPUP | WS_VISIBLE,
+            100, 100, 200, 100, 0, 0, NULL, NULL);
+    ok(hwnd != 0, "CreateWindowEx failed\n");
+
+    pt.x = pt.y = 150;
+    win = WindowFromPoint(pt);
+    pt.x = 250;
+    if(win == hwnd)
+        win = WindowFromPoint(pt);
+    if(win != hwnd) {
+        skip("there's another window covering test window\n");
+        DestroyWindow(hwnd);
+        return;
+    }
+
+    child = CreateWindowExA(0, "static", "static", WS_CHILD | WS_VISIBLE,
+            0, 0, 100, 100, hwnd, 0, NULL, NULL);
+    ok(child != 0, "CreateWindowEx failed\n");
+    pt.x = pt.y = 150;
+    win = WindowFromPoint(pt);
+    ok(win == hwnd, "WindowFromPoint returned %p, expected %p\n", win, hwnd);
+    DestroyWindow(child);
+
+    child = CreateWindowExA(0, "button", "button", WS_CHILD | WS_VISIBLE,
+                0, 0, 100, 100, hwnd, 0, NULL, NULL);
+    ok(child != 0, "CreateWindowEx failed\n");
+    win = WindowFromPoint(pt);
+    ok(win == child, "WindowFromPoint returned %p, expected %p\n", win, child);
+    DestroyWindow(child);
+
+    DestroyWindow(hwnd);
+}
+
 static void test_map_points(void)
 {
     BOOL ret;
@@ -7745,6 +7783,7 @@ START_TEST(win)
 
     /* Add the tests below this line */
     test_child_window_from_point();
+    test_window_from_point();
     test_thick_child_size(hwndMain);
     test_fullscreen();
     test_hwnd_message();




More information about the wine-cvs mailing list