user32/tests: Add some SetDlgItemTextA tests
Bruno Jesus
00cpxxx at gmail.com
Wed Feb 19 05:02:38 CST 2014
This patch was an attempt to reproduce the issue in bug 35621, I could not
get what I wanted but at least here I got the following error covered in a
todo:
dialog.c:1022: Test failed: GetDlgItemText error, expected 102400, got
80968.
dialog.c:1023: Test failed: Different text read.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.winehq.org/pipermail/wine-patches/attachments/20140219/42be19e6/attachment.html>
-------------- next part --------------
diff --git a/dlls/user32/tests/dialog.c b/dlls/user32/tests/dialog.c
index ef72cfe..99bf79a 100644
--- a/dlls/user32/tests/dialog.c
+++ b/dlls/user32/tests/dialog.c
@@ -982,6 +982,58 @@ static void test_GetDlgItemText(void)
"string retrieved using GetDlgItemText should have been NULL terminated\n");
}
+static void test_SetDlgItemText(void)
+{
+ HWND hwnd, child;
+ char *strin, *strout;
+ BOOL ret;
+ int i, copied;
+ struct _tests
+ {
+ int size, todo;
+ } tests[] = {{1, 0}, {256,0}, {1024,0}, {10240,0}, {102400, 1}};
+
+ hwnd = CreateWindowA("button", "parent", WS_VISIBLE, 0, 0, 100, 100, NULL, 0, g_hinst, NULL);
+ ok(hwnd != NULL, "failed to created window\n");
+ child = CreateWindowA("edit", "child", WS_VISIBLE|WS_CHILD, 0, 0, 10, 10, hwnd, 0, g_hinst, NULL);
+ ok(child != NULL, "failed to created child window\n");
+
+ i = tests[sizeof(tests) / sizeof(tests[0]) - 1].size;
+ strin = HeapAlloc(GetProcessHeap(), 0, i + 1);
+ strout = HeapAlloc(GetProcessHeap(), 0, i + 1);
+ if (!strin || !strout)
+ {
+ skip("Out of memory for SetDlgItemText tests\n");
+ goto cleanup;
+ }
+
+ for (i = 0; i < sizeof(tests)/sizeof(tests[0]); i++)
+ {
+ FillMemory(strout, tests[i].size, 0);
+ FillMemory(strin, tests[i].size, ' ');
+ strin[tests[i].size] = 0;
+ ret = SetDlgItemTextA(hwnd, 0, strin);
+ ok(ret, "SetDlgItemText error, expected TRUE, got FALSE.\n");
+ copied = GetDlgItemTextA(hwnd, 0, strout, tests[i].size + 1);
+
+ if(tests[i].todo)
+ winetest_start_todo("wine");
+
+ ok(copied == tests[i].size, "GetDlgItemText error, expected %d, got %d.\n", tests[i].size, copied);
+ ok(!strcmp(strin, strout), "Different text read.\n");
+
+ if(tests[i].todo)
+ winetest_end_todo("wine");
+ }
+
+cleanup:
+ HeapFree(GetProcessHeap(), 0, strin);
+ HeapFree(GetProcessHeap(), 0, strout);
+
+ DestroyWindow(child);
+ DestroyWindow(hwnd);
+}
+
static void test_GetDlgItem(void)
{
HWND hwnd, child1, child2, hwnd2;
@@ -1435,6 +1487,7 @@ START_TEST(dialog)
test_focus();
test_GetDlgItem();
test_GetDlgItemText();
+ test_SetDlgItemText();
test_DialogBoxParamA();
test_DisabledDialogTest();
test_MessageBoxFontTest();
More information about the wine-patches
mailing list