comctl32/tests: Don't crash if adding the tooltip failed.

Francois Gouget fgouget at free.fr
Sun Sep 28 11:41:02 CDT 2008


---

It does not seem to make sense to try to retrieve the tooltip if we 
failed to add it. But I could also check whether toolinfoA.lpszText is 
NULL in the ok() call so it does not crash. Or do both.

 dlls/comctl32/tests/tooltips.c |   14 ++++++++------
 1 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/dlls/comctl32/tests/tooltips.c b/dlls/comctl32/tests/tooltips.c
index 6bf5a3a..7454b6f 100644
--- a/dlls/comctl32/tests/tooltips.c
+++ b/dlls/comctl32/tests/tooltips.c
@@ -257,12 +257,14 @@ static void test_gettext(void)
     GetClientRect(hwnd, &toolinfoA.rect);
     r = SendMessageA(hwnd, TTM_ADDTOOL, 0, (LPARAM)&toolinfoA);
     ok(r, "Adding the tool to the tooltip failed\n");
-
-    toolinfoA.hwnd = NULL;
-    toolinfoA.uId = (UINT_PTR)0x1234ABCD;
-    toolinfoA.lpszText = bufA;
-    SendMessageA(hwnd, TTM_GETTEXTA, 0, (LPARAM)&toolinfoA);
-    ok(strcmp(toolinfoA.lpszText, "") == 0, "lpszText should be an empty string\n");
+    if (r)
+    {
+        toolinfoA.hwnd = NULL;
+        toolinfoA.uId = (UINT_PTR)0x1234ABCD;
+        toolinfoA.lpszText = bufA;
+        SendMessageA(hwnd, TTM_GETTEXTA, 0, (LPARAM)&toolinfoA);
+        ok(strcmp(toolinfoA.lpszText, "") == 0, "lpszText should be an empty string\n");
+    }
 
     DestroyWindow(hwnd);
 
-- 
1.5.6.5



More information about the wine-patches mailing list