Dylan Smith : richedit: Added tests for WM_GETDLGCODE message.

Alexandre Julliard julliard at winehq.org
Thu Jan 8 08:31:14 CST 2009


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

Author: Dylan Smith <dylan.ah.smith at gmail.com>
Date:   Thu Jan  8 00:44:05 2009 -0500

richedit: Added tests for WM_GETDLGCODE message.

---

 dlls/riched20/tests/editor.c |  172 ++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 172 insertions(+), 0 deletions(-)

diff --git a/dlls/riched20/tests/editor.c b/dlls/riched20/tests/editor.c
index 9e2f5e4..d9c5d78 100644
--- a/dlls/riched20/tests/editor.c
+++ b/dlls/riched20/tests/editor.c
@@ -6010,6 +6010,177 @@ static void test_format_rect(void)
     DestroyWindow(hwnd);
 }
 
+static void test_WM_GETDLGCODE(void)
+{
+    HWND hwnd;
+    UINT res, expected;
+    MSG msg;
+
+    expected = DLGC_WANTCHARS|DLGC_WANTTAB|DLGC_WANTARROWS|DLGC_HASSETSEL|DLGC_WANTMESSAGE;
+
+    hwnd = CreateWindowEx(0, RICHEDIT_CLASS, NULL,
+                          ES_MULTILINE|ES_WANTRETURN|WS_POPUP,
+                          0, 0, 200, 60, NULL, NULL, hmoduleRichEdit, NULL);
+    ok(hwnd != NULL, "class: %s, error: %d\n", RICHEDIT_CLASS, (int) GetLastError());
+    msg.hwnd = hwnd;
+    res = SendMessage(hwnd, WM_GETDLGCODE, VK_RETURN, 0);
+    expected = expected | DLGC_WANTMESSAGE;
+    todo_wine ok(res == expected, "WM_GETDLGCODE returned %x but expected %x\n",
+       res, expected);
+    DestroyWindow(hwnd);
+
+    msg.message = WM_KEYDOWN;
+    msg.wParam = VK_RETURN;
+    msg.lParam = MapVirtualKey(VK_RETURN, MAPVK_VK_TO_VSC) | 0x0001;
+    msg.pt.x = 0;
+    msg.pt.y = 0;
+    msg.time = GetTickCount();
+
+    hwnd = CreateWindowEx(0, RICHEDIT_CLASS, NULL,
+                          ES_MULTILINE|ES_WANTRETURN|WS_POPUP,
+                          0, 0, 200, 60, NULL, NULL, hmoduleRichEdit, NULL);
+    ok(hwnd != NULL, "class: %s, error: %d\n", RICHEDIT_CLASS, (int) GetLastError());
+    msg.hwnd = hwnd;
+    res = SendMessage(hwnd, WM_GETDLGCODE, VK_RETURN, (LPARAM)&msg);
+    expected = expected | DLGC_WANTMESSAGE;
+    todo_wine ok(res == expected, "WM_GETDLGCODE returned %x but expected %x\n",
+       res, expected);
+    DestroyWindow(hwnd);
+
+    hwnd = CreateWindowEx(0, RICHEDIT_CLASS, NULL,
+                          ES_MULTILINE|WS_POPUP,
+                          0, 0, 200, 60, NULL, NULL, hmoduleRichEdit, NULL);
+    ok(hwnd != NULL, "class: %s, error: %d\n", RICHEDIT_CLASS, (int) GetLastError());
+    msg.hwnd = hwnd;
+    res = SendMessage(hwnd, WM_GETDLGCODE, VK_RETURN, (LPARAM)&msg);
+    expected = DLGC_WANTCHARS|DLGC_WANTTAB|DLGC_WANTARROWS|DLGC_HASSETSEL|DLGC_WANTMESSAGE;
+    todo_wine ok(res == expected, "WM_GETDLGCODE returned %x but expected %x\n",
+       res, expected);
+    DestroyWindow(hwnd);
+
+    hwnd = CreateWindowEx(0, RICHEDIT_CLASS, NULL,
+                          ES_WANTRETURN|WS_POPUP,
+                          0, 0, 200, 60, NULL, NULL, hmoduleRichEdit, NULL);
+    ok(hwnd != NULL, "class: %s, error: %d\n", RICHEDIT_CLASS, (int) GetLastError());
+    msg.hwnd = hwnd;
+    res = SendMessage(hwnd, WM_GETDLGCODE, VK_RETURN, (LPARAM)&msg);
+    expected = DLGC_WANTCHARS|DLGC_WANTTAB|DLGC_WANTARROWS|DLGC_HASSETSEL;
+    todo_wine ok(res == expected, "WM_GETDLGCODE returned %x but expected %x\n",
+       res, expected);
+    DestroyWindow(hwnd);
+
+    hwnd = CreateWindowEx(0, RICHEDIT_CLASS, NULL,
+                          WS_POPUP,
+                          0, 0, 200, 60, NULL, NULL, hmoduleRichEdit, NULL);
+    ok(hwnd != NULL, "class: %s, error: %d\n", RICHEDIT_CLASS, (int) GetLastError());
+    msg.hwnd = hwnd;
+    res = SendMessage(hwnd, WM_GETDLGCODE, VK_RETURN, (LPARAM)&msg);
+    expected = DLGC_WANTCHARS|DLGC_WANTTAB|DLGC_WANTARROWS|DLGC_HASSETSEL;
+    todo_wine ok(res == expected, "WM_GETDLGCODE returned %x but expected %x\n",
+       res, expected);
+    DestroyWindow(hwnd);
+
+    msg.wParam = VK_TAB;
+    msg.lParam = MapVirtualKey(VK_TAB, MAPVK_VK_TO_VSC) | 0x0001;
+
+    hwnd = CreateWindowEx(0, RICHEDIT_CLASS, NULL,
+                          ES_MULTILINE|WS_POPUP,
+                          0, 0, 200, 60, NULL, NULL, hmoduleRichEdit, NULL);
+    ok(hwnd != NULL, "class: %s, error: %d\n", RICHEDIT_CLASS, (int) GetLastError());
+    msg.hwnd = hwnd;
+    res = SendMessage(hwnd, WM_GETDLGCODE, VK_RETURN, (LPARAM)&msg);
+    expected = DLGC_WANTCHARS|DLGC_WANTTAB|DLGC_WANTARROWS|DLGC_HASSETSEL|DLGC_WANTMESSAGE;
+    todo_wine ok(res == expected, "WM_GETDLGCODE returned %x but expected %x\n",
+       res, expected);
+    DestroyWindow(hwnd);
+
+    hwnd = CreateWindowEx(0, RICHEDIT_CLASS, NULL,
+                          WS_POPUP,
+                          0, 0, 200, 60, NULL, NULL, hmoduleRichEdit, NULL);
+    ok(hwnd != NULL, "class: %s, error: %d\n", RICHEDIT_CLASS, (int) GetLastError());
+    msg.hwnd = hwnd;
+    res = SendMessage(hwnd, WM_GETDLGCODE, VK_RETURN, (LPARAM)&msg);
+    expected = DLGC_WANTCHARS|DLGC_WANTTAB|DLGC_WANTARROWS|DLGC_HASSETSEL;
+    todo_wine ok(res == expected, "WM_GETDLGCODE returned %x but expected %x\n",
+       res, expected);
+    DestroyWindow(hwnd);
+
+    hold_key(VK_CONTROL);
+
+    hwnd = CreateWindowEx(0, RICHEDIT_CLASS, NULL,
+                          ES_MULTILINE|WS_POPUP,
+                          0, 0, 200, 60, NULL, NULL, hmoduleRichEdit, NULL);
+    ok(hwnd != NULL, "class: %s, error: %d\n", RICHEDIT_CLASS, (int) GetLastError());
+    msg.hwnd = hwnd;
+    res = SendMessage(hwnd, WM_GETDLGCODE, VK_RETURN, (LPARAM)&msg);
+    expected = DLGC_WANTCHARS|DLGC_WANTTAB|DLGC_WANTARROWS|DLGC_HASSETSEL|DLGC_WANTMESSAGE;
+    todo_wine ok(res == expected, "WM_GETDLGCODE returned %x but expected %x\n",
+       res, expected);
+    DestroyWindow(hwnd);
+
+    hwnd = CreateWindowEx(0, RICHEDIT_CLASS, NULL,
+                          WS_POPUP,
+                          0, 0, 200, 60, NULL, NULL, hmoduleRichEdit, NULL);
+    ok(hwnd != NULL, "class: %s, error: %d\n", RICHEDIT_CLASS, (int) GetLastError());
+    msg.hwnd = hwnd;
+    res = SendMessage(hwnd, WM_GETDLGCODE, VK_RETURN, (LPARAM)&msg);
+    expected = DLGC_WANTCHARS|DLGC_WANTTAB|DLGC_WANTARROWS|DLGC_HASSETSEL;
+    todo_wine ok(res == expected, "WM_GETDLGCODE returned %x but expected %x\n",
+       res, expected);
+    DestroyWindow(hwnd);
+
+    release_key(VK_CONTROL);
+
+    msg.wParam = 'a';
+    msg.lParam = MapVirtualKey('a', MAPVK_VK_TO_VSC) | 0x0001;
+
+    hwnd = CreateWindowEx(0, RICHEDIT_CLASS, NULL,
+                          ES_MULTILINE|WS_POPUP,
+                          0, 0, 200, 60, NULL, NULL, hmoduleRichEdit, NULL);
+    ok(hwnd != NULL, "class: %s, error: %d\n", RICHEDIT_CLASS, (int) GetLastError());
+    msg.hwnd = hwnd;
+    res = SendMessage(hwnd, WM_GETDLGCODE, VK_RETURN, (LPARAM)&msg);
+    expected = DLGC_WANTCHARS|DLGC_WANTTAB|DLGC_WANTARROWS|DLGC_HASSETSEL|DLGC_WANTMESSAGE;
+    todo_wine ok(res == expected, "WM_GETDLGCODE returned %x but expected %x\n",
+       res, expected);
+    DestroyWindow(hwnd);
+
+    hwnd = CreateWindowEx(0, RICHEDIT_CLASS, NULL,
+                          WS_POPUP,
+                          0, 0, 200, 60, NULL, NULL, hmoduleRichEdit, NULL);
+    ok(hwnd != NULL, "class: %s, error: %d\n", RICHEDIT_CLASS, (int) GetLastError());
+    msg.hwnd = hwnd;
+    res = SendMessage(hwnd, WM_GETDLGCODE, VK_RETURN, (LPARAM)&msg);
+    expected = DLGC_WANTCHARS|DLGC_WANTTAB|DLGC_WANTARROWS|DLGC_HASSETSEL;
+    todo_wine ok(res == expected, "WM_GETDLGCODE returned %x but expected %x\n",
+       res, expected);
+    DestroyWindow(hwnd);
+
+    msg.message = WM_CHAR;
+
+    hwnd = CreateWindowEx(0, RICHEDIT_CLASS, NULL,
+                          ES_MULTILINE|WS_POPUP,
+                          0, 0, 200, 60, NULL, NULL, hmoduleRichEdit, NULL);
+    ok(hwnd != NULL, "class: %s, error: %d\n", RICHEDIT_CLASS, (int) GetLastError());
+    msg.hwnd = hwnd;
+    res = SendMessage(hwnd, WM_GETDLGCODE, VK_RETURN, (LPARAM)&msg);
+    expected = DLGC_WANTCHARS|DLGC_WANTTAB|DLGC_WANTARROWS|DLGC_HASSETSEL|DLGC_WANTMESSAGE;
+    todo_wine ok(res == expected, "WM_GETDLGCODE returned %x but expected %x\n",
+       res, expected);
+    DestroyWindow(hwnd);
+
+    hwnd = CreateWindowEx(0, RICHEDIT_CLASS, NULL,
+                          WS_POPUP,
+                          0, 0, 200, 60, NULL, NULL, hmoduleRichEdit, NULL);
+    ok(hwnd != NULL, "class: %s, error: %d\n", RICHEDIT_CLASS, (int) GetLastError());
+    msg.hwnd = hwnd;
+    res = SendMessage(hwnd, WM_GETDLGCODE, VK_RETURN, (LPARAM)&msg);
+    expected = DLGC_WANTCHARS|DLGC_WANTTAB|DLGC_WANTARROWS|DLGC_HASSETSEL;
+    todo_wine ok(res == expected, "WM_GETDLGCODE returned %x but expected %x\n",
+       res, expected);
+    DestroyWindow(hwnd);
+}
+
 START_TEST( editor )
 {
   /* Must explicitly LoadLibrary(). The test has no references to functions in
@@ -6063,6 +6234,7 @@ START_TEST( editor )
   test_word_wrap();
   test_auto_yscroll();
   test_format_rect();
+  test_WM_GETDLGCODE();
 
   /* Set the environment variable WINETEST_RICHED20 to keep windows
    * responsive and open for 30 seconds. This is useful for debugging.




More information about the wine-cvs mailing list