Author: jimtabor
Date: Sun Sep 20 01:37:32 2009
New Revision: 43090
URL:
http://svn.reactos.org/svn/reactos?rev=43090&view=rev
Log:
- Update Edit wine tests.
Modified:
trunk/rostests/winetests/user32/edit.c
Modified: trunk/rostests/winetests/user32/edit.c
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/user32/edit.c?r…
==============================================================================
--- trunk/rostests/winetests/user32/edit.c [iso-8859-1] (original)
+++ trunk/rostests/winetests/user32/edit.c [iso-8859-1] Sun Sep 20 01:37:32 2009
@@ -28,6 +28,7 @@
#define ES_COMBO 0x200
#endif
+#define ID_EDITTESTDBUTTON 0x123
#define ID_EDITTEST2 99
#define MAXLEN 200
@@ -1817,9 +1818,9 @@
/* more tests for WM_KEYDOWN + WM_CHAR */
r = DialogBoxParam(hinst, "EDIT_READONLY_DIALOG", NULL,
(DLGPROC)edit_dialog_proc, 6);
- todo_wine ok(444 == r, "Expected %d, got %d\n", 444, r);
+ ok(444 == r, "Expected %d, got %d\n", 444, r);
r = DialogBoxParam(hinst, "EDIT_READONLY_DIALOG", NULL,
(DLGPROC)edit_dialog_proc, 7);
- todo_wine ok(444 == r, "Expected %d, got %d\n", 444, r);
+ ok(444 == r, "Expected %d, got %d\n", 444, r);
r = DialogBoxParam(hinst, "EDIT_READONLY_DIALOG", NULL,
(DLGPROC)edit_dialog_proc, 8);
ok(444 == r, "Expected %d, got %d\n", 444, r);
@@ -1841,9 +1842,9 @@
/* tests for WM_KEYDOWN + WM_CHAR */
r = DialogBoxParam(hinst, "EDIT_DIALOG", NULL, (DLGPROC)edit_dialog_proc,
6);
- todo_wine ok(444 == r, "Expected %d, got %d\n", 444, r);
+ ok(444 == r, "Expected %d, got %d\n", 444, r);
r = DialogBoxParam(hinst, "EDIT_DIALOG", NULL, (DLGPROC)edit_dialog_proc,
7);
- todo_wine ok(444 == r, "Expected %d, got %d\n", 444, r);
+ ok(444 == r, "Expected %d, got %d\n", 444, r);
r = DialogBoxParam(hinst, "EDIT_DIALOG", NULL, (DLGPROC)edit_dialog_proc,
8);
ok(444 == r, "Expected %d, got %d\n", 444, r);
@@ -1891,7 +1892,7 @@
/* tests for WM_KEYDOWN + WM_CHAR */
r = DialogBoxParam(hinst, "EDIT_WANTRETURN_DIALOG", NULL,
(DLGPROC)edit_wantreturn_dialog_proc, 6);
- todo_wine ok(444 == r, "Expected %d, got %d\n", 444, r);
+ ok(444 == r, "Expected %d, got %d\n", 444, r);
r = DialogBoxParam(hinst, "EDIT_WANTRETURN_DIALOG", NULL,
(DLGPROC)edit_wantreturn_dialog_proc, 7);
ok(444 == r, "Expected %d, got %d\n", 444, r);
r = DialogBoxParam(hinst, "EDIT_WANTRETURN_DIALOG", NULL,
(DLGPROC)edit_wantreturn_dialog_proc, 8);
@@ -2079,6 +2080,184 @@
DestroyWindow (hwEdit);
DeleteObject(hfont);
+}
+
+struct dialog_mode_messages
+{
+ int wm_getdefid, wm_close, wm_command, wm_nextdlgctl;
+};
+
+static struct dialog_mode_messages dm_messages;
+
+static void zero_dm_messages(void)
+{
+ dm_messages.wm_command = 0;
+ dm_messages.wm_close = 0;
+ dm_messages.wm_getdefid = 0;
+ dm_messages.wm_nextdlgctl = 0;
+}
+
+#define test_dm_messages(wmcommand, wmclose, wmgetdefid, wmnextdlgctl) \
+ ok(dm_messages.wm_command == wmcommand, "expected %d WM_COMMAND messages, "
\
+ "got %d\n", wmcommand, dm_messages.wm_command); \
+ ok(dm_messages.wm_close == wmclose, "expected %d WM_CLOSE messages, " \
+ "got %d\n", wmclose, dm_messages.wm_close); \
+ ok(dm_messages.wm_getdefid == wmgetdefid, "expected %d WM_GETDIFID messages,
" \
+ "got %d\n", wmgetdefid, dm_messages.wm_getdefid);\
+ ok(dm_messages.wm_nextdlgctl == wmnextdlgctl, "expected %d WM_NEXTDLGCTL
messages, " \
+ "got %d\n", wmnextdlgctl, dm_messages.wm_nextdlgctl)
+
+static LRESULT CALLBACK dialog_mode_wnd_proc(HWND hwnd, UINT iMsg, WPARAM wParam, LPARAM
lParam)
+{
+ switch (iMsg)
+ {
+ case WM_COMMAND:
+ dm_messages.wm_command++;
+ break;
+ case DM_GETDEFID:
+ dm_messages.wm_getdefid++;
+ return MAKELONG(ID_EDITTESTDBUTTON, DC_HASDEFID);
+ case WM_NEXTDLGCTL:
+ dm_messages.wm_nextdlgctl++;
+ break;
+ case WM_CLOSE:
+ dm_messages.wm_close++;
+ break;
+ }
+
+ return DefWindowProc(hwnd, iMsg, wParam, lParam);
+}
+
+static void test_dialogmode(void)
+{
+ HWND hwEdit, hwParent, hwButton;
+ MSG msg= {0};
+ int len, r;
+ hwEdit = create_child_editcontrol(ES_MULTILINE, 0);
+
+ r = SendMessage(hwEdit, WM_CHAR, VK_RETURN, 0x1c0001);
+ ok(1 == r, "expected 1, got %d\n", r);
+ len = SendMessage(hwEdit, WM_GETTEXTLENGTH, 0, 0);
+ ok(11 == len, "expected 11, got %d\n", len);
+
+ r = SendMessage(hwEdit, WM_GETDLGCODE, (WPARAM)NULL, (LPARAM)NULL);
+ ok(0x8d == r, "expected 0x8d, got 0x%x\n", r);
+
+ r = SendMessage(hwEdit, WM_CHAR, VK_RETURN, 0x1c0001);
+ ok(1 == r, "expected 1, got %d\n", r);
+ len = SendMessage(hwEdit, WM_GETTEXTLENGTH, 0, 0);
+ ok(13 == len, "expected 13, got %d\n", len);
+
+ r = SendMessage(hwEdit, WM_GETDLGCODE, (WPARAM)NULL, (LPARAM)&msg);
+ ok(0x8d == r, "expected 0x8d, got 0x%x\n", r);
+ r = SendMessage(hwEdit, WM_CHAR, VK_RETURN, 0x1c0001);
+ ok(1 == r, "expected 1, got %d\n", r);
+ len = SendMessage(hwEdit, WM_GETTEXTLENGTH, 0, 0);
+ ok(13 == len, "expected 13, got %d\n", len);
+
+ r = SendMessage(hwEdit, WM_CHAR, VK_RETURN, 0x1c0001);
+ ok(1 == r, "expected 1, got %d\n", r);
+ len = SendMessage(hwEdit, WM_GETTEXTLENGTH, 0, 0);
+ ok(13 == len, "expected 13, got %d\n", len);
+
+ destroy_child_editcontrol(hwEdit);
+
+ hwEdit = create_editcontrol(ES_MULTILINE, 0);
+
+ r = SendMessage(hwEdit, WM_CHAR, VK_RETURN, 0x1c0001);
+ ok(1 == r, "expected 1, got %d\n", r);
+ len = SendMessage(hwEdit, WM_GETTEXTLENGTH, 0, 0);
+ ok(11 == len, "expected 11, got %d\n", len);
+
+ msg.hwnd = hwEdit;
+ msg.message = WM_KEYDOWN;
+ msg.wParam = VK_BACK;
+ msg.lParam = 0xe0001;
+ r = SendMessage(hwEdit, WM_GETDLGCODE, VK_BACK, (LPARAM)&msg);
+ ok(0x8d == r, "expected 0x8d, got 0x%x\n", r);
+
+ r = SendMessage(hwEdit, WM_CHAR, VK_RETURN, 0x1c0001);
+ ok(1 == r, "expected 1, got %d\n", r);
+ len = SendMessage(hwEdit, WM_GETTEXTLENGTH, 0, 0);
+ ok(11 == len, "expected 11, got %d\n", len);
+
+ DestroyWindow(hwEdit);
+
+ hwEdit = create_child_editcontrol(0, 0);
+ hwParent = GetParent(hwEdit);
+ SetWindowLongPtr(hwParent, GWLP_WNDPROC, (LONG_PTR)dialog_mode_wnd_proc);
+
+ zero_dm_messages();
+ r = SendMessage(hwEdit, WM_KEYDOWN, VK_ESCAPE, 0x10001);
+ ok(1 == r, "expected 1, got %d\n", r);
+ test_dm_messages(0, 0, 0, 0);
+ zero_dm_messages();
+
+ r = SendMessage(hwEdit, WM_KEYDOWN, VK_TAB, 0xf0001);
+ ok(1 == r, "expected 1, got %d\n", r);
+ test_dm_messages(0, 0, 0, 0);
+ zero_dm_messages();
+
+ msg.hwnd = hwEdit;
+ msg.message = WM_KEYDOWN;
+ msg.wParam = VK_TAB;
+ msg.lParam = 0xf0001;
+ r = SendMessage(hwEdit, WM_GETDLGCODE, VK_TAB, (LPARAM)&msg);
+ ok(0x89 == r, "expected 0x89, got 0x%x\n", r);
+ test_dm_messages(0, 0, 0, 0);
+ zero_dm_messages();
+
+ r = SendMessage(hwEdit, WM_KEYDOWN, VK_TAB, 0xf0001);
+ ok(1 == r, "expected 1, got %d\n", r);
+ test_dm_messages(0, 0, 0, 0);
+ zero_dm_messages();
+
+ destroy_child_editcontrol(hwEdit);
+
+ hwEdit = create_child_editcontrol(ES_MULTILINE, 0);
+ hwParent = GetParent(hwEdit);
+ SetWindowLongPtr(hwParent, GWLP_WNDPROC, (LONG_PTR)dialog_mode_wnd_proc);
+
+ r = SendMessage(hwEdit, WM_KEYDOWN, VK_TAB, 0xf0001);
+ ok(1 == r, "expected 1, got %d\n", r);
+ test_dm_messages(0, 0, 0, 0);
+ zero_dm_messages();
+
+ msg.hwnd = hwEdit;
+ msg.message = WM_KEYDOWN;
+ msg.wParam = VK_ESCAPE;
+ msg.lParam = 0x10001;
+ r = SendMessage(hwEdit, WM_GETDLGCODE, VK_ESCAPE, (LPARAM)&msg);
+ ok(0x8d == r, "expected 0x8d, got 0x%x\n", r);
+ test_dm_messages(0, 0, 0, 0);
+ zero_dm_messages();
+
+ r = SendMessage(hwEdit, WM_KEYDOWN, VK_ESCAPE, 0x10001);
+ ok(1 == r, "expected 1, got %d\n", r);
+ test_dm_messages(0, 0, 0, 0);
+ zero_dm_messages();
+
+ r = SendMessage(hwEdit, WM_KEYDOWN, VK_TAB, 0xf0001);
+ ok(1 == r, "expected 1, got %d\n", r);
+ test_dm_messages(0, 0, 0, 1);
+ zero_dm_messages();
+
+ r = SendMessage(hwEdit, WM_KEYDOWN, VK_RETURN, 0x1c0001);
+ ok(1 == r, "expected 1, got %d\n", r);
+ test_dm_messages(0, 0, 1, 0);
+ zero_dm_messages();
+
+ hwButton = CreateWindow("BUTTON", "OK",
WS_VISIBLE|WS_CHILD|BS_PUSHBUTTON,
+ 100, 100, 50, 20, hwParent, (HMENU)ID_EDITTESTDBUTTON, hinst, NULL);
+ ok(hwButton!=NULL, "CreateWindow failed with error code %d\n",
GetLastError());
+
+ r = SendMessage(hwEdit, WM_KEYDOWN, VK_RETURN, 0x1c0001);
+ ok(1 == r, "expected 1, got %d\n", r);
+ test_dm_messages(0, 0, 1, 1);
+ zero_dm_messages();
+
+ DestroyWindow(hwButton);
+ destroy_child_editcontrol(hwEdit);
}
START_TEST(edit)
@@ -2105,6 +2284,7 @@
test_singleline_wantreturn_edit_dialog();
test_child_edit_wmkeydown();
test_fontsize();
+ test_dialogmode();
UnregisterWindowClasses();
}