ReactOS  0.4.14-dev-614-gbfd8a84
edit.c File Reference
#include <windows.h>
#include <commctrl.h>
#include "wine/test.h"
#include "v6util.h"
#include "msg.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)
 

Enumerations

enum  seq_index {
  COMBINED_SEQ_INDEX = 0, NUM_MSG_SEQUENCES, LB_SEQ_INDEX, PARENT_SEQ_INDEX,
  NUM_MSG_SEQUENCES, PARENT_SEQ_INDEX, PARENT_FULL_SEQ_INDEX, PARENT_CD_SEQ_INDEX,
  LISTVIEW_SEQ_INDEX, EDITBOX_SEQ_INDEX, COMBINED_SEQ_INDEX, NUM_MSG_SEQUENCES,
  PARENT_SEQ_INDEX = 0, NUM_MSG_SEQUENCES
}
 
enum  msg_id { PARENT_ID, EDIT_ID }
 

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 LRESULT CALLBACK parent_wnd_proc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
 
static LRESULT CALLBACK edit_subclass_proc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
 
static void test_edit_control_3 (void)
 
static void test_char_from_pos (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 BOOL is_cjk (HDC dc)
 
static void test_margins_usefontinfo (UINT charset)
 
static INT get_cjk_fontinfo_margin (INT width, INT side_bearing)
 
static DWORD get_cjk_font_margins (HDC hdc)
 
static void test_margins_default (const char *facename, UINT charset)
 
static INT CALLBACK find_font_proc (const LOGFONTA *elf, const TEXTMETRICA *ntm, DWORD type, LPARAM lParam)
 
static BOOL is_font_installed (const char *name)
 
static void test_margins (void)
 
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 child_edit_menu_proc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
 
static void test_contextmenu (void)
 
static BOOL register_classes (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)
 
static void test_cue_banner (void)
 
static void test_change_focus (void)
 
 START_TEST (edit)
 

Variables

static struct msg_sequencesequences [NUM_MSG_SEQUENCES]
 
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
 
static const struct message setfocus_combined_seq []
 
static const struct message killfocus_combined_seq []
 

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 1949 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 1946 of file edit.c.

◆ ES_COMBO

#define ES_COMBO   0x200

Definition at line 29 of file edit.c.

◆ ID_EDITTEST2

#define ID_EDITTEST2   99

Definition at line 33 of file edit.c.

◆ ID_EDITTESTDBUTTON

#define ID_EDITTESTDBUTTON   0x123

Definition at line 32 of file edit.c.

◆ MAXLEN

#define MAXLEN   200

Definition at line 34 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)
#define ok(value,...)
Definition: atltest.h:57
static struct dialog_mode_messages dm_messages
Definition: edit.c:2741

Definition at line 2751 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:54

Definition at line 851 of file edit.c.

Enumeration Type Documentation

◆ msg_id

Enumerator
PARENT_ID 
EDIT_ID 

Definition at line 42 of file edit.c.

43 {
44  PARENT_ID,
45  EDIT_ID,
46 };
Definition: edit.c:44
Definition: edit.c:45

◆ seq_index

Enumerator
COMBINED_SEQ_INDEX 
NUM_MSG_SEQUENCES 
LB_SEQ_INDEX 
PARENT_SEQ_INDEX 
NUM_MSG_SEQUENCES 
PARENT_SEQ_INDEX 
PARENT_FULL_SEQ_INDEX 
PARENT_CD_SEQ_INDEX 
LISTVIEW_SEQ_INDEX 
EDITBOX_SEQ_INDEX 
COMBINED_SEQ_INDEX 
NUM_MSG_SEQUENCES 
PARENT_SEQ_INDEX 
NUM_MSG_SEQUENCES 

Definition at line 36 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 2528 of file edit.c.

2529 {
2530  switch (msg)
2531  {
2532  case WM_ENTERIDLE:
2533  if (wParam == MSGF_MENU)
2534  {
2535  HWND hwndMenu = (HWND)lParam;
2536  MENUBARINFO mbi = { sizeof(mbi) };
2537  if (GetMenuBarInfo(hwndMenu, OBJID_CLIENT, 0, &mbi))
2538  {
2539  MENUITEMINFOA mii = { sizeof(MENUITEMINFOA), MIIM_STATE };
2540  if (GetMenuItemInfoA(mbi.hMenu, EM_SETSEL, FALSE, &mii))
2541  {
2542  if (mii.fState & MFS_HILITE)
2543  {
2544  PostMessageA(hwnd, WM_KEYDOWN, VK_RETURN, 0x1c0001);
2545  PostMessageA(hwnd, WM_KEYUP, VK_RETURN, 0x1c0001);
2546  }
2547  else
2548  {
2549  PostMessageA(hwnd, WM_KEYDOWN, VK_DOWN, 0x500001);
2550  PostMessageA(hwnd, WM_KEYUP, VK_DOWN, 0x500001);
2551  }
2552  }
2553  }
2554  }
2555  break;
2556  case WM_COMMAND:
2557  menu_messages.wm_command++;
2558  break;
2559  case EM_SETSEL:
2560  menu_messages.em_setsel++;
2561  break;
2562  }
2563  return CallWindowProcA(p_edit_proc, hwnd, msg, wParam, lParam);
2564 }
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
#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
#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
static struct context_menu_messages menu_messages
Definition: edit.c:2526
#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 2465 of file edit.c.

2466 {
2467  switch (msg)
2468  {
2469  case WM_DESTROY:
2470  case WM_NCDESTROY:
2471  break;
2472 
2473  default:
2475  break;
2476  }
2477 
2478  return FALSE;
2479 }
static int child_edit_wmkeydown_num_messages
Definition: edit.c:2464
#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 582 of file edit.c.

583 {
584  HWND parentWnd;
585  HWND editWnd;
586  RECT rect;
587  BOOL b;
588  SetRect(&rect, 0, 0, 300, 300);
590  ok(b, "AdjustWindowRect failed\n");
591 
592  parentWnd = CreateWindowExA(0,
594  "Edit Test",
597  rect.right - rect.left, rect.bottom - rect.top,
598  NULL, NULL, hinst, NULL);
599  ok (parentWnd != NULL, "CreateWindow EDIT Test failed\n");
600 
601  editWnd = CreateWindowExA(exstyle,
602  "EDIT",
603  "Test Text",
604  WS_CHILD | style,
605  0, 0, 300, 300,
606  parentWnd, NULL, hinst, NULL);
607  ok (editWnd != NULL, "CreateWindow EDIT Test Text failed\n");
609  ShowWindow (parentWnd, SW_SHOW);
610  return editWnd;
611 }
static const char szEditTextPositionClass[]
Definition: edit.c:556
#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
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
static HINSTANCE hinst
Definition: edit.c:551
Arabic default style
Definition: afstyles.h:93

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 558 of file edit.c.

559 {
560  HWND handle;
561 
562  handle = CreateWindowExA(exstyle, WC_EDITA, "Text Text", style, 10, 10, 300, 300,
563  NULL, NULL, hinst, NULL);
564  ok (handle != NULL, "CreateWindow EDIT Control failed\n");
565 
568  return handle;
569 }
namespace GUID const ADDRINFOEXW ADDRINFOEXW struct timeval OVERLAPPED LPLOOKUPSERVICE_COMPLETION_ROUTINE HANDLE * handle
Definition: sock.c:82
int winetest_interactive
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
#define WC_EDITA
Definition: commctrl.h:4682
smooth NULL
Definition: ftsmooth.c:416
#define SW_SHOW
Definition: winuser.h:769
#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)
static HINSTANCE hinst
Definition: edit.c:551
Arabic default style
Definition: afstyles.h:93

Referenced by test_char_from_pos(), test_dialogmode(), test_edit_control_1(), 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 571 of file edit.c.

572 {
573  static const WCHAR testtextW[] = {'T','e','s','t',' ','t','e','x','t',0};
574  HWND handle;
575 
576  handle = CreateWindowExW(exstyle, WC_EDITW, testtextW, style, 10, 10, 300, 300,
577  NULL, NULL, hinst, NULL);
578  ok(handle != NULL, "Failed to create Edit control.\n");
579  return handle;
580 }
namespace GUID const ADDRINFOEXW ADDRINFOEXW struct timeval OVERLAPPED LPLOOKUPSERVICE_COMPLETION_ROUTINE HANDLE * handle
Definition: sock.c:82
#define WC_EDITW
Definition: commctrl.h:4683
smooth NULL
Definition: ftsmooth.c:416
__wchar_t WCHAR
Definition: xmlstorage.h:180
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:1388
#define ok(value,...)
Definition: atltest.h:57
static HINSTANCE hinst
Definition: edit.c:551
Arabic default style
Definition: afstyles.h:93

Referenced by test_cue_banner(), and test_EM_GETLINE().

◆ destroy_child_editcontrol()

static void destroy_child_editcontrol ( HWND  hwndEdit)
static

Definition at line 613 of file edit.c.

614 {
615  if (GetParent(hwndEdit))
617  else {
618  trace("Edit control has no parent!\n");
620  }
621 }
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 2761 of file edit.c.

2762 {
2763  switch (iMsg)
2764  {
2765  case WM_COMMAND:
2766  dm_messages.wm_command++;
2767  break;
2768  case DM_GETDEFID:
2769  dm_messages.wm_getdefid++;
2771  case WM_NEXTDLGCTL:
2772  dm_messages.wm_nextdlgctl++;
2773  break;
2774  case WM_CLOSE:
2775  dm_messages.wm_close++;
2776  break;
2777  }
2778 
2779  return DefWindowProcA(hwnd, iMsg, wParam, lParam);
2780 }
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
#define WM_CLOSE
Definition: winuser.h:1603
#define WM_COMMAND
Definition: winuser.h:1722
LRESULT WINAPI DefWindowProcA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
LPARAM lParam
Definition: combotst.c:139
static struct dialog_mode_messages dm_messages
Definition: edit.c:2741
#define ID_EDITTESTDBUTTON
Definition: edit.c:32

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 861 of file edit.c.

862 {
863  switch (msg)
864  {
865  case WM_COMMAND:
866  switch (HIWORD(wParam))
867  {
868  case EN_MAXTEXT:
869  notifications.en_maxtext++;
870  break;
871  case EN_UPDATE:
872  notifications.en_update++;
873  break;
874  case EN_CHANGE:
875  notifications.en_change++;
876  break;
877  }
878  break;
879  }
880  return DefWindowProcA(hWnd, msg, wParam, lParam);
881 }
#define EN_MAXTEXT
Definition: winuser.h:2008
HWND hWnd
Definition: settings.c:17
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 struct edit_notify notifications
Definition: edit.c:54
#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 register_classes().

◆ edit4_wnd_procA()

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

Definition at line 2499 of file edit.c.

2500 {
2501  switch (msg) {
2502  case WM_COMMAND:
2503  switch (HIWORD(wParam))
2504  {
2505  case EN_SETFOCUS:
2507  break;
2508  }
2509  break;
2510  case WM_CAPTURECHANGED:
2511  if (hWnd != (HWND)lParam)
2512  {
2514  EndMenu();
2515  }
2516  break;
2517  }
2518  return DefWindowProcA(hWnd, msg, wParam, lParam);
2519 }
#define TRUE
Definition: types.h:120
static BOOL got_en_setfocus
Definition: edit.c:2495
#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:2496
#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 register_classes().

◆ edit_dialog_proc()

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

Definition at line 155 of file edit.c.

156 {
157  switch (msg)
158  {
159  case WM_INITDIALOG:
160  {
161  HWND hedit = GetDlgItem(hdlg, 1000);
162  SetFocus(hedit);
163  switch (lparam)
164  {
165  /* from bug 11841 */
166  case 0:
167  PostMessageA(hedit, WM_KEYDOWN, VK_ESCAPE, 0x10001);
168  break;
169  case 1:
170  PostMessageA(hedit, WM_KEYDOWN, VK_RETURN, 0x1c0001);
171  break;
172  case 2:
173  PostMessageA(hedit, WM_KEYDOWN, VK_TAB, 0xf0001);
174  PostMessageA(hdlg, WM_USER, 0xdeadbeef, 1);
175  break;
176 
177  /* more test cases for WM_CHAR */
178  case 3:
179  PostMessageA(hedit, WM_CHAR, VK_ESCAPE, 0x10001);
180  PostMessageA(hdlg, WM_USER, 0xdeadbeef, 0);
181  break;
182  case 4:
183  PostMessageA(hedit, WM_CHAR, VK_RETURN, 0x1c0001);
184  PostMessageA(hdlg, WM_USER, 0xdeadbeef, 0);
185  break;
186  case 5:
187  PostMessageA(hedit, WM_CHAR, VK_TAB, 0xf0001);
188  PostMessageA(hdlg, WM_USER, 0xdeadbeef, 0);
189  break;
190 
191  /* more test cases for WM_KEYDOWN + WM_CHAR */
192  case 6:
193  PostMessageA(hedit, WM_KEYDOWN, VK_ESCAPE, 0x10001);
194  PostMessageA(hedit, WM_CHAR, VK_ESCAPE, 0x10001);
195  PostMessageA(hdlg, WM_USER, 0xdeadbeef, 0);
196  break;
197  case 7:
198  PostMessageA(hedit, WM_KEYDOWN, VK_RETURN, 0x1c0001);
199  PostMessageA(hedit, WM_CHAR, VK_RETURN, 0x1c0001);
200  PostMessageA(hdlg, WM_USER, 0xdeadbeef, 1);
201  break;
202  case 8:
203  PostMessageA(hedit, WM_KEYDOWN, VK_TAB, 0xf0001);
204  PostMessageA(hedit, WM_CHAR, VK_TAB, 0xf0001);
205  PostMessageA(hdlg, WM_USER, 0xdeadbeef, 1);
206  break;
207 
208  /* multiple tab tests */
209  case 9:
210  PostMessageA(hedit, WM_KEYDOWN, VK_TAB, 0xf0001);
211  PostMessageA(hedit, WM_KEYDOWN, VK_TAB, 0xf0001);
212  PostMessageA(hdlg, WM_USER, 0xdeadbeef, 2);
213  break;
214  case 10:
215  PostMessageA(hedit, WM_KEYDOWN, VK_TAB, 0xf0001);
216  PostMessageA(hedit, WM_KEYDOWN, VK_TAB, 0xf0001);
217  PostMessageA(hedit, WM_KEYDOWN, VK_TAB, 0xf0001);
218  PostMessageA(hdlg, WM_USER, 0xdeadbeef, 2);
219  break;
220 
221  default:
222  break;
223  }
224  break;
225  }
226 
227  case WM_COMMAND:
228  if (HIWORD(wparam) != BN_CLICKED)
229  break;
230 
231  switch (LOWORD(wparam))
232  {
233  case IDOK:
234  EndDialog(hdlg, 111);
235  break;
236 
237  case IDCANCEL:
238  EndDialog(hdlg, 222);
239  break;
240 
241  default:
242  break;
243  }
244  break;
245 
246  case WM_USER:
247  {
248  int len;
249  HWND hok = GetDlgItem(hdlg, IDOK);
250  HWND hcancel = GetDlgItem(hdlg, IDCANCEL);
251  HWND hedit = GetDlgItem(hdlg, 1000);
252  HWND hfocus = GetFocus();
253 
254  if (wparam != 0xdeadbeef)
255  break;
256 
257  switch (lparam)
258  {
259  case 0:
260  len = SendMessageA(hedit, WM_GETTEXTLENGTH, 0, 0);
261  if (len == 0)
262  EndDialog(hdlg, 444);
263  else
264  EndDialog(hdlg, 555);
265  break;
266 
267  case 1:
268  len = SendMessageA(hedit, WM_GETTEXTLENGTH, 0, 0);
269  if ((hfocus == hok) && len == 0)
270  EndDialog(hdlg, 444);
271  else
272  EndDialog(hdlg, 555);
273  break;
274 
275  case 2:
276  if (hfocus == hok)
277  EndDialog(hdlg, 11);
278  else if (hfocus == hcancel)
279  EndDialog(hdlg, 22);
280  else if (hfocus == hedit)
281  EndDialog(hdlg, 33);
282  else
283  EndDialog(hdlg, 44);
284  break;
285 
286  default:
287  EndDialog(hdlg, 555);
288  }
289  break;
290  }
291 
292  case WM_CLOSE:
293  EndDialog(hdlg, 333);
294  break;
295 
296  default:
297  break;
298  }
299 
300  return FALSE;
301 }
#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_singleline_dialog_proc()

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

Definition at line 303 of file edit.c.

304 {
305  switch (msg)
306  {
307  case WM_INITDIALOG:
308  {
309  HWND hedit = GetDlgItem(hdlg, 1000);
310  SetFocus(hedit);
311  switch (lparam)
312  {
313  /* test cases for WM_KEYDOWN */
314  case 0:
315  PostMessageA(hedit, WM_KEYDOWN, VK_ESCAPE, 0x10001);
316  break;
317  case 1:
318  PostMessageA(hedit, WM_KEYDOWN, VK_RETURN, 0x1c0001);
319  break;
320  case 2:
321  PostMessageA(hedit, WM_KEYDOWN, VK_TAB, 0xf0001);
322  PostMessageA(hdlg, WM_USER, 0xdeadbeef, 1);
323  break;
324 
325  /* test cases for WM_CHAR */
326  case 3:
327  PostMessageA(hedit, WM_CHAR, VK_ESCAPE, 0x10001);
328  PostMessageA(hdlg, WM_USER, 0xdeadbeef, 0);
329  break;
330  case 4:
331  PostMessageA(hedit, WM_CHAR, VK_RETURN, 0x1c0001);
332  PostMessageA(hdlg, WM_USER, 0xdeadbeef, 0);
333  break;
334  case 5:
335  PostMessageA(hedit, WM_CHAR, VK_TAB, 0xf0001);
336  PostMessageA(hdlg, WM_USER, 0xdeadbeef, 0);
337  break;
338 
339  /* test cases for WM_KEYDOWN + WM_CHAR */
340  case 6:
341  PostMessageA(hedit, WM_KEYDOWN, VK_ESCAPE, 0x10001);
342  PostMessageA(hedit, WM_CHAR, VK_ESCAPE, 0x10001);
343  break;
344  case 7:
345  PostMessageA(hedit, WM_KEYDOWN, VK_RETURN, 0x1c0001);
346  PostMessageA(hedit, WM_CHAR, VK_RETURN, 0x1c0001);
347  break;
348  case 8:
349  PostMessageA(hedit, WM_KEYDOWN, VK_TAB, 0xf0001);
350  PostMessageA(hedit, WM_CHAR, VK_TAB, 0xf0001);
351  PostMessageA(hdlg, WM_USER, 0xdeadbeef, 1);
352  break;
353 
354  default:
355  break;
356  }
357  break;
358  }
359 
360  case WM_COMMAND:
361  if (HIWORD(wparam) != BN_CLICKED)
362  break;
363 
364  switch (LOWORD(wparam))
365  {
366  case IDOK:
367  EndDialog(hdlg, 111);
368  break;
369 
370  case IDCANCEL:
371  EndDialog(hdlg, 222);
372  break;
373 
374  default:
375  break;
376  }
377  break;
378 
379  case WM_USER:
380  {
381  HWND hok = GetDlgItem(hdlg, IDOK);
382  HWND hedit = GetDlgItem(hdlg, 1000);
383  HWND hfocus = GetFocus();
384  int len = SendMessageA(hedit, WM_GETTEXTLENGTH, 0, 0);
385 
386  if (wparam != 0xdeadbeef)
387  break;
388 
389  switch (lparam)
390  {
391  case 0:
392  if ((hfocus == hedit) && len == 0)
393  EndDialog(hdlg, 444);
394  else
395  EndDialog(hdlg, 555);
396  break;
397 
398  case 1:
399  if ((hfocus == hok) && len == 0)
400  EndDialog(hdlg, 444);
401  else
402  EndDialog(hdlg, 555);
403  break;
404 
405  default:
406  EndDialog(hdlg, 55);
407  }
408  break;
409  }
410 
411  case WM_CLOSE:
412  EndDialog(hdlg, 333);
413  break;
414 
415  default:
416  break;
417  }
418 
419  return FALSE;
420 }
#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_subclass_proc()

static LRESULT CALLBACK edit_subclass_proc ( HWND  hwnd,
UINT  message,
WPARAM  wParam,
LPARAM  lParam 
)
static

Definition at line 914 of file edit.c.

915 {
917  static LONG defwndproc_counter = 0;
918  struct message msg = { 0 };
919  LRESULT ret;
920 
921  msg.message = message;
922  msg.flags = sent|wparam|id;
923  if (defwndproc_counter) msg.flags |= defwinproc;
924  msg.wParam = wParam;
925  msg.id = EDIT_ID;
926 
927  if (message != WM_IME_SETCONTEXT &&
929  {
931  }
932 
933  defwndproc_counter++;
934  if (IsWindowUnicode(hwnd))
935  ret = CallWindowProcW(oldproc, hwnd, message, wParam, lParam);
936  else
937  ret = CallWindowProcA(oldproc, hwnd, message, wParam, lParam);
938  defwndproc_counter--;
939 
940  return ret;
941 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
#define WM_IME_NOTIFY
Definition: winuser.h:1812
Definition: tftpd.h:59
Definition: msg.h:39
GLenum GLuint GLenum GLsizei const GLchar * message
Definition: glext.h:5579
WPARAM wParam
Definition: combotst.c:138
LRESULT WINAPI CallWindowProcA(_In_ WNDPROC, _In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
long LONG
Definition: pedump.c:60
static struct msg_sequence * sequences[NUM_MSG_SEQUENCES]
Definition: edit.c:48
#define GWLP_USERDATA
Definition: treelist.c:63
BOOL WINAPI IsWindowUnicode(_In_ HWND)
#define GetWindowLongPtrA
Definition: winuser.h:4803
#define WM_IME_SETCONTEXT
Definition: winuser.h:1811
int ret
Definition: msg.h:34
LRESULT(CALLBACK * WNDPROC)(HWND, UINT, WPARAM, LPARAM)
Definition: winuser.h:2881
Definition: edit.c:45
#define add_message(msg)
Definition: msg.c:2113
#define msg(x)
Definition: auth_time.c:54
LRESULT WINAPI CallWindowProcW(_In_ WNDPROC, _In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
GLenum GLuint id
Definition: glext.h:5579
LONG_PTR LRESULT
Definition: windef.h:209
LPARAM lParam
Definition: combotst.c:139
static UINT WPARAM wparam
Definition: combo.c:716

Referenced by test_change_focus().

◆ edit_wantreturn_dialog_proc()

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

Definition at line 422 of file edit.c.

423 {
424  switch (msg)
425  {
426  case WM_INITDIALOG:
427  {
428  HWND hedit = GetDlgItem(hdlg, 1000);
429  SetFocus(hedit);
430  switch (lparam)
431  {
432  /* test cases for WM_KEYDOWN */
433  case 0:
434  PostMessageA(hedit, WM_KEYDOWN, VK_ESCAPE, 0x10001);
435  break;
436  case 1:
437  PostMessageA(hedit, WM_KEYDOWN, VK_RETURN, 0x1c0001);
438  PostMessageA(hdlg, WM_USER, 0xdeadbeef, 0);
439  break;
440  case 2:
441  PostMessageA(hedit, WM_KEYDOWN, VK_TAB, 0xf0001);
442  PostMessageA(hdlg, WM_USER, 0xdeadbeef, 1);
443  break;
444 
445  /* test cases for WM_CHAR */
446  case 3:
447  PostMessageA(hedit, WM_CHAR, VK_ESCAPE, 0x10001);
448  PostMessageA(hdlg, WM_USER, 0xdeadbeef, 0);
449  break;
450  case 4:
451  PostMessageA(hedit, WM_CHAR, VK_RETURN, 0x1c0001);
452  PostMessageA(hdlg, WM_USER, 0xdeadbeef, 2);
453  break;
454  case 5:
455  PostMessageA(hedit, WM_CHAR, VK_TAB, 0xf0001);
456  PostMessageA(hdlg, WM_USER, 0xdeadbeef, 0);
457  break;
458 
459  /* test cases for WM_KEYDOWN + WM_CHAR */
460  case 6:
461  PostMessageA(hedit, WM_KEYDOWN, VK_ESCAPE, 0x10001);
462  PostMessageA(hedit, WM_CHAR, VK_ESCAPE, 0x10001);
463  PostMessageA(hdlg, WM_USER, 0xdeadbeef, 0);
464  break;
465  case 7:
466  PostMessageA(hedit, WM_KEYDOWN, VK_RETURN, 0x1c0001);
467  PostMessageA(hedit, WM_CHAR, VK_RETURN, 0x1c0001);
468  PostMessageA(hdlg, WM_USER, 0xdeadbeef, 2);
469  break;
470  case 8:
471  PostMessageA(hedit, WM_KEYDOWN, VK_TAB, 0xf0001);
472  PostMessageA(hedit, WM_CHAR, VK_TAB, 0xf0001);
473  PostMessageA(hdlg, WM_USER, 0xdeadbeef, 1);
474  break;
475 
476  default:
477  break;
478  }
479  break;
480  }
481 
482  case WM_COMMAND:
483  if (HIWORD(wparam) != BN_CLICKED)
484  break;
485 
486  switch (LOWORD(wparam))
487  {
488  case IDOK:
489  EndDialog(hdlg, 111);
490  break;
491 
492  case IDCANCEL:
493  EndDialog(hdlg, 222);
494  break;
495 
496  default:
497  break;
498  }
499  break;
500 
501  case WM_USER:
502  {
503  HWND hok = GetDlgItem(hdlg, IDOK);
504  HWND hedit = GetDlgItem(hdlg, 1000);
505  HWND hfocus = GetFocus();
506  int len = SendMessageA(hedit, WM_GETTEXTLENGTH, 0, 0);
507 
508  if (wparam != 0xdeadbeef)
509  break;
510 
511  switch (lparam)
512  {
513  case 0:
514  if ((hfocus == hedit) && len == 0)
515  EndDialog(hdlg, 444);
516  else
517  EndDialog(hdlg, 555);
518  break;
519 
520  case 1:
521  if ((hfocus == hok) && len == 0)
522  EndDialog(hdlg, 444);
523  else
524  EndDialog(hdlg, 555);
525  break;
526 
527  case 2:
528  if ((hfocus == hedit) && len == 2)
529  EndDialog(hdlg, 444);
530  else
531  EndDialog(hdlg, 555);
532  break;
533 
534  default:
535  EndDialog(hdlg, 55);
536  }
537  break;
538  }
539 
540  case WM_CLOSE:
541  EndDialog(hdlg, 333);
542  break;
543 
544  default:
545  break;
546  }
547 
548  return FALSE;
549 }
#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 813 of file edit.c.

814 {
815  char szLocalString[MAXLEN];
816  /* This EN_UPDATE handler changes any 'foo' to 'bar'. */
817  GetWindowTextA(hwndET2, szLocalString, MAXLEN);
818  if (!strcmp(szLocalString, "foo"))
819  {
820  strcpy(szLocalString, "bar");
821  SendMessageA(hwndET2, WM_SETTEXT, 0, (LPARAM)szLocalString);
822  }
823  /* always leave the cursor at the end. */
825 }
int WINAPI GetWindowTextA(HWND hWnd, LPSTR lpString, int nMaxCount)
Definition: window.c:1326
LRESULT WINAPI SendMessageA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
LONG_PTR LPARAM
Definition: windef.h:208
#define MAXLEN
Definition: edit.c:34
#define WM_SETTEXT
Definition: winuser.h:1599
#define EM_SETSEL
Definition: winuser.h:2000
static HWND hwndET2
Definition: edit.c:552
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 827 of file edit.c.

828 {
829  if (id == ID_EDITTEST2 && codeNotify == EN_UPDATE)
831 }
#define ID_EDITTEST2
Definition: edit.c:33
static void ET2_check_change(void)
Definition: edit.c:813
#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 833 of file edit.c.

834 {
835  switch (iMsg)
836  {
837  case WM_COMMAND:
839  break;
840  }
841  return DefWindowProcA(hwnd, iMsg, wParam, lParam);
842 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
WPARAM wParam
Definition: combotst.c:138
static void ET2_OnCommand(HWND hwnd, int id, HWND hwndCtl, UINT codeNotify)
Definition: edit.c:827
#define WM_COMMAND
Definition: winuser.h:1722
LRESULT WINAPI DefWindowProcA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define HIWORD(l)
Definition: typedefs.h:246
LPARAM lParam
Definition: combotst.c:139
#define LOWORD(l)
Definition: pedump.c:82

Referenced by register_classes().

◆ find_font_proc()

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

Definition at line 1734 of file edit.c.

1735 {
1736  return 0;
1737 }

Referenced by is_font_installed().

◆ get_cjk_font_margins()

static DWORD get_cjk_font_margins ( HDC  hdc)
static

Definition at line 1616 of file edit.c.

1617 {
1618  ABC abc[256];
1619  SHORT left, right;
1620  UINT i;
1621 
1622  if (!GetCharABCWidthsW(hdc, 0, 255, abc))
1623  return 0;
1624 
1625  left = right = 0;
1626  for (i = 0; i < ARRAY_SIZE(abc); i++) {
1627  if (-abc[i].abcA > right) right = -abc[i].abcA;
1628  if (-abc[i].abcC > left) left = -abc[i].abcC;
1629  }
1630  return MAKELONG(left, right);
1631 }
Definition: wingdi.h:1409
int abcC
Definition: wingdi.h:1412
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
short SHORT
Definition: pedump.c:59
#define MAKELONG(a, b)
Definition: typedefs.h:248
int abcA
Definition: wingdi.h:1410
GLint left
Definition: glext.h:7726
GLdouble GLdouble right
Definition: glext.h:10859
HDC hdc
Definition: main.c:9
#define ARRAY_SIZE(a)
Definition: main.h:24
unsigned int UINT
Definition: ndis.h:50
BOOL WINAPI GetCharABCWidthsW(_In_ HDC hdc, _In_ UINT wFirst, _In_ UINT wLast, _Out_writes_(wLast - wFirst+1) LPABC lpABC)
static UINT UINT LPWORD LPABC abc
Definition: font.c:44

Referenced by test_margins_default().

◆ get_cjk_fontinfo_margin()

static INT get_cjk_fontinfo_margin ( INT  width,
INT  side_bearing 
)
static

Definition at line 1606 of file edit.c.

1607 {
1608  INT margin;
1609  if (side_bearing < 0)
1610  margin = min(-side_bearing, width/2);
1611  else
1612  margin = 0;
1613  return margin;
1614 }
GLint GLint GLsizei width
Definition: gl.h:1546
int32_t INT
Definition: typedefs.h:56
#define min(a, b)
Definition: monoChain.cc:55

Referenced by test_margins_default().

◆ get_edit_style()

static LONG get_edit_style ( HWND  hwnd)
static

Definition at line 623 of file edit.c.

624 {
625  return GetWindowLongA( hwnd, GWL_STYLE ) & (
626  ES_LEFT |
627 /* FIXME: not implemented
628  ES_CENTER |
629  ES_RIGHT |
630  ES_OEMCONVERT |
631 */
632  ES_MULTILINE |
633  ES_UPPERCASE |
634  ES_LOWERCASE |
635  ES_PASSWORD |
638  ES_NOHIDESEL |
639  ES_COMBO |
640  ES_READONLY |
641  ES_WANTRETURN |
642  ES_NUMBER
643  );
644 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
#define ES_MULTILINE
Definition: pedump.c:667
#define ES_COMBO
Definition: edit.c:29
#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 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().

◆ is_cjk()

static BOOL is_cjk ( HDC  dc)
static

Definition at line 1488 of file edit.c.

1489 {
1491  FONTSIGNATURE fs;
1492 
1493  switch (GdiGetCodePage(dc)) {
1494  case 932: case 936: case 949: case 950: case 1361:
1495  return TRUE;
1496  default:
1497  return (GetTextCharsetInfo(dc, &fs, 0) != DEFAULT_CHARSET &&
1498  (fs.fsCsb[0] & FS_DBCS_MASK));
1499  }
1500 }
#define TRUE
Definition: types.h:120
#define FS_CHINESESIMP
Definition: wingdi.h:570
#define FS_CHINESETRAD
Definition: wingdi.h:572
Definition: fs.h:235
#define DEFAULT_CHARSET
Definition: wingdi.h:383
int WINAPI GetTextCharsetInfo(_In_ HDC, _Out_opt_ LPFONTSIGNATURE, _In_ DWORD)
unsigned long DWORD
Definition: ntddk_ex.h:95
#define FS_JISJAPAN
Definition: wingdi.h:569
#define FS_WANSUNG
Definition: wingdi.h:571
#define fs
Definition: i386-dis.c:435
static const WCHAR dc[]
#define FS_JOHAB
Definition: wingdi.h:573
DWORD WINAPI GdiGetCodePage(HDC)

Referenced by test_margins_default().

◆ is_font_installed()

static BOOL is_font_installed ( const char name)
static

Definition at line 1739 of file edit.c.

1740 {
1741  HDC hdc = GetDC(NULL);
1742  BOOL ret = FALSE;
1743 
1745  ret = TRUE;
1746 
1747  ReleaseDC(NULL, hdc);
1748  return ret;
1749 }
#define TRUE
Definition: types.h:120
HDC WINAPI GetDC(_In_opt_ HWND)
static HDC
Definition: imagelist.c:92
unsigned int BOOL
Definition: ntddk_ex.h:94
int WINAPI EnumFontFamiliesA(_In_ HDC, _In_opt_ LPCSTR, _In_ FONTENUMPROCA, _In_ LPARAM)
int WINAPI ReleaseDC(_In_opt_ HWND, _In_ HDC)
smooth NULL
Definition: ftsmooth.c:416
int ret
HDC hdc
Definition: main.c:9
static INT CALLBACK find_font_proc(const LOGFONTA *elf, const TEXTMETRICA *ntm, DWORD type, LPARAM lParam)
Definition: edit.c:1734
Definition: name.c:38

Referenced by test_margins(), and test_margins_font_change().

◆ 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 56 of file edit.c.

57 {
58  static int num_ok_commands = 0;
59  switch (msg)
60  {
61  case WM_INITDIALOG:
62  {
63  HWND hedit = GetDlgItem(hdlg, 1000);
64  SetFocus(hedit);
65  switch (lparam)
66  {
67  /* test cases related to bug 12319 */
68  case 0:
69  PostMessageA(hedit, WM_KEYDOWN, VK_TAB, 0xf0001);
70  PostMessageA(hdlg, WM_USER, 0xdeadbeef, 0);
71  break;
72  case 1:
73  PostMessageA(hedit, WM_CHAR, VK_TAB, 0xf0001);
74  PostMessageA(hdlg, WM_USER, 0xdeadbeef, 0);
75  break;
76  case 2:
77  PostMessageA(hedit, WM_KEYDOWN, VK_TAB, 0xf0001);
78  PostMessageA(hedit, WM_CHAR, VK_TAB, 0xf0001);
79  PostMessageA(hdlg, WM_USER, 0xdeadbeef, 0);
80  break;
81 
82  /* test cases for pressing enter */
83  case 3:
84  num_ok_commands = 0;
85  PostMessageA(hedit, WM_KEYDOWN, VK_RETURN, 0x1c0001);
86  PostMessageA(hdlg, WM_USER, 0xdeadbeef, 1);
87  break;
88 
89  default:
90  break;
91  }
92  break;
93  }
94 
95  case WM_COMMAND:
96  if (HIWORD(wparam) != BN_CLICKED)
97  break;
98 
99  switch (LOWORD(wparam))
100  {
101  case IDOK:
102  num_ok_commands++;
103  break;
104 
105  default:
106  break;
107  }
108  break;
109 
110  case WM_USER:
111  {
112  HWND hfocus = GetFocus();
113  HWND hedit = GetDlgItem(hdlg, 1000);
114  HWND hedit2 = GetDlgItem(hdlg, 1001);
115  HWND hedit3 = GetDlgItem(hdlg, 1002);
116 
117  if (wparam != 0xdeadbeef)
118  break;
119 
120  switch (lparam)
121  {
122  case 0:
123  if (hfocus == hedit)
124  EndDialog(hdlg, 1111);
125  else if (hfocus == hedit2)
126  EndDialog(hdlg, 2222);
127  else if (hfocus == hedit3)
128  EndDialog(hdlg, 3333);
129  else
130  EndDialog(hdlg, 4444);
131  break;
132  case 1:
133  if ((hfocus == hedit) && (num_ok_commands == 0))
134  EndDialog(hdlg, 11);
135  else
136  EndDialog(hdlg, 22);
137  break;
138  default:
139  EndDialog(hdlg, 5555);
140  }
141  break;
142  }
143 
144  case WM_CLOSE:
145  EndDialog(hdlg, 333);
146  break;
147 
148  default:
149  break;
150  }
151 
152  return FALSE;
153 }
#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().

◆ parent_wnd_proc()

static LRESULT CALLBACK parent_wnd_proc ( HWND  hwnd,
UINT  message,
WPARAM  wParam,
LPARAM  lParam 
)
static

Definition at line 883 of file edit.c.

884 {
885  static LONG defwndproc_counter = 0;
886  struct message msg = { 0 };
887  LRESULT ret;
888 
889  msg.message = message;
890  msg.flags = sent|wparam|id;
891  if (defwndproc_counter) msg.flags |= defwinproc;
892  msg.wParam = wParam;
893  msg.id = PARENT_ID;
894 
895  if (message != WM_IME_SETCONTEXT &&
896  message != WM_IME_NOTIFY &&
897  message != WM_GETICON &&
900  message != WM_PAINT &&
902  message < 0xc000)
903  {
905  }
906 
907  defwndproc_counter++;
909  defwndproc_counter--;
910 
911  return ret;
912 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
#define WM_IME_NOTIFY
Definition: winuser.h:1812
Definition: tftpd.h:59
Definition: edit.c:44
Definition: msg.h:39
GLenum GLuint GLenum GLsizei const GLchar * message
Definition: glext.h:5579
WPARAM wParam
Definition: combotst.c:138
long LONG
Definition: pedump.c:60
static struct msg_sequence * sequences[NUM_MSG_SEQUENCES]
Definition: edit.c:48
#define WM_IME_SETCONTEXT
Definition: winuser.h:1811
#define WM_PAINT
Definition: winuser.h:1602
int ret
Definition: msg.h:34
LRESULT WINAPI DefWindowProcA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define add_message(msg)
Definition: msg.c:2113
#define WM_CTLCOLOREDIT
Definition: winuser.h:1749
#define msg(x)
Definition: auth_time.c:54
GLenum GLuint id
Definition: glext.h:5579
LONG_PTR LRESULT
Definition: windef.h:209
LPARAM lParam
Definition: combotst.c:139
#define WM_GETMINMAXINFO
Definition: winuser.h:1622
#define WM_DWMNCRENDERINGCHANGED
Definition: winuser.h:1867
static UINT WPARAM wparam
Definition: combo.c:716

Referenced by register_classes().

◆ register_classes()

static BOOL register_classes ( void  )
static

Definition at line 2609 of file edit.c.

2610 {
2611  WNDCLASSA test2;
2612  WNDCLASSA test3;
2613  WNDCLASSA test4;
2614  WNDCLASSA text_position;
2615  WNDCLASSA wc;
2616 
2617  test2.style = 0;
2618  test2.lpfnWndProc = ET2_WndProc;
2619  test2.cbClsExtra = 0;
2620  test2.cbWndExtra = 0;
2621  test2.hInstance = hinst;
2622  test2.hIcon = NULL;
2623  test2.hCursor = LoadCursorA (NULL, (LPCSTR)IDC_ARROW);
2624  test2.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1);
2625  test2.lpszMenuName = NULL;
2626  test2.lpszClassName = szEditTest2Class;
2627  if (!RegisterClassA(&test2)) return FALSE;
2628 
2629  test3.style = 0;
2630  test3.lpfnWndProc = edit3_wnd_procA;
2631  test3.cbClsExtra = 0;
2632  test3.cbWndExtra = 0;
2633  test3.hInstance = hinst;
2634  test3.hIcon = 0;
2635  test3.hCursor = LoadCursorA(0, (LPCSTR)IDC_ARROW);
2636  test3.hbrBackground = GetStockObject(WHITE_BRUSH);
2637  test3.lpszMenuName = NULL;
2638  test3.lpszClassName = szEditTest3Class;
2639  if (!RegisterClassA(&test3)) return FALSE;
2640 
2641  test4.style = 0;
2642  test4.lpfnWndProc = edit4_wnd_procA;
2643  test4.cbClsExtra = 0;
2644  test4.cbWndExtra = 0;
2645  test4.hInstance = hinst;
2646  test4.hIcon = NULL;
2647  test4.hCursor = LoadCursorA (NULL, (LPCSTR)IDC_ARROW);
2648  test4.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1);
2649  test4.lpszMenuName = NULL;
2650  test4.lpszClassName = szEditTest4Class;
2651  if (!RegisterClassA(&test4)) return FALSE;
2652 
2653  text_position.style = CS_HREDRAW | CS_VREDRAW;
2654  text_position.cbClsExtra = 0;
2655  text_position.cbWndExtra = 0;
2656  text_position.hInstance = hinst;
2657  text_position.hIcon = NULL;
2658  text_position.hCursor = LoadCursorA(NULL, (LPCSTR)IDC_ARROW);
2659  text_position.hbrBackground = (HBRUSH)(COLOR_BTNFACE + 1);
2660  text_position.lpszMenuName = NULL;
2661  text_position.lpszClassName = szEditTextPositionClass;
2662  text_position.lpfnWndProc = DefWindowProcA;
2663  if (!RegisterClassA(&text_position)) return FALSE;
2664 
2665  memset(&wc, 0, sizeof(wc));
2668  wc.lpszClassName = "ParentWnd";
2669  if (!RegisterClassA(&wc)) return FALSE;
2670 
2671  return TRUE;
2672 }
HGDIOBJ WINAPI GetStockObject(_In_ int)
#define TRUE
Definition: types.h:120
void test3(void)
Definition: hivetest.c:423
static const char szEditTextPositionClass[]
Definition: edit.c:556
static LRESULT CALLBACK parent_wnd_proc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
Definition: edit.c:883
static const char szEditTest2Class[]
Definition: edit.c:553
int cbClsExtra
Definition: winuser.h:3140
#define CS_HREDRAW
Definition: winuser.h:648
LPCSTR lpszMenuName
Definition: winuser.h:3146
#define WHITE_BRUSH
Definition: wingdi.h:901
HBRUSH hbrBackground
Definition: winuser.h:3145
static const char szEditTest4Class[]
Definition: edit.c:555
#define COLOR_WINDOW
Definition: winuser.h:908
int cbWndExtra
Definition: winuser.h:3141
HCURSOR hCursor
Definition: winuser.h:3144
smooth NULL
Definition: ftsmooth.c:416
const char * LPCSTR
Definition: xmlstorage.h:183
#define CS_VREDRAW
Definition: winuser.h:653
static LRESULT CALLBACK edit3_wnd_procA(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
Definition: edit.c:861
static const char szEditTest3Class[]
Definition: edit.c:554
static LRESULT CALLBACK edit4_wnd_procA(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
Definition: edit.c:2499
#define COLOR_BTNFACE
Definition: winuser.h:918
HMODULE WINAPI DECLSPEC_HOTPATCH GetModuleHandleA(LPCSTR lpModuleName)
Definition: loader.c:821
LRESULT WINAPI DefWindowProcA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
LPCSTR lpszClassName
Definition: winuser.h:3147
HCURSOR WINAPI LoadCursorA(_In_opt_ HINSTANCE, _In_ LPCSTR)
Definition: cursoricon.c:2059
UINT style
Definition: winuser.h:3138
void test2(void)
Definition: regtest.c:173
static LRESULT CALLBACK ET2_WndProc(HWND hwnd, UINT iMsg, WPARAM wParam, LPARAM lParam)
Definition: edit.c:833
HINSTANCE hInstance
Definition: winuser.h:3142
WNDPROC lpfnWndProc
Definition: winuser.h:3139
#define IDC_ARROW
Definition: winuser.h:682
static HINSTANCE hinst
Definition: edit.c:551
#define memset(x, y, z)
Definition: compat.h:39
ATOM WINAPI RegisterClassA(_In_ CONST WNDCLASSA *)
void test4(void)
Definition: hivetest.c:461
HICON hIcon
Definition: winuser.h:3143

Referenced by START_TEST().

◆ set_client_height()

static void set_client_height ( HWND  Wnd,
unsigned  Height 
)
static

Definition at line 646 of file edit.c.

647 {
648  RECT ClientRect, WindowRect;
649 
650  GetWindowRect(Wnd, &WindowRect);
651  GetClientRect(Wnd, &ClientRect);
652  SetWindowPos(Wnd, NULL, 0, 0,
653  WindowRect.right - WindowRect.left,
654  Height + (WindowRect.bottom - WindowRect.top) -
655  (ClientRect.bottom - ClientRect.top),
657 
658  /* Workaround for a bug in Windows' edit control
659  (multi-line mode) */
660  GetWindowRect(Wnd, &WindowRect);
661  SetWindowPos(Wnd, NULL, 0, 0,
662  WindowRect.right - WindowRect.left + 1,
663  WindowRect.bottom - WindowRect.top + 1,
665  SetWindowPos(Wnd, NULL, 0, 0,
666  WindowRect.right - WindowRect.left,
667  WindowRect.bottom - WindowRect.top,
669 
670  GetClientRect(Wnd, &ClientRect);
671  ok(ClientRect.bottom - ClientRect.top == Height,
672  "The client height should be %d, but is %d\n",
673  Height, ClientRect.bottom - ClientRect.top);
674 }
LONG top
Definition: windef.h:307
LONG left
Definition: windef.h:306
#define SWP_NOZORDER
Definition: winuser.h:1232
LONG right
Definition: windef.h:308
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:309
#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 3353 of file edit.c.

3354 {
3355  ULONG_PTR ctx_cookie;
3356  HANDLE hCtx;
3357  BOOL b;
3358 
3359  if (!load_v6_module(&ctx_cookie, &hCtx))
3360  return;
3361 
3363 
3365  b = register_classes();
3366  ok(b, "Failed to register test classes.\n");
3367  if (!b) return;
3368 
3377  test_margins();
3380  test_espassword();
3381  test_undo();
3382  test_enter();
3383  test_tab();
3384  test_edit_dialog();
3389  test_fontsize();
3390  test_dialogmode();
3391  test_contextmenu();
3393  test_paste();
3394  test_EM_GETLINE();
3397  test_cue_banner();
3398 
3400 
3401  unload_v6_module(ctx_cookie, hCtx);
3402 }
static void test_singleline_wantreturn_edit_dialog(void)
Definition: edit.c:2411
static void test_edit_control_5(void)
Definition: edit.c:1329
static void test_contextmenu(void)
Definition: edit.c:2566
static void test_change_focus(void)
Definition: edit.c:3313
static void test_tab(void)
Definition: edit.c:2261
static void test_edit_control_2(void)
Definition: edit.c:744
static void test_margins(void)
Definition: edit.c:1751
static void unload_v6_module(ULONG_PTR cookie, HANDLE hCtx)
Definition: v6util.h:63
static void test_edit_dialog(void)
Definition: edit.c:2308
static void test_edit_control_6(void)
Definition: edit.c:1385
uint32_t ULONG_PTR
Definition: typedefs.h:63
static BOOL load_v6_module(ULONG_PTR *pcookie, HANDLE *hCtx)
Definition: v6util.h:71
unsigned int BOOL
Definition: ntddk_ex.h:94
static void test_margins_font_change(void)
Definition: edit.c:1854
static struct msg_sequence * sequences[NUM_MSG_SEQUENCES]
Definition: edit.c:48
static void init_msg_sequences(struct msg_sequence **seq, int n)
Definition: msg.h:391
smooth NULL
Definition: ftsmooth.c:416
static void test_dialogmode(void)
Definition: edit.c:2782
static void test_edit_control_limittext(void)
Definition: edit.c:1420
static void UnregisterWindowClasses(void)
Definition: edit.c:2674
static void test_undo(void)
Definition: edit.c:2137
static void test_child_edit_wmkeydown(void)
Definition: edit.c:2481
#define b
Definition: ke_i.h:79
static void test_wantreturn_edit_dialog(void)
Definition: edit.c:2382
static void test_wordbreak_proc(void)
Definition: edit.c:3189
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
static void test_text_position(void)
Definition: edit.c:2082
static void test_edit_control_scroll(void)
Definition: edit.c:1447
static void test_char_from_pos(void)
Definition: edit.c:1188
static void test_enter(void)
Definition: edit.c:2194
static void test_espassword(void)
Definition: edit.c:2090
HMODULE WINAPI DECLSPEC_HOTPATCH GetModuleHandleA(LPCSTR lpModuleName)
Definition: loader.c:821
static BOOL register_classes(void)
Definition: edit.c:2609
static void test_paste(void)
Definition: edit.c:3067
static void test_multi_edit_dialog(void)
Definition: edit.c:2367
#define ok(value,...)
Definition: atltest.h:57
static HINSTANCE hinst
Definition: edit.c:551
static void test_cue_banner(void)
Definition: edit.c:3236
static void test_EM_GETHANDLE(void)
Definition: edit.c:2914
static void test_edit_control_1(void)
Definition: edit.c:676
static void test_fontsize(void)
Definition: edit.c:2682
static void test_edit_control_3(void)
Definition: edit.c:946
static void test_EM_GETLINE(void)
Definition: edit.c:3136

◆ test_change_focus()

static void test_change_focus ( void  )
static

Definition at line 3313 of file edit.c.

3314 {
3315  HWND hwnd, parent_wnd;
3316  WNDPROC oldproc;
3317  MSG msg;
3318  POINT orig_pos;
3319 
3320  GetCursorPos(&orig_pos);
3321 
3322  parent_wnd = CreateWindowA("ParentWnd", "", WS_OVERLAPPEDWINDOW,
3323  0, 0, 200, 200, NULL, NULL, GetModuleHandleA(NULL), NULL);
3324  ok(parent_wnd != NULL, "Failed to create control parent.\n");
3327 
3328  hwnd = CreateWindowExA(0, WC_EDITA, "Test", WS_CHILD | WS_VISIBLE, 0, 0, 100, 100,
3330  ok(hwnd != NULL, "Failed to create Edit control.\n");
3331 
3334 
3335  SetCursorPos(400, 400);
3336 
3339  SetFocus(hwnd);
3340  while (PeekMessageA(&msg, 0, 0, 0, PM_REMOVE)) DispatchMessageA(&msg);
3342 
3345  while (PeekMessageA(&msg, 0, 0, 0, PM_REMOVE)) DispatchMessageA(&msg);
3347 
3348  SetCursorPos(orig_pos.x, orig_pos.y);
3349 
3351 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
LRESULT WINAPI DispatchMessageA(_In_ const MSG *)
#define TRUE
Definition: types.h:120
long y
Definition: polytest.cpp:48
long x
Definition: polytest.cpp:48
static const struct message killfocus_combined_seq[]
Definition: edit.c:3226
TW_UINT32 TW_UINT16 TW_UINT16 MSG
Definition: twain.h:1827
#define HWND_TOPMOST
Definition: winuser.h:1194
HWND WINAPI SetFocus(_In_opt_ HWND)
#define WS_CHILD
Definition: pedump.c:617
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
BOOL WINAPI PeekMessageA(_Out_ LPMSG, _In_opt_ HWND, _In_ UINT, _In_ UINT, _In_ UINT)
BOOL WINAPI GetCursorPos(_Out_ LPPOINT)
Definition: cursoricon.c:2635
BOOL WINAPI DestroyWindow(_In_ HWND)
#define WC_EDITA
Definition: commctrl.h:4682
static struct msg_sequence * sequences[NUM_MSG_SEQUENCES]
Definition: edit.c:48
#define CreateWindowA(a, b, c, d, e, f, g, h, i, j, k)
Definition: winuser.h:4290
#define GWLP_USERDATA
Definition: treelist.c:63
smooth NULL
Definition: ftsmooth.c:416
static const struct message setfocus_combined_seq[]
Definition: edit.c:3215
#define SW_SHOW
Definition: winuser.h:769
#define ok_sequence(seq, index, exp, contx, todo)
Definition: msg.h:387
BOOL WINAPI SetCursorPos(_In_ int, _In_ int)
Definition: cursoricon.c:2627
#define SetWindowLongPtrA
Definition: winuser.h:5320
HMODULE WINAPI DECLSPEC_HOTPATCH GetModuleHandleA(LPCSTR lpModuleName)
Definition: loader.c:821
#define GWLP_WNDPROC
Definition: treelist.c:66
static LRESULT CALLBACK edit_subclass_proc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
Definition: edit.c:914
#define SWP_NOSIZE
Definition: winuser.h:1230
LRESULT(CALLBACK * WNDPROC)(HWND, UINT, WPARAM, LPARAM)
Definition: winuser.h:2881
#define ok(value,...)
Definition: atltest.h:57
static void flush_sequences(struct msg_sequence **seq, int n)
Definition: msg.h:97
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
#define msg(x)
Definition: auth_time.c:54
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
#define SWP_NOMOVE
Definition: winuser.h:1229
BOOL WINAPI SetWindowPos(_In_ HWND, _In_opt_ HWND, _In_ int, _In_ int, _In_ int, _In_ int, _In_ UINT)
#define PM_REMOVE
Definition: winuser.h:1182
#define WS_VISIBLE
Definition: pedump.c:620
static HWND parent_wnd
Definition: monthcal.c:49
static const CLSID *static CLSID *static const GUID VARIANT VARIANT *static IServiceProvider DWORD *static HMENU
Definition: ordinal.c:60

Referenced by START_TEST().

◆ test_char_from_pos()

static void test_char_from_pos ( void  )
static

Definition at line 1188 of file edit.c.

1189 {
1190  int lo, hi, mid, ret, i;
1191  HWND hwEdit;
1192 
1194  SendMessageA(hwEdit, WM_SETTEXT, 0, (LPARAM)"aa");
1195  lo = LOWORD(SendMessageA(hwEdit, EM_POSFROMCHAR, 0, 0));
1196  hi = LOWORD(SendMessageA(hwEdit, EM_POSFROMCHAR, 1, 0));
1197  mid = lo + (hi - lo) / 2;
1198 
1199  for (i = lo; i < mid; i++)
1200  {
1201  ret = LOWORD(SendMessageA(hwEdit, EM_CHARFROMPOS, 0, i));
1202  ok(0 == ret, "expected 0 got %d\n", ret);
1203  }
1204 
1205  for (i = mid; i <= hi; i++)
1206  {
1207  ret = LOWORD(SendMessageA(hwEdit, EM_CHARFROMPOS, 0, i));
1208  ok(1 == ret, "expected 1 got %d\n", ret);
1209  }
1210 
1211  ret = SendMessageA(hwEdit, EM_POSFROMCHAR, 2, 0);
1212  ok(-1 == ret, "expected -1 got %d\n", ret);
1213  DestroyWindow(hwEdit);
1214 
1216  SendMessageA(hwEdit, WM_SETTEXT, 0, (LPARAM)"aa");
1217  lo = LOWORD(SendMessageA(hwEdit, EM_POSFROMCHAR, 0, 0));
1218  hi = LOWORD(SendMessageA(hwEdit, EM_POSFROMCHAR, 1, 0));
1219  mid = lo + (hi - lo) / 2;
1220 
1221  for (i = lo; i < mid; i++)
1222  {
1223  ret = LOWORD(SendMessageA(hwEdit, EM_CHARFROMPOS, 0, i));
1224  ok(0 == ret, "expected 0 got %d\n", ret);
1225  }
1226 
1227  for (i = mid; i <= hi; i++)
1228  {
1229  ret = LOWORD(SendMessageA(hwEdit, EM_CHARFROMPOS, 0, i));
1230  ok(1 == ret, "expected 1 got %d\n", ret);
1231  }
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;
1242 
1243  for (i = lo; i < mid; i++)
1244  {
1245  ret = LOWORD(SendMessageA(hwEdit, EM_CHARFROMPOS, 0, i));
1246  ok(0 == ret, "expected 0 got %d\n", ret);
1247  }
1248 
1249  for (i = mid; i <= hi; i++)
1250  {
1251  ret = LOWORD(SendMessageA(hwEdit, EM_CHARFROMPOS, 0, i));
1252  ok(1 == ret, "expected 1 got %d\n", ret);
1253  }
1254 
1255  ret = SendMessageA(hwEdit, EM_POSFROMCHAR, 2, 0);
1256  ok(-1 == ret, "expected -1 got %d\n", ret);
1257  DestroyWindow(hwEdit);
1258 
1260  SendMessageA(hwEdit, WM_SETTEXT, 0, (LPARAM)"aa");
1261  lo = LOWORD(SendMessageA(hwEdit, EM_POSFROMCHAR, 0, 0));
1262  hi = LOWORD(SendMessageA(hwEdit, EM_POSFROMCHAR, 1, 0));
1263  mid = lo + (hi - lo) / 2 + 1;
1264 
1265  for (i = lo; i < mid; i++)
1266  {
1267  ret = LOWORD(SendMessageA(hwEdit, EM_CHARFROMPOS, 0, i));
1268  ok((0 == ret || 1 == ret /* Vista */), "expected 0 or 1 got %d\n", ret);
1269  }
1270 
1271  for (i = mid; i <= hi; i++)
1272  {
1273  ret = LOWORD(SendMessageA(hwEdit, EM_CHARFROMPOS, 0, i));
1274  ok(1 == ret, "expected 1 got %d\n", ret);
1275  }
1276 
1277  ret = SendMessageA(hwEdit, EM_POSFROMCHAR, 2, 0);
1278  ok(-1 == ret, "expected -1 got %d\n", ret);
1279  DestroyWindow(hwEdit);
1280 
1282  SendMessageA(hwEdit, WM_SETTEXT, 0, (LPARAM)"aa");
1283  lo = LOWORD(SendMessageA(hwEdit, EM_POSFROMCHAR, 0, 0));
1284  hi = LOWORD(SendMessageA(hwEdit, EM_POSFROMCHAR, 1, 0));
1285  mid = lo + (hi - lo) / 2 + 1;
1286 
1287  for (i = lo; i < mid; i++)
1288  {
1289  ret = LOWORD(SendMessageA(hwEdit, EM_CHARFROMPOS, 0, i));
1290  ok((0 == ret || 1 == ret /* Vista */), "expected 0 or 1 got %d\n", ret);
1291  }
1292 
1293  for (i = mid; i <= hi; i++)
1294  {
1295  ret = LOWORD(SendMessageA(hwEdit, EM_CHARFROMPOS, 0, i));
1296  ok(1 == ret, "expected 1 got %d\n", ret);
1297  }
1298 
1299  ret = SendMessageA(hwEdit, EM_POSFROMCHAR, 2, 0);
1300  ok(-1 == ret, "expected -1 got %d\n", ret);
1301  DestroyWindow(hwEdit);
1302 
1304  SendMessageA(hwEdit, WM_SETTEXT, 0, (LPARAM)"aa");
1305  lo = LOWORD(SendMessageA(hwEdit, EM_POSFROMCHAR, 0, 0));
1306  hi = LOWORD(SendMessageA(hwEdit, EM_POSFROMCHAR, 1, 0));
1307  mid = lo + (hi - lo) / 2 + 1;
1308 
1309  for (i = lo; i < mid; i++)
1310  {
1311  ret = LOWORD(SendMessageA(hwEdit, EM_CHARFROMPOS, 0, i));
1312  ok((0 == ret || 1 == ret /* Vista */), "expected 0 or 1 got %d\n", ret);
1313  }
1314 
1315  for (i = mid; i <= hi; i++)
1316  {
1317  ret = LOWORD(SendMessageA(hwEdit, EM_CHARFROMPOS, 0, i));
1318  ok(1 == ret, "expected 1 got %d\n", ret);
1319  }
1320 
1321  ret = SendMessageA(hwEdit, EM_POSFROMCHAR, 2, 0);
1322  ok(-1 == ret, "expected -1 got %d\n", ret);
1323  DestroyWindow(hwEdit);
1324 }
#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
int ret
#define ok(value,...)
Definition: atltest.h:57
static HWND create_editcontrol(DWORD style, DWORD exstyle)
Definition: edit.c:558
#define ES_AUTOHSCROLL
Definition: pedump.c:672
#define LOWORD(l)
Definition: pedump.c:82

Referenced by START_TEST().

◆ test_child_edit_wmkeydown()

static void test_child_edit_wmkeydown ( void  )
static

Definition at line 2481 of file edit.c.

2482 {
2483  HWND hwEdit, hwParent;
2484  int r;
2485 
2486  hwEdit = create_child_editcontrol(0, 0);
2487  hwParent = GetParent(hwEdit);
2489  r = SendMessageA(hwEdit, WM_KEYDOWN, VK_RETURN, 0x1c0001);
2490  ok(1 == r, "expected 1, got %d\n", r);
2492  destroy_child_editcontrol(hwEdit);
2493 }
static HWND create_child_editcontrol(DWORD style, DWORD exstyle)
Definition: edit.c:582
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:2464
#define WM_KEYDOWN
Definition: winuser.h:1697
static void destroy_child_editcontrol(HWND hwndEdit)
Definition: edit.c:613
static INT_PTR CALLBACK child_edit_wmkeydown_proc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM lparam)
Definition: edit.c:2465
#define SetWindowLongPtrA
Definition: winuser.h:5320
#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 2566 of file edit.c.

2567 {
2569  MSG msg;
2570 
2572  0, 0, 200, 200, NULL, NULL, hinst, NULL);
2573  ok(hwndMain != NULL, "Failed to create control parent.\n");
2574 
2576  0, 0, 150, 50, /* important this not be 0 size. */
2578  ok(hwndEdit != NULL, "Failed to create Edit control.\n");
2579 
2580  SetFocus(NULL);
2583  ok(got_en_setfocus, "edit box didn't get focused\n");
2584  ok(got_wm_capturechanged, "main window capture did not change\n");
2585 
2587 
2588  hwndEdit = CreateWindowA("EDIT", "Test Text",
2590  0, 0, 100, 100,
2591  hwndMain, NULL, hinst, NULL);
2592  memset(&menu_messages, 0, sizeof(menu_messages));
2593  p_edit_proc = (void*)SetWindowLongPtrA(hwndEdit, GWLP_WNDPROC,
2595 
2596  SetFocus(hwndEdit);
2597  SendMessageA(hwndEdit, WM_SETTEXT, 0, (LPARAM)"foo");
2599  while (PeekMessageA(&msg, hwndEdit, 0, 0, PM_REMOVE)) DispatchMessageA(&msg);
2600  ok(menu_messages.wm_command == 0,
2601  "Expected no WM_COMMAND messages, got %d\n", menu_messages.wm_command);
2602  ok(menu_messages.em_setsel == 1,
2603  "Expected 1 EM_SETSEL message, got %d\n", menu_messages.em_setsel);
2604 
2607 }
LRESULT WINAPI DispatchMessageA(_In_ const MSG *)
#define ID_EDITTEST2
Definition: edit.c:33
#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)
static BOOL got_en_setfocus
Definition: edit.c:2495
TW_UINT32 TW_UINT16 TW_UINT16 MSG
Definition: twain.h:1827
HWND WINAPI SetFocus(_In_opt_ HWND)
UINT_PTR WPARAM
Definition: windef.h:207
#define WS_CHILD
Definition: pedump.c:617
static const char szEditTest4Class[]
Definition: edit.c:555
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
#define WC_EDITA
Definition: commctrl.h:4682
#define CreateWindowA(a, b, c, d, e, f, g, h, i, j, k)
Definition: winuser.h:4290
smooth NULL
Definition: ftsmooth.c:416
LONG_PTR LPARAM
Definition: windef.h:208
#define WM_SETTEXT
Definition: winuser.h:1599
static BOOL got_wm_capturechanged
Definition: edit.c:2496
#define SetWindowLongPtrA
Definition: winuser.h:5320
#define GWLP_WNDPROC
Definition: treelist.c:66
static LRESULT CALLBACK child_edit_menu_proc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
Definition: edit.c:2528
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
static struct context_menu_messages menu_messages
Definition: edit.c:2526
#define msg(x)
Definition: auth_time.c:54
#define WS_OVERLAPPEDWINDOW
Definition: pedump.c:637
static HINSTANCE hinst
Definition: edit.c:551
#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_cue_banner()

static void test_cue_banner ( void  )
static

Definition at line 3236 of file edit.c.

3237 {
3238  HWND hwnd_edit;
3239  BOOL ret;
3240  static WCHAR getcuetestW[5] = {'T',0};
3241  static const WCHAR testcmp1W[] = {'T','e','s','t',0};
3242  static const WCHAR testcmp2W[] = {'T','e','s',0};
3243  static const WCHAR emptyW[] = {0};
3244 
3246 
3247  ret = SendMessageW(hwnd_edit, EM_GETCUEBANNER, (WPARAM)getcuetestW, 5);
3248  if (lstrcmpW(getcuetestW, emptyW) != 0)
3249  {
3250  win_skip("skipping for Win XP and 2003 Server.\n");
3251  DestroyWindow(hwnd_edit);
3252  return;
3253  }
3254  ok(lstrcmpW(getcuetestW, emptyW) == 0, "First char is %c\n", getcuetestW[0]);
3255  ok(ret == FALSE, "EM_GETCUEBANNER should have returned FALSE.\n");
3256 
3257  lstrcpyW(getcuetestW, testcmp1W);
3258  ret = SendMessageW(hwnd_edit, EM_GETCUEBANNER, (WPARAM)getcuetestW, 0);
3259  ok(lstrcmpW(getcuetestW, testcmp1W) == 0, "String was %s.\n", wine_dbgstr_w(getcuetestW));
3260  ok(ret == FALSE, "EM_GETCUEBANNER should have returned FALSE.\n");
3261 
3262  ret = SendMessageW(hwnd_edit, EM_GETCUEBANNER, 0, 0);
3263  ok(ret == FALSE, "EM_GETCUEBANNER should have returned FALSE.\n");
3264 
3265  ret = SendMessageW(hwnd_edit, EM_SETCUEBANNER, 0, 0);
3266  ok(ret == FALSE, "EM_SETCUEBANNER should have returned FALSE.\n");
3267 
3268  ret = SendMessageW(hwnd_edit, EM_GETCUEBANNER, 0, 0);
3269  ok(ret == FALSE, "EM_GETCUEBANNER should have returned FALSE.\n");
3270 
3271  lstrcpyW(getcuetestW, testcmp1W);
3272  ret = SendMessageW(hwnd_edit, EM_SETCUEBANNER, 0, (LPARAM)getcuetestW);
3273  ok(ret == TRUE, "EM_SETCUEBANNER should have returned TRUE.\n");
3274 
3275  ret = SendMessageW(hwnd_edit, EM_GETCUEBANNER, 0, 5);
3276  ok(ret == TRUE, "EM_GETCUEBANNER should have returned TRUE.\n");
3277 
3278  ret = SendMessageW(hwnd_edit, EM_GETCUEBANNER, (WPARAM)getcuetestW, 5);
3279  ok(ret == TRUE, "EM_GETCUEBANNER should have returned TRUE.\n");
3280  ok(lstrcmpW(getcuetestW, testcmp1W) == 0, "EM_GETCUEBANNER returned string %s.\n", wine_dbgstr_w(getcuetestW));
3281 
3282  ret = SendMessageW(hwnd_edit, EM_SETCUEBANNER, 0, (LPARAM)emptyW);
3283  ok(ret == TRUE, "EM_SETCUEBANNER should have returned TRUE.\n");
3284 
3285  ret = SendMessageW(hwnd_edit, EM_GETCUEBANNER, (WPARAM)getcuetestW, 5);
3286  ok(ret == TRUE, "EM_GETCUEBANNER should have returned TRUE.\n");
3287  ok(lstrcmpW(getcuetestW, emptyW) == 0, "EM_GETCUEBANNER returned string %s.\n", wine_dbgstr_w(getcuetestW));
3288 
3289  /* EM_GETCUEBANNER's buffer size includes null char */
3290  ret = SendMessageW(hwnd_edit, EM_SETCUEBANNER, 0, (LPARAM)testcmp1W);
3291  ok(ret == TRUE, "EM_SETCUEBANNER should have returned TRUE.\n");
3292  memset(getcuetestW, 0, lstrlenW(testcmp1W)*sizeof(WCHAR));
3293  ret = SendMessageW(hwnd_edit, EM_GETCUEBANNER, (WPARAM)getcuetestW, (LPARAM)lstrlenW(testcmp1W)+1);
3294  ok(ret == TRUE, "EM_GETCUEBANNER should have returned TRUE.\n");
3295  ok(lstrcmpW(getcuetestW, testcmp1W) == 0, "EM_GETCUEBANNER returned string %s.\n", wine_dbgstr_w(getcuetestW));
3296  memset(getcuetestW, 0, lstrlenW(testcmp1W)*sizeof(WCHAR));
3297  ret = SendMessageW(hwnd_edit, EM_GETCUEBANNER, (WPARAM)getcuetestW, (LPARAM)lstrlenW(testcmp1W));
3298  ok(lstrcmpW(getcuetestW, testcmp2W) == 0, "EM_GETCUEBANNER returned string %s.\n", wine_dbgstr_w(getcuetestW));
3299  DestroyWindow(hwnd_edit);
3300 
3301  /* setting cue banner fails for multi-line edit controls */
3303  lstrcpyW(getcuetestW, testcmp1W);
3304  ret = SendMessageW(hwnd_edit, EM_GETCUEBANNER, (WPARAM)getcuetestW, 5);
3305  ok(ret == FALSE, "EM_SETCUEBANNER.\n");
3306  ok(lstrcmpW(getcuetestW, testcmp1W) == 0, "String was %s.\n", wine_dbgstr_w(getcuetestW));
3307  ret = SendMessageW(hwnd_edit, EM_SETCUEBANNER, 0, (LPARAM)getcuetestW);
3308  ok(ret == FALSE, "EM_SETCUEBANNER.\n");
3309 
3310  DestroyWindow(hwnd_edit);
3311 }
#define TRUE
Definition: types.h:120
char * wine_dbgstr_w(const wchar_t *wstr)
Definition: atltest.h:87
int WINAPI lstrcmpW(LPCWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:170
#define ES_MULTILINE
Definition: pedump.c:667
UINT_PTR WPARAM
Definition: windef.h:207
#define lstrlenW
Definition: compat.h:415
BOOL WINAPI DestroyWindow(_In_ HWND)
unsigned int BOOL
Definition: ntddk_ex.h:94
LONG_PTR LPARAM
Definition: windef.h:208
static HWND create_editcontrolW(DWORD style, DWORD exstyle)
Definition: edit.c:571
#define EM_GETCUEBANNER
Definition: commctrl.h:4689
#define EM_SETCUEBANNER
Definition: commctrl.h:4687
#define ES_AUTOVSCROLL
Definition: pedump.c:671
__wchar_t WCHAR
Definition: xmlstorage.h:180
int ret
static const WCHAR emptyW[]
Definition: navigate.c:40
#define lstrcpyW
Definition: compat.h:414
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define ok(value,...)
Definition: atltest.h:57
#define memset(x, y, z)
Definition: compat.h:39
#define win_skip
Definition: test.h:150
#define ES_AUTOHSCROLL
Definition: pedump.c:672

Referenced by START_TEST().

◆ test_dialogmode()

static void test_dialogmode ( void  )
static

Definition at line 2782 of file edit.c.

2783 {
2784  HWND hwEdit, hwParent, hwButton;
2785  MSG msg= {0};
2786  int len, r;
2788 
2789  r = SendMessageA(hwEdit, WM_CHAR, VK_RETURN, 0x1c0001);
2790  ok(1 == r, "expected 1, got %d\n", r);
2791  len = SendMessageA(hwEdit, WM_GETTEXTLENGTH, 0, 0);
2792  ok(11 == len, "expected 11, got %d\n", len);
2793 
2794  r = SendMessageA(hwEdit, WM_GETDLGCODE, 0, 0);
2795  ok(0x8d == r, "expected 0x8d, got 0x%x\n", r);
2796 
2797  r = SendMessageA(hwEdit, WM_CHAR, VK_RETURN, 0x1c0001);
2798  ok(1 == r, "expected 1, got %d\n", r);
2799  len = SendMessageA(hwEdit, WM_GETTEXTLENGTH, 0, 0);
2800  ok(13 == len, "expected 13, got %d\n", len);
2801 
2802  r = SendMessageA(hwEdit, WM_GETDLGCODE, 0, (LPARAM)&msg);
2803  ok(0x8d == r, "expected 0x8d, got 0x%x\n", r);
2804  r = SendMessageA(hwEdit, WM_CHAR, VK_RETURN, 0x1c0001);
2805  ok(1 == r, "expected 1, got %d\n", r);
2806  len = SendMessageA(hwEdit, WM_GETTEXTLENGTH, 0, 0);
2807  ok(13 == len, "expected 13, got %d\n", len);
2808 
2809  r = SendMessageA(hwEdit, WM_CHAR, VK_RETURN, 0x1c0001);
2810  ok(1 == r, "expected 1, got %d\n", r);
2811  len = SendMessageA(hwEdit, WM_GETTEXTLENGTH, 0, 0);
2812  ok(13 == len, "expected 13, got %d\n", len);
2813 
2814  destroy_child_editcontrol(hwEdit);
2815 
2816  hwEdit = create_editcontrol(ES_MULTILINE, 0);
2817 
2818  r = SendMessageA(hwEdit, WM_CHAR, VK_RETURN, 0x1c0001);
2819  ok(1 == r, "expected 1, got %d\n", r);
2820  len = SendMessageA(hwEdit, WM_GETTEXTLENGTH, 0, 0);
2821  ok(11 == len, "expected 11, got %d\n", len);
2822 
2823  msg.hwnd = hwEdit;
2824  msg.message = WM_KEYDOWN;
2825  msg.wParam = VK_BACK;
2826  msg.lParam = 0xe0001;
2827  r = SendMessageA(hwEdit, WM_GETDLGCODE, VK_BACK, (LPARAM)&msg);
2828  ok(0x8d == r, "expected 0x8d, got 0x%x\n", r);
2829 
2830  r = SendMessageA(hwEdit, WM_CHAR, VK_RETURN, 0x1c0001);
2831  ok(1 == r, "expected 1, got %d\n", r);
2832  len = SendMessageA(hwEdit, WM_GETTEXTLENGTH, 0, 0);
2833  ok(11 == len, "expected 11, got %d\n", len);
2834 
2835  DestroyWindow(hwEdit);
2836 
2837  hwEdit = create_child_editcontrol(0, 0);
2838  hwParent = GetParent(hwEdit);
2840 
2841  zero_dm_messages();
2842  r = SendMessageA(hwEdit, WM_KEYDOWN, VK_ESCAPE, 0x10001);
2843  ok(1 == r, "expected 1, got %d\n", r);
2844  test_dm_messages(0, 0, 0, 0);
2845  zero_dm_messages();
2846 
2847  r = SendMessageA(hwEdit, WM_KEYDOWN, VK_TAB, 0xf0001);
2848  ok(1 == r, "expected 1, got %d\n", r);
2849  test_dm_messages(0, 0, 0, 0);
2850  zero_dm_messages();
2851 
2852  msg.hwnd = hwEdit;
2853  msg.message = WM_KEYDOWN;
2854  msg.wParam = VK_TAB;
2855  msg.lParam = 0xf0001;
2856  r = SendMessageA(hwEdit, WM_GETDLGCODE, VK_TAB, (LPARAM)&msg);
2857  ok(0x89 == r, "expected 0x89, got 0x%x\n", r);
2858  test_dm_messages(0, 0, 0, 0);
2859  zero_dm_messages();
2860 
2861  r = SendMessageA(hwEdit, WM_KEYDOWN, VK_TAB, 0xf0001);
2862  ok(1 == r, "expected 1, got %d\n", r);
2863  test_dm_messages(0, 0, 0, 0);
2864  zero_dm_messages();
2865 
2866  destroy_child_editcontrol(hwEdit);
2867 
2869  hwParent = GetParent(hwEdit);
2871 
2872  r = SendMessageA(hwEdit, WM_KEYDOWN, VK_TAB, 0xf0001);
2873  ok(1 == r, "expected 1, got %d\n", r);
2874  test_dm_messages(0, 0, 0, 0);
2875  zero_dm_messages();
2876 
2877  msg.hwnd = hwEdit;
2878  msg.message = WM_KEYDOWN;
2879  msg.wParam = VK_ESCAPE;
2880  msg.lParam = 0x10001;
2882  ok(0x8d == r, "expected 0x8d, got 0x%x\n", r);
2883  test_dm_messages(0, 0, 0, 0);
2884  zero_dm_messages();
2885 
2886  r = SendMessageA(hwEdit, WM_KEYDOWN, VK_ESCAPE, 0x10001);
2887  ok(1 == r, "expected 1, got %d\n", r);
2888  test_dm_messages(0, 0, 0, 0);
2889  zero_dm_messages();
2890 
2891  r = SendMessageA(hwEdit, WM_KEYDOWN, VK_TAB, 0xf0001);
2892  ok(1 == r, "expected 1, got %d\n", r);
2893  test_dm_messages(0, 0, 0, 1);
2894  zero_dm_messages();
2895 
2896  r = SendMessageA(hwEdit, WM_KEYDOWN, VK_RETURN, 0x1c0001);
2897  ok(1 == r, "expected 1, got %d\n", r);
2898  test_dm_messages(0, 0, 1, 0);
2899  zero_dm_messages();
2900 
2901  hwButton = CreateWindowA("BUTTON", "OK", WS_VISIBLE|WS_CHILD|BS_PUSHBUTTON,
2902  100, 100, 50, 20, hwParent, (HMENU)ID_EDITTESTDBUTTON, hinst, NULL);
2903  ok(hwButton!=NULL, "CreateWindow failed with error code %d\n", GetLastError());
2904 
2905  r = SendMessageA(hwEdit, WM_KEYDOWN, VK_RETURN, 0x1c0001);
2906  ok(1 == r, "expected 1, got %d\n", r);
2907  test_dm_messages(0, 0, 1, 1);
2908  zero_dm_messages();
2909 
2910  DestroyWindow(hwButton);
2911  destroy_child_editcontrol(hwEdit);
2912 }
#define WM_GETTEXTLENGTH
Definition: winuser.h:1601
static HWND create_child_editcontrol(DWORD style, DWORD exstyle)
Definition: edit.c:582
#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
static LRESULT CALLBACK dialog_mode_wnd_proc(HWND hwnd, UINT iMsg, WPARAM wParam, LPARAM lParam)
Definition: edit.c:2761
#define VK_ESCAPE
Definition: winuser.h:2189
BOOL WINAPI DestroyWindow(_In_ HWND)
#define VK_RETURN
Definition: winuser.h:2176
static void zero_dm_messages(void)
Definition: edit.c:2743
#define CreateWindowA(a, b, c, d, e, f, g, h, i, j, k)
Definition: winuser.h:4290
smooth NULL
Definition: ftsmooth.c:416
#define WM_KEYDOWN
Definition: winuser.h:1697
LONG_PTR LPARAM
Definition: windef.h:208
static void destroy_child_editcontrol(HWND hwndEdit)
Definition: edit.c:613
GLenum GLsizei len
Definition: glext.h:6722
#define SetWindowLongPtrA
Definition: winuser.h:5320
#define VK_BACK
Definition: winuser.h:2173
#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 HWND create_editcontrol(DWORD style, DWORD exstyle)
Definition: edit.c:558
#define msg(x)
Definition: auth_time.c:54
static HINSTANCE hinst
Definition: edit.c:551
#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
#define test_dm_messages(wmcommand, wmclose, wmgetdefid, wmnextdlgctl)
Definition: edit.c:2751
#define ID_EDITTESTDBUTTON
Definition: edit.c:32

Referenced by START_TEST().

◆ test_edit_control_1()

static void test_edit_control_1 ( void  )
static

Definition at line 676 of file edit.c.

677 {
678  HWND hwEdit;
679  MSG msMessage;
680  int i;
681  LONG r;
682 
683  msMessage.message = WM_KEYDOWN;
684 
685  trace("EDIT: Single line\n");
687  r = get_edit_style(hwEdit);
688  ok(r == (ES_AUTOVSCROLL | ES_AUTOHSCROLL), "Wrong style expected 0xc0 got: 0x%x\n", r);
689  for (i = 0; i < 65535; i++)
690  {
691  msMessage.wParam = i;
692  r = SendMessageA(hwEdit, WM_GETDLGCODE, 0, (LPARAM) &msMessage);
694  "Expected DLGC_WANTCHARS | DLGC_HASSETSEL | DLGC_WANTARROWS got %x\n", r);
695  }
696  DestroyWindow(hwEdit);
697 
698  trace("EDIT: Single line want returns\n");
700  r = get_edit_style(hwEdit);
701  ok(r == (ES_AUTOVSCROLL | ES_AUTOHSCROLL | ES_WANTRETURN), "Wrong style expected 0x10c0 got: 0x%x\n", r);
702  for (i = 0; i < 65535; i++)
703  {
704  msMessage.wParam = i;
705  r = SendMessageA(hwEdit, WM_GETDLGCODE, 0, (LPARAM) &msMessage);
707  "Expected DLGC_WANTCHARS | DLGC_HASSETSEL | DLGC_WANTARROWS got %x\n", r);
708  }
709  DestroyWindow(hwEdit);
710 
711  trace("EDIT: Multiline line\n");
713  r = get_edit_style(hwEdit);
714  ok(r == (ES_AUTOHSCROLL | ES_AUTOVSCROLL | ES_MULTILINE), "Wrong style expected 0xc4 got: 0x%x\n", r);
715  for (i = 0; i < 65535; i++)
716  {
717  msMessage.wParam = i;
718  r = SendMessageA(hwEdit, WM_GETDLGCODE, 0, (LPARAM) &msMessage);
720  "Expected DLGC_WANTCHARS | DLGC_HASSETSEL | DLGC_WANTALLKEYS | DLGC_WANTARROWS got %x\n", r);
721  }
722  DestroyWindow(hwEdit);
723 
724  trace("EDIT: Multi line want returns\n");
726  r = get_edit_style(hwEdit);
727  ok(r == (ES_WANTRETURN | ES_AUTOHSCROLL | ES_AUTOVSCROLL | ES_MULTILINE), "Wrong style expected 0x10c4 got: 0x%x\n", r);
728  for (i = 0; i < 65535; i++)
729  {
730  msMessage.wParam = i;
731  r = SendMessageA(hwEdit, WM_GETDLGCODE, 0, (LPARAM) &msMessage);
733  "Expected DLGC_WANTCHARS | DLGC_HASSETSEL | DLGC_WANTALLKEYS | DLGC_WANTARROWS got %x\n", r);
734  }
735  DestroyWindow(hwEdit);
736 }
#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
static LONG get_edit_style(HWND hwnd)
Definition: edit.c:623
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
#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
static HWND create_editcontrol(DWORD style, DWORD exstyle)
Definition: edit.c:558
#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 744 of file edit.c.

745 {
746  HWND hwndMain, phwnd;
747  char szLocalString[MAXLEN];
748  LONG r, w = 150, h = 50;
749  POINT cpos;
750 
751  /* Create main and edit windows. */
753  0, 0, 200, 200, NULL, NULL, hinst, NULL);
754  ok(hwndMain != NULL, "Failed to create control parent.\n");
757 
759  0, 0, w, h, /* important this not be 0 size. */
761  ok(hwndET2 != NULL, "Failed to create Edit control.\n");
764 
765  trace("EDIT: SETTEXT atomicity\n");
766  /* Send messages to "type" in the word 'foo'. */
767  r = SendMessageA(hwndET2, WM_CHAR, 'f', 1);
768  ok(1 == r, "Expected: %d, got: %d\n", 1, r);
769  r = SendMessageA(hwndET2, WM_CHAR, 'o', 1);
770  ok(1 == r, "Expected: %d, got: %d\n", 1, r);
771  r = SendMessageA(hwndET2, WM_CHAR, 'o', 1);
772  ok(1 == r, "Expected: %d, got: %d\n", 1, r);
773  /* 'foo' should have been changed to 'bar' by the UPDATE handler. */
774  GetWindowTextA(hwndET2, szLocalString, MAXLEN);
775  ok(strcmp(szLocalString, "bar")==0,
776  "Wrong contents of edit: %s\n", szLocalString);
777 
778  /* try setting the caret before it's visible */
779  r = SetCaretPos(0, 0);
780  todo_wine ok(0 == r, "SetCaretPos succeeded unexpectedly, expected: 0, got: %d\n", r);
781  phwnd = SetFocus(hwndET2);
782  ok(phwnd != NULL, "SetFocus failed unexpectedly, expected non-zero, got NULL\n");
783  r = SetCaretPos(0, 0);
784  ok(1 == r, "SetCaretPos failed unexpectedly, expected: 1, got: %d\n", r);
785  r = GetCaretPos(&cpos);
786  ok(1 == r, "GetCaretPos failed unexpectedly, expected: 1, got: %d\n", r);
787  ok(cpos.x == 0 && cpos.y == 0, "Wrong caret position, expected: (0,0), got: (%d,%d)\n", cpos.x, cpos.y);
788  r = SetCaretPos(-1, -1);
789  ok(1 == r, "SetCaretPos failed unexpectedly, expected: 1, got: %d\n", r);
790  r = GetCaretPos(&cpos);
791  ok(1 == r, "GetCaretPos failed unexpectedly, expected: 1, got: %d\n", r);
792  ok(cpos.x == -1 && cpos.y == -1, "Wrong caret position, expected: (-1,-1), got: (%d,%d)\n", cpos.x, cpos.y);
793  r = SetCaretPos(w << 1, h << 1);
794  ok(1 == r, "SetCaretPos failed unexpectedly, expected: 1, got: %d\n", r);
795  r = GetCaretPos(&cpos);
796  ok(1 == r, "GetCaretPos failed unexpectedly, expected: 1, got: %d\n", r);
797  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);
798  r = SetCaretPos(w, h);
799  ok(1 == r, "SetCaretPos failed unexpectedly, expected: 1, got: %d\n", r);
800  r = GetCaretPos(&cpos);
801  ok(1 == r, "GetCaretPos failed unexpectedly, expected: 1, got: %d\n", r);
802  ok(cpos.x == w && cpos.y == h, "Wrong caret position, expected: (%d,%d), got: (%d,%d)\n", w, h, cpos.x, cpos.y);
803  r = SetCaretPos(w - 1, h - 1);
804  ok(1 == r, "SetCaretPos failed unexpectedly, expected: 1, got: %d\n", r);
805  r = GetCaretPos(&cpos);
806  ok(1 == r, "GetCaretPos failed unexpectedly, expected: 1, got: %d\n", r);
807  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);
808 
811 }
#define ID_EDITTEST2
Definition: edit.c:33
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
static const char szEditTest2Class[]
Definition: edit.c:553
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 WC_EDITA
Definition: commctrl.h:4682
long LONG
Definition: pedump.c:60
#define CreateWindowA(a, b, c, d, e, f, g, h, i, j, k)
Definition: winuser.h:4290
smooth NULL
Definition: ftsmooth.c:416
#define SW_SHOW
Definition: winuser.h:769
#define MAXLEN
Definition: edit.c:34
#define trace
Definition: atltest.h:70
#define todo_wine
Definition: test.h:163
#define WS_BORDER
Definition: pedump.c:625
#define ok(value,...)
Definition: atltest.h:57
static HWND hwndET2
Definition: edit.c:552
#define WS_OVERLAPPEDWINDOW
Definition: pedump.c:637
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469
static HINSTANCE hinst
Definition: edit.c:551
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 946 of file edit.c.

947 {
948  static const char *str = "this is a long string.";
949  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.";
950  HWND hWnd, hParent;
951  int len, dpi;
952  HDC hDC;
953 
954  hDC = GetDC(NULL);
956  ReleaseDC(NULL, hDC);
957 
958  trace("EDIT: Test notifications\n");
959 
962  NULL,
963  0,
964  CW_USEDEFAULT, CW_USEDEFAULT, 10, 10,
965  NULL, NULL, NULL, NULL);
966  ok(hParent != NULL, "Failed to create control parent.\n");
967 
968  trace("EDIT: Single line, no ES_AUTOHSCROLL\n");
969  hWnd = CreateWindowExA(0, WC_EDITA, NULL, 0, 10, 10, 50, 50, hParent, NULL, NULL, NULL);
970  ok(hWnd != NULL, "Failed to create Edit control.\n");
971 
972  zero_notify();
975  if (len == lstrlenA(str)) /* Win 8 */
976  test_notify(1, 0, 1);
977  else
978  test_notify(1, 1, 1);
979 
981  zero_notify();
984  ok(1 == len, "wrong text length, expected 1, got %d\n", len);
985  test_notify(1, 0, 1);
986 
987  zero_notify();
990  ok(lstrlenA(str) == len, "text shouldn't have been truncated\n");
991  test_notify(1, 0, 1);
992 
993  len = SendMessageA(hWnd, EM_GETSEL, 0, 0);
994  ok(LOWORD(len)==0, "Unexpected start position for selection %d\n", LOWORD(len));
995  ok(HIWORD(len)==0, "Unexpected end position for selection %d\n", HIWORD(len));
997  len = SendMessageA(hWnd, EM_GETSEL, 0, 0);
998  ok(LOWORD(len)==0, "Unexpected start position for selection %d\n", LOWORD(len));
999  ok(HIWORD(len)==0, "Unexpected end position for selection %d\n", HIWORD(len));
1000 
1002 
1003  SendMessageA(hWnd, WM_SETTEXT, 0, (LPARAM)"");
1004  zero_notify();
1007  ok(5 == len, "text should have been truncated to limit, expected 5, got %d\n", len);
1008  test_notify(1, 1, 1);
1009 
1010  zero_notify();
1013  ok(lstrlenA(str) == len, "text shouldn't have been truncated\n");
1014  test_notify(1, 0, 1);
1015 
1017 
1018  trace("EDIT: Single line, ES_AUTOHSCROLL\n");
1019  hWnd = CreateWindowExA(0, WC_EDITA, NULL, ES_AUTOHSCROLL, 10, 10, 50, 50, hParent, NULL, NULL, NULL);
1020  ok(hWnd != NULL, "Failed to create Edit control.\n");
1021 
1022  zero_notify();
1025  ok(lstrlenA(str) == len, "text shouldn't have been truncated\n");
1026  test_notify(1, 0, 1);
1027 
1028  zero_notify();
1031  ok(lstrlenA(str) == len, "text shouldn't have been truncated\n");
1032  test_notify(1, 0, 1);
1033 
1034  SendMessageA(hWnd, WM_SETTEXT, 0, (LPARAM)"");
1035  zero_notify();
1036  SendMessageA(hWnd, EM_REPLACESEL, 0, (LPARAM)str2);
1038  ok(lstrlenA(str2) == len, "text shouldn't have been truncated\n");
1039  test_notify(1, 0, 1);
1040 
1041  zero_notify();
1042  SendMessageA(hWnd, WM_SETTEXT, 0, (LPARAM)str2);
1044  ok(lstrlenA(str2) == len, "text shouldn't have been truncated\n");
1045  test_notify(1, 0, 1);
1046 
1048 
1049  SendMessageA(hWnd, WM_SETTEXT, 0, (LPARAM)"");
1050  zero_notify();
1053  ok(5 == len, "text should have been truncated to limit, expected 5, got %d\n", len);
1054  test_notify(1, 1, 1);
1055 
1056  zero_notify();
1059  ok(lstrlenA(str) == len, "text shouldn't have been truncated\n");
1060  test_notify(1, 0, 1);
1061 
1063 
1064  trace("EDIT: Multline, no ES_AUTOHSCROLL, no ES_AUTOVSCROLL\n");
1066  10, 10, (50 * dpi) / 96, (50 * dpi) / 96,
1067  hParent, NULL, NULL, NULL);
1068  ok(hWnd != NULL, "Failed to create Edit control.\n");
1069 
1070  zero_notify();
1073  if (len == lstrlenA(str)) /* Win 8 */
1074  test_notify(1, 0, 1);
1075  else
1076  {
1077  ok(0 == len, "text should have been truncated, expected 0, got %d\n", len);
1078  test_notify(1, 1, 1);
1079  }
1080 
1081  SendMessageA(hWnd, WM_SETTEXT, 0, (LPARAM)"");
1082  zero_notify();
1085  ok(1 == SendMessageA(hWnd, WM_GETTEXTLENGTH, 0, 0), "wrong text length, expected 1, got %d\n", len);
1086  test_notify(1, 0, 1);
1087 
1088  zero_notify();
1091  ok(lstrlenA(str) == len, "text shouldn't have been truncated\n");
1092  test_notify(0, 0, 0);
1093 
1095 
1096  SendMessageA(hWnd, WM_SETTEXT, 0, (LPARAM)"");
1097  zero_notify();
1100  ok(5 == len, "text should have been truncated to limit, expected 5, got %d\n", len);
1101  test_notify(1, 1, 1);
1102 
1103  zero_notify();
1106  ok(lstrlenA(str) == len, "text shouldn't have been truncated\n");
1107  test_notify(0, 0, 0);
1108 
1110 
1111  trace("EDIT: Multline, ES_AUTOHSCROLL, no ES_AUTOVSCROLL\n");
1113  10, 10, (50 * dpi) / 96, (50 * dpi) / 96,
1114  hParent, NULL, NULL, NULL);
1115  ok(hWnd != NULL, "Failed to create Edit control.\n");
1116 
1117  zero_notify();
1118  SendMessageA(hWnd, EM_REPLACESEL, 0, (LPARAM)str2);
1120  ok(0 == len, "text should have been truncated, expected 0, got %d\n", len);
1121  test_notify(1, 1, 1);
1122 
1123  SendMessageA(hWnd, WM_SETTEXT, 0, (LPARAM)"");
1124  zero_notify();
1127  ok(1 == SendMessageA(hWnd, WM_GETTEXTLENGTH, 0, 0), "wrong text length, expected 1, got %d\n", len);
1128  test_notify(1, 0, 1);
1129 
1130  zero_notify();
1131  SendMessageA(hWnd, WM_SETTEXT, 0, (LPARAM)str2);
1133  ok(lstrlenA(str2) == len, "text shouldn't have been truncated\n");
1134  test_notify(0, 0, 0);
1135 
1137 
1138  SendMessageA(hWnd, WM_SETTEXT, 0, (LPARAM)"");
1139  zero_notify();
1140  SendMessageA(hWnd, EM_REPLACESEL, 0, (LPARAM)str2);
1142  ok(5 == len, "text should have been truncated to limit, expected 5, got %d\n", len);
1143  test_notify(1, 1, 1);
1144 
1145  zero_notify();
1146  SendMessageA(hWnd, WM_SETTEXT, 0, (LPARAM)str2);
1148  ok(lstrlenA(str2) == len, "text shouldn't have been truncated\n");
1149  test_notify(0, 0, 0);
1150 
1152 
1153  trace("EDIT: Multline, ES_AUTOHSCROLL and ES_AUTOVSCROLL\n");
1155  10, 10, 50, 50, hParent, NULL, NULL, NULL);
1156  ok(hWnd != NULL, "Failed to create Edit control.\n");
1157 
1158  zero_notify();
1159  SendMessageA(hWnd, EM_REPLACESEL, 0, (LPARAM)str2);
1161  ok(lstrlenA(str2) == len, "text shouldn't have been truncated\n");
1162  test_notify(1, 0, 1);
1163 
1164  zero_notify();
1165  SendMessageA(hWnd, WM_SETTEXT, 0, (LPARAM)str2);
1167  ok(lstrlenA(str2) == len, "text shouldn't have been truncated\n");
1168  test_notify(0, 0, 0);
1169 
1171 
1172  SendMessageA(hWnd, WM_SETTEXT, 0, (LPARAM)"");
1173  zero_notify();
1174  SendMessageA(hWnd, EM_REPLACESEL, 0, (LPARAM)str2);
1176  ok(5 == len, "text should have been truncated to limit, expected 5, got %d\n", len);
1177  test_notify(1, 1, 1);
1178 
1179  zero_notify();
1180  SendMessageA(hWnd, WM_SETTEXT, 0, (LPARAM)str2);
1182  ok(lstrlenA(str2) == len, "text shouldn't have been truncated\n");
1183  test_notify(0, 0, 0);
1184 
1186 }
#define WM_GETTEXTLENGTH
Definition: winuser.h:1601
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
static void zero_notify(void)
Definition: edit.c:844
BOOL WINAPI DestroyWindow(_In_ HWND)
#define EM_GETSEL
Definition: winuser.h:1979
#define WC_EDITA
Definition: commctrl.h:4682
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
static const char szEditTest3Class[]
Definition: edit.c:554
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
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
#define test_notify(enchange, enmaxtext, enupdate)
Definition: edit.c:851

Referenced by START_TEST().

◆ test_edit_control_5()

static void test_edit_control_5 ( void  )
static

Definition at line 1329 of file edit.c.

1330 {
1331  static const char *str = "test\r\ntest";
1332  HWND parentWnd;
1333  HWND hWnd;
1334  int len;
1335  RECT rc1 = { 10, 10, 11, 11};
1336  RECT rc;
1337 
1338  /* first show that a non-child won't do for this test */
1339  hWnd = CreateWindowExA(0, WC_EDITA, str, 0, 10, 10, 1, 1, NULL, NULL, NULL, NULL);
1340  ok(hWnd != NULL, "Failed to create Edit control.\n");
1341 
1342  /* size of non-child edit control is (much) bigger than requested */
1343  GetWindowRect( hWnd, &rc);
1344  ok( rc.right - rc.left > 20, "size of the window (%d) is smaller than expected\n",
1345  rc.right - rc.left);
1347  /* so create a parent, and give it edit controls children to test with */
1348  parentWnd = CreateWindowExA(0,
1350  "Edit Test", WS_VISIBLE |
1353  250, 250,
1354  NULL, NULL, hinst, NULL);
1355  ok(parentWnd != NULL, "Failed to create control parent.\n");
1356  ShowWindow( parentWnd, SW_SHOW);
1357  /* single line */
1359  rc1.left, rc1.top, rc1.right - rc1.left, rc1.bottom - rc1.top,
1360  parentWnd, NULL, NULL, NULL);
1361  ok(hWnd != NULL, "Failed to create Edit control.\n");
1362  GetClientRect( hWnd, &rc);
1363  ok( rc.right == rc1.right - rc1.left && rc.bottom == rc1.bottom - rc1.top,
1364  "Client rectangle not the expected size %s\n", wine_dbgstr_rect( &rc ));
1366  ok(lstrlenA(str) == len, "text shouldn't have been truncated\n");
1368  /* multi line */
1370  rc1.left, rc1.top, rc1.right - rc1.left, rc1.bottom - rc1.top,
1371  parentWnd, NULL, NULL, NULL);
1372  ok(hWnd != NULL, "Failed to create Edit control.\n");
1373  GetClientRect( hWnd, &rc);
1374  ok( rc.right == rc1.right - rc1.left && rc.bottom == rc1.bottom - rc1.top,
1375  "Client rectangle not the expected size %s\n", wine_dbgstr_rect( &rc ));
1377  ok(lstrlenA(str) == len, "text shouldn't have been truncated\n");
1379  DestroyWindow(parentWnd);
1380 }
#define WM_GETTEXTLENGTH
Definition: winuser.h:1601
static const char szEditTextPositionClass[]
Definition: edit.c:556
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:307
#define WS_CHILD
Definition: pedump.c:617
LONG left
Definition: windef.h:306
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
LONG right
Definition: windef.h:308
BOOL WINAPI DestroyWindow(_In_ HWND)
#define WC_EDITA
Definition: commctrl.h:4682
#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)
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
static HINSTANCE hinst
Definition: edit.c:551
LONG bottom
Definition: windef.h:309
BOOL WINAPI GetWindowRect(_In_ HWND, _Out_ LPRECT)
#define WS_VISIBLE
Definition: pedump.c:620

Referenced by START_TEST().

◆ test_edit_control_6()

static void test_edit_control_6 ( void  )
static

Definition at line 1385 of file edit.c.

1386 {
1387  static const char *str = "test\r\ntest";
1388  char buf[MAXLEN];
1389  HWND hWnd;
1390  LONG ret;
1391 
1392  hWnd = CreateWindowExA(0, "EDIT", "Test", 0, 10, 10, 1, 1, NULL, NULL, hinst, NULL);
1393  ok(hWnd != NULL, "Failed to create edit control.\n");
1394 
1396  ok(ret == TRUE, "Expected %d, got %d\n", TRUE, ret);
1398  ok(ret == strlen(str), "Expected %s, got len %d\n", str, ret);
1399  ok(!strcmp(buf, str), "Expected %s, got %s\n", str, buf);
1400 
1401  buf[0] = 0;
1402  ret = SendMessageA(hWnd, WM_DESTROY, 0, 0);
1403 todo_wine
1404  ok(ret == 1, "Unexpected return value %d\n", ret);
1406  ok(ret == strlen(str), "Expected %s, got len %d\n", str, ret);
1407  ok(!strcmp(buf, str), "Expected %s, got %s\n", str, buf);
1408 
1409  buf[0] = 0;
1410  ret = SendMessageA(hWnd, WM_NCDESTROY, 0, 0);
1411  ok(ret == 0, "Expected 0, got %d\n", ret);
1413 todo_wine {
1414  ok(ret == strlen("Test"), "Unexpected text length %d\n", ret);
1415  ok(!strcmp(buf, "Test"), "Unexpected text %s\n", buf);
1416 }
1418 }
#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
BOOL WINAPI DestroyWindow(_In_ HWND)
long LONG
Definition: pedump.c:60
const WCHAR * str
smooth NULL
Definition: ftsmooth.c:416
LONG_PTR LPARAM
Definition: windef.h:208
#define MAXLEN
Definition: edit.c:34
#define WM_SETTEXT
Definition: winuser.h:1599
#define WM_DESTROY
Definition: winuser.h:1591
#define WM_NCDESTROY
Definition: winuser.h:1666
int ret
#define todo_wine
Definition: test.h:163
#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
static HINSTANCE hinst
Definition: edit.c:551

Referenced by START_TEST().

◆ test_edit_control_limittext()

static void test_edit_control_limittext ( void  )
static

Definition at line 1420 of file edit.c.

1421 {
1422  HWND hwEdit;
1423  DWORD r;
1424 
1425  /* Test default limit for single-line control */
1426  trace("EDIT: buffer limit for single-line\n");
1428  r = SendMessageA(hwEdit, EM_GETLIMITTEXT, 0, 0);
1429  ok(r == 30000, "Incorrect default text limit, expected 30000 got %u\n", r);
1430  SendMessageA(hwEdit, EM_SETLIMITTEXT, 0, 0);
1431  r = SendMessageA(hwEdit, EM_GETLIMITTEXT, 0, 0);
1432  ok( r == 2147483646, "got limit %u (expected 2147483646)\n", r);
1433  DestroyWindow(hwEdit);
1434 
1435  /* Test default limit for multi-line control */
1436  trace("EDIT: buffer limit for multi-line\n");
1438  r = SendMessageA(hwEdit, EM_GETLIMITTEXT, 0, 0);
1439  ok(r == 30000, "Incorrect default text limit, expected 30000 got %u\n", r);
1440  SendMessageA(hwEdit, EM_SETLIMITTEXT, 0, 0);
1441  r = SendMessageA(hwEdit, EM_GETLIMITTEXT, 0, 0);
1442  ok( r == 4294967295U, "got limit %u (expected 4294967295)\n", r);
1443  DestroyWindow(hwEdit);
1444 }
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
static HWND create_editcontrol(DWORD style, DWORD exstyle)
Definition: edit.c:558
#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 1447 of file edit.c.

1448 {
1449  static const char *single_line_str = "a";
1450  static const char *multiline_str = "Test\r\nText";
1451  HWND hwEdit;
1452  LONG ret;
1453 
1454  /* Check the return value when EM_SCROLL doesn't scroll
1455  * anything. Should not return true unless any lines were actually
1456  * scrolled. */
1457  hwEdit = CreateWindowA(WC_EDITA, single_line_str, WS_VSCROLL | ES_MULTILINE,
1458  1, 1, 100, 100, NULL, NULL, hinst, NULL);
1459  ok(hwEdit != NULL, "Failed to create Edit control.\n");
1460 
1461  ret = SendMessageA(hwEdit, EM_SCROLL, SB_PAGEDOWN, 0);
1462  ok(!ret, "Returned %x, expected 0.\n", ret);
1463 
1464  ret = SendMessageA(hwEdit, EM_SCROLL, SB_PAGEUP, 0);
1465  ok(!ret, "Returned %x, expected 0.\n", ret);
1466 
1467  ret = SendMessageA(hwEdit, EM_SCROLL, SB_LINEUP, 0);
1468  ok(!ret, "Returned %x, expected 0.\n", ret);
1469 
1470  ret = SendMessageA(hwEdit, EM_SCROLL, SB_LINEDOWN, 0);
1471  ok(!ret, "Returned %x, expected 0.\n", ret);
1472 
1473  DestroyWindow (hwEdit);
1474 
1475  /* SB_PAGEDOWN while at the beginning of a buffer with few lines
1476  should not cause EM_SCROLL to return a negative value of
1477  scrolled lines that would put us "before" the beginning. */
1478  hwEdit = CreateWindowA(WC_EDITA, multiline_str, WS_VSCROLL | ES_MULTILINE,
1479  0, 0, 100, 100, NULL, NULL, hinst, NULL);
1480  ok(hwEdit != NULL, "Failed to create Edit control.\n");
1481 
1482  ret = SendMessageA(hwEdit, EM_SCROLL, SB_PAGEDOWN, 0);
1483  ok(!ret, "Returned %x, expected 0.\n", ret);
1484 
1485  DestroyWindow (hwEdit);
1486 }
#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
BOOL WINAPI DestroyWindow(_In_ HWND)
#define WC_EDITA
Definition: commctrl.h:4682
long LONG
Definition: pedump.c:60
#define CreateWindowA(a, b, c, d, e, f, g, h, i, j, k)
Definition: winuser.h:4290
smooth NULL
Definition: ftsmooth.c:416
#define EM_SCROLL
Definition: winuser.h:1989
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
static HINSTANCE hinst
Definition: edit.c:551

Referenced by START_TEST().

◆ test_edit_dialog()

static void test_edit_dialog ( void  )
static

Definition at line 2308 of file edit.c.

2309 {
2310  int r;
2311 
2312  /* from bug 11841 */
2313  r = DialogBoxParamA(hinst, "EDIT_READONLY_DIALOG", NULL, edit_dialog_proc, 0);
2314  ok(333 == r, "Expected %d, got %d\n", 333, r);
2315  r = DialogBoxParamA(hinst, "EDIT_READONLY_DIALOG", NULL, edit_dialog_proc, 1);
2316  ok(111 == r, "Expected %d, got %d\n", 111, r);
2317  r = DialogBoxParamA(hinst, "EDIT_READONLY_DIALOG", NULL, edit_dialog_proc, 2);
2318  ok(444 == r, "Expected %d, got %d\n", 444, r);
2319 
2320  /* more tests for WM_CHAR */
2321  r = DialogBoxParamA(hinst, "EDIT_READONLY_DIALOG", NULL, edit_dialog_proc, 3);
2322  ok(444 == r, "Expected %d, got %d\n", 444, r);
2323  r = DialogBoxParamA(hinst, "EDIT_READONLY_DIALOG", NULL, edit_dialog_proc, 4);
2324  ok(444 == r, "Expected %d, got %d\n", 444, r);
2325  r = DialogBoxParamA(hinst, "EDIT_READONLY_DIALOG", NULL, edit_dialog_proc, 5);
2326  ok(444 == r, "Expected %d, got %d\n", 444, r);
2327 
2328  /* more tests for WM_KEYDOWN + WM_CHAR */
2329  r = DialogBoxParamA(hinst, "EDIT_READONLY_DIALOG", NULL, edit_dialog_proc, 6);
2330  ok(444 == r, "Expected %d, got %d\n", 444, r);
2331  r = DialogBoxParamA(hinst, "EDIT_READONLY_DIALOG", NULL, edit_dialog_proc, 7);
2332  ok(444 == r, "Expected %d, got %d\n", 444, r);
2333  r = DialogBoxParamA(hinst, "EDIT_READONLY_DIALOG", NULL, edit_dialog_proc, 8);
2334  ok(444 == r, "Expected %d, got %d\n", 444, r);
2335 
2336  /* tests with an editable edit control */
2337  r = DialogBoxParamA(hinst, "EDIT_DIALOG", NULL, edit_dialog_proc, 0);
2338  ok(333 == r, "Expected %d, got %d\n", 333, r);
2339  r = DialogBoxParamA(hinst, "EDIT_DIALOG", NULL, edit_dialog_proc, 1);
2340  ok(111 == r, "Expected %d, got %d\n", 111, r);
2341  r = DialogBoxParamA(hinst, "EDIT_DIALOG", NULL, edit_dialog_proc, 2);
2342  ok(444 == r, "Expected %d, got %d\n", 444, r);
2343 
2344  /* tests for WM_CHAR */
2345  r = DialogBoxParamA(hinst, "EDIT_DIALOG", NULL, edit_dialog_proc, 3);
2346  ok(444 == r, "Expected %d, got %d\n", 444, r);
2347  r = DialogBoxParamA(hinst, "EDIT_DIALOG", NULL, edit_dialog_proc, 4);
2348  ok(444 == r, "Expected %d, got %d\n", 444, r);
2349  r = DialogBoxParamA(hinst, "EDIT_DIALOG", NULL, edit_dialog_proc, 5);
2350  ok(444 == r, "Expected %d, got %d\n", 444, r);
2351 
2352  /* tests for WM_KEYDOWN + WM_CHAR */
2353  r = DialogBoxParamA(hinst, "EDIT_DIALOG", NULL, edit_dialog_proc, 6);
2354  ok(444 == r, "Expected %d, got %d\n", 444, r);
2355  r = DialogBoxParamA(hinst, "EDIT_DIALOG", NULL, edit_dialog_proc, 7);
2356  ok(444 == r, "Expected %d, got %d\n", 444, r);
2357  r = DialogBoxParamA(hinst, "EDIT_DIALOG", NULL, edit_dialog_proc, 8);
2358  ok(444 == r, "Expected %d, got %d\n", 444, r);
2359 
2360  /* multiple tab tests */
2361  r = DialogBoxParamA(hinst, "EDIT_DIALOG", NULL, edit_dialog_proc, 9);
2362  ok(22 == r, "Expected %d, got %d\n", 22, r);
2363  r = DialogBoxParamA(hinst, "EDIT_DIALOG", NULL, edit_dialog_proc, 10);
2364  ok(33 == r, "Expected %d, got %d\n", 33, r);
2365 }
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
smooth NULL
Definition: ftsmooth.c:416
static INT_PTR CALLBACK edit_dialog_proc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM lparam)
Definition: edit.c:155
#define ok(value,...)
Definition: atltest.h:57
static HINSTANCE hinst
Definition: edit.c:551
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 2914 of file edit.c.

2915 {
2916  static const WCHAR str1W[] = {'1','1','1','1','+','1','1','1','1','+','1','1','1','1','#',0};
2917  static const WCHAR str2W[] = {'2','2','2','2','-','2','2','2','2','-','2','2','2','2','-','2','2','2','2','#',0};
2918  static const char str0[] = "untouched";
2919  static const char str1[] = "1111+1111+1111#";
2920  static const char str1_1[] = "2111+1111+1111#";
2921  static const char str2[] = "2222-2222-2222-2222#";
2922  static const char str3[] = "3333*3333*3333*3333*3333#";
2923  CHAR current[42];
2924  HWND hEdit;
2925  HLOCAL hmem;
2926  HLOCAL hmem2;
2927  HLOCAL halloc;
2928  WCHAR *buffer;
2929  int len;
2930  int r;
2931 
2932  trace("EDIT: EM_GETHANDLE\n");