shell32/tests: Fix a test on Win2k platform and above.

Nicolas Le Cam niko.lecam at gmail.com
Tue Mar 17 16:40:45 CDT 2009


---
 dlls/shell32/tests/appbar.c |   16 +++++++++++++++-
 1 files changed, 15 insertions(+), 1 deletions(-)

diff --git a/dlls/shell32/tests/appbar.c b/dlls/shell32/tests/appbar.c
index 5d15fcd..480f2d6 100644
--- a/dlls/shell32/tests/appbar.c
+++ b/dlls/shell32/tests/appbar.c
@@ -45,13 +45,21 @@ static struct testwindow_info windows[3];
 
 static int expected_bottom;
 
+static int registered_count = 0;
+
 static void testwindow_setpos(HWND hwnd)
 {
     struct testwindow_info* info = (struct testwindow_info*)GetWindowLongPtr(hwnd, GWLP_USERDATA);
     APPBARDATA abd;
     BOOL ret;
 
-    ok(info != NULL, "got unexpected ABN_POSCHANGED notification\n");
+    if (!info)
+    {
+        if (!registered_count)
+            win_skip("got unexpected ABN_POSCHANGED notification\n");
+        else
+            ok(FALSE, "got unexpected ABN_POSCHANGED notification\n");
+    }
 
     if (!info || !info->registered)
     {
@@ -211,6 +219,7 @@ static void test_setpos(void)
     abd.cbSize = sizeof(abd);
     abd.hWnd = windows[0].hwnd;
     abd.uCallbackMessage = MSG_APPBAR;
+    ++registered_count;
     ret = SHAppBarMessage(ABM_NEW, &abd);
     ok(ret == TRUE, "SHAppBarMessage returned %i\n", ret);
 
@@ -236,6 +245,7 @@ static void test_setpos(void)
         NULL, NULL, NULL, NULL);
     ok(windows[1].hwnd != NULL, "couldn't create window\n");
     abd.hWnd = windows[1].hwnd;
+    ++registered_count;
     ret = SHAppBarMessage(ABM_NEW, &abd);
     ok(ret == TRUE, "SHAppBarMessage returned %i\n", ret);
 
@@ -267,6 +277,7 @@ static void test_setpos(void)
     do_events();
 
     abd.hWnd = windows[2].hwnd;
+    ++registered_count;
     ret = SHAppBarMessage(ABM_NEW, &abd);
     ok(ret == TRUE, "SHAppBarMessage returned %i\n", ret);
 
@@ -328,6 +339,7 @@ static void test_setpos(void)
     expected_bottom = max(windows[0].allocated_rect.bottom, windows[1].allocated_rect.bottom);
 
     abd.hWnd = windows[0].hwnd;
+    --registered_count;
     ret = SHAppBarMessage(ABM_REMOVE, &abd);
     ok(ret == TRUE, "SHAppBarMessage returned %i\n", ret);
     windows[0].registered = FALSE;
@@ -342,6 +354,7 @@ static void test_setpos(void)
     /* remove the other windows */
     SetWindowLongPtr(windows[1].hwnd, GWLP_USERDATA, 0);
     abd.hWnd = windows[1].hwnd;
+    --registered_count;
     ret = SHAppBarMessage(ABM_REMOVE, &abd);
     ok(ret == TRUE, "SHAppBarMessage returned %i\n", ret);
     windows[1].registered = FALSE;
@@ -349,6 +362,7 @@ static void test_setpos(void)
 
     SetWindowLongPtr(windows[2].hwnd, GWLP_USERDATA, 0);
     abd.hWnd = windows[2].hwnd;
+    --registered_count;
     ret = SHAppBarMessage(ABM_REMOVE, &abd);
     ok(ret == TRUE, "SHAppBarMessage returned %i\n", ret);
     windows[2].registered = FALSE;
-- 
1.5.6.3


--=-eZktaCDeOC4pN0pMhcnx--




More information about the wine-patches mailing list