Alex Villacís Lasso : user32: Fix for failing tests of LB_GETTEXT on listbox on Win98.

Alexandre Julliard julliard at winehq.org
Thu Nov 8 07:07:29 CST 2007


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

Author: Alex Villacís Lasso <a_villacis at palosanto.com>
Date:   Wed Nov  7 10:36:53 2007 -0500

user32: Fix for failing tests of LB_GETTEXT on listbox on Win98.

---

 dlls/user32/tests/listbox.c |   16 ++++++++++++----
 1 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/dlls/user32/tests/listbox.c b/dlls/user32/tests/listbox.c
index 7fd5659..8009d38 100644
--- a/dlls/user32/tests/listbox.c
+++ b/dlls/user32/tests/listbox.c
@@ -166,15 +166,23 @@ check (const struct listbox_test test)
 	DWORD size = SendMessage (hLB, LB_GETTEXTLEN, i, 0);
 	CHAR *txt;
 	WCHAR *txtw;
+	int resA, resW;
 
 	txt = HeapAlloc (GetProcessHeap(), 0, size+1);
-	SendMessageA(hLB, LB_GETTEXT, i, (LPARAM)txt);
+	memset(txt, 0, size+1);
+	resA=SendMessageA(hLB, LB_GETTEXT, i, (LPARAM)txt);
         ok(!strcmp (txt, strings[i]), "returned string for item %d does not match %s vs %s\n", i, txt, strings[i]);
 
 	txtw = HeapAlloc (GetProcessHeap(), 0, 2*size+2);
-	SendMessageW(hLB, LB_GETTEXT, i, (LPARAM)txtw);
-	WideCharToMultiByte( CP_ACP, 0, txtw, -1, txt, size, NULL, NULL );
-        ok(!strcmp (txt, strings[i]), "returned string for item %d does not match %s vs %s\n", i, txt, strings[i]);
+	memset(txtw, 0, 2*size+2);
+	resW=SendMessageW(hLB, LB_GETTEXT, i, (LPARAM)txtw);
+	if (resA != resW) {
+            trace("SendMessageW(LB_GETTEXT) not supported on this platform (resA=%d resW=%d), skipping...\n",
+                resA, resW);
+	} else {
+	    WideCharToMultiByte( CP_ACP, 0, txtw, -1, txt, size, NULL, NULL );
+            ok(!strcmp (txt, strings[i]), "returned string for item %d does not match %s vs %s\n", i, txt, strings[i]);
+	}
 
 	HeapFree (GetProcessHeap(), 0, txtw);
 	HeapFree (GetProcessHeap(), 0, txt);




More information about the wine-cvs mailing list