ReactOS  0.4.14-dev-57-g333b8f1
edit.c File Reference
#include <assert.h>
#include <windows.h>
#include <commctrl.h>
#include "wine/test.h"
Include dependency graph for edit.c:

Go to the source code of this file.

Classes

struct  edit_notify
 
struct  context_menu_messages
 
struct  dialog_mode_messages
 

Macros

#define ES_COMBO   0x200
 
#define ID_EDITTESTDBUTTON   0x123
 
#define ID_EDITTEST2   99
 
#define MAXLEN   200
 
#define test_notify(enchange, enmaxtext, enupdate)
 
#define edit_pos_ok(exp, got, txt)   ok(exp == got, "wrong " #txt " expected %d got %d\n", exp, got);
 
#define check_pos(hwEdit, set_height, test_top, test_height, test_left)
 
#define test_dm_messages(wmcommand, wmclose, wmgetdefid, wmnextdlgctl)
 

Functions

static INT_PTR CALLBACK multi_edit_dialog_proc (HWND hdlg, UINT msg, WPARAM wparam, LPARAM lparam)
 
static INT_PTR CALLBACK edit_dialog_proc (HWND hdlg, UINT msg, WPARAM wparam, LPARAM lparam)
 
static INT_PTR CALLBACK edit_singleline_dialog_proc (HWND hdlg, UINT msg, WPARAM wparam, LPARAM lparam)
 
static INT_PTR CALLBACK edit_wantreturn_dialog_proc (HWND hdlg, UINT msg, WPARAM wparam, LPARAM lparam)
 
static HWND create_editcontrol (DWORD style, DWORD exstyle)
 
static HWND create_editcontrolW (DWORD style, DWORD exstyle)
 
static HWND create_child_editcontrol (DWORD style, DWORD exstyle)
 
static void destroy_child_editcontrol (HWND hwndEdit)
 
static LONG get_edit_style (HWND hwnd)
 
static void set_client_height (HWND Wnd, unsigned Height)
 
static void test_edit_control_1 (void)
 
static void test_edit_control_2 (void)
 
static void ET2_check_change (void)
 
static void ET2_OnCommand (HWND hwnd, int id, HWND hwndCtl, UINT codeNotify)
 
static LRESULT CALLBACK ET2_WndProc (HWND hwnd, UINT iMsg, WPARAM wParam, LPARAM lParam)
 
static void zero_notify (void)
 
static LRESULT CALLBACK edit3_wnd_procA (HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
 
static void test_edit_control_3 (void)
 
static void test_edit_control_4 (void)
 
static void test_edit_control_5 (void)
 
static void test_edit_control_6 (void)
 
static void test_edit_control_limittext (void)
 
static void test_edit_control_scroll (void)
 
static void test_margins_usefontinfo (UINT charset)
 
static void test_margins (void)
 
static INT CALLBACK find_font_proc (const LOGFONTA *elf, const TEXTMETRICA *ntm, DWORD type, LPARAM lParam)
 
static void test_margins_font_change (void)
 
static void test_text_position_style (DWORD style)
 
static void test_text_position (void)
 
static void test_espassword (void)
 
static void test_undo (void)
 
static void test_enter (void)
 
static void test_tab (void)
 
static void test_edit_dialog (void)
 
static void test_multi_edit_dialog (void)
 
static void test_wantreturn_edit_dialog (void)
 
static void test_singleline_wantreturn_edit_dialog (void)
 
static INT_PTR CALLBACK child_edit_wmkeydown_proc (HWND hdlg, UINT msg, WPARAM wparam, LPARAM lparam)
 
static void test_child_edit_wmkeydown (void)
 
static LRESULT (CALLBACK *p_edit_proc)(HWND
 
static LRESULT CALLBACK edit4_wnd_procA (HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
 
static LRESULT CALLBACK edit_proc_proxy (HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
 
static LRESULT CALLBACK child_edit_menu_proc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
 
static void test_contextmenu (void)
 
static BOOL RegisterWindowClasses (void)
 
static void UnregisterWindowClasses (void)
 
static void test_fontsize (void)
 
static void zero_dm_messages (void)
 
static LRESULT CALLBACK dialog_mode_wnd_proc (HWND hwnd, UINT iMsg, WPARAM wParam, LPARAM lParam)
 
static void test_dialogmode (void)
 
static void test_EM_GETHANDLE (void)
 
static void test_paste (void)
 
static void test_EM_GETLINE (void)
 
static int CALLBACK test_wordbreak_procA (char *text, int current, int length, int code)
 
static void test_wordbreak_proc (void)
 
 START_TEST (edit)
 

Variables

static struct edit_notify notifications
 
static HINSTANCE hinst
 
static HWND hwndET2
 
static const char szEditTest2Class [] = "EditTest2Class"
 
static const char szEditTest3Class [] = "EditTest3Class"
 
static const char szEditTest4Class [] = "EditTest4Class"
 
static const char szEditTextPositionClass [] = "EditTextPositionWindowClass"
 
static int child_edit_wmkeydown_num_messages = 0
 
static BOOL got_en_setfocus = FALSE
 
static BOOL got_wm_capturechanged = FALSE
 
static UINT
 
static WPARAM
 
static LPARAM
 
static struct context_menu_messages menu_messages
 
static struct dialog_mode_messages dm_messages
 

Macro Definition Documentation

◆ check_pos

#define check_pos (   hwEdit,
  set_height,
  test_top,
  test_height,
  test_left 
)
Value:
do { \
RECT format_rect; \
int left_margin; \
set_client_height(hwEdit, set_height); \
SendMessageA(hwEdit, EM_GETRECT, 0, (LPARAM) &format_rect); \
left_margin = LOWORD(SendMessageA(hwEdit, EM_GETMARGINS, 0, 0)); \
edit_pos_ok(test_top, format_rect.top, vertical position); \
edit_pos_ok((int)test_height, format_rect.bottom - format_rect.top, height); \
edit_pos_ok(test_left, format_rect.left - left_margin, left); \
} while(0)
LRESULT WINAPI SendMessageA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define EM_GETMARGINS
Definition: winuser.h:1975
LONG_PTR LPARAM
Definition: windef.h:208
GLint left
Definition: glext.h:7726
GLint GLint GLsizei GLsizei height
Definition: gl.h:1546
static void test_height(void)
Definition: status.c:168
#define EM_GETRECT
Definition: winuser.h:1978
#define LOWORD(l)
Definition: pedump.c:82

Definition at line 1734 of file edit.c.

◆ edit_pos_ok

#define edit_pos_ok (   exp,
  got,
  txt 
)    ok(exp == got, "wrong " #txt " expected %d got %d\n", exp, got);

Definition at line 1731 of file edit.c.

◆ ES_COMBO

#define ES_COMBO   0x200

Definition at line 28 of file edit.c.

◆ ID_EDITTEST2

#define ID_EDITTEST2   99

Definition at line 32 of file edit.c.

◆ ID_EDITTESTDBUTTON

#define ID_EDITTESTDBUTTON   0x123

Definition at line 31 of file edit.c.

◆ MAXLEN

#define MAXLEN   200

Definition at line 33 of file edit.c.

◆ test_dm_messages

#define test_dm_messages (   wmcommand,
  wmclose,
  wmgetdefid,
  wmnextdlgctl 
)
Value:
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 struct dialog_mode_messages dm_messages
Definition: edit.c:2557
#define ok(value,...)
Definition: atltest.h:57

Definition at line 2567 of file edit.c.

◆ test_notify

#define test_notify (   enchange,
  enmaxtext,
  enupdate 
)
Value:
do { \
ok(notifications.en_change == enchange, "expected %d EN_CHANGE notifications, " \
"got %d\n", enchange, notifications.en_change); \
ok(notifications.en_maxtext == enmaxtext, "expected %d EN_MAXTEXT notifications, " \
"got %d\n", enmaxtext, notifications.en_maxtext); \
ok(notifications.en_update == enupdate, "expected %d EN_UPDATE notifications, " \
"got %d\n", enupdate, notifications.en_update); \
} while(0)
static struct edit_notify notifications
Definition: edit.c:39

Definition at line 840 of file edit.c.

Function Documentation

◆ child_edit_menu_proc()

static LRESULT CALLBACK child_edit_menu_proc ( HWND  hwnd,
UINT  msg,
WPARAM  wParam,
LPARAM  lParam 
)
static

Definition at line 2353 of file edit.c.

2354 {
2355  switch (msg) {
2356  case WM_ENTERIDLE:
2357  if (wParam == MSGF_MENU) {
2358  HWND hwndMenu = (HWND)lParam;
2359  MENUBARINFO mbi = { sizeof(MENUBARINFO) };
2360  if (GetMenuBarInfo(hwndMenu, OBJID_CLIENT, 0, &mbi)) {
2361  MENUITEMINFOA mii = { sizeof(MENUITEMINFOA), MIIM_STATE };
2362  if (GetMenuItemInfoA(mbi.hMenu, EM_SETSEL, FALSE, &mii)) {
2363  if (mii.fState & MFS_HILITE) {
2364  PostMessageA(hwnd, WM_KEYDOWN, VK_RETURN, 0x1c0001);
2365  PostMessageA(hwnd, WM_KEYUP, VK_RETURN, 0x1c0001);
2366  }
2367  else {
2368  PostMessageA(hwnd, WM_KEYDOWN, VK_DOWN, 0x500001);
2369  PostMessageA(hwnd, WM_KEYUP, VK_DOWN, 0x500001);
2370  }
2371  }
2372  }
2373  }
2374  break;
2375  case WM_COMMAND:
2376  menu_messages.wm_command++;
2377  break;
2378  case EM_SETSEL:
2379  menu_messages.em_setsel++;
2380  break;
2381  }
2382  return CallWindowProcA(p_edit_proc, hwnd, msg, wParam, lParam);
2383 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
BOOL WINAPI PostMessageA(_In_opt_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
HANDLE HWND
Definition: compat.h:13
static struct context_menu_messages menu_messages
Definition: edit.c:2351
#define MSGF_MENU
Definition: winuser.h:1161
#define VK_DOWN
Definition: winuser.h:2202
#define VK_RETURN
Definition: winuser.h:2176
WPARAM wParam
Definition: combotst.c:138
LRESULT WINAPI CallWindowProcA(_In_ WNDPROC, _In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define MIIM_STATE
Definition: winuser.h:716
struct tagMENUBARINFO MENUBARINFO
#define WM_KEYDOWN
Definition: winuser.h:1697
#define OBJID_CLIENT
Definition: winable.h:19
#define MFS_HILITE
Definition: winuser.h:747
#define WM_ENTERIDLE
Definition: winuser.h:1731
BOOL WINAPI GetMenuBarInfo(_In_ HWND, _In_ LONG, _In_ LONG, _Inout_ PMENUBARINFO)
#define EM_SETSEL
Definition: winuser.h:2000
#define WM_KEYUP
Definition: winuser.h:1698
BOOL WINAPI GetMenuItemInfoA(_In_ HMENU, _In_ UINT, _In_ BOOL, _Inout_ LPMENUITEMINFOA)
#define WM_COMMAND
Definition: winuser.h:1722
#define msg(x)
Definition: auth_time.c:54
struct tagMENUITEMINFOA MENUITEMINFOA
LPARAM lParam
Definition: combotst.c:139

Referenced by test_contextmenu().

◆ child_edit_wmkeydown_proc()

static INT_PTR CALLBACK child_edit_wmkeydown_proc ( HWND  hdlg,
UINT  msg,
WPARAM  wparam,
LPARAM  lparam 
)
static

Definition at line 2250 of file edit.c.

2251 {
2252  switch (msg)
2253  {
2254  case WM_DESTROY:
2255  case WM_NCDESTROY:
2256  break;
2257 
2258  default:
2260  break;
2261  }
2262 
2263  return FALSE;
2264 }
static int child_edit_wmkeydown_num_messages
Definition: edit.c:2249
#define WM_DESTROY
Definition: winuser.h:1591
#define WM_NCDESTROY
Definition: winuser.h:1666
#define msg(x)
Definition: auth_time.c:54

Referenced by test_child_edit_wmkeydown().

◆ create_child_editcontrol()

static HWND create_child_editcontrol ( DWORD  style,
DWORD  exstyle 
)
static

Definition at line 572 of file edit.c.

573 {
574  HWND parentWnd;
575  HWND editWnd;
576  RECT rect;
577  BOOL b;
578  SetRect(&rect, 0, 0, 300, 300);
580  ok(b, "AdjustWindowRect failed\n");
581 
582  parentWnd = CreateWindowExA(0,
584  "Edit Test",
587  rect.right - rect.left, rect.bottom - rect.top,
588  NULL, NULL, hinst, NULL);
589  ok (parentWnd != NULL, "CreateWindow EDIT Test failed\n");
590  assert(parentWnd);
591 
592  editWnd = CreateWindowExA(exstyle,
593  "EDIT",
594  "Test Text",
595  WS_CHILD | style,
596  0, 0, 300, 300,
597  parentWnd, NULL, hinst, NULL);
598  ok (editWnd != NULL, "CreateWindow EDIT Test Text failed\n");
599  assert(editWnd);
601  ShowWindow (parentWnd, SW_SHOW);
602  return editWnd;
603 }
#define assert(x)
Definition: debug.h:53
#define WS_CHILD
Definition: pedump.c:617
int winetest_interactive
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
& rect
Definition: startmenu.cpp:1413
BOOL WINAPI AdjustWindowRect(_Inout_ LPRECT, _In_ DWORD, _In_ BOOL)
unsigned int BOOL
Definition: ntddk_ex.h:94
#define CW_USEDEFAULT
Definition: winuser.h:225
smooth NULL
Definition: ftsmooth.c:416
#define SW_SHOW
Definition: winuser.h:769
#define b
Definition: ke_i.h:79
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
static HINSTANCE hinst
Definition: edit.c:536
BOOL WINAPI SetRect(_Out_ LPRECT, _In_ int, _In_ int, _In_ int, _In_ int)
#define ok(value,...)
Definition: atltest.h:57
HWND WINAPI CreateWindowExA(_In_ DWORD dwExStyle, _In_opt_ LPCSTR lpClassName, _In_opt_ LPCSTR lpWindowName, _In_ DWORD dwStyle, _In_ int X, _In_ int Y, _In_ int nWidth, _In_ int nHeight, _In_opt_ HWND hWndParent, _In_opt_ HMENU hMenu, _In_opt_ HINSTANCE hInstance, _In_opt_ LPVOID lpParam)
#define WS_OVERLAPPEDWINDOW
Definition: pedump.c:637
Arabic default style
Definition: afstyles.h:93
static const char szEditTextPositionClass[]
Definition: edit.c:541

Referenced by test_child_edit_wmkeydown(), test_dialogmode(), test_margins_font_change(), and test_text_position_style().

◆ create_editcontrol()

static HWND create_editcontrol ( DWORD  style,
DWORD  exstyle 
)
static

Definition at line 543 of file edit.c.

544 {
545  HWND handle;
546 
547  handle = CreateWindowExA(exstyle,
548  "EDIT",
549  "Test Text",
550  style,
551  10, 10, 300, 300,
552  NULL, NULL, hinst, NULL);
553  ok (handle != NULL, "CreateWindow EDIT Control failed\n");
554  assert (handle);
557  return handle;
558 }
namespace GUID const ADDRINFOEXW ADDRINFOEXW struct timeval OVERLAPPED LPLOOKUPSERVICE_COMPLETION_ROUTINE HANDLE * handle
Definition: sock.c:82
#define assert(x)
Definition: debug.h:53
int winetest_interactive
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
smooth NULL
Definition: ftsmooth.c:416
#define SW_SHOW
Definition: winuser.h:769
static HINSTANCE hinst
Definition: edit.c:536
#define ok(value,...)
Definition: atltest.h:57
HWND WINAPI CreateWindowExA(_In_ DWORD dwExStyle, _In_opt_ LPCSTR lpClassName, _In_opt_ LPCSTR lpWindowName, _In_ DWORD dwStyle, _In_ int X, _In_ int Y, _In_ int nWidth, _In_ int nHeight, _In_opt_ HWND hWndParent, _In_opt_ HMENU hMenu, _In_opt_ HINSTANCE hInstance, _In_opt_ LPVOID lpParam)
Arabic default style
Definition: afstyles.h:93

Referenced by test_dialogmode(), test_edit_control_1(), test_edit_control_4(), test_edit_control_limittext(), test_EM_GETHANDLE(), test_EM_GETLINE(), test_enter(), test_espassword(), test_margins(), test_paste(), test_tab(), test_text_position_style(), test_undo(), and test_wordbreak_proc().

◆ create_editcontrolW()

static HWND create_editcontrolW ( DWORD  style,
DWORD  exstyle 
)
static

Definition at line 560 of file edit.c.

561 {
562  static const WCHAR testtextW[] = {'T','e','s','t',' ','t','e','x','t',0};
563  static const WCHAR editW[] = {'E','d','i','t',0};
564  HWND handle;
565 
566  handle = CreateWindowExW(exstyle, editW, testtextW, style, 10, 10, 300, 300,
567  NULL, NULL, hinst, NULL);
568  ok(handle != NULL, "Failed to create Edit control.\n");
569  return handle;
570 }
namespace GUID const ADDRINFOEXW ADDRINFOEXW struct timeval OVERLAPPED LPLOOKUPSERVICE_COMPLETION_ROUTINE HANDLE * handle
Definition: sock.c:82
smooth NULL
Definition: ftsmooth.c:416
static const WCHAR editW[]
Definition: edit.c:5362
__wchar_t WCHAR
Definition: xmlstorage.h:180
static HINSTANCE hinst
Definition: edit.c:536
HWND WINAPI CreateWindowExW(_In_ DWORD dwExStyle, _In_opt_ LPCWSTR lpClassName, _In_opt_ LPCWSTR lpWindowName, _In_ DWORD dwStyle, _In_ int X, _In_ int Y, _In_ int nWidth, _In_ int nHeight, _In_opt_ HWND hWndParent, _In_opt_ HMENU hMenu, _In_opt_ HINSTANCE hInstance, _In_opt_ LPVOID lpParam)
static const WCHAR testtextW[]
Definition: dialog.c:1264
#define ok(value,...)
Definition: atltest.h:57
Arabic default style
Definition: afstyles.h:93

Referenced by test_EM_GETLINE().

◆ destroy_child_editcontrol()

static void destroy_child_editcontrol ( HWND  hwndEdit)
static

Definition at line 605 of file edit.c.

606 {
607  if (GetParent(hwndEdit))
609  else {
610  trace("Edit control has no parent!\n");
612  }
613 }
BOOL WINAPI DestroyWindow(_In_ HWND)
#define trace
Definition: atltest.h:70
HWND hwndEdit
Definition: combotst.c:65
HWND WINAPI GetParent(_In_ HWND)

Referenced by test_child_edit_wmkeydown(), test_dialogmode(), test_margins_font_change(), and test_text_position_style().

◆ dialog_mode_wnd_proc()

static LRESULT CALLBACK dialog_mode_wnd_proc ( HWND  hwnd,
UINT  iMsg,
WPARAM  wParam,
LPARAM  lParam 
)
static

Definition at line 2577 of file edit.c.

2578 {
2579  switch (iMsg)
2580  {
2581  case WM_COMMAND:
2582  dm_messages.wm_command++;
2583  break;
2584  case DM_GETDEFID:
2585  dm_messages.wm_getdefid++;
2587  case WM_NEXTDLGCTL:
2588  dm_messages.wm_nextdlgctl++;
2589  break;
2590  case WM_CLOSE:
2591  dm_messages.wm_close++;
2592  break;
2593  }
2594 
2595  return DefWindowProcA(hwnd, iMsg, wParam, lParam);
2596 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
#define WM_NEXTDLGCTL
Definition: winuser.h:1625
WPARAM wParam
Definition: combotst.c:138
#define DM_GETDEFID
Definition: winuser.h:2080
#define DC_HASDEFID
Definition: winuser.h:2584
#define MAKELONG(a, b)
Definition: typedefs.h:248
static struct dialog_mode_messages dm_messages
Definition: edit.c:2557
#define WM_CLOSE
Definition: winuser.h:1603
#define ID_EDITTESTDBUTTON
Definition: edit.c:31
#define WM_COMMAND
Definition: winuser.h:1722
LRESULT WINAPI DefWindowProcA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
LPARAM lParam
Definition: combotst.c:139

Referenced by test_dialogmode().

◆ edit3_wnd_procA()

static LRESULT CALLBACK edit3_wnd_procA ( HWND  hWnd,
UINT  msg,
WPARAM  wParam,
LPARAM  lParam 
)
static

Definition at line 851 of file edit.c.

852 {
853  switch (msg) {
854  case WM_COMMAND:
855  switch (HIWORD(wParam)) {
856  case EN_MAXTEXT:
857  notifications.en_maxtext++;
858  break;
859  case EN_UPDATE:
860  notifications.en_update++;
861  break;
862  case EN_CHANGE:
863  notifications.en_change++;
864  break;
865  }
866  break;
867  }
868  return DefWindowProcA(hWnd, msg, wParam, lParam);
869 }
#define EN_MAXTEXT
Definition: winuser.h:2008
HWND hWnd
Definition: settings.c:17
WPARAM wParam
Definition: combotst.c:138
static struct edit_notify notifications
Definition: edit.c:39
#define WM_COMMAND
Definition: winuser.h:1722
LRESULT WINAPI DefWindowProcA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define msg(x)
Definition: auth_time.c:54
#define HIWORD(l)
Definition: typedefs.h:246
#define EN_UPDATE
Definition: winuser.h:2010
LPARAM lParam
Definition: combotst.c:139
#define EN_CHANGE
Definition: winuser.h:2004

Referenced by RegisterWindowClasses().

◆ edit4_wnd_procA()

static LRESULT CALLBACK edit4_wnd_procA ( HWND  hWnd,
UINT  msg,
WPARAM  wParam,
LPARAM  lParam 
)
static

Definition at line 2284 of file edit.c.

2285 {
2286  switch (msg) {
2287  case WM_COMMAND:
2288  switch (HIWORD(wParam)) {
2289  case EN_SETFOCUS:
2291  break;
2292  }
2293  break;
2294  case WM_CAPTURECHANGED:
2295  if (hWnd != (HWND)lParam)
2296  {
2298  EndMenu();
2299  }
2300  break;
2301  }
2302  return DefWindowProcA(hWnd, msg, wParam, lParam);
2303 }
static BOOL got_en_setfocus
Definition: edit.c:2280
#define TRUE
Definition: types.h:120
#define WM_CAPTURECHANGED
Definition: winuser.h:1790
HWND hWnd
Definition: settings.c:17
WPARAM wParam
Definition: combotst.c:138
#define EN_SETFOCUS
Definition: winuser.h:2009
static BOOL got_wm_capturechanged
Definition: edit.c:2281
#define WM_COMMAND
Definition: winuser.h:1722
LRESULT WINAPI DefWindowProcA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define msg(x)
Definition: auth_time.c:54
#define HIWORD(l)
Definition: typedefs.h:246
BOOL WINAPI EndMenu(void)
LPARAM lParam
Definition: combotst.c:139

Referenced by RegisterWindowClasses().

◆ edit_dialog_proc()

static INT_PTR CALLBACK edit_dialog_proc ( HWND  hdlg,
UINT  msg,
WPARAM  wparam,
LPARAM  lparam 
)
static

Definition at line 140 of file edit.c.

141 {
142  switch (msg)
143  {
144  case WM_INITDIALOG:
145  {
146  HWND hedit = GetDlgItem(hdlg, 1000);
147  SetFocus(hedit);
148  switch (lparam)
149  {
150  /* from bug 11841 */
151  case 0:
152  PostMessageA(hedit, WM_KEYDOWN, VK_ESCAPE, 0x10001);
153  break;
154  case 1:
155  PostMessageA(hedit, WM_KEYDOWN, VK_RETURN, 0x1c0001);
156  break;
157  case 2:
158  PostMessageA(hedit, WM_KEYDOWN, VK_TAB, 0xf0001);
159  PostMessageA(hdlg, WM_USER, 0xdeadbeef, 1);
160  break;
161 
162  /* more test cases for WM_CHAR */
163  case 3:
164  PostMessageA(hedit, WM_CHAR, VK_ESCAPE, 0x10001);
165  PostMessageA(hdlg, WM_USER, 0xdeadbeef, 0);
166  break;
167  case 4:
168  PostMessageA(hedit, WM_CHAR, VK_RETURN, 0x1c0001);
169  PostMessageA(hdlg, WM_USER, 0xdeadbeef, 0);
170  break;
171  case 5:
172  PostMessageA(hedit, WM_CHAR, VK_TAB, 0xf0001);
173  PostMessageA(hdlg, WM_USER, 0xdeadbeef, 0);
174  break;
175 
176  /* more test cases for WM_KEYDOWN + WM_CHAR */
177  case 6:
178  PostMessageA(hedit, WM_KEYDOWN, VK_ESCAPE, 0x10001);
179  PostMessageA(hedit, WM_CHAR, VK_ESCAPE, 0x10001);
180  PostMessageA(hdlg, WM_USER, 0xdeadbeef, 0);
181  break;
182  case 7:
183  PostMessageA(hedit, WM_KEYDOWN, VK_RETURN, 0x1c0001);
184  PostMessageA(hedit, WM_CHAR, VK_RETURN, 0x1c0001);
185  PostMessageA(hdlg, WM_USER, 0xdeadbeef, 1);
186  break;
187  case 8:
188  PostMessageA(hedit, WM_KEYDOWN, VK_TAB, 0xf0001);
189  PostMessageA(hedit, WM_CHAR, VK_TAB, 0xf0001);
190  PostMessageA(hdlg, WM_USER, 0xdeadbeef, 1);
191  break;
192 
193  /* multiple tab tests */
194  case 9:
195  PostMessageA(hedit, WM_KEYDOWN, VK_TAB, 0xf0001);
196  PostMessageA(hedit, WM_KEYDOWN, VK_TAB, 0xf0001);
197  PostMessageA(hdlg, WM_USER, 0xdeadbeef, 2);
198  break;
199  case 10:
200  PostMessageA(hedit, WM_KEYDOWN, VK_TAB, 0xf0001);
201  PostMessageA(hedit, WM_KEYDOWN, VK_TAB, 0xf0001);
202  PostMessageA(hedit, WM_KEYDOWN, VK_TAB, 0xf0001);
203  PostMessageA(hdlg, WM_USER, 0xdeadbeef, 2);
204  break;
205 
206  default:
207  break;
208  }
209  break;
210  }
211 
212  case WM_COMMAND:
213  if (HIWORD(wparam) != BN_CLICKED)
214  break;
215 
216  switch (LOWORD(wparam))
217  {
218  case IDOK:
219  EndDialog(hdlg, 111);
220  break;
221 
222  case IDCANCEL:
223  EndDialog(hdlg, 222);
224  break;
225 
226  default:
227  break;
228  }
229  break;
230 
231  case WM_USER:
232  {
233  int len;
234  HWND hok = GetDlgItem(hdlg, IDOK);
235  HWND hcancel = GetDlgItem(hdlg, IDCANCEL);
236  HWND hedit = GetDlgItem(hdlg, 1000);
237  HWND hfocus = GetFocus();
238 
239  if (wparam != 0xdeadbeef)
240  break;
241 
242  switch (lparam)
243  {
244  case 0:
245  len = SendMessageA(hedit, WM_GETTEXTLENGTH, 0, 0);
246  if (len == 0)
247  EndDialog(hdlg, 444);
248  else
249  EndDialog(hdlg, 555);
250  break;
251 
252  case 1:
253  len = SendMessageA(hedit, WM_GETTEXTLENGTH, 0, 0);
254  if ((hfocus == hok) && len == 0)
255  EndDialog(hdlg, 444);
256  else
257  EndDialog(hdlg, 555);
258  break;
259 
260  case 2:
261  if (hfocus == hok)
262  EndDialog(hdlg, 11);
263  else if (hfocus == hcancel)
264  EndDialog(hdlg, 22);
265  else if (hfocus == hedit)
266  EndDialog(hdlg, 33);
267  else
268  EndDialog(hdlg, 44);
269  break;
270 
271  default:
272  EndDialog(hdlg, 555);
273  }
274  break;
275  }
276 
277  case WM_CLOSE:
278  EndDialog(hdlg, 333);
279  break;
280 
281  default:
282  break;
283  }
284 
285  return FALSE;
286 }
#define WM_GETTEXTLENGTH
Definition: winuser.h:1601
#define IDOK
Definition: winuser.h:824
#define WM_CHAR
Definition: winuser.h:1699
BOOL WINAPI PostMessageA(_In_opt_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
LRESULT WINAPI SendMessageA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
HWND WINAPI SetFocus(_In_opt_ HWND)
#define VK_TAB
Definition: winuser.h:2174
#define VK_ESCAPE
Definition: winuser.h:2189
#define VK_RETURN
Definition: winuser.h:2176
BOOL WINAPI EndDialog(_In_ HWND, _In_ INT_PTR)
static UINT WPARAM LPARAM lparam
Definition: combo.c:716
#define WM_KEYDOWN
Definition: winuser.h:1697
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
#define WM_CLOSE
Definition: winuser.h:1603
#define BN_CLICKED
Definition: winuser.h:1907
GLenum GLsizei len
Definition: glext.h:6722
#define WM_COMMAND
Definition: winuser.h:1722
#define WM_USER
Definition: winuser.h:1877
HWND WINAPI GetFocus(void)
Definition: window.c:1905
#define msg(x)
Definition: auth_time.c:54
#define HIWORD(l)
Definition: typedefs.h:246
#define IDCANCEL
Definition: winuser.h:825
#define WM_INITDIALOG
Definition: winuser.h:1721
#define LOWORD(l)
Definition: pedump.c:82
static UINT WPARAM wparam
Definition: combo.c:716

Referenced by test_edit_dialog().

◆ edit_proc_proxy()

static LRESULT CALLBACK edit_proc_proxy ( HWND  hWnd,
UINT  msg,
WPARAM  wParam,
LPARAM  lParam 
)
static

Definition at line 2305 of file edit.c.

2306 {
2307  switch (msg) {
2308  case WM_ENTERIDLE: {
2309  MENUBARINFO mbi;
2310  BOOL ret;
2311  HWND ctx_menu = (HWND)lParam;
2312 
2313  memset(&mbi, 0, sizeof(mbi));
2314  mbi.cbSize = sizeof(mbi);
2315  SetLastError(0xdeadbeef);
2316  ret = GetMenuBarInfo(ctx_menu, OBJID_CLIENT, 0, &mbi);
2317  ok(ret, "GetMenuBarInfo failed\n");
2318  if (ret)
2319  {
2320  ok(mbi.hMenu != NULL, "mbi.hMenu = NULL\n");
2321  ok(!mbi.hwndMenu, "mbi.hwndMenu != NULL\n");
2322  ok(mbi.fBarFocused, "mbi.fBarFocused = FALSE\n");
2323  ok(mbi.fFocused, "mbi.fFocused = FALSE\n");
2324  }
2325 
2326  memset(&mbi, 0, sizeof(mbi));
2327  mbi.cbSize = sizeof(mbi);
2328  SetLastError(0xdeadbeef);
2329  ret = GetMenuBarInfo(ctx_menu, OBJID_CLIENT, 1, &mbi);
2330  ok(ret, "GetMenuBarInfo failed\n");
2331  if (ret)
2332  {
2333  ok(mbi.hMenu != NULL, "mbi.hMenu = NULL\n");
2334  ok(!mbi.hwndMenu, "mbi.hwndMenu != NULL\n");
2335  ok(mbi.fBarFocused, "mbi.fBarFocused = FALSE\n");
2336  ok(!mbi.fFocused, "mbi.fFocused = TRUE\n");
2337  }
2338 
2339  EndMenu();
2340  break;
2341  }
2342  }
2343  return p_edit_proc(hWnd, msg, wParam, lParam);
2344 }
HWND hWnd
Definition: settings.c:17
HANDLE HWND
Definition: compat.h:13
WPARAM wParam
Definition: combotst.c:138
unsigned int BOOL
Definition: ntddk_ex.h:94
smooth NULL
Definition: ftsmooth.c:416
BOOL fBarFocused
Definition: winuser.h:3704
#define OBJID_CLIENT
Definition: winable.h:19
#define WM_ENTERIDLE
Definition: winuser.h:1731
BOOL WINAPI GetMenuBarInfo(_In_ HWND, _In_ LONG, _In_ LONG, _Inout_ PMENUBARINFO)
#define SetLastError(x)
Definition: compat.h:409
int ret
#define ok(value,...)
Definition: atltest.h:57
#define msg(x)
Definition: auth_time.c:54
BOOL WINAPI EndMenu(void)
#define memset(x, y, z)
Definition: compat.h:39
DWORD cbSize
Definition: winuser.h:3700
LPARAM lParam
Definition: combotst.c:139

Referenced by test_contextmenu().

◆ edit_singleline_dialog_proc()

static INT_PTR CALLBACK edit_singleline_dialog_proc ( HWND  hdlg,
UINT  msg,
WPARAM  wparam,
LPARAM  lparam 
)
static

Definition at line 288 of file edit.c.

289 {
290  switch (msg)
291  {
292  case WM_INITDIALOG:
293  {
294  HWND hedit = GetDlgItem(hdlg, 1000);
295  SetFocus(hedit);
296  switch (lparam)
297  {
298  /* test cases for WM_KEYDOWN */
299  case 0:
300  PostMessageA(hedit, WM_KEYDOWN, VK_ESCAPE, 0x10001);
301  break;
302  case 1:
303  PostMessageA(hedit, WM_KEYDOWN, VK_RETURN, 0x1c0001);
304  break;
305  case 2:
306  PostMessageA(hedit, WM_KEYDOWN, VK_TAB, 0xf0001);
307  PostMessageA(hdlg, WM_USER, 0xdeadbeef, 1);
308  break;
309 
310  /* test cases for WM_CHAR */
311  case 3:
312  PostMessageA(hedit, WM_CHAR, VK_ESCAPE, 0x10001);
313  PostMessageA(hdlg, WM_USER, 0xdeadbeef, 0);
314  break;
315  case 4:
316  PostMessageA(hedit, WM_CHAR, VK_RETURN, 0x1c0001);
317  PostMessageA(hdlg, WM_USER, 0xdeadbeef, 0);
318  break;
319  case 5:
320  PostMessageA(hedit, WM_CHAR, VK_TAB, 0xf0001);
321  PostMessageA(hdlg, WM_USER, 0xdeadbeef, 0);
322  break;
323 
324  /* test cases for WM_KEYDOWN + WM_CHAR */
325  case 6:
326  PostMessageA(hedit, WM_KEYDOWN, VK_ESCAPE, 0x10001);
327  PostMessageA(hedit, WM_CHAR, VK_ESCAPE, 0x10001);
328  break;
329  case 7:
330  PostMessageA(hedit, WM_KEYDOWN, VK_RETURN, 0x1c0001);
331  PostMessageA(hedit, WM_CHAR, VK_RETURN, 0x1c0001);
332  break;
333  case 8:
334  PostMessageA(hedit, WM_KEYDOWN, VK_TAB, 0xf0001);
335  PostMessageA(hedit, WM_CHAR, VK_TAB, 0xf0001);
336  PostMessageA(hdlg, WM_USER, 0xdeadbeef, 1);
337  break;
338 
339  default:
340  break;
341  }
342  break;
343  }
344 
345  case WM_COMMAND:
346  if (HIWORD(wparam) != BN_CLICKED)
347  break;
348 
349  switch (LOWORD(wparam))
350  {
351  case IDOK:
352  EndDialog(hdlg, 111);
353  break;
354 
355  case IDCANCEL:
356  EndDialog(hdlg, 222);
357  break;
358 
359  default:
360  break;
361  }
362  break;
363 
364  case WM_USER:
365  {
366  HWND hok = GetDlgItem(hdlg, IDOK);
367  HWND hedit = GetDlgItem(hdlg, 1000);
368  HWND hfocus = GetFocus();
369  int len = SendMessageA(hedit, WM_GETTEXTLENGTH, 0, 0);
370 
371  if (wparam != 0xdeadbeef)
372  break;
373 
374  switch (lparam)
375  {
376  case 0:
377  if ((hfocus == hedit) && len == 0)
378  EndDialog(hdlg, 444);
379  else
380  EndDialog(hdlg, 555);
381  break;
382 
383  case 1:
384  if ((hfocus == hok) && len == 0)
385  EndDialog(hdlg, 444);
386  else
387  EndDialog(hdlg, 555);
388  break;
389 
390  default:
391  EndDialog(hdlg, 55);
392  }
393  break;
394  }
395 
396  case WM_CLOSE:
397  EndDialog(hdlg, 333);
398  break;
399 
400  default:
401  break;
402  }
403 
404  return FALSE;
405 }
#define WM_GETTEXTLENGTH
Definition: winuser.h:1601
#define IDOK
Definition: winuser.h:824
#define WM_CHAR
Definition: winuser.h:1699
BOOL WINAPI PostMessageA(_In_opt_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
LRESULT WINAPI SendMessageA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
HWND WINAPI SetFocus(_In_opt_ HWND)
#define VK_TAB
Definition: winuser.h:2174
#define VK_ESCAPE
Definition: winuser.h:2189
#define VK_RETURN
Definition: winuser.h:2176
BOOL WINAPI EndDialog(_In_ HWND, _In_ INT_PTR)
static UINT WPARAM LPARAM lparam
Definition: combo.c:716
#define WM_KEYDOWN
Definition: winuser.h:1697
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
#define WM_CLOSE
Definition: winuser.h:1603
#define BN_CLICKED
Definition: winuser.h:1907
GLenum GLsizei len
Definition: glext.h:6722
#define WM_COMMAND
Definition: winuser.h:1722
#define WM_USER
Definition: winuser.h:1877
HWND WINAPI GetFocus(void)
Definition: window.c:1905
#define msg(x)
Definition: auth_time.c:54
#define HIWORD(l)
Definition: typedefs.h:246
#define IDCANCEL
Definition: winuser.h:825
#define WM_INITDIALOG
Definition: winuser.h:1721
#define LOWORD(l)
Definition: pedump.c:82
static UINT WPARAM wparam
Definition: combo.c:716

Referenced by test_singleline_wantreturn_edit_dialog().

◆ edit_wantreturn_dialog_proc()

static INT_PTR CALLBACK edit_wantreturn_dialog_proc ( HWND  hdlg,
UINT  msg,
WPARAM  wparam,
LPARAM  lparam 
)
static

Definition at line 407 of file edit.c.

408 {
409  switch (msg)
410  {
411  case WM_INITDIALOG:
412  {
413  HWND hedit = GetDlgItem(hdlg, 1000);
414  SetFocus(hedit);
415  switch (lparam)
416  {
417  /* test cases for WM_KEYDOWN */
418  case 0:
419  PostMessageA(hedit, WM_KEYDOWN, VK_ESCAPE, 0x10001);
420  break;
421  case 1:
422  PostMessageA(hedit, WM_KEYDOWN, VK_RETURN, 0x1c0001);
423  PostMessageA(hdlg, WM_USER, 0xdeadbeef, 0);
424  break;
425  case 2:
426  PostMessageA(hedit, WM_KEYDOWN, VK_TAB, 0xf0001);
427  PostMessageA(hdlg, WM_USER, 0xdeadbeef, 1);
428  break;
429 
430  /* test cases for WM_CHAR */
431  case 3:
432  PostMessageA(hedit, WM_CHAR, VK_ESCAPE, 0x10001);
433  PostMessageA(hdlg, WM_USER, 0xdeadbeef, 0);
434  break;
435  case 4:
436  PostMessageA(hedit, WM_CHAR, VK_RETURN, 0x1c0001);
437  PostMessageA(hdlg, WM_USER, 0xdeadbeef, 2);
438  break;
439  case 5:
440  PostMessageA(hedit, WM_CHAR, VK_TAB, 0xf0001);
441  PostMessageA(hdlg, WM_USER, 0xdeadbeef, 0);
442  break;
443 
444  /* test cases for WM_KEYDOWN + WM_CHAR */
445  case 6:
446  PostMessageA(hedit, WM_KEYDOWN, VK_ESCAPE, 0x10001);
447  PostMessageA(hedit, WM_CHAR, VK_ESCAPE, 0x10001);
448  PostMessageA(hdlg, WM_USER, 0xdeadbeef, 0);
449  break;
450  case 7:
451  PostMessageA(hedit, WM_KEYDOWN, VK_RETURN, 0x1c0001);
452  PostMessageA(hedit, WM_CHAR, VK_RETURN, 0x1c0001);
453  PostMessageA(hdlg, WM_USER, 0xdeadbeef, 2);
454  break;
455  case 8:
456  PostMessageA(hedit, WM_KEYDOWN, VK_TAB, 0xf0001);
457  PostMessageA(hedit, WM_CHAR, VK_TAB, 0xf0001);
458  PostMessageA(hdlg, WM_USER, 0xdeadbeef, 1);
459  break;
460 
461  default:
462  break;
463  }
464  break;
465  }
466 
467  case WM_COMMAND:
468  if (HIWORD(wparam) != BN_CLICKED)
469  break;
470 
471  switch (LOWORD(wparam))
472  {
473  case IDOK:
474  EndDialog(hdlg, 111);
475  break;
476 
477  case IDCANCEL:
478  EndDialog(hdlg, 222);
479  break;
480 
481  default:
482  break;
483  }
484  break;
485 
486  case WM_USER:
487  {
488  HWND hok = GetDlgItem(hdlg, IDOK);
489  HWND hedit = GetDlgItem(hdlg, 1000);
490  HWND hfocus = GetFocus();
491  int len = SendMessageA(hedit, WM_GETTEXTLENGTH, 0, 0);
492 
493  if (wparam != 0xdeadbeef)
494  break;
495 
496  switch (lparam)
497  {
498  case 0:
499  if ((hfocus == hedit) && len == 0)
500  EndDialog(hdlg, 444);
501  else
502  EndDialog(hdlg, 555);
503  break;
504 
505  case 1:
506  if ((hfocus == hok) && len == 0)
507  EndDialog(hdlg, 444);
508  else
509  EndDialog(hdlg, 555);
510  break;
511 
512  case 2:
513  if ((hfocus == hedit) && len == 2)
514  EndDialog(hdlg, 444);
515  else
516  EndDialog(hdlg, 555);
517  break;
518 
519  default:
520  EndDialog(hdlg, 55);
521  }
522  break;
523  }
524 
525  case WM_CLOSE:
526  EndDialog(hdlg, 333);
527  break;
528 
529  default:
530  break;
531  }
532 
533  return FALSE;
534 }
#define WM_GETTEXTLENGTH
Definition: winuser.h:1601
#define IDOK
Definition: winuser.h:824
#define WM_CHAR
Definition: winuser.h:1699
BOOL WINAPI PostMessageA(_In_opt_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
LRESULT WINAPI SendMessageA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
HWND WINAPI SetFocus(_In_opt_ HWND)
#define VK_TAB
Definition: winuser.h:2174
#define VK_ESCAPE
Definition: winuser.h:2189
#define VK_RETURN
Definition: winuser.h:2176
BOOL WINAPI EndDialog(_In_ HWND, _In_ INT_PTR)
static UINT WPARAM LPARAM lparam
Definition: combo.c:716
#define WM_KEYDOWN
Definition: winuser.h:1697
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
#define WM_CLOSE
Definition: winuser.h:1603
#define BN_CLICKED
Definition: winuser.h:1907
GLenum GLsizei len
Definition: glext.h:6722
#define WM_COMMAND
Definition: winuser.h:1722
#define WM_USER
Definition: winuser.h:1877
HWND WINAPI GetFocus(void)
Definition: window.c:1905
#define msg(x)
Definition: auth_time.c:54
#define HIWORD(l)
Definition: typedefs.h:246
#define IDCANCEL
Definition: winuser.h:825
#define WM_INITDIALOG
Definition: winuser.h:1721
#define LOWORD(l)
Definition: pedump.c:82
static UINT WPARAM wparam
Definition: combo.c:716

Referenced by test_wantreturn_edit_dialog().

◆ ET2_check_change()

static void ET2_check_change ( void  )
static

Definition at line 807 of file edit.c.

807  {
808  char szLocalString[MAXLEN];
809  /* This EN_UPDATE handler changes any 'foo' to 'bar'. */
810  GetWindowTextA(hwndET2, szLocalString, MAXLEN);
811  if (strcmp(szLocalString, "foo")==0) {
812  strcpy(szLocalString, "bar");
813  SendMessageA(hwndET2, WM_SETTEXT, 0, (LPARAM) szLocalString);
814  }
815  /* always leave the cursor at the end. */
817 }
int WINAPI GetWindowTextA(HWND hWnd, LPSTR lpString, int nMaxCount)
Definition: window.c:1326
LRESULT WINAPI SendMessageA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
static HWND hwndET2
Definition: edit.c:537
#define MAXLEN
Definition: edit.c:33
LONG_PTR LPARAM
Definition: windef.h:208
#define WM_SETTEXT
Definition: winuser.h:1599
#define EM_SETSEL
Definition: winuser.h:2000
char * strcpy(char *DstString, const char *SrcString)
Definition: utclib.c:388
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469

Referenced by ET2_OnCommand().

◆ ET2_OnCommand()

static void ET2_OnCommand ( HWND  hwnd,
int  id,
HWND  hwndCtl,
UINT  codeNotify 
)
static

Definition at line 818 of file edit.c.

819 {
820  if (id==ID_EDITTEST2 && codeNotify == EN_UPDATE)
822 }
static void ET2_check_change(void)
Definition: edit.c:807
#define ID_EDITTEST2
Definition: edit.c:32
#define EN_UPDATE
Definition: winuser.h:2010

Referenced by ET2_WndProc().

◆ ET2_WndProc()

static LRESULT CALLBACK ET2_WndProc ( HWND  hwnd,
UINT  iMsg,
WPARAM  wParam,
LPARAM  lParam 
)
static

Definition at line 823 of file edit.c.

824 {
825  switch (iMsg) {
826  case WM_COMMAND:
828  break;
829  }
830  return DefWindowProcA(hwnd, iMsg, wParam, lParam);
831 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
WPARAM wParam
Definition: combotst.c:138
#define WM_COMMAND
Definition: winuser.h:1722
LRESULT WINAPI DefWindowProcA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
static void ET2_OnCommand(HWND hwnd, int id, HWND hwndCtl, UINT codeNotify)
Definition: edit.c:818
#define HIWORD(l)
Definition: typedefs.h:246
LPARAM lParam
Definition: combotst.c:139
#define LOWORD(l)
Definition: pedump.c:82

Referenced by RegisterWindowClasses().

◆ find_font_proc()

static INT CALLBACK find_font_proc ( const LOGFONTA elf,
const TEXTMETRICA ntm,
DWORD  type,
LPARAM  lParam 
)
static

Definition at line 1620 of file edit.c.

1621 {
1622  return 0;
1623 }

Referenced by test_margins_font_change().

◆ get_edit_style()

static LONG get_edit_style ( HWND  hwnd)
static

Definition at line 615 of file edit.c.

616 {
617  return GetWindowLongA( hwnd, GWL_STYLE ) & (
618  ES_LEFT |
619 /* FIXME: not implemented
620  ES_CENTER |
621  ES_RIGHT |
622  ES_OEMCONVERT |
623 */
624  ES_MULTILINE |
625  ES_UPPERCASE |
626  ES_LOWERCASE |
627  ES_PASSWORD |
630  ES_NOHIDESEL |
631  ES_COMBO |
632  ES_READONLY |
633  ES_WANTRETURN |
634  ES_NUMBER
635  );
636 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
#define ES_MULTILINE
Definition: pedump.c:667
#define ES_READONLY
Definition: pedump.c:675
#define ES_PASSWORD
Definition: pedump.c:670
LONG WINAPI GetWindowLongA(_In_ HWND, _In_ int)
#define ES_WANTRETURN
Definition: pedump.c:676
#define ES_UPPERCASE
Definition: pedump.c:668
#define ES_AUTOVSCROLL
Definition: pedump.c:671
#define ES_NOHIDESEL
Definition: pedump.c:673
#define ES_COMBO
Definition: edit.c:28
#define GWL_STYLE
Definition: winuser.h:846
#define ES_NUMBER
Definition: winuser.h:301
#define ES_LEFT
Definition: pedump.c:664
#define ES_AUTOHSCROLL
Definition: pedump.c:672
#define ES_LOWERCASE
Definition: pedump.c:669

Referenced by test_edit_control_1(), test_enter(), test_espassword(), test_tab(), and test_undo().

◆ LRESULT()

static LRESULT ( CALLBACK p_edit_proc)
static

◆ multi_edit_dialog_proc()

static INT_PTR CALLBACK multi_edit_dialog_proc ( HWND  hdlg,
UINT  msg,
WPARAM  wparam,
LPARAM  lparam 
)
static

Definition at line 41 of file edit.c.

42 {
43  static int num_ok_commands = 0;
44  switch (msg)
45  {
46  case WM_INITDIALOG:
47  {
48  HWND hedit = GetDlgItem(hdlg, 1000);
49  SetFocus(hedit);
50  switch (lparam)
51  {
52  /* test cases related to bug 12319 */
53  case 0:
54  PostMessageA(hedit, WM_KEYDOWN, VK_TAB, 0xf0001);
55  PostMessageA(hdlg, WM_USER, 0xdeadbeef, 0);
56  break;
57  case 1:
58  PostMessageA(hedit, WM_CHAR, VK_TAB, 0xf0001);
59  PostMessageA(hdlg, WM_USER, 0xdeadbeef, 0);
60  break;
61  case 2:
62  PostMessageA(hedit, WM_KEYDOWN, VK_TAB, 0xf0001);
63  PostMessageA(hedit, WM_CHAR, VK_TAB, 0xf0001);
64  PostMessageA(hdlg, WM_USER, 0xdeadbeef, 0);
65  break;
66 
67  /* test cases for pressing enter */
68  case 3:
69  num_ok_commands = 0;
70  PostMessageA(hedit, WM_KEYDOWN, VK_RETURN, 0x1c0001);
71  PostMessageA(hdlg, WM_USER, 0xdeadbeef, 1);
72  break;
73 
74  default:
75  break;
76  }
77  break;
78  }
79 
80  case WM_COMMAND:
81  if (HIWORD(wparam) != BN_CLICKED)
82  break;
83 
84  switch (LOWORD(wparam))
85  {
86  case IDOK:
87  num_ok_commands++;
88  break;
89 
90  default:
91  break;
92  }
93  break;
94 
95  case WM_USER:
96  {
97  HWND hfocus = GetFocus();
98  HWND hedit = GetDlgItem(hdlg, 1000);
99  HWND hedit2 = GetDlgItem(hdlg, 1001);
100  HWND hedit3 = GetDlgItem(hdlg, 1002);
101 
102  if (wparam != 0xdeadbeef)
103  break;
104 
105  switch (lparam)
106  {
107  case 0:
108  if (hfocus == hedit)
109  EndDialog(hdlg, 1111);
110  else if (hfocus == hedit2)
111  EndDialog(hdlg, 2222);
112  else if (hfocus == hedit3)
113  EndDialog(hdlg, 3333);
114  else
115  EndDialog(hdlg, 4444);
116  break;
117  case 1:
118  if ((hfocus == hedit) && (num_ok_commands == 0))
119  EndDialog(hdlg, 11);
120  else
121  EndDialog(hdlg, 22);
122  break;
123  default:
124  EndDialog(hdlg, 5555);
125  }
126  break;
127  }
128 
129  case WM_CLOSE:
130  EndDialog(hdlg, 333);
131  break;
132 
133  default:
134  break;
135  }
136 
137  return FALSE;
138 }
#define IDOK
Definition: winuser.h:824
#define WM_CHAR
Definition: winuser.h:1699
BOOL WINAPI PostMessageA(_In_opt_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
HWND WINAPI SetFocus(_In_opt_ HWND)
#define VK_TAB
Definition: winuser.h:2174
#define VK_RETURN
Definition: winuser.h:2176
BOOL WINAPI EndDialog(_In_ HWND, _In_ INT_PTR)
static UINT WPARAM LPARAM lparam
Definition: combo.c:716
#define WM_KEYDOWN
Definition: winuser.h:1697
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
#define WM_CLOSE
Definition: winuser.h:1603
#define BN_CLICKED
Definition: winuser.h:1907
#define WM_COMMAND
Definition: winuser.h:1722
#define WM_USER
Definition: winuser.h:1877
HWND WINAPI GetFocus(void)
Definition: window.c:1905
#define msg(x)
Definition: auth_time.c:54
#define HIWORD(l)
Definition: typedefs.h:246
#define WM_INITDIALOG
Definition: winuser.h:1721
#define LOWORD(l)
Definition: pedump.c:82
static UINT WPARAM wparam
Definition: combo.c:716

Referenced by test_multi_edit_dialog().

◆ RegisterWindowClasses()

static BOOL RegisterWindowClasses ( void  )
static

Definition at line 2432 of file edit.c.

2433 {
2434  WNDCLASSA test2;
2435  WNDCLASSA test3;
2436  WNDCLASSA test4;
2437  WNDCLASSA text_position;
2438 
2439  test2.style = 0;
2440  test2.lpfnWndProc = ET2_WndProc;
2441  test2.cbClsExtra = 0;
2442  test2.cbWndExtra = 0;
2443  test2.hInstance = hinst;
2444  test2.hIcon = NULL;
2445  test2.hCursor = LoadCursorA (NULL, (LPCSTR)IDC_ARROW);
2446  test2.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1);
2447  test2.lpszMenuName = NULL;
2448  test2.lpszClassName = szEditTest2Class;
2449  if (!RegisterClassA(&test2)) return FALSE;
2450 
2451  test3.style = 0;
2452  test3.lpfnWndProc = edit3_wnd_procA;
2453  test3.cbClsExtra = 0;
2454  test3.cbWndExtra = 0;
2455  test3.hInstance = hinst;
2456  test3.hIcon = 0;
2457  test3.hCursor = LoadCursorA(0, (LPCSTR)IDC_ARROW);
2458  test3.hbrBackground = GetStockObject(WHITE_BRUSH);
2459  test3.lpszMenuName = NULL;
2460  test3.lpszClassName = szEditTest3Class;
2461  if (!RegisterClassA(&test3)) return FALSE;
2462 
2463  test4.style = 0;
2464  test4.lpfnWndProc = edit4_wnd_procA;
2465  test4.cbClsExtra = 0;
2466  test4.cbWndExtra = 0;
2467  test4.hInstance = hinst;
2468  test4.hIcon = NULL;
2469  test4.hCursor = LoadCursorA (NULL, (LPCSTR)IDC_ARROW);
2470  test4.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1);
2471  test4.lpszMenuName = NULL;
2472  test4.lpszClassName = szEditTest4Class;
2473  if (!RegisterClassA(&test4)) return FALSE;
2474 
2475  text_position.style = CS_HREDRAW | CS_VREDRAW;
2476  text_position.cbClsExtra = 0;
2477  text_position.cbWndExtra = 0;
2478  text_position.hInstance = hinst;
2479  text_position.hIcon = NULL;
2480  text_position.hCursor = LoadCursorA(NULL, (LPCSTR)IDC_ARROW);
2481  text_position.hbrBackground = (HBRUSH)(COLOR_BTNFACE + 1);
2482  text_position.lpszMenuName = NULL;
2483  text_position.lpszClassName = szEditTextPositionClass;
2484  text_position.lpfnWndProc = DefWindowProcA;
2485  if (!RegisterClassA(&text_position)) return FALSE;
2486 
2487  return TRUE;
2488 }
HGDIOBJ WINAPI GetStockObject(_In_ int)
static const char szEditTest3Class[]
Definition: edit.c:539
#define TRUE
Definition: types.h:120
void test3(void)
Definition: hivetest.c:423
int cbClsExtra
Definition: winuser.h:3139
#define CS_HREDRAW
Definition: winuser.h:648
LPCSTR lpszMenuName
Definition: winuser.h:3145
#define WHITE_BRUSH
Definition: wingdi.h:901
HBRUSH hbrBackground
Definition: winuser.h:3144
static LRESULT CALLBACK ET2_WndProc(HWND hwnd, UINT iMsg, WPARAM wParam, LPARAM lParam)
Definition: edit.c:823
#define COLOR_WINDOW
Definition: winuser.h:908
int cbWndExtra
Definition: winuser.h:3140
HCURSOR hCursor
Definition: winuser.h:3143
smooth NULL
Definition: ftsmooth.c:416
const char * LPCSTR
Definition: xmlstorage.h:183
static const char szEditTest2Class[]
Definition: edit.c:538
#define CS_VREDRAW
Definition: winuser.h:653
static const char szEditTest4Class[]
Definition: edit.c:540
static LRESULT CALLBACK edit4_wnd_procA(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
Definition: edit.c:2284
static HINSTANCE hinst
Definition: edit.c:536
static LRESULT CALLBACK edit3_wnd_procA(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
Definition: edit.c:851
#define COLOR_BTNFACE
Definition: winuser.h:918
LRESULT WINAPI DefWindowProcA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
LPCSTR lpszClassName
Definition: winuser.h:3146
HCURSOR WINAPI LoadCursorA(_In_opt_ HINSTANCE, _In_ LPCSTR)
Definition: cursoricon.c:2059
UINT style
Definition: winuser.h:3137
void test2(void)
Definition: regtest.c:173
HINSTANCE hInstance
Definition: winuser.h:3141
WNDPROC lpfnWndProc
Definition: winuser.h:3138
#define IDC_ARROW
Definition: winuser.h:682
static const char szEditTextPositionClass[]
Definition: edit.c:541
ATOM WINAPI RegisterClassA(_In_ CONST WNDCLASSA *)
void test4(void)
Definition: hivetest.c:461
HICON hIcon
Definition: winuser.h:3142

Referenced by START_TEST().

◆ set_client_height()

static void set_client_height ( HWND  Wnd,
unsigned  Height 
)
static

Definition at line 638 of file edit.c.

639 {
640  RECT ClientRect, WindowRect;
641 
642  GetWindowRect(Wnd, &WindowRect);
643  GetClientRect(Wnd, &ClientRect);
644  SetWindowPos(Wnd, NULL, 0, 0,
645  WindowRect.right - WindowRect.left,
646  Height + (WindowRect.bottom - WindowRect.top) -
647  (ClientRect.bottom - ClientRect.top),
649 
650  /* Workaround for a bug in Windows' edit control
651  (multi-line mode) */
652  GetWindowRect(Wnd, &WindowRect);
653  SetWindowPos(Wnd, NULL, 0, 0,
654  WindowRect.right - WindowRect.left + 1,
655  WindowRect.bottom - WindowRect.top + 1,
657  SetWindowPos(Wnd, NULL, 0, 0,
658  WindowRect.right - WindowRect.left,
659  WindowRect.bottom - WindowRect.top,
661 
662  GetClientRect(Wnd, &ClientRect);
663  ok(ClientRect.bottom - ClientRect.top == Height,
664  "The client height should be %d, but is %d\n",
665  Height, ClientRect.bottom - ClientRect.top);
666 }
LONG top
Definition: windef.h:292
LONG left
Definition: windef.h:291
#define SWP_NOZORDER
Definition: winuser.h:1232
LONG right
Definition: windef.h:293
smooth NULL
Definition: ftsmooth.c:416
#define SWP_NOACTIVATE
Definition: winuser.h:1227
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
#define ok(value,...)
Definition: atltest.h:57
LONG bottom
Definition: windef.h:294
#define SWP_NOMOVE
Definition: winuser.h:1229
BOOL WINAPI GetWindowRect(_In_ HWND, _Out_ LPRECT)
BOOL WINAPI SetWindowPos(_In_ HWND, _In_opt_ HWND, _In_ int, _In_ int, _In_ int, _In_ int, _In_ UINT)

◆ START_TEST()

START_TEST ( edit  )

Definition at line 3033 of file edit.c.

3034 {
3035  BOOL b;
3036 
3039  ok (b, "RegisterWindowClasses failed\n");
3040  if (!b) return;
3041 
3050  test_margins();
3053  test_espassword();
3054  test_undo();
3055  test_enter();
3056  test_tab();
3057  test_edit_dialog();
3062  test_fontsize();
3063  test_dialogmode();
3064  test_contextmenu();
3066  test_paste();
3067  test_EM_GETLINE();
3069 
3071 }
static void test_edit_control_6(void)
Definition: edit.c:1325
static void test_multi_edit_dialog(void)
Definition: edit.c:2152
static void test_margins_font_change(void)
Definition: edit.c:1625
static void test_espassword(void)
Definition: edit.c:1875
static void test_edit_control_4(void)
Definition: edit.c:1139
static BOOL RegisterWindowClasses(void)
Definition: edit.c:2432
static void test_edit_control_2(void)
Definition: edit.c:736
static void test_contextmenu(void)
Definition: edit.c:2385
static void test_wordbreak_proc(void)
Definition: edit.c:3007
static void test_margins(void)
Definition: edit.c:1544
static void test_edit_dialog(void)
Definition: edit.c:2093
unsigned int BOOL
Definition: ntddk_ex.h:94
static void test_text_position(void)
Definition: edit.c:1867
static void test_edit_control_limittext(void)
Definition: edit.c:1361
smooth NULL
Definition: ftsmooth.c:416
#define b
Definition: ke_i.h:79
static void test_singleline_wantreturn_edit_dialog(void)
Definition: edit.c:2196
static void test_edit_control_5(void)
Definition: edit.c:1259
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
static void test_tab(void)
Definition: edit.c:2046
static void test_edit_control_scroll(void)
Definition: edit.c:1388
static void test_edit_control_3(void)
Definition: edit.c:874
static HINSTANCE hinst
Definition: edit.c:536
static void test_dialogmode(void)
Definition: edit.c:2598
static void test_enter(void)
Definition: edit.c:1979
HMODULE WINAPI DECLSPEC_HOTPATCH GetModuleHandleA(LPCSTR lpModuleName)
Definition: loader.c:821
static void test_wantreturn_edit_dialog(void)
Definition: edit.c:2167
#define ok(value,...)
Definition: atltest.h:57
static void UnregisterWindowClasses(void)
Definition: edit.c:2490
static void test_EM_GETHANDLE(void)
Definition: edit.c:2730
static void test_fontsize(void)
Definition: edit.c:2498
static void test_paste(void)
Definition: edit.c:2882
static void test_EM_GETLINE(void)
Definition: edit.c:2951
static void test_child_edit_wmkeydown(void)
Definition: edit.c:2266
static void test_edit_control_1(void)
Definition: edit.c:668
static void test_undo(void)
Definition: edit.c:1922

◆ test_child_edit_wmkeydown()

static void test_child_edit_wmkeydown ( void  )
static

Definition at line 2266 of file edit.c.

2267 {
2268  HWND hwEdit, hwParent;
2269  int r;
2270 
2271  hwEdit = create_child_editcontrol(0, 0);
2272  hwParent = GetParent(hwEdit);
2274  r = SendMessageA(hwEdit, WM_KEYDOWN, VK_RETURN, 0x1c0001);
2275  ok(1 == r, "expected 1, got %d\n", r);
2277  destroy_child_editcontrol(hwEdit);
2278 }
LRESULT WINAPI SendMessageA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
#define VK_RETURN
Definition: winuser.h:2176
static int child_edit_wmkeydown_num_messages
Definition: edit.c:2249
#define WM_KEYDOWN
Definition: winuser.h:1697
#define SetWindowLongPtrA
Definition: winuser.h:5246
static HWND create_child_editcontrol(DWORD style, DWORD exstyle)
Definition: edit.c:572
static void destroy_child_editcontrol(HWND hwndEdit)
Definition: edit.c:605
static INT_PTR CALLBACK child_edit_wmkeydown_proc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM lparam)
Definition: edit.c:2250
#define GWLP_WNDPROC
Definition: treelist.c:66
HWND WINAPI GetParent(_In_ HWND)
#define ok(value,...)
Definition: atltest.h:57
__int3264 LONG_PTR
Definition: mstsclib_h.h:276

Referenced by START_TEST().

◆ test_contextmenu()

static void test_contextmenu ( void  )
static

Definition at line 2385 of file edit.c.

2386 {
2388  MSG msg;
2389 
2391  0, 0, 200, 200, NULL, NULL, hinst, NULL);
2392  assert(hwndMain);
2393 
2394  hwndEdit = CreateWindowA("EDIT", NULL,
2396  0, 0, 150, 50, /* important this not be 0 size. */
2398  assert(hwndEdit);
2399 
2400  SetFocus(NULL);
2403  ok(got_en_setfocus, "edit box didn't get focused\n");
2404  ok(got_wm_capturechanged, "main window capture did not change\n");
2405 
2408 
2410 
2411  hwndEdit = CreateWindowA("EDIT", "Test Text",
2413  0, 0, 100, 100,
2414  hwndMain, NULL, hinst, NULL);
2415  memset(&menu_messages, 0, sizeof(menu_messages));
2416  p_edit_proc = (void*)SetWindowLongPtrA(hwndEdit, GWLP_WNDPROC,
2418 
2419  SetFocus(hwndEdit);
2420  SendMessageA(hwndEdit, WM_SETTEXT, 0, (LPARAM)"foo");
2422  while (PeekMessageA(&msg, hwndEdit, 0, 0, PM_REMOVE)) DispatchMessageA(&msg);
2423  ok(menu_messages.wm_command == 0,
2424  "Expected no WM_COMMAND messages, got %d\n", menu_messages.wm_command);
2425  ok(menu_messages.em_setsel == 1,
2426  "Expected 1 EM_SETSEL message, got %d\n", menu_messages.em_setsel);
2427 
2430 }
LRESULT WINAPI DispatchMessageA(_In_ const MSG *)
static BOOL got_en_setfocus
Definition: edit.c:2280
#define WM_CONTEXTMENU
Definition: richedit.h:64
HWND hwndMain
Definition: solitaire.cpp:12
#define MAKEWORD(a, b)
Definition: typedefs.h:247
LRESULT WINAPI SendMessageA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
TW_UINT32 TW_UINT16 TW_UINT16 MSG
Definition: twain.h:1827
#define assert(x)
Definition: debug.h:53
HWND WINAPI SetFocus(_In_opt_ HWND)
static struct context_menu_messages menu_messages
Definition: edit.c:2351
UINT_PTR WPARAM
Definition: windef.h:207
#define WS_CHILD
Definition: pedump.c:617
BOOL WINAPI PeekMessageA(_Out_ LPMSG, _In_opt_ HWND, _In_ UINT, _In_ UINT, _In_ UINT)
BOOL WINAPI DestroyWindow(_In_ HWND)
uint32_t ULONG_PTR
Definition: typedefs.h:63
static LRESULT CALLBACK child_edit_menu_proc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
Definition: edit.c:2353
#define CreateWindowA(a, b, c, d, e, f, g, h, i, j, k)
Definition: winuser.h:4216
#define ID_EDITTEST2
Definition: edit.c:32
smooth NULL
Definition: ftsmooth.c:416
static BOOL got_wm_capturechanged
Definition: edit.c:2281
LONG_PTR LPARAM
Definition: windef.h:208
#define WM_SETTEXT
Definition: winuser.h:1599
static const char szEditTest4Class[]
Definition: edit.c:540
static HINSTANCE hinst
Definition: edit.c:536
#define SetWindowLongPtrA
Definition: winuser.h:5246
#define GWLP_WNDPROC
Definition: treelist.c:66
HWND hwndEdit
Definition: combotst.c:65
HWND WINAPI SetCapture(_In_ HWND hWnd)
#define WS_BORDER
Definition: pedump.c:625
#define ok(value,...)
Definition: atltest.h:57
#define msg(x)
Definition: auth_time.c:54
static LRESULT CALLBACK edit_proc_proxy(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
Definition: edit.c:2305
#define WS_OVERLAPPEDWINDOW
Definition: pedump.c:637
#define PM_REMOVE
Definition: winuser.h:1182
#define ES_LEFT
Definition: pedump.c:664
#define WS_VISIBLE
Definition: pedump.c:620
#define memset(x, y, z)
Definition: compat.h:39
static const CLSID *static CLSID *static const GUID VARIANT VARIANT *static IServiceProvider DWORD *static HMENU
Definition: ordinal.c:60
#define ES_AUTOHSCROLL
Definition: pedump.c:672

Referenced by START_TEST().

◆ test_dialogmode()

static void test_dialogmode ( void  )
static

Definition at line 2598 of file edit.c.

2599 {
2600  HWND hwEdit, hwParent, hwButton;
2601  MSG msg= {0};
2602  int len, r;
2604 
2605  r = SendMessageA(hwEdit, WM_CHAR, VK_RETURN, 0x1c0001);
2606  ok(1 == r, "expected 1, got %d\n", r);
2607  len = SendMessageA(hwEdit, WM_GETTEXTLENGTH, 0, 0);
2608  ok(11 == len, "expected 11, got %d\n", len);
2609 
2610  r = SendMessageA(hwEdit, WM_GETDLGCODE, 0, 0);
2611  ok(0x8d == r, "expected 0x8d, got 0x%x\n", r);
2612 
2613  r = SendMessageA(hwEdit, WM_CHAR, VK_RETURN, 0x1c0001);
2614  ok(1 == r, "expected 1, got %d\n", r);
2615  len = SendMessageA(hwEdit, WM_GETTEXTLENGTH, 0, 0);
2616  ok(13 == len, "expected 13, got %d\n", len);
2617 
2618  r = SendMessageA(hwEdit, WM_GETDLGCODE, 0, (LPARAM)&msg);
2619  ok(0x8d == r, "expected 0x8d, got 0x%x\n", r);
2620  r = SendMessageA(hwEdit, WM_CHAR, VK_RETURN, 0x1c0001);
2621  ok(1 == r, "expected 1, got %d\n", r);
2622  len = SendMessageA(hwEdit, WM_GETTEXTLENGTH, 0, 0);
2623  ok(13 == len, "expected 13, got %d\n", len);
2624 
2625  r = SendMessageA(hwEdit, WM_CHAR, VK_RETURN, 0x1c0001);
2626  ok(1 == r, "expected 1, got %d\n", r);
2627  len = SendMessageA(hwEdit, WM_GETTEXTLENGTH, 0, 0);
2628  ok(13 == len, "expected 13, got %d\n", len);
2629 
2630  destroy_child_editcontrol(hwEdit);
2631 
2632  hwEdit = create_editcontrol(ES_MULTILINE, 0);
2633 
2634  r = SendMessageA(hwEdit, WM_CHAR, VK_RETURN, 0x1c0001);
2635  ok(1 == r, "expected 1, got %d\n", r);
2636  len = SendMessageA(hwEdit, WM_GETTEXTLENGTH, 0, 0);
2637  ok(11 == len, "expected 11, got %d\n", len);
2638 
2639  msg.hwnd = hwEdit;
2640  msg.message = WM_KEYDOWN;
2641  msg.wParam = VK_BACK;
2642  msg.lParam = 0xe0001;
2643  r = SendMessageA(hwEdit, WM_GETDLGCODE, VK_BACK, (LPARAM)&msg);
2644  ok(0x8d == r, "expected 0x8d, got 0x%x\n", r);
2645 
2646  r = SendMessageA(hwEdit, WM_CHAR, VK_RETURN, 0x1c0001);
2647  ok(1 == r, "expected 1, got %d\n", r);
2648  len = SendMessageA(hwEdit, WM_GETTEXTLENGTH, 0, 0);
2649  ok(11 == len, "expected 11, got %d\n", len);
2650 
2651  DestroyWindow(hwEdit);
2652 
2653  hwEdit = create_child_editcontrol(0, 0);
2654  hwParent = GetParent(hwEdit);
2656 
2657  zero_dm_messages();
2658  r = SendMessageA(hwEdit, WM_KEYDOWN, VK_ESCAPE, 0x10001);
2659  ok(1 == r, "expected 1, got %d\n", r);
2660  test_dm_messages(0, 0, 0, 0);
2661  zero_dm_messages();
2662 
2663  r = SendMessageA(hwEdit, WM_KEYDOWN, VK_TAB, 0xf0001);
2664  ok(1 == r, "expected 1, got %d\n", r);
2665  test_dm_messages(0, 0, 0, 0);
2666  zero_dm_messages();
2667 
2668  msg.hwnd = hwEdit;
2669  msg.message = WM_KEYDOWN;
2670  msg.wParam = VK_TAB;
2671  msg.lParam = 0xf0001;
2672  r = SendMessageA(hwEdit, WM_GETDLGCODE, VK_TAB, (LPARAM)&msg);
2673  ok(0x89 == r, "expected 0x89, got 0x%x\n", r);
2674  test_dm_messages(0, 0, 0, 0);
2675  zero_dm_messages();
2676 
2677  r = SendMessageA(hwEdit, WM_KEYDOWN, VK_TAB, 0xf0001);
2678  ok(1 == r, "expected 1, got %d\n", r);
2679  test_dm_messages(0, 0, 0, 0);
2680  zero_dm_messages();
2681 
2682  destroy_child_editcontrol(hwEdit);
2683 
2685  hwParent = GetParent(hwEdit);
2687 
2688  r = SendMessageA(hwEdit, WM_KEYDOWN, VK_TAB, 0xf0001);
2689  ok(1 == r, "expected 1, got %d\n", r);
2690  test_dm_messages(0, 0, 0, 0);
2691  zero_dm_messages();
2692 
2693  msg.hwnd = hwEdit;
2694  msg.message = WM_KEYDOWN;
2695  msg.wParam = VK_ESCAPE;
2696  msg.lParam = 0x10001;
2698  ok(0x8d == r, "expected 0x8d, got 0x%x\n", r);
2699  test_dm_messages(0, 0, 0, 0);
2700  zero_dm_messages();
2701 
2702  r = SendMessageA(hwEdit, WM_KEYDOWN, VK_ESCAPE, 0x10001);
2703  ok(1 == r, "expected 1, got %d\n", r);
2704  test_dm_messages(0, 0, 0, 0);
2705  zero_dm_messages();
2706 
2707  r = SendMessageA(hwEdit, WM_KEYDOWN, VK_TAB, 0xf0001);
2708  ok(1 == r, "expected 1, got %d\n", r);
2709  test_dm_messages(0, 0, 0, 1);
2710  zero_dm_messages();
2711 
2712  r = SendMessageA(hwEdit, WM_KEYDOWN, VK_RETURN, 0x1c0001);
2713  ok(1 == r, "expected 1, got %d\n", r);
2714  test_dm_messages(0, 0, 1, 0);
2715  zero_dm_messages();
2716 
2717  hwButton = CreateWindowA("BUTTON", "OK", WS_VISIBLE|WS_CHILD|BS_PUSHBUTTON,
2718  100, 100, 50, 20, hwParent, (HMENU)ID_EDITTESTDBUTTON, hinst, NULL);
2719  ok(hwButton!=NULL, "CreateWindow failed with error code %d\n", GetLastError());
2720 
2721  r = SendMessageA(hwEdit, WM_KEYDOWN, VK_RETURN, 0x1c0001);
2722  ok(1 == r, "expected 1, got %d\n", r);
2723  test_dm_messages(0, 0, 1, 1);
2724  zero_dm_messages();
2725 
2726  DestroyWindow(hwButton);
2727  destroy_child_editcontrol(hwEdit);
2728 }
static HWND create_editcontrol(DWORD style, DWORD exstyle)
Definition: edit.c:543
#define WM_GETTEXTLENGTH
Definition: winuser.h:1601
#define WM_GETDLGCODE
Definition: winuser.h:1671
#define WM_CHAR
Definition: winuser.h:1699
LRESULT WINAPI SendMessageA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
TW_UINT32 TW_UINT16 TW_UINT16 MSG
Definition: twain.h:1827
#define ES_MULTILINE
Definition: pedump.c:667
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
#define VK_TAB
Definition: winuser.h:2174
#define WS_CHILD
Definition: pedump.c:617
#define VK_ESCAPE
Definition: winuser.h:2189
static void zero_dm_messages(void)
Definition: edit.c:2559
BOOL WINAPI DestroyWindow(_In_ HWND)
#define VK_RETURN
Definition: winuser.h:2176
#define test_dm_messages(wmcommand, wmclose, wmgetdefid, wmnextdlgctl)
Definition: edit.c:2567
#define CreateWindowA(a, b, c, d, e, f, g, h, i, j, k)
Definition: winuser.h:4216
smooth NULL
Definition: ftsmooth.c:416
#define WM_KEYDOWN
Definition: winuser.h:1697
LONG_PTR LPARAM
Definition: windef.h:208
#define ID_EDITTESTDBUTTON
Definition: edit.c:31
static HINSTANCE hinst
Definition: edit.c:536
GLenum GLsizei len
Definition: glext.h:6722
#define SetWindowLongPtrA
Definition: winuser.h:5246
#define VK_BACK
Definition: winuser.h:2173
static HWND create_child_editcontrol(DWORD style, DWORD exstyle)
Definition: edit.c:572
static void destroy_child_editcontrol(HWND hwndEdit)
Definition: edit.c:605
#define BS_PUSHBUTTON
Definition: pedump.c:651
#define GWLP_WNDPROC
Definition: treelist.c:66
HWND WINAPI GetParent(_In_ HWND)
#define ok(value,...)
Definition: atltest.h:57
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
static LRESULT CALLBACK dialog_mode_wnd_proc(HWND hwnd, UINT iMsg, WPARAM wParam, LPARAM lParam)
Definition: edit.c:2577
#define msg(x)
Definition: auth_time.c:54
#define WS_VISIBLE
Definition: pedump.c:620
static const CLSID *static CLSID *static const GUID VARIANT VARIANT *static IServiceProvider DWORD *static HMENU
Definition: ordinal.c:60

Referenced by START_TEST().

◆ test_edit_control_1()

static void test_edit_control_1 ( void  )
static

Definition at line 668 of file edit.c.

669 {
670  HWND hwEdit;
671  MSG msMessage;
672  int i;
673  LONG r;
674 
675  msMessage.message = WM_KEYDOWN;
676 
677  trace("EDIT: Single line\n");
679  r = get_edit_style(hwEdit);
680  ok(r == (ES_AUTOVSCROLL | ES_AUTOHSCROLL), "Wrong style expected 0xc0 got: 0x%x\n", r);
681  for (i=0;i<65535;i++)
682  {
683  msMessage.wParam = i;
684  r = SendMessageA(hwEdit, WM_GETDLGCODE, 0, (LPARAM) &msMessage);
686  "Expected DLGC_WANTCHARS | DLGC_HASSETSEL | DLGC_WANTARROWS got %x\n", r);
687  }
688  DestroyWindow (hwEdit);
689 
690  trace("EDIT: Single line want returns\n");
692  r = get_edit_style(hwEdit);
693  ok(r == (ES_AUTOVSCROLL | ES_AUTOHSCROLL | ES_WANTRETURN), "Wrong style expected 0x10c0 got: 0x%x\n", r);
694  for (i=0;i<65535;i++)
695  {
696  msMessage.wParam = i;
697  r = SendMessageA(hwEdit, WM_GETDLGCODE, 0, (LPARAM) &msMessage);
699  "Expected DLGC_WANTCHARS | DLGC_HASSETSEL | DLGC_WANTARROWS got %x\n", r);
700  }
701  DestroyWindow (hwEdit);
702 
703  trace("EDIT: Multiline line\n");
705  r = get_edit_style(hwEdit);
706  ok(r == (ES_AUTOHSCROLL | ES_AUTOVSCROLL | ES_MULTILINE), "Wrong style expected 0xc4 got: 0x%x\n", r);
707  for (i=0;i<65535;i++)
708  {
709  msMessage.wParam = i;
710  r = SendMessageA(hwEdit, WM_GETDLGCODE, 0, (LPARAM) &msMessage);
712  "Expected DLGC_WANTCHARS | DLGC_HASSETSEL | DLGC_WANTALLKEYS | DLGC_WANTARROWS got %x\n", r);
713  }
714  DestroyWindow (hwEdit);
715 
716  trace("EDIT: Multi line want returns\n");
718  r = get_edit_style(hwEdit);
719  ok(r == (ES_WANTRETURN | ES_AUTOHSCROLL | ES_AUTOVSCROLL | ES_MULTILINE), "Wrong style expected 0x10c4 got: 0x%x\n", r);
720  for (i=0;i<65535;i++)
721  {
722  msMessage.wParam = i;
723  r = SendMessageA(hwEdit, WM_GETDLGCODE, 0, (LPARAM) &msMessage);
725  "Expected DLGC_WANTCHARS | DLGC_HASSETSEL | DLGC_WANTALLKEYS | DLGC_WANTARROWS got %x\n", r);
726  }
727  DestroyWindow (hwEdit);
728 }
static HWND create_editcontrol(DWORD style, DWORD exstyle)
Definition: edit.c:543
#define DLGC_WANTCHARS
Definition: winuser.h:2593
#define WM_GETDLGCODE
Definition: winuser.h:1671
LRESULT WINAPI SendMessageA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
TW_UINT32 TW_UINT16 TW_UINT16 MSG
Definition: twain.h:1827
#define ES_MULTILINE
Definition: pedump.c:667
BOOL WINAPI DestroyWindow(_In_ HWND)
#define DLGC_HASSETSEL
Definition: winuser.h:2589
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
long LONG
Definition: pedump.c:60
#define ES_WANTRETURN
Definition: pedump.c:676
#define WM_KEYDOWN
Definition: winuser.h:1697
LONG_PTR LPARAM
Definition: windef.h:208
static LONG get_edit_style(HWND hwnd)
Definition: edit.c:615
#define ES_AUTOVSCROLL
Definition: pedump.c:671
#define trace
Definition: atltest.h:70
#define DLGC_WANTALLKEYS
Definition: winuser.h:2587
#define ok(value,...)
Definition: atltest.h:57
#define WS_VSCROLL
Definition: pedump.c:627
#define ES_AUTOHSCROLL
Definition: pedump.c:672
#define DLGC_WANTARROWS
Definition: winuser.h:2585

Referenced by START_TEST().

◆ test_edit_control_2()

static void test_edit_control_2 ( void  )
static

Definition at line 736 of file edit.c.

737 {
738  HWND hwndMain, phwnd;
739  char szLocalString[MAXLEN];
740  LONG r, w = 150, h = 50;
741  POINT cpos;
742 
743  /* Create main and edit windows. */
745  0, 0, 200, 200, NULL, NULL, hinst, NULL);
746  assert(hwndMain);
749 
750  hwndET2 = CreateWindowA("EDIT", NULL,
752  0, 0, w, h, /* important this not be 0 size. */
754  assert(hwndET2);
757 
758  trace("EDIT: SETTEXT atomicity\n");
759  /* Send messages to "type" in the word 'foo'. */
760  r = SendMessageA(hwndET2, WM_CHAR, 'f', 1);
761  ok(1 == r, "Expected: %d, got: %d\n", 1, r);
762  r = SendMessageA(hwndET2, WM_CHAR, 'o', 1);
763  ok(1 == r, "Expected: %d, got: %d\n", 1, r);
764  r = SendMessageA(hwndET2, WM_CHAR, 'o', 1);
765  ok(1 == r, "Expected: %d, got: %d\n", 1, r);
766  /* 'foo' should have been changed to 'bar' by the UPDATE handler. */
767  GetWindowTextA(hwndET2, szLocalString, MAXLEN);
768  ok(strcmp(szLocalString, "bar")==0,
769  "Wrong contents of edit: %s\n", szLocalString);
770 
771  /* try setting the caret before it's visible */
772  r = SetCaretPos(0, 0);
773  todo_wine ok(0 == r, "SetCaretPos succeeded unexpectedly, expected: 0, got: %d\n", r);
774  phwnd = SetFocus(hwndET2);
775  ok(phwnd != NULL, "SetFocus failed unexpectedly, expected non-zero, got NULL\n");
776  r = SetCaretPos(0, 0);
777  ok(1 == r, "SetCaretPos failed unexpectedly, expected: 1, got: %d\n", r);
778  r = GetCaretPos(&cpos);
779  ok(1 == r, "GetCaretPos failed unexpectedly, expected: 1, got: %d\n", r);
780  ok(cpos.x == 0 && cpos.y == 0, "Wrong caret position, expected: (0,0), got: (%d,%d)\n", cpos.x, cpos.y);
781  r = SetCaretPos(-1, -1);
782  ok(1 == r, "SetCaretPos failed unexpectedly, expected: 1, got: %d\n", r);
783  r = GetCaretPos(&cpos);
784  ok(1 == r, "GetCaretPos failed unexpectedly, expected: 1, got: %d\n", r);
785  ok(cpos.x == -1 && cpos.y == -1, "Wrong caret position, expected: (-1,-1), got: (%d,%d)\n", cpos.x, cpos.y);
786  r = SetCaretPos(w << 1, h << 1);
787  ok(1 == r, "SetCaretPos failed unexpectedly, expected: 1, got: %d\n", r);
788  r = GetCaretPos(&cpos);
789  ok(1 == r, "GetCaretPos failed unexpectedly, expected: 1, got: %d\n", r);
790  ok(cpos.x == (w << 1) && cpos.y == (h << 1), "Wrong caret position, expected: (%d,%d), got: (%d,%d)\n", w << 1, h << 1, cpos.x, cpos.y);
791  r = SetCaretPos(w, h);
792  ok(1 == r, "SetCaretPos failed unexpectedly, expected: 1, got: %d\n", r);
793  r = GetCaretPos(&cpos);
794  ok(1 == r, "GetCaretPos failed unexpectedly, expected: 1, got: %d\n", r);
795  ok(cpos.x == w && cpos.y == h, "Wrong caret position, expected: (%d,%d), got: (%d,%d)\n", w, h, cpos.x, cpos.y);
796  r = SetCaretPos(w - 1, h - 1);
797  ok(1 == r, "SetCaretPos failed unexpectedly, expected: 1, got: %d\n", r);
798  r = GetCaretPos(&cpos);
799  ok(1 == r, "GetCaretPos failed unexpectedly, expected: 1, got: %d\n", r);
800  ok(cpos.x == (w - 1) && cpos.y == (h - 1), "Wrong caret position, expected: (%d,%d), got: (%d,%d)\n", w - 1, h - 1, cpos.x, cpos.y);
801 
802  /* OK, done! */
805 }
GLubyte GLubyte GLubyte GLubyte w
Definition: glext.h:6102
int WINAPI GetWindowTextA(HWND hWnd, LPSTR lpString, int nMaxCount)
Definition: window.c:1326
long y
Definition: polytest.cpp:48
#define WM_CHAR
Definition: winuser.h:1699
long x
Definition: polytest.cpp:48
HWND hwndMain
Definition: solitaire.cpp:12
LRESULT WINAPI SendMessageA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
#define assert(x)
Definition: debug.h:53
static HWND hwndET2
Definition: edit.c:537
HWND WINAPI SetFocus(_In_opt_ HWND)
#define WS_CHILD
Definition: pedump.c:617
int winetest_interactive
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
BOOL WINAPI DestroyWindow(_In_ HWND)
GLfloat GLfloat GLfloat GLfloat h
Definition: glext.h:7723
#define MAXLEN
Definition: edit.c:33
long LONG
Definition: pedump.c:60
#define CreateWindowA(a, b, c, d, e, f, g, h, i, j, k)
Definition: winuser.h:4216
#define ID_EDITTEST2
Definition: edit.c:32
smooth NULL
Definition: ftsmooth.c:416
#define SW_SHOW
Definition: winuser.h:769
static const char szEditTest2Class[]
Definition: edit.c:538
#define trace
Definition: atltest.h:70
static HINSTANCE hinst
Definition: edit.c:536
#define todo_wine
Definition: test.h:154
#define WS_BORDER
Definition: pedump.c:625
#define ok(value,...)
Definition: atltest.h:57
#define WS_OVERLAPPEDWINDOW
Definition: pedump.c:637
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469
BOOL WINAPI GetCaretPos(_Out_ LPPOINT)
#define ES_LEFT
Definition: pedump.c:664
static const CLSID *static CLSID *static const GUID VARIANT VARIANT *static IServiceProvider DWORD *static HMENU
Definition: ordinal.c:60
#define ES_AUTOHSCROLL
Definition: pedump.c:672
BOOL WINAPI SetCaretPos(_In_ int, _In_ int)

Referenced by START_TEST().

◆ test_edit_control_3()

static void test_edit_control_3 ( void  )
static

Definition at line 874 of file edit.c.

875 {
876  HWND hWnd;
877  HWND hParent;
878  HDC hDC;
879  int len, dpi;
880  static const char *str = "this is a long string.";
881  static const char *str2 = "this is a long string.\r\nthis is a long string.\r\nthis is a long string.\r\nthis is a long string.";
882 
883  hDC = GetDC(NULL);
885  ReleaseDC(NULL, hDC);
886 
887  trace("EDIT: Test notifications\n");
888 
891  NULL,
892  0,
893  CW_USEDEFAULT, CW_USEDEFAULT, 10, 10,
894  NULL, NULL, NULL, NULL);
895  assert(hParent);
896 
897  trace("EDIT: Single line, no ES_AUTOHSCROLL\n");
898  hWnd = CreateWindowExA(0,
899  "EDIT",
900  NULL,
901  0,
902  10, 10, 50, 50,
903  hParent, NULL, NULL, NULL);
904  assert(hWnd);
905 
906  zero_notify();
909  if (len == lstrlenA(str)) /* Win 8 */
910  test_notify(1, 0, 1);
911  else
912  test_notify(1, 1, 1);
913 
915  zero_notify();
918  ok(1 == len, "wrong text length, expected 1, got %d\n", len);
919  test_notify(1, 0, 1);
920 
921  zero_notify();
924  ok(lstrlenA(str) == len, "text shouldn't have been truncated\n");
925  test_notify(1, 0, 1);
926 
927  len = SendMessageA(hWnd, EM_GETSEL, 0, 0);
928  ok(LOWORD(len)==0, "Unexpected start position for selection %d\n", LOWORD(len));
929  ok(HIWORD(len)==0, "Unexpected end position for selection %d\n", HIWORD(len));
931  len = SendMessageA(hWnd, EM_GETSEL, 0, 0);
932  ok(LOWORD(len)==0, "Unexpected start position for selection %d\n", LOWORD(len));
933  ok(HIWORD(len)==0, "Unexpected end position for selection %d\n", HIWORD(len));
934 
936 
938  zero_notify();
941  ok(5 == len, "text should have been truncated to limit, expected 5, got %d\n", len);
942  test_notify(1, 1, 1);
943 
944  zero_notify();
947  ok(lstrlenA(str) == len, "text shouldn't have been truncated\n");
948  test_notify(1, 0, 1);
949 
951 
952  trace("EDIT: Single line, ES_AUTOHSCROLL\n");
953  hWnd = CreateWindowExA(0,
954  "EDIT",
955  NULL,
957  10, 10, 50, 50,
958  hParent, NULL, NULL, NULL);
959  assert(hWnd);
960 
961  zero_notify();
964  ok(lstrlenA(str) == len, "text shouldn't have been truncated\n");
965  test_notify(1, 0, 1);
966 
967  zero_notify();
970  ok(lstrlenA(str) == len, "text shouldn't have been truncated\n");
971  test_notify(1, 0, 1);
972 
974  zero_notify();
977  ok(lstrlenA(str2) == len, "text shouldn't have been truncated\n");
978  test_notify(1, 0, 1);
979 
980  zero_notify();
981  SendMessageA(hWnd, WM_SETTEXT, 0, (LPARAM)str2);
983  ok(lstrlenA(str2) == len, "text shouldn't have been truncated\n");
984  test_notify(1, 0, 1);
985 
987 
989  zero_notify();
992  ok(5 == len, "text should have been truncated to limit, expected 5, got %d\n", len);
993  test_notify(1, 1, 1);
994 
995  zero_notify();
998  ok(lstrlenA(str) == len, "text shouldn't have been truncated\n");
999  test_notify(1, 0, 1);
1000 
1002 
1003  trace("EDIT: Multline, no ES_AUTOHSCROLL, no ES_AUTOVSCROLL\n");
1004  hWnd = CreateWindowExA(0,
1005  "EDIT",
1006  NULL,
1007  ES_MULTILINE,
1008  10, 10, (50 * dpi) / 96, (50 * dpi) / 96,
1009  hParent, NULL, NULL, NULL);
1010  assert(hWnd);
1011 
1012  zero_notify();
1015  if (len == lstrlenA(str)) /* Win 8 */
1016  test_notify(1, 0, 1);
1017  else
1018  {
1019  ok(0 == len, "text should have been truncated, expected 0, got %d\n", len);
1020  test_notify(1, 1, 1);
1021  }
1022 
1023  SendMessageA(hWnd, WM_SETTEXT, 0, (LPARAM)"");
1024  zero_notify();
1027  ok(1 == SendMessageA(hWnd, WM_GETTEXTLENGTH, 0, 0), "wrong text length, expected 1, got %d\n", len);
1028  test_notify(1, 0, 1);
1029 
1030  zero_notify();
1033  ok(lstrlenA(str) == len, "text shouldn't have been truncated\n");
1034  test_notify(0, 0, 0);
1035 
1037 
1038  SendMessageA(hWnd, WM_SETTEXT, 0, (LPARAM)"");
1039  zero_notify();
1042  ok(5 == len, "text should have been truncated to limit, expected 5, got %d\n", len);
1043  test_notify(1, 1, 1);
1044 
1045  zero_notify();
1048  ok(lstrlenA(str) == len, "text shouldn't have been truncated\n");
1049  test_notify(0, 0, 0);
1050 
1052 
1053  trace("EDIT: Multline, ES_AUTOHSCROLL, no ES_AUTOVSCROLL\n");
1054  hWnd = CreateWindowExA(0,
1055  "EDIT",
1056  NULL,
1058  10, 10, (50 * dpi) / 96, (50 * dpi) / 96,
1059  hParent, NULL, NULL, NULL);
1060  assert(hWnd);
1061 
1062  zero_notify();
1063  SendMessageA(hWnd, EM_REPLACESEL, 0, (LPARAM)str2);
1065  ok(0 == len, "text should have been truncated, expected 0, got %d\n", len);
1066  test_notify(1, 1, 1);
1067 
1068  SendMessageA(hWnd, WM_SETTEXT, 0, (LPARAM)"");
1069  zero_notify();
1072  ok(1 == SendMessageA(hWnd, WM_GETTEXTLENGTH, 0, 0), "wrong text length, expected 1, got %d\n", len);
1073  test_notify(1, 0, 1);
1074 
1075  zero_notify();
1076  SendMessageA(hWnd, WM_SETTEXT, 0, (LPARAM)str2);
1078  ok(lstrlenA(str2) == len, "text shouldn't have been truncated\n");
1079  test_notify(0, 0, 0);
1080 
1082 
1083  SendMessageA(hWnd, WM_SETTEXT, 0, (LPARAM)"");
1084  zero_notify();
1085  SendMessageA(hWnd, EM_REPLACESEL, 0, (LPARAM)str2);
1087  ok(5 == len, "text should have been truncated to limit, expected 5, got %d\n", len);
1088  test_notify(1, 1, 1);
1089 
1090  zero_notify();
1091  SendMessageA(hWnd, WM_SETTEXT, 0, (LPARAM)str2);
1093  ok(lstrlenA(str2) == len, "text shouldn't have been truncated\n");
1094  test_notify(0, 0, 0);
1095 
1097 
1098  trace("EDIT: Multline, ES_AUTOHSCROLL and ES_AUTOVSCROLL\n");
1099  hWnd = CreateWindowExA(0,
1100  "EDIT",
1101  NULL,
1103  10, 10, 50, 50,
1104  hParent, NULL, NULL, NULL);
1105  assert(hWnd);
1106 
1107  zero_notify();
1108  SendMessageA(hWnd, EM_REPLACESEL, 0, (LPARAM)str2);
1110  ok(lstrlenA(str2) == len, "text shouldn't have been truncated\n");
1111  test_notify(1, 0, 1);
1112 
1113  zero_notify();
1114  SendMessageA(hWnd, WM_SETTEXT, 0, (LPARAM)str2);
1116  ok(lstrlenA(str2) == len, "text shouldn't have been truncated\n");
1117  test_notify(0, 0, 0);
1118 
1120 
1121  SendMessageA(hWnd, WM_SETTEXT, 0, (LPARAM)"");
1122  zero_notify();
1123  SendMessageA(hWnd, EM_REPLACESEL, 0, (LPARAM)str2);
1125  ok(5 == len, "text should have been truncated to limit, expected 5, got %d\n", len);
1126  test_notify(1, 1, 1);
1127 
1128  zero_notify();
1129  SendMessageA(hWnd, WM_SETTEXT, 0, (LPARAM)str2);
1131  ok(lstrlenA(str2) == len, "text shouldn't have been truncated\n");
1132  test_notify(0, 0, 0);
1133 
1135 }
#define WM_GETTEXTLENGTH
Definition: winuser.h:1601
static const char szEditTest3Class[]
Definition: edit.c:539
HDC WINAPI GetDC(_In_opt_ HWND)
LRESULT WINAPI SendMessageA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define EM_SETLIMITTEXT
Definition: winuser.h:1993
#define ES_MULTILINE
Definition: pedump.c:667
static HDC
Definition: imagelist.c:92
HWND hWnd
Definition: settings.c:17
#define assert(x)
Definition: debug.h:53
BOOL WINAPI DestroyWindow(_In_ HWND)
#define EM_GETSEL
Definition: winuser.h:1979
#define test_notify(enchange, enmaxtext, enupdate)
Definition: edit.c:840
int WINAPI ReleaseDC(_In_opt_ HWND, _In_ HDC)
#define CW_USEDEFAULT
Definition: winuser.h:225
const WCHAR * str
smooth NULL
Definition: ftsmooth.c:416
LONG_PTR LPARAM
Definition: windef.h:208
#define WM_SETTEXT
Definition: winuser.h:1599
#define ES_AUTOVSCROLL
Definition: pedump.c:671
#define dpi
Definition: sysparams.c:22
#define trace
Definition: atltest.h:70
int WINAPI GetDeviceCaps(_In_opt_ HDC, _In_ int)
const DOCKBAR PVOID HWND hParent
Definition: tooldock.h:22
GLenum GLsizei len
Definition: glext.h:6722
static HDC hDC
Definition: 3dtext.c:33
int WINAPI lstrlenA(LPCSTR lpString)
Definition: lstring.c:145
#define ok(value,...)
Definition: atltest.h:57
static void zero_notify(void)
Definition: edit.c:833
HWND WINAPI CreateWindowExA(_In_ DWORD dwExStyle, _In_opt_ LPCSTR lpClassName, _In_opt_ LPCSTR lpWindowName, _In_ DWORD dwStyle, _In_ int X, _In_ int Y, _In_ int nWidth, _In_ int nHeight, _In_opt_ HWND hWndParent, _In_opt_ HMENU hMenu, _In_opt_ HINSTANCE hInstance, _In_opt_ LPVOID lpParam)
#define HIWORD(l)
Definition: typedefs.h:246
#define LOGPIXELSY
Definition: wingdi.h:718
#define WM_SETFOCUS
Definition: winuser.h:1595
#define ES_AUTOHSCROLL
Definition: pedump.c:672
#define LOWORD(l)
Definition: pedump.c:82
#define EM_REPLACESEL
Definition: winuser.h:1988

Referenced by START_TEST().

◆ test_edit_control_4()

static void test_edit_control_4 ( void  )
static

Definition at line 1139 of file edit.c.

1140 {
1141  HWND hwEdit;
1142  int lo, hi, mid;
1143  int ret;
1144  int i;
1145 
1146  trace("EDIT: Test EM_CHARFROMPOS and EM_POSFROMCHAR\n");
1148  SendMessageA(hwEdit, WM_SETTEXT, 0, (LPARAM) "aa");
1149  lo = LOWORD(SendMessageA(hwEdit, EM_POSFROMCHAR, 0, 0));
1150  hi = LOWORD(SendMessageA(hwEdit, EM_POSFROMCHAR, 1, 0));
1151  mid = lo + (hi - lo) / 2;
1152 
1153  for (i = lo; i < mid; i++) {
1154  ret = LOWORD(SendMessageA(hwEdit, EM_CHARFROMPOS, 0, i));
1155  ok(0 == ret, "expected 0 got %d\n", ret);
1156  }
1157  for (i = mid; i <= hi; i++) {
1158  ret = LOWORD(SendMessageA(hwEdit, EM_CHARFROMPOS, 0, i));
1159  ok(1 == ret, "expected 1 got %d\n", ret);
1160  }
1161  ret = SendMessageA(hwEdit, EM_POSFROMCHAR, 2, 0);
1162  ok(-1 == ret, "expected -1 got %d\n", ret);
1163  DestroyWindow(hwEdit);
1164 
1166  SendMessageA(hwEdit, WM_SETTEXT, 0, (LPARAM) "aa");
1167  lo = LOWORD(SendMessageA(hwEdit, EM_POSFROMCHAR, 0, 0));
1168  hi = LOWORD(SendMessageA(hwEdit, EM_POSFROMCHAR, 1, 0));
1169  mid = lo + (hi - lo) / 2;
1170 
1171  for (i = lo; i < mid; i++) {
1172  ret = LOWORD(SendMessageA(hwEdit, EM_CHARFROMPOS, 0, i));
1173  ok(0 == ret, "expected 0 got %d\n", ret);
1174  }
1175  for (i = mid; i <= hi; i++) {
1176  ret = LOWORD(SendMessageA(hwEdit, EM_CHARFROMPOS, 0, i));
1177  ok(1 == ret, "expected 1 got %d\n", ret);
1178  }
1179  ret = SendMessageA(hwEdit, EM_POSFROMCHAR, 2, 0);
1180  ok(-1 == ret, "expected -1 got %d\n", ret);
1181  DestroyWindow(hwEdit);
1182 
1184  SendMessageA(hwEdit, WM_SETTEXT, 0, (LPARAM) "aa");
1185  lo = LOWORD(SendMessageA(hwEdit, EM_POSFROMCHAR, 0, 0));
1186  hi = LOWORD(SendMessageA(hwEdit, EM_POSFROMCHAR, 1, 0));
1187  mid = lo + (hi - lo) / 2;
1188 
1189  for (i = lo; i < mid; i++) {
1190  ret = LOWORD(SendMessageA(hwEdit, EM_CHARFROMPOS, 0, i));
1191  ok(0 == ret, "expected 0 got %d\n", ret);
1192  }
1193  for (i = mid; i <= hi; i++) {
1194  ret = LOWORD(SendMessageA(hwEdit, EM_CHARFROMPOS, 0, i));
1195  ok(1 == ret, "expected 1 got %d\n", ret);
1196  }
1197  ret = SendMessageA(hwEdit, EM_POSFROMCHAR, 2, 0);
1198  ok(-1 == ret, "expected -1 got %d\n", ret);
1199  DestroyWindow(hwEdit);
1200 
1202  SendMessageA(hwEdit, WM_SETTEXT, 0, (LPARAM) "aa");
1203  lo = LOWORD(SendMessageA(hwEdit, EM_POSFROMCHAR, 0, 0));
1204  hi = LOWORD(SendMessageA(hwEdit, EM_POSFROMCHAR, 1, 0));
1205  mid = lo + (hi - lo) / 2 +1;
1206 
1207  for (i = lo; i < mid; i++) {
1208  ret = LOWORD(SendMessageA(hwEdit, EM_CHARFROMPOS, 0, i));
1209  ok((0 == ret || 1 == ret /* Vista */), "expected 0 or 1 got %d\n", ret);
1210  }
1211  for (i = mid; i <= hi; i++) {
1212  ret = LOWORD(SendMessageA(hwEdit, EM_CHARFROMPOS, 0, i));
1213  ok(1 == ret, "expected 1 got %d\n", ret);
1214  }
1215  ret = SendMessageA(hwEdit, EM_POSFROMCHAR, 2, 0);
1216  ok(-1 == ret, "expected -1 got %d\n", ret);
1217  DestroyWindow(hwEdit);
1218 
1220  SendMessageA(hwEdit, WM_SETTEXT, 0, (LPARAM) "aa");
1221  lo = LOWORD(SendMessageA(hwEdit, EM_POSFROMCHAR, 0, 0));
1222  hi = LOWORD(SendMessageA(hwEdit, EM_POSFROMCHAR, 1, 0));
1223  mid = lo + (hi - lo) / 2 +1;
1224 
1225  for (i = lo; i < mid; i++) {
1226  ret = LOWORD(SendMessageA(hwEdit, EM_CHARFROMPOS, 0, i));
1227  ok((0 == ret || 1 == ret /* Vista */), "expected 0 or 1 got %d\n", ret);
1228  }
1229  for (i = mid; i <= hi; i++) {
1230  ret = LOWORD(SendMessageA(hwEdit, EM_CHARFROMPOS, 0, i));
1231  ok(1 == ret, "expected 1 got %d\n", ret);
1232  }
1233  ret = SendMessageA(hwEdit, EM_POSFROMCHAR, 2, 0);
1234  ok(-1 == ret, "expected -1 got %d\n", ret);
1235  DestroyWindow(hwEdit);
1236 
1238  SendMessageA(hwEdit, WM_SETTEXT, 0, (LPARAM) "aa");
1239  lo = LOWORD(SendMessageA(hwEdit, EM_POSFROMCHAR, 0, 0));
1240  hi = LOWORD(SendMessageA(hwEdit, EM_POSFROMCHAR, 1, 0));
1241  mid = lo + (hi - lo) / 2 +1;
1242 
1243  for (i = lo; i < mid; i++) {
1244  ret = LOWORD(SendMessageA(hwEdit, EM_CHARFROMPOS, 0, i));
1245  ok((0 == ret || 1 == ret /* Vista */), "expected 0 or 1 got %d\n", ret);
1246  }
1247  for (i = mid; i <= hi; i++) {
1248  ret = LOWORD(SendMessageA(hwEdit, EM_CHARFROMPOS, 0, i));
1249  ok(1 == ret, "expected 1 got %d\n", ret);
1250  }
1251  ret = SendMessageA(hwEdit, EM_POSFROMCHAR, 2, 0);
1252  ok(-1 == ret, "expected -1 got %d\n", ret);
1253  DestroyWindow(hwEdit);
1254 }
static HWND create_editcontrol(DWORD style, DWORD exstyle)
Definition: edit.c:543
#define ES_CENTER
Definition: pedump.c:665
LRESULT WINAPI SendMessageA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define ES_MULTILINE
Definition: pedump.c:667
BOOL WINAPI DestroyWindow(_In_ HWND)
#define EM_CHARFROMPOS
Definition: richedit.h:78
#define EM_POSFROMCHAR
Definition: richedit.h:77
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define ES_RIGHT
Definition: pedump.c:666
LONG_PTR LPARAM
Definition: windef.h:208
#define WM_SETTEXT
Definition: winuser.h:1599
#define ES_AUTOVSCROLL
Definition: pedump.c:671
#define trace
Definition: atltest.h:70
int ret
#define ok(value,...)
Definition: atltest.h:57
#define ES_AUTOHSCROLL
Definition: pedump.c:672
#define LOWORD(l)
Definition: pedump.c:82

Referenced by START_TEST().

◆ test_edit_control_5()

static void test_edit_control_5 ( void  )
static

Definition at line 1259 of file edit.c.

1260 {
1261  static const char *str = "test\r\ntest";
1262  HWND parentWnd;
1263  HWND hWnd;
1264  int len;
1265  RECT rc1 = { 10, 10, 11, 11};
1266  RECT rc;
1267 
1268  /* first show that a non-child won't do for this test */
1269  hWnd = CreateWindowExA(0,
1270  "EDIT",
1271  str,
1272  0,
1273  10, 10, 1, 1,
1274  NULL, NULL, NULL, NULL);
1275  assert(hWnd);
1276  /* size of non-child edit control is (much) bigger than requested */
1277  GetWindowRect( hWnd, &rc);
1278  ok( rc.right - rc.left > 20, "size of the window (%d) is smaller than expected\n",
1279  rc.right - rc.left);
1281  /* so create a parent, and give it edit controls children to test with */
1282  parentWnd = CreateWindowExA(0,
1284  "Edit Test", WS_VISIBLE |
1287  250, 250,
1288  NULL, NULL, hinst, NULL);
1289  assert(parentWnd);
1290  ShowWindow( parentWnd, SW_SHOW);
1291  /* single line */
1292  hWnd = CreateWindowExA(0,
1293  "EDIT",
1294  str, WS_VISIBLE | WS_BORDER |
1295  WS_CHILD,
1296  rc1.left, rc1.top, rc1.right - rc1.left, rc1.bottom - rc1.top,
1297  parentWnd, NULL, NULL, NULL);
1298  assert(hWnd);
1299  GetClientRect( hWnd, &rc);
1300  ok( rc.right == rc1.right - rc1.left && rc.bottom == rc1.bottom - rc1.top,
1301  "Client rectangle not the expected size %s\n", wine_dbgstr_rect( &rc ));
1303  ok(lstrlenA(str) == len, "text shouldn't have been truncated\n");
1305  /* multi line */
1306  hWnd = CreateWindowExA(0,
1307  "EDIT",
1308  str,
1310  rc1.left, rc1.top, rc1.right - rc1.left, rc1.bottom - rc1.top,
1311  parentWnd, NULL, NULL, NULL);
1312  assert(hWnd);
1313  GetClientRect( hWnd, &rc);
1314  ok( rc.right == rc1.right - rc1.left && rc.bottom == rc1.bottom - rc1.top,
1315  "Client rectangle not the expected size %s\n", wine_dbgstr_rect( &rc ));
1317  ok(lstrlenA(str) == len, "text shouldn't have been truncated\n");
1319  DestroyWindow(parentWnd);
1320 }
#define WM_GETTEXTLENGTH
Definition: winuser.h:1601
LRESULT WINAPI SendMessageA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define ES_MULTILINE
Definition: pedump.c:667
HWND hWnd
Definition: settings.c:17
LONG top
Definition: windef.h:292
#define assert(x)
Definition: debug.h:53
#define WS_CHILD
Definition: pedump.c:617
LONG left
Definition: windef.h:291
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
LONG right
Definition: windef.h:293
BOOL WINAPI DestroyWindow(_In_ HWND)
#define CW_USEDEFAULT
Definition: winuser.h:225
const WCHAR * str
smooth NULL
Definition: ftsmooth.c:416
#define SW_SHOW
Definition: winuser.h:769
const char * wine_dbgstr_rect(const RECT *rect)
static HINSTANCE hinst
Definition: edit.c:536
GLenum GLsizei len
Definition: glext.h:6722
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
#define WS_BORDER
Definition: pedump.c:625
int WINAPI lstrlenA(LPCSTR lpString)
Definition: lstring.c:145
#define ok(value,...)
Definition: atltest.h:57
HWND WINAPI CreateWindowExA(_In_ DWORD dwExStyle, _In_opt_ LPCSTR lpClassName, _In_opt_ LPCSTR lpWindowName, _In_ DWORD dwStyle, _In_ int X, _In_ int Y, _In_ int nWidth, _In_ int nHeight, _In_opt_ HWND hWndParent, _In_opt_ HMENU hMenu, _In_opt_ HINSTANCE hInstance, _In_opt_ LPVOID lpParam)
#define WS_OVERLAPPEDWINDOW
Definition: pedump.c:637
LONG bottom
Definition: windef.h:294
BOOL WINAPI GetWindowRect(_In_ HWND, _Out_ LPRECT)
#define WS_VISIBLE
Definition: pedump.c:620
static const char szEditTextPositionClass[]
Definition: edit.c:541

Referenced by START_TEST().

◆ test_edit_control_6()

static void test_edit_control_6 ( void  )
static

Definition at line 1325 of file edit.c.

1326 {
1327  static const char *str = "test\r\ntest";
1328  char buf[MAXLEN];
1329  LONG ret;
1330  HWND hWnd;
1331 
1332  hWnd = CreateWindowExA(0,
1333  "EDIT",
1334  "Test",
1335  0,
1336  10, 10, 1, 1,
1337  NULL, NULL, hinst, NULL);
1338  assert(hWnd);
1339 
1341  ok(ret == TRUE, "Expected %d, got %d\n", TRUE, ret);
1343  ok(ret == strlen(str), "Expected %s, got len %d\n", str, ret);
1344  ok(!strcmp(buf, str), "Expected %s, got %s\n", str, buf);
1345  buf[0] = 0;
1346  ret = SendMessageA(hWnd, WM_DESTROY, 0, 0);
1347  ok(ret == 0, "Expected 0, got %d\n", ret);
1349  ok(ret == strlen(str), "Expected %s, got len %d\n", str, ret);
1350  ok(!strcmp(buf, str), "Expected %s, got %s\n", str, buf);
1351  buf[0] = 0;
1352  ret = SendMessageA(hWnd, WM_NCDESTROY, 0, 0);
1353  ok(ret == 0, "Expected 0, got %d\n", ret);
1355  ok(ret == 0, "Expected 0, got len %d\n", ret);
1356  ok(!strcmp(buf, ""), "Expected empty string, got %s\n", buf);
1357 
1359 }
#define TRUE
Definition: types.h:120
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
LRESULT WINAPI SendMessageA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define WM_GETTEXT
Definition: winuser.h:1600
HWND hWnd
Definition: settings.c:17
#define assert(x)
Definition: debug.h:53
BOOL WINAPI DestroyWindow(_In_ HWND)
#define MAXLEN
Definition: edit.c:33
long LONG
Definition: pedump.c:60
const WCHAR * str
smooth NULL
Definition: ftsmooth.c:416
LONG_PTR LPARAM
Definition: windef.h:208
#define WM_SETTEXT
Definition: winuser.h:1599
#define WM_DESTROY
Definition: winuser.h:1591
#define WM_NCDESTROY
Definition: winuser.h:1666
static HINSTANCE hinst
Definition: edit.c:536
int ret
#define ok(value,...)
Definition: atltest.h:57
HWND WINAPI CreateWindowExA(_In_ DWORD dwExStyle, _In_opt_ LPCSTR lpClassName, _In_opt_ LPCSTR lpWindowName, _In_ DWORD dwStyle, _In_ int X, _In_ int Y, _In_ int nWidth, _In_ int nHeight, _In_opt_ HWND hWndParent, _In_opt_ HMENU hMenu, _In_opt_ HINSTANCE hInstance, _In_opt_ LPVOID lpParam)
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469

Referenced by START_TEST().

◆ test_edit_control_limittext()

static void test_edit_control_limittext ( void  )
static

Definition at line 1361 of file edit.c.

1362 {
1363  HWND hwEdit;
1364  DWORD r;
1365 
1366  /* Test default limit for single-line control */
1367  trace("EDIT: buffer limit for single-line\n");
1369  r = SendMessageA(hwEdit, EM_GETLIMITTEXT, 0, 0);
1370  ok(r == 30000, "Incorrect default text limit, expected 30000 got %u\n", r);
1371  SendMessageA(hwEdit, EM_SETLIMITTEXT, 0, 0);
1372  r = SendMessageA(hwEdit, EM_GETLIMITTEXT, 0, 0);
1373  ok( r == 2147483646, "got limit %u (expected 2147483646)\n", r);
1374  DestroyWindow(hwEdit);
1375 
1376  /* Test default limit for multi-line control */
1377  trace("EDIT: buffer limit for multi-line\n");
1379  r = SendMessageA(hwEdit, EM_GETLIMITTEXT, 0, 0);
1380  ok(r == 30000, "Incorrect default text limit, expected 30000 got %u\n", r);
1381  SendMessageA(hwEdit, EM_SETLIMITTEXT, 0, 0);
1382  r = SendMessageA(hwEdit, EM_GETLIMITTEXT, 0, 0);
1383  ok( r == 4294967295U, "got limit %u (expected 4294967295)\n", r);
1384  DestroyWindow(hwEdit);
1385 }
static HWND create_editcontrol(DWORD style, DWORD exstyle)
Definition: edit.c:543
LRESULT WINAPI SendMessageA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
#define EM_SETLIMITTEXT
Definition: winuser.h:1993
#define U(x)
Definition: wordpad.c:44
#define ES_MULTILINE
Definition: pedump.c:667
BOOL WINAPI DestroyWindow(_In_ HWND)
#define ES_AUTOVSCROLL
Definition: pedump.c:671
#define trace
Definition: atltest.h:70
#define EM_GETLIMITTEXT
Definition: richedit.h:74
unsigned long DWORD
Definition: ntddk_ex.h:95
#define ok(value,...)
Definition: atltest.h:57
#define WS_VSCROLL
Definition: pedump.c:627
#define ES_AUTOHSCROLL
Definition: pedump.c:672

Referenced by START_TEST().

◆ test_edit_control_scroll()

static void test_edit_control_scroll ( void  )
static

Definition at line 1388 of file edit.c.

1389 {
1390  static const char *single_line_str = "a";
1391  static const char *multiline_str = "Test\r\nText";
1392  HWND hwEdit;
1393  LONG ret;
1394 
1395  /* Check the return value when EM_SCROLL doesn't scroll
1396  * anything. Should not return true unless any lines were actually
1397  * scrolled. */
1398  hwEdit = CreateWindowA(
1399  "EDIT",
1400  single_line_str,
1402  1, 1, 100, 100,
1403  NULL, NULL, hinst, NULL);
1404 
1405  assert(hwEdit);
1406 
1407  ret = SendMessageA(hwEdit, EM_SCROLL, SB_PAGEDOWN, 0);
1408  ok(!ret, "Returned %x, expected 0.\n", ret);
1409 
1410  ret = SendMessageA(hwEdit, EM_SCROLL, SB_PAGEUP, 0);
1411  ok(!ret, "Returned %x, expected 0.\n", ret);
1412 
1413  ret = SendMessageA(hwEdit, EM_SCROLL, SB_LINEUP, 0);
1414  ok(!ret, "Returned %x, expected 0.\n", ret);
1415 
1416  ret = SendMessageA(hwEdit, EM_SCROLL, SB_LINEDOWN, 0);
1417  ok(!ret, "Returned %x, expected 0.\n", ret);
1418 
1419  DestroyWindow (hwEdit);
1420 
1421  /* SB_PAGEDOWN while at the beginning of a buffer with few lines
1422  should not cause EM_SCROLL to return a negative value of
1423  scrolled lines that would put us "before" the beginning. */
1424  hwEdit = CreateWindowA(
1425  "EDIT",
1426  multiline_str,
1428  0, 0, 100, 100,
1429  NULL, NULL, hinst, NULL);
1430  assert(hwEdit);
1431 
1432  ret = SendMessageA(hwEdit, EM_SCROLL, SB_PAGEDOWN, 0);
1433  ok(!ret, "Returned %x, expected 0.\n", ret);
1434 
1435  DestroyWindow (hwEdit);
1436 }
#define SB_PAGEDOWN
Definition: winuser.h:569
#define SB_PAGEUP
Definition: winuser.h:568
LRESULT WINAPI SendMessageA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define ES_MULTILINE
Definition: pedump.c:667
#define assert(x)
Definition: debug.h:53
BOOL WINAPI DestroyWindow(_In_ HWND)
long LONG
Definition: pedump.c:60
#define CreateWindowA(a, b, c, d, e, f, g, h, i, j, k)
Definition: winuser.h:4216
smooth NULL
Definition: ftsmooth.c:416
#define EM_SCROLL
Definition: winuser.h:1989
static HINSTANCE hinst
Definition: edit.c:536
int ret
#define ok(value,...)
Definition: atltest.h:57
#define SB_LINEDOWN
Definition: winuser.h:565
#define SB_LINEUP
Definition: winuser.h:564
#define WS_VSCROLL
Definition: pedump.c:627

Referenced by START_TEST().

◆ test_edit_dialog()

static void test_edit_dialog ( void  )
static

Definition at line 2093 of file edit.c.

2094 {
2095  int r;
2096 
2097  /* from bug 11841 */
2098  r = DialogBoxParamA(hinst, "EDIT_READONLY_DIALOG", NULL, edit_dialog_proc, 0);
2099  ok(333 == r, "Expected %d, got %d\n", 333, r);
2100  r = DialogBoxParamA(hinst, "EDIT_READONLY_DIALOG", NULL, edit_dialog_proc, 1);
2101  ok(111 == r, "Expected %d, got %d\n", 111, r);
2102  r = DialogBoxParamA(hinst, "EDIT_READONLY_DIALOG", NULL, edit_dialog_proc, 2);
2103  ok(444 == r, "Expected %d, got %d\n", 444, r);
2104 
2105  /* more tests for WM_CHAR */
2106  r = DialogBoxParamA(hinst, "EDIT_READONLY_DIALOG", NULL, edit_dialog_proc, 3);
2107  ok(444 == r, "Expected %d, got %d\n", 444, r);
2108  r = DialogBoxParamA(hinst, "EDIT_READONLY_DIALOG", NULL, edit_dialog_proc, 4);
2109  ok(444 == r, "Expected %d, got %d\n", 444, r);
2110  r = DialogBoxParamA(hinst, "EDIT_READONLY_DIALOG", NULL, edit_dialog_proc, 5);
2111  ok(444 == r, "Expected %d, got %d\n", 444, r);
2112 
2113  /* more tests for WM_KEYDOWN + WM_CHAR */
2114  r = DialogBoxParamA(hinst, "EDIT_READONLY_DIALOG", NULL, edit_dialog_proc, 6);
2115  ok(444 == r, "Expected %d, got %d\n", 444, r);
2116  r = DialogBoxParamA(hinst, "EDIT_READONLY_DIALOG", NULL, edit_dialog_proc, 7);
2117  ok(444 == r, "Expected %d, got %d\n", 444, r);
2118  r = DialogBoxParamA(hinst, "EDIT_READONLY_DIALOG", NULL, edit_dialog_proc, 8);
2119  ok(444 == r, "Expected %d, got %d\n", 444, r);
2120 
2121  /* tests with an editable edit control */
2122  r = DialogBoxParamA(hinst, "EDIT_DIALOG", NULL, edit_dialog_proc, 0);
2123  ok(333 == r, "Expected %d, got %d\n", 333, r);
2124  r = DialogBoxParamA(hinst, "EDIT_DIALOG", NULL, edit_dialog_proc, 1);
2125  ok(111 == r, "Expected %d, got %d\n", 111, r);
2126  r = DialogBoxParamA(hinst, "EDIT_DIALOG", NULL, edit_dialog_proc, 2);
2127  ok(444 == r, "Expected %d, got %d\n", 444, r);
2128 
2129  /* tests for WM_CHAR */
2130  r = DialogBoxParamA(hinst, "EDIT_DIALOG", NULL, edit_dialog_proc, 3);
2131  ok(444 == r, "Expected %d, got %d\n", 444, r);
2132  r = DialogBoxParamA(hinst, "EDIT_DIALOG", NULL, edit_dialog_proc, 4);
2133  ok(444 == r, "Expected %d, got %d\n", 444, r);
2134  r = DialogBoxParamA(hinst, "EDIT_DIALOG", NULL, edit_dialog_proc, 5);
2135  ok(444 == r, "Expected %d, got %d\n", 444, r);
2136 
2137  /* tests for WM_KEYDOWN + WM_CHAR */
2138  r = DialogBoxParamA(hinst, "EDIT_DIALOG", NULL, edit_dialog_proc, 6);
2139  ok(444 == r, "Expected %d, got %d\n", 444, r);
2140  r = DialogBoxParamA(hinst, "EDIT_DIALOG", NULL, edit_dialog_proc, 7);
2141  ok(444 == r, "Expected %d, got %d\n", 444, r);
2142  r = DialogBoxParamA(hinst, "EDIT_DIALOG", NULL, edit_dialog_proc, 8);
2143  ok(444 == r, "Expected %d, got %d\n", 444, r);
2144 
2145  /* multiple tab tests */
2146  r = DialogBoxParamA(hinst, "EDIT_DIALOG", NULL, edit_dialog_proc, 9);
2147  ok(22 == r, "Expected %d, got %d\n", 22, r);
2148  r = DialogBoxParamA(hinst, "EDIT_DIALOG", NULL, edit_dialog_proc, 10);
2149  ok(33 == r, "Expected %d, got %d\n", 33, r);
2150 }
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
static INT_PTR CALLBACK edit_dialog_proc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM lparam)
Definition: edit.c:140
smooth NULL
Definition: ftsmooth.c:416
static HINSTANCE hinst
Definition: edit.c:536
#define ok(value,...)
Definition: atltest.h:57
INT_PTR WINAPI DialogBoxParamA(_In_opt_ HINSTANCE, _In_ LPCSTR, _In_opt_ HWND, _In_opt_ DLGPROC, _In_ LPARAM)

Referenced by START_TEST().

◆ test_EM_GETHANDLE()

static void test_EM_GETHANDLE ( void  )
static

Definition at line 2730 of file edit.c.

2731 {
2732  static const char str0[] = "untouched";
2733  static const char str1[] = "1111+1111+1111#";
2734  static const char str1_1[] = "2111+1111+1111#";
2735  static const char str2[] = "2222-2222-2222-2222#";
2736  static const char str3[] = "3333*3333*3333*3333*3333#";
2737  CHAR current[42];
2738  HWND hEdit;
2739  HLOCAL hmem;
2740  HLOCAL hmem2;
2741  HLOCAL halloc;
2742  char *buffer;
2743  int len;
2744  int r;
2745 
2746  trace("EDIT: EM_GETHANDLE\n");
2747 
2748  /* EM_GETHANDLE is not supported for a single line edit control */
2750  ok(hEdit != NULL, "got %p (expected != NULL)\n", hEdit);
2751 
2752  hmem = (HGLOBAL) SendMessageA(hEdit, EM_GETHANDLE, 0, 0);
2753  ok(hmem == NULL, "got %p (expected NULL)\n", hmem);
2755 
2756 
2757  /* EM_GETHANDLE needs a multiline edit control */
2759  ok(hEdit != NULL, "got %p (expected != NULL)\n", hEdit);
2760 
2761  /* set some text */
2762  r = SendMessageA(hEdit, WM_SETTEXT, 0, (LPARAM)str1);
2764  ok((r == 1) && (len == lstrlenA(str1)), "got %d and %d (expected 1 and %d)\n", r, len, lstrlenA(str1));
2765 
2766  lstrcpyA(current, str0);
2768  ok((r == lstrlenA(str1)) && !lstrcmpA(current, str1),
2769  "got %d and \"%s\" (expected %d and \"%s\")\n", r, current, lstrlenA(str1), str1);
2770 
2771  hmem = (HGLOBAL) SendMessageA(hEdit, EM_GETHANDLE, 0, 0);
2772  ok(hmem != NULL, "got %p (expected != NULL)\n", hmem);
2773  /* The buffer belongs to the app now. According to MSDN, the app has to LocalFree the
2774  buffer, LocalAlloc a new buffer and pass it to the edit control with EM_SETHANDLE. */
2775 
2776  buffer = LocalLock(hmem);
2777  ok(buffer != NULL, "got %p (expected != NULL)\n", buffer);
2778  len = lstrlenA(buffer);
2779  ok((len == lstrlenA(str1)) && !lstrcmpA(buffer, str1),
2780  "got %d and \"%s\" (expected %d and \"%s\")\n", len, buffer, lstrlenA(str1), str1);
2781  LocalUnlock(hmem);
2782 
2783  /* See if WM_GETTEXTLENGTH/WM_GETTEXT still work. */
2785  ok(len == lstrlenA(str1), "Unexpected text length %d.\n", len);
2786 
2787  lstrcpyA(current, str0);
2789  ok((r == lstrlenA(str1)) && !lstrcmpA(current, str1),
2790  "Unexpected retval %d and text \"%s\" (expected %d and \"%s\")\n", r, current, lstrlenA(str1), str1);
2791 
2792  /* Application altered buffer contents, see if WM_GETTEXTLENGTH/WM_GETTEXT pick that up. */
2793  buffer = LocalLock(hmem);
2794  ok(buffer != NULL, "got %p (expected != NULL)\n", buffer);
2795  buffer[0] = '2';
2796  LocalUnlock(hmem);
2797 
2799  ok(len == lstrlenA(str1_1), "Unexpected text length %d.\n", len);
2800 
2801  lstrcpyA(current, str0);
2803  ok((r == lstrlenA(str1_1)) && !lstrcmpA(current, str1_1),
2804  "Unexpected retval %d and text \"%s\" (expected %d and \"%s\")\n", r, current, lstrlenA(str1_1), str1_1);
2805 
2806  /* See if WM_SETTEXT/EM_REPLACESEL work. */
2807  r = SendMessageA(hEdit, WM_SETTEXT, 0, (LPARAM)str1);
2808  ok(r, "Failed to set text.\n");
2809 
2810  buffer = LocalLock(hmem);
2811  ok(buffer != NULL && buffer[0] == '1', "Unexpected buffer contents\n");
2812  LocalUnlock(hmem);
2813 
2814  r = SendMessageA(hEdit, EM_REPLACESEL, 0, (LPARAM)str1_1);
2815  ok(r, "Failed to replace selection.\n");
2816 
2817  buffer = LocalLock(hmem);
2818  ok(buffer != NULL && buffer[0] == '2', "Unexpected buffer contents\n");
2819  LocalUnlock(hmem);
2820 
2821  /* use LocalAlloc first to get a different handle */
2822  halloc = LocalAlloc(LMEM_MOVEABLE, 42);
2823  ok(halloc != NULL, "got %p (expected != NULL)\n", halloc);
2824  /* prepare our new memory */
2825  buffer = LocalLock(halloc);
2826  ok(buffer != NULL, "got %p (expected != NULL)\n", buffer);
2827  lstrcpyA(buffer, str2);
2828  LocalUnlock(halloc);
2829 
2830  /* LocalFree the old memory handle before EM_SETHANDLE the new handle */
2831  LocalFree(hmem);
2832  /* use LocalAlloc after the LocalFree to likely consume the handle */
2833  hmem2 = LocalAlloc(LMEM_MOVEABLE, 42);
2834  ok(hmem2 != NULL, "got %p (expected != NULL)\n", hmem2);
2835 
2836  SendMessageA(hEdit, EM_SETHANDLE, (WPARAM)halloc, 0);
2837 
2839  ok(len == lstrlenA(str2), "got %d (expected %d)\n", len, lstrlenA(str2));
2840 
2841  lstrcpyA(current, str0);
2843  ok((r == lstrlenA(str2)) && !lstrcmpA(current, str2),
2844  "got %d and \"%s\" (expected %d and \"%s\")\n", r, current, lstrlenA(str2), str2);
2845 
2846  /* set a different text */
2847  r = SendMessageA(hEdit, WM_SETTEXT, 0, (LPARAM)str3);
2849  ok((r == 1) && (len == lstrlenA(str3)), "got %d and %d (expected 1 and %d)\n", r, len, lstrlenA(str3));
2850 
2851  lstrcpyA(current, str0);
2853  ok((r == lstrlenA(str3)) && !lstrcmpA(current, str3),
2854  "got %d and \"%s\" (expected %d and \"%s\")\n", r, current, lstrlenA(str3), str3);
2855 
2856  LocalFree(hmem2);
2858 
2859  /* Some apps have bugs ... */
2861 
2862  /* set some text */
2863  r = SendMessageA(hEdit, WM_SETTEXT, 0, (LPARAM)str1);
2865  ok((r == 1) && (len == lstrlenA(str1)), "got %d and %d (expected 1 and %d)\n", r, len, lstrlenA(str1));
2866 
2867  /* everything is normal up to EM_GETHANDLE */
2868  hmem = (HGLOBAL) SendMessageA(hEdit, EM_GETHANDLE, 0, 0);
2869  /* Some messages still work while other messages fail.
2870  After LocalFree the memory handle, messages can crash the app */
2871 
2872  /* A buggy editor used EM_GETHANDLE twice */
2873  hmem2 = (HGLOBAL) SendMessageA(hEdit, EM_GETHANDLE, 0, 0);
2874  ok(hmem2 == hmem, "got %p (expected %p)\n", hmem2, hmem);
2875 
2876  /* Let the edit control free the memory handle */
2877  SendMessageA(hEdit, EM_SETHANDLE, (WPARAM)hmem2, 0);
2878 
2880 }
static HWND create_editcontrol(DWORD style, DWORD exstyle)
Definition: edit.c:543
HANDLE HGLOBAL
Definition: windef.h:243
#define WM_GETTEXTLENGTH
Definition: winuser.h:1601
BOOL NTAPI LocalUnlock(HLOCAL hMem)
Definition: heapmem.c:1788
LRESULT WINAPI SendMessageA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
char CHAR
Definition: xmlstorage.h:175
#define WM_GETTEXT
Definition: winuser.h:1600
#define ES_MULTILINE
Definition: pedump.c:667
int WINAPI lstrcmpA(LPCSTR lpString1, LPCSTR lpString2)
Definition: lstring.c:18
GLuint buffer
Definition: glext.h:5915
UINT_PTR WPARAM
Definition: windef.h:207
BOOL WINAPI DestroyWindow(_In_ HWND)
#define EM_SETHANDLE
Definition: winuser.h:1991
smooth NULL
Definition: ftsmooth.c:416
LONG_PTR LPARAM
Definition: windef.h:208
#define WM_SETTEXT
Definition: winuser.h:1599
#define trace
Definition: atltest.h:70
#define LMEM_MOVEABLE
Definition: winbase.h:350
LPSTR WINAPI lstrcpyA(LPSTR lpString1, LPCSTR lpString2)
Definition: lstring.c:100
#define EM_GETHANDLE
Definition: winuser.h:1971
GLenum GLsizei len
Definition: glext.h:6722
static HWND hEdit
Definition: autocomplete.c:34
#define WS_BORDER
Definition: pedump.c:625
int WINAPI lstrlenA(LPCSTR lpString)
Definition: lstring.c:145
HLOCAL NTAPI LocalFree(HLOCAL hMem)
Definition: heapmem.c:1577
LPVOID NTAPI LocalLock(HLOCAL hMem)
Definition: heapmem.c:1599
#define ok(value,...)
Definition: atltest.h:57
HLOCAL NTAPI LocalAlloc(UINT uFlags, SIZE_T dwBytes)
Definition: heapmem.c:1373
#define EM_REPLACESEL
Definition: winuser.h:1988
struct task_struct * current
Definition: linux.c:32

Referenced by START_TEST().

◆ test_EM_GETLINE()

static void test_EM_GETLINE ( void  )
static

Definition at line 2951 of file edit.c.

2952 {
2953  HWND hwnd[2];
2954  int i;
2955 
2958 
2959  for (i = 0; i < sizeof(hwnd)/sizeof(hwnd[0]); i++)
2960  {
2961  static const WCHAR strW[] = {'t','e','x','t',0};
2962  static const char *str = "text";
2963  WCHAR buffW[16];
2964  char buff[16];
2965  int r;
2966 
2967  if (i == 0)
2968  ok(!IsWindowUnicode(hwnd[i]), "Expected ansi window.\n");
2969  else
2970  ok(IsWindowUnicode(hwnd[i]), "Expected unicode window.\n");
2971 
2973 
2974  memset(buff, 0, sizeof(buff));
2975  *(WORD *)buff = sizeof(buff);
2977  ok(r == strlen(str), "Failed to get a line %d.\n", r);
2978  ok(!strcmp(buff, str), "Unexpected line data %s.\n", buff);
2979 
2980  memset(buff, 0, sizeof(buff));
2981  *(WORD *)buff = sizeof(buff);
2983  ok(r == strlen(str), "Failed to get a line %d.\n", r);
2984  ok(!strcmp(buff, str), "Unexpected line data %s.\n", buff);
2985 
2986  memset(buffW, 0, sizeof(buffW));
2987  *(WORD *)buffW = sizeof(buffW)/sizeof(buffW[0]);
2988  r = SendMessageW(hwnd[i], EM_GETLINE, 0, (LPARAM)buffW);
2989  ok(r == lstrlenW(strW), "Failed to get a line %d.\n", r);
2990  ok(!lstrcmpW(buffW, strW), "Unexpected line data %s.\n", wine_dbgstr_w(buffW));
2991 
2992  memset(buffW, 0, sizeof(buffW));
2993  *(WORD *)buffW = sizeof(buffW)/sizeof(buffW[0]);
2994  r = SendMessageW(hwnd[i], EM_GETLINE, 1, (LPARAM)buffW);
2995  ok(r == lstrlenW(strW), "Failed to get a line %d.\n", r);
2996  ok(!lstrcmpW(buffW, strW), "Unexpected line data %s.\n", wine_dbgstr_w(buffW));
2997 
2998  DestroyWindow(hwnd[i]);
2999  }
3000 }
static HWND create_editcontrol(DWORD style, DWORD exstyle)
Definition: edit.c:543
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
LRESULT WINAPI SendMessageA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
char * wine_dbgstr_w(const wchar_t *wstr)
Definition: atltest.h:87
int WINAPI lstrcmpW(LPCWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:170
#define lstrlenW
Definition: compat.h:407
static HWND create_editcontrolW(DWORD style, DWORD exstyle)
Definition: edit.c:560
BOOL WINAPI DestroyWindow(_In_ HWND)
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
WCHAR strW[12]
Definition: clipboard.c:2029
const WCHAR * str
LONG_PTR LPARAM
Definition: windef.h:208
BOOL WINAPI IsWindowUnicode(_In_ HWND)
#define WM_SETTEXT
Definition: winuser.h:1599
#define ES_AUTOVSCROLL
Definition: pedump.c:671
__wchar_t WCHAR
Definition: xmlstorage.h:180
unsigned short WORD
Definition: ntddk_ex.h:93
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define ok(value,...)
Definition: atltest.h:57
#define EM_GETLINE
Definition: winuser.h:1973
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469
#define memset(x, y, z)
Definition: compat.h:39
#define ES_AUTOHSCROLL
Definition: pedump.c:672
static unsigned char buff[32768]
Definition: fatten.c:17

Referenced by START_TEST().

◆ test_enter()

static void test_enter ( void  )
static

Definition at line 1979 of file edit.c.

1980 {
1981  HWND hwEdit;
1982  LONG r;
1983  char buffer[16];
1984 
1985  /* multiline */
1986  hwEdit = create_editcontrol(ES_MULTILINE, 0);
1987  r = get_edit_style(hwEdit);
1988  ok(ES_MULTILINE == r, "Wrong style expected ES_MULTILINE got: 0x%x\n", r);
1989 
1990  /* set text */
1991  r = SendMessageA(hwEdit , WM_SETTEXT, 0, (LPARAM) "");
1992  ok(TRUE == r, "Expected: %d, got: %d\n", TRUE, r);
1993 
1994  r = SendMessageA(hwEdit, WM_CHAR, VK_RETURN, 0);
1995  ok(1 == r, "Expected: %d, got: %d\n", 1, r);
1996 
1997  /* get text */
1998  buffer[0] = 0;
1999  r = SendMessageA(hwEdit, WM_GETTEXT, 16, (LPARAM) buffer);
2000  ok(2 == r, "Expected: %d, got len %d\n", 2, r);
2001  ok(0 == strcmp(buffer, "\r\n"), "expected \"\\r\\n\", got \"%s\"\n", buffer);
2002 
2003  DestroyWindow (hwEdit);
2004 
2005  /* single line */
2006  hwEdit = create_editcontrol(0, 0);
2007  r = get_edit_style(hwEdit);
2008  ok(0 == r, "Wrong style expected 0x%x got: 0x%x\n", 0, r);
2009 
2010  /* set text */
2011  r = SendMessageA(hwEdit , WM_SETTEXT, 0, (LPARAM) "");
2012  ok(TRUE == r, "Expected: %d, got: %d\n", TRUE, r);
2013 
2014  r = SendMessageA(hwEdit, WM_CHAR, VK_RETURN, 0);
2015  ok(1 == r, "Expected: %d, got: %d\n", 1, r);
2016 
2017  /* get text */
2018  buffer[0] = 0;
2019  r = SendMessageA(hwEdit, WM_GETTEXT, 16, (LPARAM) buffer);
2020  ok(0 == r, "Expected: %d, got len %d\n", 0, r);
2021  ok(0 == strcmp(buffer, ""), "expected \"\", got \"%s\"\n", buffer);
2022 
2023  DestroyWindow (hwEdit);
2024 
2025  /* single line with ES_WANTRETURN */
2026  hwEdit = create_editcontrol(ES_WANTRETURN, 0);
2027  r = get_edit_style(hwEdit);
2028  ok(ES_WANTRETURN == r, "Wrong style expected ES_WANTRETURN got: 0x%x\n", r);
2029 
2030  /* set text */
2031  r = SendMessageA(hwEdit , WM_SETTEXT, 0, (LPARAM) "");
2032  ok(TRUE == r, "Expected: %d, got: %d\n", TRUE, r);
2033 
2034  r = SendMessageA(hwEdit, WM_CHAR, VK_RETURN, 0);
2035  ok(1 == r, "Expected: %d, got: %d\n", 1, r);
2036 
2037  /* get text */
2038  buffer[0] = 0;
2039  r = SendMessageA(hwEdit, WM_GETTEXT, 16, (LPARAM) buffer);
2040  ok(0 == r, "Expected: %d, got len %d\n", 0, r);
2041  ok(0 == strcmp(buffer, ""), "expected \"\", got \"%s\"\n", buffer);
2042 
2043  DestroyWindow (hwEdit);
2044 }
static HWND create_editcontrol(DWORD style, DWORD exstyle)
Definition: edit.c:543
#define TRUE
Definition: types.h:120
#define WM_CHAR
Definition: winuser.h:1699
LRESULT WINAPI SendMessageA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
#define WM_GETTEXT
Definition: winuser.h:1600
#define ES_MULTILINE
Definition: pedump.c:667
GLuint buffer
Definition: glext.h:5915
BOOL WINAPI DestroyWindow(_In_ HWND)
#define VK_RETURN
Definition: winuser.h:2176
long LONG
Definition: pedump.c:60
#define ES_WANTRETURN
Definition: pedump.c:676
LONG_PTR LPARAM
Definition: windef.h:208
static LONG get_edit_style(HWND hwnd)
Definition: edit.c:615
#define WM_SETTEXT
Definition: winuser.h:1599
#define ok(value,...)
Definition: atltest.h:57
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469

Referenced by START_TEST().

◆ test_espassword()

static void test_espassword ( void  )
static

Definition at line 1875 of file edit.c.

1876 {
1877  HWND hwEdit;
1878  LONG r;
1879  char buffer[1024];
1880  const char* password = "secret";
1881 
1882  hwEdit = create_editcontrol(ES_PASSWORD, 0);
1883  r = get_edit_style(hwEdit);
1884  ok(r == ES_PASSWORD, "Wrong style expected ES_PASSWORD got: 0x%x\n", r);
1885  /* set text */
1886  r = SendMessageA(hwEdit , WM_SETTEXT, 0, (LPARAM) password);
1887  ok(r == TRUE, "Expected: %d, got: %d\n", TRUE, r);
1888 
1889  /* select all, cut (ctrl-x) */
1890  SendMessageA(hwEdit, EM_SETSEL, 0, -1);
1891  r = SendMessageA(hwEdit, WM_CHAR, 24, 0);
1892  ok(1 == r, "Expected: %d, got: %d\n", 1, r);
1893 
1894  /* get text */
1895  r = SendMessageA(hwEdit, WM_GETTEXT, 1024, (LPARAM) buffer);
1896  ok(r == strlen(password), "Expected: %s, got len %d\n", password, r);
1897  ok(strcmp(buffer, password) == 0, "expected %s, got %s\n", password, buffer);
1898 
1899  r = OpenClipboard(hwEdit);
1900  ok(r == TRUE, "expected %d, got %d\n", TRUE, r);
1901  r = EmptyClipboard();
1902  ok(r == TRUE, "expected %d, got %d\n", TRUE, r);
1903  r = CloseClipboard();
1904  ok(r == TRUE, "expected %d, got %d\n", TRUE, r);
1905 
1906  /* select all, copy (ctrl-c) and paste (ctrl-v) */
1907  SendMessageA(hwEdit, EM_SETSEL, 0, -1);
1908  r = SendMessageA(hwEdit, WM_CHAR, 3, 0);
1909  ok(1 == r, "Expected: %d, got: %d\n", 1, r);
1910  r = SendMessageA(hwEdit, WM_CHAR, 22, 0);
1911  ok(1 == r, "Expected: %d, got: %d\n", 1, r);
1912 
1913  /* get text */
1914  buffer[0] = 0;
1915  r = SendMessageA(hwEdit, WM_GETTEXT, 1024, (LPARAM) buffer);
1916  ok(r == 0, "Expected: 0, got: %d\n", r);
1917  ok(strcmp(buffer, "") == 0, "expected empty string, got %s\n", buffer);
1918 
1919  DestroyWindow (hwEdit);
1920 }
static HWND create_editcontrol(DWORD style, DWORD exstyle)
Definition: edit.c:543
#define TRUE
Definition: types.h:120
#define WM_CHAR
Definition: winuser.h:1699
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
LRESULT WINAPI SendMessageA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
#define WM_GETTEXT
Definition: winuser.h:1600
GLuint buffer
Definition: glext.h:5915
BOOL WINAPI DestroyWindow(_In_ HWND)
#define ES_PASSWORD
Definition: pedump.c:670
long LONG
Definition: pedump.c:60
LONG_PTR LPARAM
Definition: windef.h:208
static LONG get_edit_style(HWND hwnd)
Definition: edit.c:615
#define WM_SETTEXT
Definition: winuser.h:1599
BOOL WINAPI EmptyClipboard(void)
Definition: ntwrapper.h:190
#define EM_SETSEL
Definition: winuser.h:2000
BOOL WINAPI CloseClipboard(void)
Definition: ntwrapper.h:178
T1_FIELD_DICT_PRIVATE password
Definition: t1tokens.h:64
#define ok(value,...)
Definition: atltest.h:57
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469
BOOL WINAPI OpenClipboard(_In_opt_ HWND)

Referenced by START_TEST().

◆ test_fontsize()

static void test_fontsize ( void  )
static

Definition at line 2498 of file edit.c.

2499 {
2500  HWND hwEdit;
2501  HFONT hfont;
2502  HDC hDC;
2503  LOGFONTA lf;
2504  LONG r;
2505  char szLocalString[MAXLEN];
2506  int dpi;
2507 
2508  hDC = GetDC(NULL);
2510  ReleaseDC(NULL, hDC);
2511 
2512  memset(&lf,0,sizeof(LOGFONTA));
2513  strcpy(lf.lfFaceName,"Arial");
2514  lf.lfHeight = -300; /* taller than the edit box */
2515  lf.lfWeight = 500;
2516  hfont = CreateFontIndirectA(&lf);
2517 
2518  trace("EDIT: Oversized font (Multi line)\n");
2519  hwEdit= CreateWindowA("EDIT", NULL, ES_MULTILINE|ES_AUTOHSCROLL,
2520  0, 0, (150 * dpi) / 96, (50 * dpi) / 96, NULL, NULL,
2521  hinst, NULL);
2522 
2523  SendMessageA(hwEdit,WM_SETFONT,(WPARAM)hfont,0);
2524 
2526  ShowWindow (hwEdit, SW_SHOW);
2527 
2528  r = SendMessageA(hwEdit, WM_CHAR, 'A', 1);
2529  ok(1 == r, "Expected: %d, got: %d\n", 1, r);
2530  r = SendMessageA(hwEdit, WM_CHAR, 'B', 1);
2531  ok(1 == r, "Expected: %d, got: %d\n", 1, r);
2532  r = SendMessageA(hwEdit, WM_CHAR, 'C', 1);
2533  ok(1 == r, "Expected: %d, got: %d\n", 1, r);
2534 
2535  GetWindowTextA(hwEdit, szLocalString, MAXLEN);
2536  ok(strcmp(szLocalString, "ABC")==0,
2537  "Wrong contents of edit: %s\n", szLocalString);
2538 
2539  r = SendMessageA(hwEdit, EM_POSFROMCHAR,0,0);
2540  ok(r != -1,"EM_POSFROMCHAR failed index 0\n");
2541  r = SendMessageA(hwEdit, EM_POSFROMCHAR,1,0);
2542