ReactOS  0.4.13-dev-257-gfabbd7c
editor.c File Reference
#include <stdarg.h>
#include <stdio.h>
#include <assert.h>
#include <windef.h>
#include <winbase.h>
#include <wingdi.h>
#include <winuser.h>
#include <winnls.h>
#include <ole2.h>
#include <richedit.h>
#include <richole.h>
#include <commdlg.h>
#include <time.h>
#include <wine/test.h>
Include dependency graph for editor.c:

Go to the source code of this file.

Classes

struct  find_s
 
struct  getline_s
 
struct  exsetsel_s
 
struct  StringWithLength
 
struct  dialog_mode_messages
 

Macros

#define COBJMACROS
 
#define ID_RICHEDITTESTDBUTTON   0x123
 
#define ok_w3(format, szString1, szString2, szString3)
 
#define ENABLE_WS_VSCROLL(hwnd)   SetWindowLongA(hwnd, GWL_STYLE, GetWindowLongA(hwnd, GWL_STYLE) | WS_VSCROLL)
 
#define DISABLE_WS_VSCROLL(hwnd)   SetWindowLongA(hwnd, GWL_STYLE, GetWindowLongA(hwnd, GWL_STYLE) & ~WS_VSCROLL)
 
#define TEST_SETTEXT(a, b)
 
#define TEST_SETTEXTW(a, b)
 
#define MAX_BUF_LEN   1024
 
#define set_textA(hwnd, wm_set_text, txt)
 
#define expect_textA(hwnd, wm_get_text, txt)
 
#define set_textW(hwnd, wm_set_text, txt)
 
#define expect_textW(hwnd, wm_get_text, txt)
 
#define expect_empty(hwnd, wm_get_text)
 
#define CURSOR_CLIENT_X   5
 
#define CURSOR_CLIENT_Y   5
 
#define WP_PARENT   1
 
#define WP_CHILD   2
 
#define test_dm_messages(wmclose, wmgetdefid, wmnextdlgctl)
 
#define TEST_EM_SETFONTSIZE(hwnd, size, expected_size, expected_res, expected_undo)   _test_font_size(__LINE__,hwnd,size,expected_size,expected_res,expected_undo)
 

Functions

static HWND new_window (LPCSTR lpClassName, DWORD dwStyle, HWND parent)
 
static HWND new_windowW (LPCWSTR lpClassName, DWORD dwStyle, HWND parent)
 
static HWND new_richedit (HWND parent)
 
static HWND new_richedit_with_style (HWND parent, DWORD style)
 
static HWND new_richeditW (HWND parent)
 
static void keep_responsive (time_t delay_time)
 
static void simulate_typing_characters (HWND hwnd, const char *szChars)
 
static BOOL hold_key (int vk)
 
static BOOL release_key (int vk)
 
static WCHARatowstr (const char *str)
 
static void check_EM_FINDTEXT (HWND hwnd, const char *name, struct find_s *f, int id, BOOL unicode)
 
static void check_EM_FINDTEXTEX (HWND hwnd, const char *name, struct find_s *f, int id, BOOL unicode)
 
static void run_tests_EM_FINDTEXT (HWND hwnd, const char *name, struct find_s *find, int num_tests, BOOL unicode)
 
static void test_EM_FINDTEXT (BOOL unicode)
 
static void test_EM_GETLINE (void)
 
static void test_EM_LINELENGTH (void)
 
static int get_scroll_pos_y (HWND hwnd)
 
static void move_cursor (HWND hwnd, LONG charindex)
 
static void line_scroll (HWND hwnd, int amount)
 
static void test_EM_SCROLLCARET (void)
 
static void test_EM_POSFROMCHAR (void)
 
static void test_EM_SETCHARFORMAT (void)
 
static void test_EM_SETTEXTMODE (void)
 
static void test_SETPARAFORMAT (void)
 
static void test_TM_PLAINTEXT (void)
 
static void test_WM_GETTEXT (void)
 
static void test_EM_GETTEXTRANGE (void)
 
static void test_EM_GETSELTEXT (void)
 
static void test_EM_SETOPTIONS (void)
 
static BOOL check_CFE_LINK_selection (HWND hwnd, int sel_start, int sel_end)
 
static void check_CFE_LINK_rcvd (HWND hwnd, BOOL is_url, const char *url)
 
static HWND new_static_wnd (HWND parent)
 
static void test_EM_AUTOURLDETECT (void)
 
static void test_EM_SCROLL (void)
 
static LRESULT (WINAPI *richeditProc)(HWND hwnd
 
static LRESULT WINAPI RicheditStupidOverrideProcA (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
 
static void test_scrollbar_visibility (void)
 
static void test_EM_SETUNDOLIMIT (void)
 
static void test_ES_PASSWORD (void)
 
static DWORD CALLBACK test_WM_SETTEXT_esCallback (DWORD_PTR dwCookie, LPBYTE pbBuff, LONG cb, LONG *pcb)
 
static void test_WM_SETTEXT (void)
 
static DWORD CALLBACK test_esCallback_written_1 (DWORD_PTR dwCookie, LPBYTE pbBuff, LONG cb, LONG *pcb)
 
static int count_pars (const char *buf)
 
static void test_EM_STREAMOUT (void)
 
static void test_EM_STREAMOUT_FONTTBL (void)
 
static void test_EM_STREAMOUT_empty_para (void)
 
static void test_EM_SETTEXTEX (void)
 
static void test_EM_LIMITTEXT (void)
 
static void test_EM_EXLIMITTEXT (void)
 
static void test_EM_GETLIMITTEXT (void)
 
static void test_WM_SETFONT (void)
 
static DWORD CALLBACK test_EM_GETMODIFY_esCallback (DWORD_PTR dwCookie, LPBYTE pbBuff, LONG cb, LONG *pcb)
 
static void test_EM_GETMODIFY (void)
 
static void check_EM_EXSETSEL (HWND hwnd, const struct exsetsel_s *setsel, int id)
 
static void test_EM_EXSETSEL (void)
 
static void check_EM_SETSEL (HWND hwnd, const struct exsetsel_s *setsel, int id)
 
static void test_EM_SETSEL (void)
 
static void test_EM_REPLACESEL (int redraw)
 
static LRESULT send_ctrl_key (HWND hwnd, UINT key)
 
static void test_WM_PASTE (void)
 
static void test_EM_FORMATRANGE (void)
 
static DWORD CALLBACK EditStreamCallback (DWORD_PTR dwCookie, LPBYTE pbBuff, LONG cb, LONG *pcb)
 
static DWORD CALLBACK test_EM_STREAMIN_esCallback (DWORD_PTR dwCookie, LPBYTE pbBuff, LONG cb, LONG *pcb)
 
static DWORD CALLBACK test_EM_STREAMIN_esCallback_UTF8Split (DWORD_PTR dwCookie, LPBYTE pbBuff, LONG cb, LONG *pcb)
 
static DWORD CALLBACK test_EM_STREAMIN_esCallback2 (DWORD_PTR dwCookie, LPBYTE pbBuff, LONG cb, LONG *pcb)
 
static void test_EM_STREAMIN (void)
 
static void test_EM_StreamIn_Undo (void)
 
static BOOL is_em_settextex_supported (HWND hwnd)
 
static void test_unicode_conversions (void)
 
static void test_WM_CHAR (void)
 
static void test_EM_GETTEXTLENGTHEX (void)
 
static LRESULT WINAPI ParentMsgCheckProcA (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
 
static void test_eventMask (void)
 
static LRESULT WINAPI WM_NOTIFY_ParentMsgCheckProcA (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
 
static void test_WM_NOTIFY (void)
 
static LRESULT WINAPI EN_LINK_ParentMsgCheckProcA (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
 
static void link_notify_test (const char *desc, int i, HWND hwnd, HWND parent, UINT msg, WPARAM wParam, LPARAM lParam, BOOL notifies)
 
static void test_EN_LINK (void)
 
static void test_undo_coalescing (void)
 
static LONG CALLBACK customWordBreakProc (WCHAR *text, int pos, int bytes, int code)
 
static void test_word_movement (void)
 
static void test_EM_CHARFROMPOS (void)
 
static void test_word_wrap (void)
 
static void test_autoscroll (void)
 
static void test_format_rect (void)
 
static void test_WM_GETDLGCODE (void)
 
static void test_zoom (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_FINDWORDBREAK_W (void)
 
static void test_EM_FINDWORDBREAK_A (void)
 
static void test_enter (void)
 
static void test_WM_CREATE (void)
 
static void test_reset_default_para_fmt (void)
 
static void test_EM_SETREADONLY (void)
 
static LONG twips2points (LONG value)
 
static void _test_font_size (unsigned line, HWND hwnd, LONG size, LONG expected_size, LRESULT expected_res, BOOL expected_undo)
 
static void test_EM_SETFONTSIZE (void)
 
static void test_alignment_style (void)
 
static void test_WM_GETTEXTLENGTH (void)
 
static void test_rtf (void)
 
static void test_background (void)
 
static void test_eop_char_fmt (void)
 
static void test_para_numbering (void)
 
static void fill_reobject_struct (REOBJECT *reobj, LONG cp, LPOLEOBJECT poleobj, LPSTORAGE pstg, LPOLECLIENTSITE polesite, LONG sizel_cx, LONG sizel_cy, DWORD aspect, DWORD flags, DWORD user)
 
static void test_EM_SELECTIONTYPE (void)
 
static void test_window_classes (void)
 
 START_TEST (editor)
 

Variables

static CHAR string1 [MAX_PATH]
 
static CHAR string2 [MAX_PATH]
 
static CHAR string3 [MAX_PATH]
 
static HMODULE hmoduleRichEdit
 
static BOOL is_lang_japanese
 
static const char haystack [] = "WINEWine wineWine wine WineWine"
 
static struct find_s find_tests []
 
static struct find_s find_tests2 []
 
static const struct getline_s gl []
 
static unsigned int recursionLevel = 0
 
static unsigned int WM_SIZE_recursionLevel = 0
 
static BOOL bailedOutOfRecursion = FALSE
 
static UINT message
 
static UINT WPARAM wParam
 
static UINT WPARAM LPARAM lParam
 
LONG streamout_written = 0
 
static const struct exsetsel_s exsetsel_tests []
 
static int nCallbackCount = 0
 
static HWND eventMaskEditHwnd = 0
 
static int queriedEventMask
 
static int watchForEventMask = 0
 
static int received_WM_NOTIFY = 0
 
static int modify_at_WM_NOTIFY = 0
 
static BOOL filter_on_WM_NOTIFY = FALSE
 
static HWND hwndRichedit_WM_NOTIFY
 
static ENLINK enlink
 
static struct dialog_mode_messages dm_messages
 

Macro Definition Documentation

◆ COBJMACROS

#define COBJMACROS

Definition at line 23 of file editor.c.

◆ CURSOR_CLIENT_X

#define CURSOR_CLIENT_X   5

Definition at line 6692 of file editor.c.

◆ CURSOR_CLIENT_Y

#define CURSOR_CLIENT_Y   5

Definition at line 6693 of file editor.c.

◆ DISABLE_WS_VSCROLL

#define DISABLE_WS_VSCROLL (   hwnd)    SetWindowLongA(hwnd, GWL_STYLE, GetWindowLongA(hwnd, GWL_STYLE) & ~WS_VSCROLL)

◆ ENABLE_WS_VSCROLL

◆ expect_empty

#define expect_empty (   hwnd,
  wm_get_text 
)
Value:
do { \
GETTEXTEX gtex = { 64, GT_DEFAULT, CP_ACP, NULL, NULL }; \
WPARAM wparam = (wm_get_text == WM_GETTEXT) ? 64 : (WPARAM)&gtex; \
assert(wm_get_text == WM_GETTEXT || wm_get_text == EM_GETTEXTEX); \
memset(bufA, 0xAA, sizeof(bufA)); \
ret = SendMessageA(hwnd, wm_get_text, wparam, (LPARAM)bufA); \
ok(!ret, "empty richedit should return 0, got %d\n", ret); \
ok(!*bufA, "empty richedit should return empty string, got %s\n", bufA); \
} while(0)
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
LRESULT WINAPI SendMessageA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define CP_ACP
Definition: compat.h:99
#define WM_GETTEXT
Definition: winuser.h:1600
UINT_PTR WPARAM
Definition: windef.h:207
#define EM_GETTEXTEX
Definition: richedit.h:128
#define GT_DEFAULT
Definition: richedit.h:1036
smooth NULL
Definition: ftsmooth.c:416
LONG_PTR LPARAM
Definition: windef.h:208
int ret
static UINT WPARAM wparam
Definition: combo.c:716

◆ expect_textA

#define expect_textA (   hwnd,
  wm_get_text,
  txt 
)
Value:
do { \
GETTEXTEX gtex = { 64, GT_DEFAULT, CP_ACP, NULL, NULL }; \
WPARAM wparam = (wm_get_text == WM_GETTEXT) ? 64 : (WPARAM)&gtex; \
assert(wm_get_text == WM_GETTEXT || wm_get_text == EM_GETTEXTEX); \
memset(bufA, 0xAA, sizeof(bufA)); \
ret = SendMessageA(hwnd, wm_get_text, wparam, (LPARAM)bufA); \
ok(ret, "SendMessageA(%02x) error %u\n", wm_get_text, GetLastError()); \
ret = lstrcmpA(bufA, txt); \
ok(!ret, "%02x: strings do not match: expected %s got %s\n", wm_get_text, txt, bufA); \
} while(0)
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
LRESULT WINAPI SendMessageA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define CP_ACP
Definition: compat.h:99
#define WM_GETTEXT
Definition: winuser.h:1600
int WINAPI lstrcmpA(LPCSTR lpString1, LPCSTR lpString2)
Definition: lstring.c:18
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
UINT_PTR WPARAM
Definition: windef.h:207
#define EM_GETTEXTEX
Definition: richedit.h:128
#define GT_DEFAULT
Definition: richedit.h:1036
smooth NULL
Definition: ftsmooth.c:416
LONG_PTR LPARAM
Definition: windef.h:208
int ret
static UINT WPARAM wparam
Definition: combo.c:716

◆ expect_textW

#define expect_textW (   hwnd,
  wm_get_text,
  txt 
)
Value:
do { \
GETTEXTEX gtex = { 64, GT_DEFAULT, 1200, NULL, NULL }; \
WPARAM wparam = (wm_get_text == WM_GETTEXT) ? 64 : (WPARAM)&gtex; \
assert(wm_get_text == WM_GETTEXT || wm_get_text == EM_GETTEXTEX); \
memset(bufW, 0xAA, sizeof(bufW)); \
ret = SendMessageW(hwnd, wm_get_text, wparam, (LPARAM)bufW); \
ok(ret, "SendMessageW(%02x) error %u\n", wm_get_text, GetLastError()); \
ret = lstrcmpW(bufW, txt); \
ok(!ret, "%02x: strings do not match: expected[0] %x got[0] %x\n", wm_get_text, txt[0], bufW[0]); \
} while(0)
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
int WINAPI lstrcmpW(LPCWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:170
#define WM_GETTEXT
Definition: winuser.h:1600
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
UINT_PTR WPARAM
Definition: windef.h:207
#define EM_GETTEXTEX
Definition: richedit.h:128
#define GT_DEFAULT
Definition: richedit.h:1036
smooth NULL
Definition: ftsmooth.c:416
LONG_PTR LPARAM
Definition: windef.h:208
int ret
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
static UINT WPARAM wparam
Definition: combo.c:716

◆ ID_RICHEDITTESTDBUTTON

#define ID_RICHEDITTESTDBUTTON   0x123

Definition at line 40 of file editor.c.

◆ MAX_BUF_LEN

#define MAX_BUF_LEN   1024

◆ ok_w3

#define ok_w3 (   format,
  szString1,
  szString2,
  szString3 
)
Value:
WideCharToMultiByte(CP_ACP, 0, szString2, -1, string2, MAX_PATH, NULL, NULL); \
WideCharToMultiByte(CP_ACP, 0, szString3, -1, string3, MAX_PATH, NULL, NULL); \
ok(!lstrcmpW(szString3, szString1) || !lstrcmpW(szString3, szString2), \
#define WideCharToMultiByte
Definition: compat.h:101
#define CP_ACP
Definition: compat.h:99
int WINAPI lstrcmpW(LPCWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:170
GLint GLint GLsizei GLsizei GLsizei GLint GLenum format
Definition: gl.h:1546
static CHAR string2[MAX_PATH]
Definition: editor.c:42
smooth NULL
Definition: ftsmooth.c:416
#define MAX_PATH
Definition: compat.h:26
static CHAR string3[MAX_PATH]
Definition: editor.c:42
static CHAR string1[MAX_PATH]
Definition: editor.c:42

Definition at line 44 of file editor.c.

◆ set_textA

#define set_textA (   hwnd,
  wm_set_text,
  txt 
)
Value:
do { \
SETTEXTEX stex = { ST_DEFAULT, CP_ACP }; \
WPARAM wparam = (wm_set_text == WM_SETTEXT) ? 0 : (WPARAM)&stex; \
assert(wm_set_text == WM_SETTEXT || wm_set_text == EM_SETTEXTEX); \
ret = SendMessageA(hwnd, wm_set_text, wparam, (LPARAM)txt); \
ok(ret, "SendMessageA(%02x) error %u\n", wm_set_text, GetLastError()); \
} while(0)
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
LRESULT WINAPI SendMessageA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define CP_ACP
Definition: compat.h:99
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
UINT_PTR WPARAM
Definition: windef.h:207
#define ST_DEFAULT
Definition: richedit.h:1070
LONG_PTR LPARAM
Definition: windef.h:208
#define WM_SETTEXT
Definition: winuser.h:1599
int ret
#define EM_SETTEXTEX
Definition: richedit.h:131
static UINT WPARAM wparam
Definition: combo.c:716

◆ set_textW

#define set_textW (   hwnd,
  wm_set_text,
  txt 
)
Value:
do { \
SETTEXTEX stex = { ST_DEFAULT, 1200 }; \
WPARAM wparam = (wm_set_text == WM_SETTEXT) ? 0 : (WPARAM)&stex; \
assert(wm_set_text == WM_SETTEXT || wm_set_text == EM_SETTEXTEX); \
ret = SendMessageW(hwnd, wm_set_text, wparam, (LPARAM)txt); \
ok(ret, "SendMessageW(%02x) error %u\n", wm_set_text, GetLastError()); \
} while(0)
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
UINT_PTR WPARAM
Definition: windef.h:207
#define ST_DEFAULT
Definition: richedit.h:1070
LONG_PTR LPARAM
Definition: windef.h:208
#define WM_SETTEXT
Definition: winuser.h:1599
int ret
#define EM_SETTEXTEX
Definition: richedit.h:131
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
static UINT WPARAM wparam
Definition: combo.c:716

◆ test_dm_messages

#define test_dm_messages (   wmclose,
  wmgetdefid,
  wmnextdlgctl 
)
Value:
ok(dm_messages.wm_close == wmclose, "expected %d WM_CLOSE message, " \
"got %d\n", wmclose, dm_messages.wm_close); \
ok(dm_messages.wm_getdefid == wmgetdefid, "expected %d WM_GETDIFID message, " \
"got %d\n", wmgetdefid, dm_messages.wm_getdefid);\
ok(dm_messages.wm_nextdlgctl == wmnextdlgctl, "expected %d WM_NEXTDLGCTL message, " \
"got %d\n", wmnextdlgctl, dm_messages.wm_nextdlgctl)
static struct dialog_mode_messages dm_messages
Definition: editor.c:7835
#define ok(value,...)

Definition at line 7837 of file editor.c.

◆ TEST_EM_SETFONTSIZE

#define TEST_EM_SETFONTSIZE (   hwnd,
  size,
  expected_size,
  expected_res,
  expected_undo 
)    _test_font_size(__LINE__,hwnd,size,expected_size,expected_res,expected_undo)

Definition at line 8436 of file editor.c.

◆ TEST_SETTEXT

#define TEST_SETTEXT (   a,
  b 
)
Value:
result = SendMessageA(hwndRichEdit, WM_SETTEXT, 0, (LPARAM)a); \
ok (result == 1, "WM_SETTEXT returned %ld instead of 1\n", result); \
result = SendMessageA(hwndRichEdit, WM_GETTEXT, 1024, (LPARAM)buf); \
ok (result == lstrlenA(buf), \
"WM_GETTEXT returned %ld instead of expected %u\n", \
result = strcmp(b, buf); \
ok(result == 0, \
"WM_SETTEXT round trip: strcmp = %ld, text=\"%s\"\n", result, buf);
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
LONG_PTR LPARAM
Definition: windef.h:208
#define WM_SETTEXT
Definition: winuser.h:1599
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
int WINAPI lstrlenA(LPCSTR lpString)
Definition: lstring.c:145
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469
GLboolean GLboolean GLboolean GLboolean a
Definition: glext.h:6204
GLuint64EXT * result
Definition: glext.h:11304

◆ TEST_SETTEXTW

#define TEST_SETTEXTW (   a,
  b 
)
Value:
result = SendMessageW(hwndRichEdit, WM_SETTEXT, 0, (LPARAM)a); \
ok (result == 1, "WM_SETTEXT returned %ld instead of 1\n", result); \
result = SendMessageW(hwndRichEdit, WM_GETTEXT, 1024, (LPARAM)bufW); \
ok (result == lstrlenW(bufW), \
"WM_GETTEXT returned %ld instead of expected %u\n", \
result, lstrlenW(bufW)); \
result = lstrcmpW(b, bufW); \
ok(result == 0, "WM_SETTEXT round trip: strcmp = %ld\n", result);
int WINAPI lstrcmpW(LPCWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:170
#define WM_GETTEXT
Definition: winuser.h:1600
#define lstrlenW
Definition: compat.h:407
LONG_PTR LPARAM
Definition: windef.h:208
#define WM_SETTEXT
Definition: winuser.h:1599
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
GLboolean GLboolean GLboolean GLboolean a
Definition: glext.h:6204
GLuint64EXT * result
Definition: glext.h:11304

◆ WP_CHILD

#define WP_CHILD   2

Definition at line 6695 of file editor.c.

◆ WP_PARENT

#define WP_PARENT   1

Definition at line 6694 of file editor.c.

Function Documentation

◆ _test_font_size()

static void _test_font_size ( unsigned  line,
HWND  hwnd,
LONG  size,
LONG  expected_size,
LRESULT  expected_res,
BOOL  expected_undo 
)
static

Definition at line 8438 of file editor.c.

8440 {
8441  CHARFORMAT2A cf;
8442  LRESULT res;
8443  BOOL isundo;
8444 
8445  cf.cbSize = sizeof(cf);
8446  cf.dwMask = CFM_SIZE;
8447 
8450  isundo = SendMessageA(hwnd, EM_CANUNDO, 0, 0);
8451  ok_(__FILE__,line)(res == expected_res, "EM_SETFONTSIZE unexpected return value: %lx.\n", res);
8452  ok_(__FILE__,line)(twips2points(cf.yHeight) == expected_size, "got wrong font size: %d, expected: %d\n",
8453  twips2points(cf.yHeight), expected_size);
8454  ok_(__FILE__,line)(isundo == expected_undo, "get wrong undo mark: %d, expected: %d.\n",
8455  isundo, expected_undo);
8456 }
static IClassFactory * cf
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
#define ok_(x1, x2)
LRESULT WINAPI SendMessageA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
unsigned int BOOL
Definition: ntddk_ex.h:94
LONG_PTR LPARAM
Definition: windef.h:208
Definition: parser.c:48
GLsizeiptr size
Definition: glext.h:5919
#define EM_SETFONTSIZE
Definition: richedit.h:168
#define CFM_SIZE
Definition: richedit.h:362
#define EM_GETCHARFORMAT
Definition: richedit.h:91
static LONG twips2points(LONG value)
Definition: editor.c:8431
GLuint res
Definition: glext.h:9613
#define EM_CANUNDO
Definition: winuser.h:1944
#define SCF_SELECTION
Definition: richedit.h:235
LONG_PTR LRESULT
Definition: windef.h:209

◆ atowstr()

static WCHAR* atowstr ( const char str)
static

Definition at line 229 of file editor.c.

230 {
231  WCHAR *ret;
232  DWORD len;
233  len = MultiByteToWideChar(CP_ACP, 0, str, -1, NULL, 0);
234  ret = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
235  MultiByteToWideChar(CP_ACP, 0, str, -1, ret, len);
236  return ret;
237 }
#define CP_ACP
Definition: compat.h:99
const WCHAR * str
smooth NULL
Definition: ftsmooth.c:416
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
__wchar_t WCHAR
Definition: xmlstorage.h:180
unsigned long DWORD
Definition: ntddk_ex.h:95
int ret
GLenum GLsizei len
Definition: glext.h:6722
#define MultiByteToWideChar
Definition: compat.h:100

Referenced by check_EM_FINDTEXT(), and check_EM_FINDTEXTEX().

◆ check_CFE_LINK_rcvd()

static void check_CFE_LINK_rcvd ( HWND  hwnd,
BOOL  is_url,
const char url 
)
static

Definition at line 1905 of file editor.c.

1906 {
1907  BOOL link_present = FALSE;
1908 
1909  link_present = check_CFE_LINK_selection(hwnd, 0, 1);
1910  if (is_url)
1911  { /* control text is url; should get CFE_LINK */
1912  ok(link_present, "URL Case: CFE_LINK not set for [%s].\n", url);
1913  }
1914  else
1915  {
1916  ok(!link_present, "Non-URL Case: CFE_LINK set for [%s].\n", url);
1917  }
1918 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
static BOOL check_CFE_LINK_selection(HWND hwnd, int sel_start, int sel_end)
Definition: editor.c:1896
unsigned int BOOL
Definition: ntddk_ex.h:94
#define ok(value,...)
static const WCHAR url[]
Definition: encode.c:1432

Referenced by test_EM_AUTOURLDETECT().

◆ check_CFE_LINK_selection()

static BOOL check_CFE_LINK_selection ( HWND  hwnd,
int  sel_start,
int  sel_end 
)
static

Definition at line 1896 of file editor.c.

1897 {
1898  CHARFORMAT2A text_format;
1899  text_format.cbSize = sizeof(text_format);
1900  SendMessageA(hwnd, EM_SETSEL, sel_start, sel_end);
1902  return (text_format.dwEffects & CFE_LINK) != 0;
1903 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
LRESULT WINAPI SendMessageA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define CFE_LINK
Definition: richedit.h:411
LONG_PTR LPARAM
Definition: windef.h:208
#define EM_SETSEL
Definition: winuser.h:1979
#define EM_GETCHARFORMAT
Definition: richedit.h:91
DWORD dwEffects
Definition: richedit.h:284
#define SCF_SELECTION
Definition: richedit.h:235

Referenced by check_CFE_LINK_rcvd(), and test_EM_AUTOURLDETECT().

◆ check_EM_EXSETSEL()

static void check_EM_EXSETSEL ( HWND  hwnd,
const struct exsetsel_s setsel,
int  id 
)
static

Definition at line 4914 of file editor.c.

4914  {
4915  CHARRANGE cr;
4916  LRESULT result;
4917  int start, end;
4918 
4919  cr.cpMin = setsel->min;
4920  cr.cpMax = setsel->max;
4921  result = SendMessageA(hwnd, EM_EXSETSEL, 0, (LPARAM)&cr);
4922 
4923  ok(result == setsel->expected_retval, "EM_EXSETSEL(%d): expected: %ld actual: %ld\n", id, setsel->expected_retval, result);
4924 
4926 
4927  todo_wine_if (setsel->todo)
4928  ok(start == setsel->expected_getsel_start && end == setsel->expected_getsel_end, "EM_EXSETSEL(%d): expected (%d,%d) actual:(%d,%d)\n",
4929  id, setsel->expected_getsel_start, setsel->expected_getsel_end, start, end);
4930 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
LRESULT expected_retval
Definition: editor.c:4879
LRESULT WINAPI SendMessageA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
BOOL todo
Definition: editor.c:4882
GLdouble n
Definition: glext.h:7729
LONG cpMax
Definition: richedit.h:501
UINT_PTR WPARAM
Definition: windef.h:207
GLuint GLuint end
Definition: gl.h:1545
#define EM_GETSEL
Definition: winuser.h:1958
#define ok(value,...)
LONG_PTR LPARAM
Definition: windef.h:208
#define todo_wine_if(is_todo)
Definition: test.h:155
#define d
Definition: ke_i.h:81
#define EM_EXSETSEL
Definition: richedit.h:88
LONG max
Definition: editor.c:4878
GLuint start
Definition: gl.h:1545
LONG min
Definition: editor.c:4877
LONG_PTR LRESULT
Definition: windef.h:209
GLuint64EXT * result
Definition: glext.h:11304
LONG cpMin
Definition: richedit.h:500
BOOL expected
Definition: store.c:2063

Referenced by test_EM_EXSETSEL().

◆ check_EM_FINDTEXT()

static void check_EM_FINDTEXT ( HWND  hwnd,
const char name,
struct find_s f,
int  id,
BOOL  unicode 
)
static

Definition at line 239 of file editor.c.

240 {
241  int findloc;
242 
243  if(unicode){
244  FINDTEXTW ftw;
245  memset(&ftw, 0, sizeof(ftw));
246  ftw.chrg.cpMin = f->start;
247  ftw.chrg.cpMax = f->end;
248  ftw.lpstrText = atowstr(f->needle);
249 
250  findloc = SendMessageA(hwnd, EM_FINDTEXT, f->flags, (LPARAM)&ftw);
251  ok(findloc == f->expected_loc,
252  "EM_FINDTEXT(%s,%d,%u) '%s' in range(%d,%d), flags %08x, got start at %d, expected %d\n",
253  name, id, unicode, f->needle, f->start, f->end, f->flags, findloc, f->expected_loc);
254 
255  findloc = SendMessageA(hwnd, EM_FINDTEXTW, f->flags, (LPARAM)&ftw);
256  ok(findloc == f->expected_loc,
257  "EM_FINDTEXTW(%s,%d,%u) '%s' in range(%d,%d), flags %08x, got start at %d, expected %d\n",
258  name, id, unicode, f->needle, f->start, f->end, f->flags, findloc, f->expected_loc);
259 
260  HeapFree(GetProcessHeap(), 0, (void*)ftw.lpstrText);
261  }else{
262  FINDTEXTA fta;
263  memset(&fta, 0, sizeof(fta));
264  fta.chrg.cpMin = f->start;
265  fta.chrg.cpMax = f->end;
266  fta.lpstrText = f->needle;
267 
268  findloc = SendMessageA(hwnd, EM_FINDTEXT, f->flags, (LPARAM)&fta);
269  ok(findloc == f->expected_loc,
270  "EM_FINDTEXT(%s,%d,%u) '%s' in range(%d,%d), flags %08x, got start at %d, expected %d\n",
271  name, id, unicode, f->needle, f->start, f->end, f->flags, findloc, f->expected_loc);
272  }
273 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
CHARRANGE chrg
Definition: richedit.h:586
LRESULT WINAPI SendMessageA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
static WCHAR * atowstr(const char *str)
Definition: editor.c:229
LONG cpMax
Definition: richedit.h:501
LPCSTR lpstrText
Definition: richedit.h:582
#define ok(value,...)
CHARRANGE chrg
Definition: richedit.h:581
#define EM_FINDTEXT
Definition: richedit.h:89
LONG_PTR LPARAM
Definition: windef.h:208
GLfloat f
Definition: glext.h:7540
#define GetProcessHeap()
Definition: compat.h:395
LPCWSTR lpstrText
Definition: richedit.h:587
#define EM_FINDTEXTW
Definition: richedit.h:147
Definition: name.c:36
#define memset(x, y, z)
Definition: compat.h:39
#define HeapFree(x, y, z)
Definition: compat.h:394
LONG cpMin
Definition: richedit.h:500

Referenced by run_tests_EM_FINDTEXT().

◆ check_EM_FINDTEXTEX()

static void check_EM_FINDTEXTEX ( HWND  hwnd,
const char name,
struct find_s f,
int  id,
BOOL  unicode 
)
static

Definition at line 275 of file editor.c.

277 {
278  int findloc;
279  int expected_end_loc;
280 
281  if(unicode){
282  FINDTEXTEXW ftw;
283  memset(&ftw, 0, sizeof(ftw));
284  ftw.chrg.cpMin = f->start;
285  ftw.chrg.cpMax = f->end;
286  ftw.lpstrText = atowstr(f->needle);
287  findloc = SendMessageA(hwnd, EM_FINDTEXTEX, f->flags, (LPARAM)&ftw);
288  ok(findloc == f->expected_loc,
289  "EM_FINDTEXTEX(%s,%d) '%s' in range(%d,%d), flags %08x, start at %d\n",
290  name, id, f->needle, f->start, f->end, f->flags, findloc);
291  ok(ftw.chrgText.cpMin == f->expected_loc,
292  "EM_FINDTEXTEX(%s,%d) '%s' in range(%d,%d), flags %08x, start at %d\n",
293  name, id, f->needle, f->start, f->end, f->flags, ftw.chrgText.cpMin);
294  expected_end_loc = ((f->expected_loc == -1) ? -1
295  : f->expected_loc + strlen(f->needle));
296  ok(ftw.chrgText.cpMax == expected_end_loc,
297  "EM_FINDTEXTEX(%s,%d) '%s' in range(%d,%d), flags %08x, end at %d, expected %d\n",
298  name, id, f->needle, f->start, f->end, f->flags, ftw.chrgText.cpMax, expected_end_loc);
299  HeapFree(GetProcessHeap(), 0, (void*)ftw.lpstrText);
300  }else{
301  FINDTEXTEXA fta;
302  memset(&fta, 0, sizeof(fta));
303  fta.chrg.cpMin = f->start;
304  fta.chrg.cpMax = f->end;
305  fta.lpstrText = f->needle;
306  findloc = SendMessageA(hwnd, EM_FINDTEXTEX, f->flags, (LPARAM)&fta);
307  ok(findloc == f->expected_loc,
308  "EM_FINDTEXTEX(%s,%d) '%s' in range(%d,%d), flags %08x, start at %d\n",
309  name, id, f->needle, f->start, f->end, f->flags, findloc);
310  ok(fta.chrgText.cpMin == f->expected_loc,
311  "EM_FINDTEXTEX(%s,%d) '%s' in range(%d,%d), flags %08x, start at %d\n",
312  name, id, f->needle, f->start, f->end, f->flags, fta.chrgText.cpMin);
313  expected_end_loc = ((f->expected_loc == -1) ? -1
314  : f->expected_loc + strlen(f->needle));
315  ok(fta.chrgText.cpMax == expected_end_loc,
316  "EM_FINDTEXTEX(%s,%d) '%s' in range(%d,%d), flags %08x, end at %d, expected %d\n",
317  name, id, f->needle, f->start, f->end, f->flags, fta.chrgText.cpMax, expected_end_loc);
318  }
319 }
CHARRANGE chrgText
Definition: richedit.h:601
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
CHARRANGE chrgText
Definition: richedit.h:595
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
LRESULT WINAPI SendMessageA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
static WCHAR * atowstr(const char *str)
Definition: editor.c:229
LONG cpMax
Definition: richedit.h:501
LPCSTR lpstrText
Definition: richedit.h:594
#define ok(value,...)
LONG_PTR LPARAM
Definition: windef.h:208
GLfloat f
Definition: glext.h:7540
#define GetProcessHeap()
Definition: compat.h:395
#define EM_FINDTEXTEX
Definition: richedit.h:112
LPCWSTR lpstrText
Definition: richedit.h:600
CHARRANGE chrg
Definition: richedit.h:593
CHARRANGE chrg
Definition: richedit.h:599
Definition: name.c:36
#define memset(x, y, z)
Definition: compat.h:39
#define HeapFree(x, y, z)
Definition: compat.h:394
LONG cpMin
Definition: richedit.h:500

Referenced by run_tests_EM_FINDTEXT().

◆ check_EM_SETSEL()

static void check_EM_SETSEL ( HWND  hwnd,
const struct exsetsel_s setsel,
int  id 
)
static

Definition at line 4971 of file editor.c.

4971  {
4972  LRESULT result;
4973  int start, end;
4974 
4975  result = SendMessageA(hwnd, EM_SETSEL, setsel->min, setsel->max);
4976 
4977  ok(result == setsel->expected_retval, "EM_SETSEL(%d): expected: %ld actual: %ld\n", id, setsel->expected_retval, result);
4978 
4980 
4981  todo_wine_if (setsel->todo)
4982  ok(start == setsel->expected_getsel_start && end == setsel->expected_getsel_end, "EM_SETSEL(%d): expected (%d,%d) actual:(%d,%d)\n",
4983  id, setsel->expected_getsel_start, setsel->expected_getsel_end, start, end);
4984 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
LRESULT expected_retval
Definition: editor.c:4879
LRESULT WINAPI SendMessageA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
BOOL todo
Definition: editor.c:4882
GLdouble n
Definition: glext.h:7729
UINT_PTR WPARAM
Definition: windef.h:207
GLuint GLuint end
Definition: gl.h:1545
#define EM_GETSEL
Definition: winuser.h:1958
#define ok(value,...)
LONG_PTR LPARAM
Definition: windef.h:208
#define todo_wine_if(is_todo)
Definition: test.h:155
#define d
Definition: ke_i.h:81
#define EM_SETSEL
Definition: winuser.h:1979
LONG max
Definition: editor.c:4878
GLuint start
Definition: gl.h:1545
LONG min
Definition: editor.c:4877
LONG_PTR LRESULT
Definition: windef.h:209
GLuint64EXT * result
Definition: glext.h:11304
BOOL expected
Definition: store.c:2063

Referenced by test_EM_SETSEL().

◆ count_pars()

static int count_pars ( const char buf)
static

Definition at line 3792 of file editor.c.

3793 {
3794  const char *p = buf;
3795  int count = 0;
3796  while ((p = strstr( p, "\\par" )) != NULL)
3797  {
3798  if (!isalpha( p[4] ))
3799  count++;
3800  p++;
3801  }
3802  return count;
3803 }
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
char * strstr(char *String1, char *String2)
Definition: utclib.c:653
GLuint GLuint GLsizei count
Definition: gl.h:1545
#define isalpha(c)
Definition: acclib.h:74
smooth NULL
Definition: ftsmooth.c:416
GLfloat GLfloat p
Definition: glext.h:8902

Referenced by test_EM_STREAMOUT().

◆ customWordBreakProc()

static LONG CALLBACK customWordBreakProc ( WCHAR text,
int  pos,
int  bytes,
int  code 
)
static

Definition at line 7010 of file editor.c.

7011 {
7012  int length;
7013 
7014  /* MSDN lied, length is actually the number of bytes. */
7015  length = bytes / sizeof(WCHAR);
7016  switch(code)
7017  {
7018  case WB_ISDELIMITER:
7019  return text[pos] == 'X';
7020  case WB_LEFT:
7021  case WB_MOVEWORDLEFT:
7023  return pos-1;
7024  return min(customWordBreakProc(text, pos, bytes, WB_LEFTBREAK)-1, 0);
7025  case WB_LEFTBREAK:
7026  pos--;
7027  while (pos > 0 && !customWordBreakProc(text, pos, bytes, WB_ISDELIMITER))
7028  pos--;
7029  return pos;
7030  case WB_RIGHT:
7031  case WB_MOVEWORDRIGHT:
7033  return pos+1;
7035  case WB_RIGHTBREAK:
7036  pos++;
7038  pos++;
7039  return pos;
7040  default:
7041  ok(FALSE, "Unexpected code %d\n", code);
7042  break;
7043  }
7044  return 0;
7045 }
#define WB_RIGHT
Definition: winuser.h:551
#define WB_ISDELIMITER
Definition: winuser.h:549
#define WB_RIGHTBREAK
Definition: richedit.h:1006
const WCHAR * text
Definition: package.c:1827
#define WB_LEFTBREAK
Definition: richedit.h:1004
#define WB_MOVEWORDLEFT
Definition: richedit.h:1000
#define WB_LEFT
Definition: winuser.h:550
static unsigned char bytes[4]
Definition: adnsresfilter.c:74
#define ok(value,...)
__wchar_t WCHAR
Definition: xmlstorage.h:180
GLenum GLuint GLenum GLsizei length
Definition: glext.h:5579
#define min(a, b)
Definition: monoChain.cc:55
#define WB_MOVEWORDRIGHT
Definition: richedit.h:1002
static LONG CALLBACK customWordBreakProc(WCHAR *text, int pos, int bytes, int code)
Definition: editor.c:7010

Referenced by test_word_movement().

◆ dialog_mode_wnd_proc()

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

Definition at line 7845 of file editor.c.

7846 {
7847  switch (iMsg)
7848  {
7849  case DM_GETDEFID:
7850  dm_messages.wm_getdefid++;
7852  case WM_NEXTDLGCTL:
7853  dm_messages.wm_nextdlgctl++;
7854  break;
7855  case WM_CLOSE:
7856  dm_messages.wm_close++;
7857  break;
7858  }
7859 
7860  return DefWindowProcA(hwnd, iMsg, wParam, lParam);
7861 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
#define WM_NEXTDLGCTL
Definition: winuser.h:1625
static struct dialog_mode_messages dm_messages
Definition: editor.c:7835
#define ID_RICHEDITTESTDBUTTON
Definition: editor.c:40
#define DM_GETDEFID
Definition: winuser.h:2059
#define DC_HASDEFID
Definition: winuser.h:2563
#define MAKELONG(a, b)
Definition: typedefs.h:248
static UINT WPARAM wParam
Definition: editor.c:2851
#define WM_CLOSE
Definition: winuser.h:1603
LRESULT WINAPI DefWindowProcA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
static UINT WPARAM LPARAM lParam
Definition: editor.c:2851

Referenced by test_dialogmode().

◆ EditStreamCallback()

static DWORD CALLBACK EditStreamCallback ( DWORD_PTR  dwCookie,
LPBYTE  pbBuff,
LONG  cb,
LONG pcb 
)
static

Definition at line 5696 of file editor.c.

5698 {
5699  const char text[] = {'t','e','s','t'};
5700 
5701  if (sizeof(text) <= cb)
5702  {
5703  if ((int)dwCookie != nCallbackCount)
5704  {
5705  *pcb = 0;
5706  return 0;
5707  }
5708 
5709  memcpy (pbBuff, text, sizeof(text));
5710  *pcb = sizeof(text);
5711 
5712  nCallbackCount++;
5713 
5714  return 0;
5715  }
5716  else
5717  return 1; /* indicates callback failed */
5718 }
const WCHAR * text
Definition: package.c:1827
static DWORD cb
Definition: integrity.c:41
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
static int nCallbackCount
Definition: editor.c:5694

Referenced by test_EM_StreamIn_Undo().

◆ EN_LINK_ParentMsgCheckProcA()

static LRESULT WINAPI EN_LINK_ParentMsgCheckProcA ( HWND  hwnd,
UINT  message,
WPARAM  wParam,
LPARAM  lParam 
)
static

Definition at line 6697 of file editor.c.

6698 {
6699  if(message == WM_NOTIFY && ((NMHDR*)lParam)->code == EN_LINK)
6700  {
6701  enlink = *(ENLINK*)lParam;
6702  }
6704 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
Definition: tftpd.h:59
static UINT WPARAM wParam
Definition: editor.c:2851
LRESULT WINAPI DefWindowProcA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
static UINT WPARAM LPARAM lParam
Definition: editor.c:2851
#define EN_LINK
Definition: richedit.h:202
static ENLINK enlink
Definition: editor.c:6691
#define WM_NOTIFY
Definition: richedit.h:61

Referenced by test_EN_LINK().

◆ fill_reobject_struct()

static void fill_reobject_struct ( REOBJECT reobj,
LONG  cp,
LPOLEOBJECT  poleobj,
LPSTORAGE  pstg,
LPOLECLIENTSITE  polesite,
LONG  sizel_cx,
LONG  sizel_cy,
DWORD  aspect,
DWORD  flags,
DWORD  user 
)
static

Definition at line 8804 of file editor.c.

8807 {
8808  reobj->cbStruct = sizeof(*reobj);
8809  reobj->clsid = CLSID_NULL;
8810  reobj->cp = cp;
8811  reobj->poleobj = poleobj;
8812  reobj->pstg = pstg;
8813  reobj->polesite = polesite;
8814  reobj->sizel.cx = sizel_cx;
8815  reobj->sizel.cy = sizel_cy;
8816  reobj->dvaspect = aspect;
8817  reobj->dwFlags = flags;
8818  reobj->dwUser = user;
8819 }
#define CLSID_NULL
Definition: guiddef.h:94
GLbitfield flags
Definition: glext.h:7161
POINT cp
Definition: magnifier.c:61
void user(int argc, const char *argv[])
Definition: cmds.c:1350

Referenced by test_EM_SELECTIONTYPE().

◆ get_scroll_pos_y()

static int get_scroll_pos_y ( HWND  hwnd)
static

Definition at line 522 of file editor.c.

523 {
524  POINT p = {-1, -1};
526  ok(p.x != -1 && p.y != -1, "p.x:%d p.y:%d\n", p.x, p.y);
527  return p.y;
528 }
#define EM_GETSCROLLPOS
Definition: richedit.h:165
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
LRESULT WINAPI SendMessageA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define ok(value,...)
LONG_PTR LPARAM
Definition: windef.h:208
GLfloat GLfloat p
Definition: glext.h:8902

Referenced by test_EM_SCROLLCARET().

◆ hold_key()

static BOOL hold_key ( int  vk)
static

Definition at line 117 of file editor.c.

118 {
119  BYTE key_state[256];
120  BOOL result;
121 
122  result = GetKeyboardState(key_state);
123  ok(result, "GetKeyboardState failed.\n");
124  if (!result) return FALSE;
125  key_state[vk] |= 0x80;
126  result = SetKeyboardState(key_state);
127  ok(result, "SetKeyboardState failed.\n");
128  return result != 0;
129 }
unsigned int BOOL
Definition: ntddk_ex.h:94
#define ok(value,...)
_Check_return_ BOOL WINAPI GetKeyboardState(_Out_writes_(256) PBYTE lpKeyState)
unsigned char BYTE
Definition: mem.h:68
BOOL WINAPI SetKeyboardState(_In_reads_(256) LPBYTE)
GLuint64EXT * result
Definition: glext.h:11304

Referenced by send_ctrl_key(), test_WM_GETDLGCODE(), test_WM_PASTE(), and test_zoom().

◆ is_em_settextex_supported()

static BOOL is_em_settextex_supported ( HWND  hwnd)
static

Definition at line 6122 of file editor.c.

6123 {
6124  SETTEXTEX stex = { ST_DEFAULT, CP_ACP };
6125  return SendMessageA(hwnd, EM_SETTEXTEX, (WPARAM)&stex, 0) != 0;
6126 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
LRESULT WINAPI SendMessageA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define CP_ACP
Definition: compat.h:99
UINT_PTR WPARAM
Definition: windef.h:207
#define ST_DEFAULT
Definition: richedit.h:1070
#define EM_SETTEXTEX
Definition: richedit.h:131

Referenced by test_unicode_conversions().

◆ keep_responsive()

static void keep_responsive ( time_t  delay_time)
static

Definition at line 86 of file editor.c.

87 {
88  MSG msg;
89  time_t end;
90 
91  /* The message pump uses PeekMessage() to empty the queue and then
92  * sleeps for 50ms before retrying the queue. */
93  end = time(NULL) + delay_time;
94  while (time(NULL) < end) {
95  if (PeekMessageA(&msg, NULL, 0, 0, PM_REMOVE)) {
98  } else {
99  Sleep(50);
100  }
101  }
102 }
BOOL WINAPI TranslateMessage(_In_ const MSG *)
LRESULT WINAPI DispatchMessageA(_In_ const MSG *)
VOID WINAPI DECLSPEC_HOTPATCH Sleep(IN DWORD dwMilliseconds)
Definition: synch.c:736
TW_UINT32 TW_UINT16 TW_UINT16 MSG
Definition: twain.h:1827
GLuint GLuint end
Definition: gl.h:1545
__u16 time
Definition: mkdosfs.c:366
BOOL WINAPI PeekMessageA(_Out_ LPMSG, _In_opt_ HWND, _In_ UINT, _In_ UINT, _In_ UINT)
smooth NULL
Definition: ftsmooth.c:416
__kernel_time_t time_t
Definition: linux.h:252
#define msg(x)
Definition: auth_time.c:54
#define PM_REMOVE
Definition: winuser.h:1182

Referenced by START_TEST().

◆ line_scroll()

static void line_scroll ( HWND  hwnd,
int  amount 
)
static

Definition at line 538 of file editor.c.

539 {
540  SendMessageA(hwnd, EM_LINESCROLL, 0, amount);
541 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
LRESULT WINAPI SendMessageA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define EM_LINESCROLL
Definition: winuser.h:1965

Referenced by test_EM_SCROLLCARET().

◆ link_notify_test()

static void link_notify_test ( const char desc,
int  i,
HWND  hwnd,
HWND  parent,
UINT  msg,
WPARAM  wParam,
LPARAM  lParam,
BOOL  notifies 
)
static

Definition at line 6706 of file editor.c.

6708 {
6709  ENLINK junk_enlink;
6710 
6711  switch (msg)
6712  {
6713  case WM_LBUTTONDBLCLK:
6714  case WM_LBUTTONDOWN:
6715  case WM_LBUTTONUP:
6716  case WM_MOUSEHOVER:
6717  case WM_MOUSEMOVE:
6718  case WM_MOUSEWHEEL:
6719  case WM_RBUTTONDBLCLK:
6720  case WM_RBUTTONDOWN:
6721  case WM_RBUTTONUP:
6723  break;
6724  case WM_SETCURSOR:
6725  if (wParam == WP_PARENT)
6726  wParam = (WPARAM)parent;
6727  else if (wParam == WP_CHILD)
6728  wParam = (WPARAM)hwnd;
6729  break;
6730  }
6731 
6732  memset(&junk_enlink, 0x23, sizeof(junk_enlink));
6733  enlink = junk_enlink;
6734 
6736 
6737  if (notifies)
6738  {
6740  "%s test %i: Expected hwnd %p got %p\n", desc, i, hwnd, enlink.nmhdr.hwndFrom);
6741  ok(enlink.nmhdr.idFrom == 0,
6742  "%s test %i: Expected idFrom 0 got 0x%lx\n", desc, i, enlink.nmhdr.idFrom);
6743  ok(enlink.msg == msg,
6744  "%s test %i: Expected msg 0x%x got 0x%x\n", desc, i, msg, enlink.msg);
6745  if (msg == WM_SETCURSOR)
6746  {
6747  ok(enlink.wParam == 0,
6748  "%s test %i: Expected wParam 0 got 0x%lx\n", desc, i, enlink.wParam);
6749  }
6750  else
6751  {
6752  ok(enlink.wParam == wParam,
6753  "%s test %i: Expected wParam 0x%lx got 0x%lx\n", desc, i, wParam, enlink.wParam);
6754  }
6756  "%s test %i: Expected lParam 0x%lx got 0x%lx\n",
6758  ok(enlink.chrg.cpMin == 0 && enlink.chrg.cpMax == 31,
6759  "%s test %i: Expected link range [0,31) got [%i,%i)\n", desc, i, enlink.chrg.cpMin, enlink.chrg.cpMax);
6760  }
6761  else
6762  {
6763  ok(memcmp(&enlink, &junk_enlink, sizeof(enlink)) == 0,
6764  "%s test %i: Expected enlink to remain unmodified\n", desc, i);
6765  }
6766 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
Definition: utclib.c:112
#define WM_LBUTTONDOWN
Definition: winuser.h:1752
LRESULT WINAPI SendMessageA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define WM_MOUSEWHEEL
Definition: treelist.c:96
#define WM_MOUSEHOVER
Definition: commctrl.h:4945
#define MAKELPARAM(l, h)
Definition: winuser.h:3915
LONG cpMax
Definition: richedit.h:501
UINT_PTR WPARAM
Definition: windef.h:207
#define WP_PARENT
Definition: editor.c:6694
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 WM_SETCURSOR
Definition: winuser.h:1618
UINT_PTR idFrom
Definition: winuser.h:3111
#define ok(value,...)
const struct builtin_class_descr * desc
Definition: regcontrol.c:48
#define WP_CHILD
Definition: editor.c:6695
#define CURSOR_CLIENT_Y
Definition: editor.c:6693
#define WM_RBUTTONDOWN
Definition: winuser.h:1755
static UINT WPARAM wParam
Definition: editor.c:2851
r parent
Definition: btrfs.c:2677
#define WM_RBUTTONUP
Definition: winuser.h:1756
#define WM_LBUTTONDBLCLK
Definition: winuser.h:1754
HWND hwndFrom
Definition: winuser.h:3110
#define CURSOR_CLIENT_X
Definition: editor.c:6692
static UINT WPARAM LPARAM lParam
Definition: editor.c:2851
#define WM_LBUTTONUP
Definition: winuser.h:1753
#define WM_MOUSEMOVE
Definition: winuser.h:1751
#define msg(x)
Definition: auth_time.c:54
static ENLINK enlink
Definition: editor.c:6691
#define WM_RBUTTONDBLCLK
Definition: winuser.h:1757
#define memset(x, y, z)
Definition: compat.h:39
LONG cpMin
Definition: richedit.h:500

Referenced by test_EN_LINK().

◆ LRESULT()

static LRESULT ( WINAPI richeditProc)
static

◆ move_cursor()

static void move_cursor ( HWND  hwnd,
LONG  charindex 
)
static

Definition at line 530 of file editor.c.

531 {
532  CHARRANGE cr;
533  cr.cpMax = charindex;
534  cr.cpMin = charindex;
535  SendMessageA(hwnd, EM_EXSETSEL, 0, (LPARAM)&cr);
536 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
LRESULT WINAPI SendMessageA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
LONG cpMax
Definition: richedit.h:501
LONG_PTR LPARAM
Definition: windef.h:208
#define EM_EXSETSEL
Definition: richedit.h:88
LONG cpMin
Definition: richedit.h:500

Referenced by test_EM_SCROLLCARET().

◆ new_richedit()

◆ new_richedit_with_style()

static HWND new_richedit_with_style ( HWND  parent,
DWORD  style 
)
static

Definition at line 76 of file editor.c.

76  {
78 }
r parent
Definition: btrfs.c:2677
static HWND new_window(LPCSTR lpClassName, DWORD dwStyle, HWND parent)
Definition: editor.c:54
#define RICHEDIT_CLASS20A
Definition: richedit.h:43
Arabic default style
Definition: afstyles.h:93

Referenced by test_EM_REPLACESEL(), test_EM_SETTEXTEX(), test_EM_STREAMIN(), test_WM_PASTE(), and test_WM_SETTEXT().

◆ new_richeditW()

static HWND new_richeditW ( HWND  parent)
static

Definition at line 80 of file editor.c.

80  {
82 }
static const WCHAR RICHEDIT_CLASS20W[]
Definition: richedit.h:50
#define ES_MULTILINE
Definition: pedump.c:667
r parent
Definition: btrfs.c:2677
static HWND new_windowW(LPCWSTR lpClassName, DWORD dwStyle, HWND parent)
Definition: editor.c:63

Referenced by test_EM_FINDTEXT(), test_EM_FINDWORDBREAK_W(), test_EM_SETREADONLY(), test_para_numbering(), test_reset_default_para_fmt(), and test_rtf().

◆ new_static_wnd()

static HWND new_static_wnd ( HWND  parent)
static

Definition at line 1920 of file editor.c.

1920  {
1921  return new_window("Static", 0, parent);
1922 }
r parent
Definition: btrfs.c:2677
static HWND new_window(LPCSTR lpClassName, DWORD dwStyle, HWND parent)
Definition: editor.c:54

Referenced by test_EM_AUTOURLDETECT().

◆ new_window()

static HWND new_window ( LPCSTR  lpClassName,
DWORD  dwStyle,
HWND  parent 
)
static

Definition at line 54 of file editor.c.

54  {
55  HWND hwnd;
56  hwnd = CreateWindowA(lpClassName, NULL, dwStyle|WS_POPUP|WS_HSCROLL|WS_VSCROLL
57  |WS_VISIBLE, 0, 0, 200, 60, parent, NULL,
59  ok(hwnd != NULL, "class: %s, error: %d\n", lpClassName, (int) GetLastError());
60  return hwnd;
61 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
static HMODULE hmoduleRichEdit
Definition: editor.c:51
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
#define ok(value,...)
#define CreateWindowA(a, b, c, d, e, f, g, h, i, j, k)
Definition: winuser.h:4184
smooth NULL
Definition: ftsmooth.c:416
r parent
Definition: btrfs.c:2677
#define WS_HSCROLL
Definition: pedump.c:628
#define WS_POPUP
Definition: pedump.c:616
#define WS_VSCROLL
Definition: pedump.c:627
#define WS_VISIBLE
Definition: pedump.c:620

Referenced by MDIMainFrame::go_to(), navigate_new_window(), new_richedit(), new_richedit_with_style(), new_static_wnd(), MainFrameBase::Notify(), test_dialogmode(), test_open_window(), and test_scrollbar_visibility().

◆ new_windowW()

static HWND new_windowW ( LPCWSTR  lpClassName,
DWORD  dwStyle,
HWND  parent 
)
static

Definition at line 63 of file editor.c.

63  {
64  HWND hwnd;
65  hwnd = CreateWindowW(lpClassName, NULL, dwStyle|WS_POPUP|WS_HSCROLL|WS_VSCROLL
66  |WS_VISIBLE, 0, 0, 200, 60, parent, NULL,
68  ok(hwnd != NULL, "class: %s, error: %d\n", wine_dbgstr_w(lpClassName), (int) GetLastError());
69  return hwnd;
70 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
static HMODULE hmoduleRichEdit
Definition: editor.c:51
#define wine_dbgstr_w
Definition: kernel32.h:34
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
#define CreateWindowW(a, b, c, d, e, f, g, h, i, j, k)
Definition: winuser.h:4185
#define ok(value,...)
smooth NULL
Definition: ftsmooth.c:416
r parent
Definition: btrfs.c:2677
#define WS_HSCROLL
Definition: pedump.c:628
#define WS_POPUP
Definition: pedump.c:616
#define WS_VSCROLL
Definition: pedump.c:627
#define WS_VISIBLE
Definition: pedump.c:620

Referenced by new_richeditW(), and test_alignment_style().

◆ ParentMsgCheckProcA()

static LRESULT WINAPI ParentMsgCheckProcA ( HWND  hwnd,
UINT  message,
WPARAM  wParam,
LPARAM  lParam 
)
static

Definition at line 6493 of file editor.c.

6494 {
6495  if(message == WM_COMMAND && (watchForEventMask & (wParam >> 16)))
6496  {
6498  }
6500 }
static int watchForEventMask
Definition: editor.c:6490
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
Definition: tftpd.h:59
#define EM_GETEVENTMASK
Definition: richedit.h:92
LRESULT WINAPI SendMessageA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
static HWND eventMaskEditHwnd
Definition: editor.c:6488
static UINT WPARAM wParam
Definition: editor.c:2851
static int queriedEventMask
Definition: editor.c:6489
#define WM_COMMAND
Definition: winuser.h:1716
LRESULT WINAPI DefWindowProcA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
static UINT WPARAM LPARAM lParam
Definition: editor.c:2851

Referenced by test_eventMask().

◆ release_key()

static BOOL release_key ( int  vk)
static

Definition at line 131 of file editor.c.

132 {
133  BYTE key_state[256];
134  BOOL result;
135 
136  result = GetKeyboardState(key_state);
137  ok(result, "GetKeyboardState failed.\n");
138  if (!result) return FALSE;
139  key_state[vk] &= ~0x80;
140  result = SetKeyboardState(key_state);
141  ok(result, "SetKeyboardState failed.\n");
142  return result != 0;
143 }
unsigned int BOOL
Definition: ntddk_ex.h:94
#define ok(value,...)
_Check_return_ BOOL WINAPI GetKeyboardState(_Out_writes_(256) PBYTE lpKeyState)
unsigned char BYTE
Definition: mem.h:68
BOOL WINAPI SetKeyboardState(_In_reads_(256) LPBYTE)
GLuint64EXT * result
Definition: glext.h:11304

Referenced by send_ctrl_key(), test_WM_GETDLGCODE(), test_WM_PASTE(), and test_zoom().

◆ RicheditStupidOverrideProcA()

static LRESULT WINAPI RicheditStupidOverrideProcA ( HWND  hwnd,
UINT  message,
WPARAM  wParam,
LPARAM  lParam 
)
static

Definition at line 2853 of file editor.c.

2854 {
2855  LRESULT r;
2856 
2857  if (bailedOutOfRecursion) return 0;
2858  if (recursionLevel >= 32) {
2860  return 0;
2861  }
2862 
2863  recursionLevel++;
2864  switch (message) {
2865  case WM_SIZE:
2867  r = richeditProc(hwnd, message, wParam, lParam);
2868  /* Because, uhhhh... I never heard of ES_DISABLENOSCROLL */
2871  break;
2872  default:
2873  r = richeditProc(hwnd, message, wParam, lParam);
2874  break;
2875  }
2876  recursionLevel--;
2877  return r;
2878 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
Definition: tftpd.h:59
#define TRUE
Definition: types.h:120
#define SB_VERT
Definition: winuser.h:553
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
BOOL WINAPI ShowScrollBar(_In_ HWND, _In_ int, _In_ BOOL)
static unsigned int recursionLevel
Definition: editor.c:2848
static UINT WPARAM wParam
Definition: editor.c:2851
#define WM_SIZE
Definition: winuser.h:1593
static BOOL bailedOutOfRecursion
Definition: editor.c:2850
static UINT WPARAM LPARAM lParam
Definition: editor.c:2851
static unsigned int WM_SIZE_recursionLevel
Definition: editor.c:2849
LONG_PTR LRESULT
Definition: windef.h:209

Referenced by test_scrollbar_visibility().

◆ run_tests_EM_FINDTEXT()

static void run_tests_EM_FINDTEXT ( HWND  hwnd,
const char name,
struct find_s find,
int  num_tests,
BOOL  unicode 
)
static

Definition at line 321 of file editor.c.

323 {
324  int i;
325 
326  for (i = 0; i < num_tests; i++) {
327  check_EM_FINDTEXT(hwnd, name, &find[i], i, unicode);
328  check_EM_FINDTEXTEX(hwnd, name, &find[i], i, unicode);
329  }
330 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
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
static void check_EM_FINDTEXTEX(HWND hwnd, const char *name, struct find_s *f, int id, BOOL unicode)
Definition: editor.c:275
static void check_EM_FINDTEXT(HWND hwnd, const char *name, struct find_s *f, int id, BOOL unicode)
Definition: editor.c:239
static TAGID TAGID find
Definition: db.cpp:153
Definition: name.c:36

Referenced by test_EM_FINDTEXT().

◆ send_ctrl_key()

static LRESULT send_ctrl_key ( HWND  hwnd,
UINT  key 
)
static

Definition at line 5404 of file editor.c.

5405 {
5406  LRESULT result;
5410  return result;
5411 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
static BOOL release_key(int vk)
Definition: editor.c:131
LRESULT WINAPI SendMessageA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define WM_KEYDOWN
Definition: winuser.h:1691
static BOOL hold_key(int vk)
Definition: editor.c:117
#define VK_CONTROL
Definition: winuser.h:2157
LONG_PTR LRESULT
Definition: windef.h:209
GLuint64EXT * result
Definition: glext.h:11304
Definition: path.c:42

Referenced by test_WM_PASTE(), and test_word_movement().

◆ simulate_typing_characters()

static void simulate_typing_characters ( HWND  hwnd,
const char szChars 
)
static

Definition at line 104 of file editor.c.

105 {
106  int ret;
107 
108  while (*szChars != '\0') {
109  SendMessageA(hwnd, WM_KEYDOWN, *szChars, 1);
110  ret = SendMessageA(hwnd, WM_CHAR, *szChars, 1);
111  ok(ret == 0, "WM_CHAR('%c') ret=%d\n", *szChars, ret);
112  SendMessageA(hwnd, WM_KEYUP, *szChars, 1);
113  szChars++;
114  }
115 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
#define WM_CHAR
Definition: winuser.h:1693
LRESULT WINAPI SendMessageA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define ok(value,...)
#define WM_KEYDOWN
Definition: winuser.h:1691
#define WM_KEYUP
Definition: winuser.h:1692
int ret

Referenced by test_alignment_style(), test_EM_AUTOURLDETECT(), test_enter(), test_reset_default_para_fmt(), and test_undo_coalescing().

◆ START_TEST()

START_TEST ( editor  )

Definition at line 8924 of file editor.c.

8925 {
8926  BOOL ret;
8927  /* Must explicitly LoadLibrary(). The test has no references to functions in
8928  * RICHED20.DLL, so the linker doesn't actually link to it. */
8929  hmoduleRichEdit = LoadLibraryA("riched20.dll");
8930  ok(hmoduleRichEdit != NULL, "error: %d\n", (int) GetLastError());
8932 
8934  test_WM_CHAR();
8937  test_EM_GETLINE();
8940  test_EM_SCROLL();
8942  test_WM_SETTEXT();
8948  test_WM_GETTEXT();
8952  test_ES_PASSWORD();
8957  test_WM_SETFONT();
8959  test_EM_SETSEL();
8960  test_EM_EXSETSEL();
8961  test_WM_PASTE();
8962  test_EM_STREAMIN();
8971  test_EM_REPLACESEL(1);
8972  test_EM_REPLACESEL(0);
8973  test_WM_NOTIFY();
8974  test_EN_LINK();
8976  test_eventMask();
8981  test_word_wrap();
8982  test_autoscroll();
8983  test_format_rect();
8985  test_zoom();
8986  test_dialogmode();
8989  test_enter();
8990  test_WM_CREATE();
8995  test_rtf();
8996  test_background();
9000 
9001  /* Set the environment variable WINETEST_RICHED20 to keep windows
9002  * responsive and open for 30 seconds. This is useful for debugging.
9003  */
9004  if (getenv( "WINETEST_RICHED20" )) {
9005  keep_responsive(30);
9006  }
9007 
9010  ok(ret, "error: %d\n", (int) GetLastError());
9011 }
static void test_EM_StreamIn_Undo(void)
Definition: editor.c:6049
static void test_WM_CHAR(void)
Definition: editor.c:6286
static void test_dialogmode(void)
Definition: editor.c:7863
static void test_EM_SELECTIONTYPE(void)
Definition: editor.c:8821
static void test_EM_EXLIMITTEXT(void)
Definition: editor.c:4483
static void test_background(void)
Definition: editor.c:8688
static void test_EM_EXSETSEL(void)
Definition: editor.c:4932
#define TRUE
Definition: types.h:120
static void test_unicode_conversions(void)
Definition: editor.c:6128
static void test_EM_GETTEXTLENGTHEX(void)
Definition: editor.c:6337
static void test_EM_SETTEXTMODE(void)
Definition: editor.c:1348
static void test_EM_STREAMOUT(void)
Definition: editor.c:3805
static void test_EM_SETSEL(void)
Definition: editor.c:4986
static HMODULE hmoduleRichEdit
Definition: editor.c:51
static void test_EM_SETFONTSIZE(void)
Definition: editor.c:8458
static void test_EM_CHARFROMPOS(void)
Definition: editor.c:7136
static void test_EM_SETREADONLY(void)
Definition: editor.c:8412
static void test_EM_GETLINE(void)
Definition: editor.c:394
static void test_EM_GETSELTEXT(void)
Definition: editor.c:1785
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
static void test_WM_GETTEXTLENGTH(void)
Definition: editor.c:8595
static void test_WM_SETFONT(void)
Definition: editor.c:4629
static void test_enter(void)
Definition: editor.c:8238
static void test_autoscroll(void)
Definition: editor.c:7285
static void test_eventMask(void)
Definition: editor.c:6503
static void test_EM_FINDWORDBREAK_W(void)
Definition: editor.c:8154
static void test_WM_GETTEXT(void)
Definition: editor.c:1634
static void test_EM_FINDTEXT(BOOL unicode)
Definition: editor.c:332
static void test_EM_STREAMOUT_empty_para(void)
Definition: editor.c:3960
static void test_zoom(void)
Definition: editor.c:7688
#define LANG_JAPANESE
Definition: nls.h:76
static void test_window_classes(void)
Definition: editor.c:8892
static void test_word_movement(void)
Definition: editor.c:7047
unsigned int BOOL
Definition: ntddk_ex.h:94
HINSTANCE WINAPI DECLSPEC_HOTPATCH LoadLibraryA(LPCSTR lpLibFileName)
Definition: loader.c:111
#define ok(value,...)
static void test_WM_GETDLGCODE(void)
Definition: editor.c:7507
static void test_EM_SETTEXTEX(void)
Definition: editor.c:3980
static void test_undo_coalescing(void)
Definition: editor.c:6893
smooth NULL
Definition: ftsmooth.c:416
static void test_EM_LIMITTEXT(void)
Definition: editor.c:4443
static void test_reset_default_para_fmt(void)
Definition: editor.c:8380
static void test_EM_STREAMIN(void)
Definition: editor.c:5786
#define FreeLibrary(x)
Definition: compat.h:405
static BOOL is_lang_japanese
Definition: editor.c:52
static void test_format_rect(void)
Definition: editor.c:7344
static void test_WM_NOTIFY(void)
Definition: editor.c:6597
static void test_WM_PASTE(void)
Definition: editor.c:5413
static void test_EM_SCROLL(void)
Definition: editor.c:2714
int ret
static void test_EN_LINK(void)
Definition: editor.c:6768
static void keep_responsive(time_t delay_time)
Definition: editor.c:86
static void test_ES_PASSWORD(void)
Definition: editor.c:3634
static void test_EM_STREAMOUT_FONTTBL(void)
Definition: editor.c:3907
static void test_EM_POSFROMCHAR(void)
Definition: editor.c:601
static void test_scrollbar_visibility(void)
Definition: editor.c:2880
static void test_rtf(void)
Definition: editor.c:8626
static void test_eop_char_fmt(void)
Definition: editor.c:8700
static void test_EM_SETOPTIONS(void)
Definition: editor.c:1824
_Check_return_ char *__cdecl getenv(_In_z_ const char *_VarName)
static void test_WM_SETTEXT(void)
Definition: editor.c:3677
static void test_EM_FORMATRANGE(void)
Definition: editor.c:5578
static void test_EM_LINELENGTH(void)
Definition: editor.c:466
static void test_EM_FINDWORDBREAK_A(void)
Definition: editor.c:8198
static void test_EM_GETTEXTRANGE(void)
Definition: editor.c:1701
static void test_word_wrap(void)
Definition: editor.c:7189
static void test_para_numbering(void)
Definition: editor.c:8736
LANGID WINAPI GetUserDefaultLangID(void)
Definition: lang.c:734
static void test_WM_CREATE(void)
Definition: editor.c:8339
static void test_EM_SETUNDOLIMIT(void)
Definition: editor.c:3570
HRESULT WINAPI OleFlushClipboard(void)
Definition: clipboard.c:2293
static void test_EM_GETMODIFY(void)
Definition: editor.c:4711
static void test_EM_REPLACESEL(int redraw)
Definition: editor.c:5029
static void test_EM_GETLIMITTEXT(void)
Definition: editor.c:4614
static void test_TM_PLAINTEXT(void)
Definition: editor.c:1524
static void test_EM_SETCHARFORMAT(void)
Definition: editor.c:753
static void test_SETPARAFORMAT(void)
Definition: editor.c:1490
static void test_alignment_style(void)
Definition: editor.c:8525
static void test_EM_AUTOURLDETECT(void)
Definition: editor.c:1924
static void test_EM_SCROLLCARET(void)
Definition: editor.c:543
#define PRIMARYLANGID(l)
Definition: nls.h:16

◆ test_alignment_style()

static void test_alignment_style ( void  )
static

Definition at line 8525 of file editor.c.

8526 {
8527  HWND richedit = NULL;
8528  PARAFORMAT2 pf;
8529  DWORD align_style[] = {ES_LEFT, ES_CENTER, ES_RIGHT, ES_RIGHT | ES_CENTER,
8531  ES_LEFT | ES_RIGHT | ES_CENTER};
8534  const char * streamtext =
8535  "{\\rtf1\\ansi\\ansicpg1252\\deff0\\deflang12298{\\fonttbl{\\f0\\fswiss\\fprq2\\fcharset0 System;}}\r\n"
8536  "\\viewkind4\\uc1\\pard\\f0\\fs17 TestSomeText\\par\r\n"
8537  "}\r\n";
8538  EDITSTREAM es;
8539  int i;
8540 
8541  for (i = 0; i < sizeof(align_style) / sizeof(align_style[0]); i++)
8542  {
8543  DWORD dwStyle, new_align;
8544 
8545  richedit = new_windowW(RICHEDIT_CLASS20W, align_style[i], NULL);
8546  memset(&pf, 0, sizeof(pf));
8547  pf.cbSize = sizeof(PARAFORMAT2);
8548  pf.dwMask = -1;
8549 
8550  SendMessageW(richedit, EM_GETPARAFORMAT, 0, (LPARAM)&pf);
8551  ok(pf.wAlignment == align_mask[i], "(i = %d) got %d expected %d\n",
8552  i, pf.wAlignment, align_mask[i]);
8553  dwStyle = GetWindowLongW(richedit, GWL_STYLE);
8554  ok((i ? (dwStyle & align_style[i]) : (!(dwStyle & 0x0000000f))) ,
8555  "(i = %d) didn't set right align style: 0x%x\n", i, dwStyle);
8556 
8557 
8558  /* Based on test_reset_default_para_fmt() */
8559  new_align = (align_mask[i] == PFA_LEFT) ? PFA_RIGHT : PFA_LEFT;
8560  simulate_typing_characters(richedit, "123");
8561 
8562  SendMessageW(richedit, EM_SETSEL, 0, -1);
8563  pf.dwMask = PFM_ALIGNMENT;
8564  pf.wAlignment = new_align;
8565  SendMessageW(richedit, EM_SETPARAFORMAT, 0, (LPARAM)&pf);
8566 
8567  SendMessageW(richedit, EM_GETPARAFORMAT, 0, (LPARAM)&pf);
8568  ok(pf.wAlignment == new_align, "got %d expect %d\n", pf.wAlignment, new_align);
8569 
8570  SendMessageW(richedit, EM_SETSEL, 0, -1);
8571  SendMessageW(richedit, WM_CUT, 0, 0);
8572 
8573  SendMessageW(richedit, EM_GETPARAFORMAT, 0, (LPARAM)&pf);
8574  ok(pf.wAlignment == align_mask[i], "got %d expect %d\n", pf.wAlignment, align_mask[i]);
8575 
8576  DestroyWindow(richedit);
8577  }
8578 
8579  /* test with EM_STREAMIN */
8581  simulate_typing_characters(richedit, "abc");
8582  es.dwCookie = (DWORD_PTR)&streamtext;
8583  es.dwError = 0;
8584  es.pfnCallback = test_EM_STREAMIN_esCallback;
8585  SendMessageW(richedit, EM_STREAMIN, SF_RTF, (LPARAM)&es);
8586  SendMessageW(richedit, EM_SETSEL, 0, -1);
8587  memset(&pf, 0, sizeof(pf));
8588  pf.cbSize = sizeof(PARAFORMAT2);
8589  pf.dwMask = -1;
8591  ok(pf.wAlignment == PFA_LEFT, "got %d expected PFA_LEFT\n", pf.wAlignment);
8592  DestroyWindow(richedit);
8593 }
#define PFA_RIGHT
Definition: richedit.h:922
#define ES_CENTER
Definition: pedump.c:665
#define DWORD_PTR
Definition: treelist.c:76
#define WM_CUT
Definition: winuser.h:1822
static const WCHAR RICHEDIT_CLASS20W[]
Definition: richedit.h:50
#define SF_RTF
Definition: richedit.h:721
WORD wAlignment
Definition: richedit.h:673
#define PFM_ALIGNMENT
Definition: richedit.h:841
#define EM_SETPARAFORMAT
Definition: richedit.h:104
BOOL WINAPI DestroyWindow(_In_ HWND)
#define EM_GETPARAFORMAT
Definition: richedit.h:94
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
#define ok(value,...)
static DWORD CALLBACK test_EM_STREAMIN_esCallback(DWORD_PTR dwCookie, LPBYTE pbBuff, LONG cb, LONG *pcb)
Definition: editor.c:5720
LONG WINAPI GetWindowLongW(_In_ HWND, _In_ int)
smooth NULL
Definition: ftsmooth.c:416
LONG_PTR LPARAM
Definition: windef.h:208
DWORD dwMask
Definition: richedit.h:667
#define EM_STREAMIN
Definition: richedit.h:106
#define PFA_CENTER
Definition: richedit.h:923
#define EM_SETSEL
Definition: winuser.h:1979
unsigned long DWORD
Definition: ntddk_ex.h:95
struct _paraformat2 PARAFORMAT2
static void simulate_typing_characters(HWND hwnd, const char *szChars)
Definition: editor.c:104
#define GWL_STYLE
Definition: winuser.h:846
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define PFA_LEFT
Definition: richedit.h:921
#define SCF_SELECTION
Definition: richedit.h:235
UINT cbSize
Definition: richedit.h:666
#define es
Definition: i386-dis.c:431
#define ES_LEFT
Definition: pedump.c:664
#define memset(x, y, z)
Definition: compat.h:39
static HWND new_windowW(LPCWSTR lpClassName, DWORD dwStyle, HWND parent)
Definition: editor.c:63

Referenced by START_TEST().

◆ test_autoscroll()

static void test_autoscroll ( void  )
static

Definition at line 7285 of file editor.c.

7286 {
7288  int lines, ret, redraw;
7289  POINT pt;
7290 
7291  for (redraw = 0; redraw <= 1; redraw++) {
7292  trace("testing with WM_SETREDRAW=%d\n", redraw);
7294  SendMessageA(hwnd, EM_REPLACESEL, 0, (LPARAM)"1\n2\n3\n4\n5\n6\n7\n8");
7296  ok(lines == 8, "%d lines instead of 8\n", lines);
7298  ok(ret == 1, "EM_GETSCROLLPOS returned %d instead of 1\n", ret);
7299  ok(pt.y != 0, "Didn't scroll down after replacing text.\n");
7301  ok(ret & WS_VSCROLL, "Scrollbar was not shown yet (style=%x).\n", (UINT)ret);
7302 
7303  SendMessageA(hwnd, WM_SETTEXT, 0, 0);
7305  ok(lines == 1, "%d lines instead of 1\n", lines);
7307  ok(ret == 1, "EM_GETSCROLLPOS returned %d instead of 1\n", ret);
7308  ok(pt.y == 0, "y scroll position is %d after clearing text.\n", pt.y);
7310  ok(!(ret & WS_VSCROLL), "Scrollbar is still shown (style=%x).\n", (UINT)ret);
7311  }
7312 
7315 
7316  /* The WS_VSCROLL and WS_HSCROLL styles implicitly set
7317  * auto vertical/horizontal scrolling options. */
7320  0, 0, 200, 60, NULL, NULL, hmoduleRichEdit, NULL);
7321  ok(hwnd != NULL, "class: %s, error: %d\n", RICHEDIT_CLASS20A, (int) GetLastError());
7322  ret = SendMessageA(hwnd, EM_GETOPTIONS, 0, 0);
7323  ok(ret & ECO_AUTOVSCROLL, "ECO_AUTOVSCROLL isn't set.\n");
7324  ok(ret & ECO_AUTOHSCROLL, "ECO_AUTOHSCROLL isn't set.\n");
7326  ok(!(ret & ES_AUTOVSCROLL), "ES_AUTOVSCROLL is set.\n");
7327  ok(!(ret & ES_AUTOHSCROLL), "ES_AUTOHSCROLL is set.\n");
7329 
7332  0, 0, 200, 60, NULL, NULL, hmoduleRichEdit, NULL);
7333  ok(hwnd != NULL, "class: %s, error: %d\n", RICHEDIT_CLASS20A, (int) GetLastError());
7334  ret = SendMessageA(hwnd, EM_GETOPTIONS, 0, 0);
7335  ok(!(ret & ECO_AUTOVSCROLL), "ECO_AUTOVSCROLL is set.\n");
7336  ok(!(ret & ECO_AUTOHSCROLL), "ECO_AUTOHSCROLL is set.\n");
7338  ok(!(ret & ES_AUTOVSCROLL), "ES_AUTOVSCROLL is set.\n");
7339  ok(!(ret & ES_AUTOHSCROLL), "ES_AUTOHSCROLL is set.\n");
7341 }
#define EM_GETSCROLLPOS
Definition: richedit.h:165
#define ECO_AUTOVSCROLL
Definition: richedit.h:457
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
#define trace(...)
Definition: kmt_test.h:217
#define TRUE
Definition: types.h:120
static HMODULE hmoduleRichEdit
Definition: editor.c:51
#define pt(x, y)
Definition: drawing.c:79
LRESULT WINAPI SendMessageA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define ES_MULTILINE
Definition: pedump.c:667
#define WM_SETREDRAW
Definition: winuser.h:1598
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
BOOL WINAPI DestroyWindow(_In_ HWND)
LONG WINAPI GetWindowLongA(_In_ HWND, _In_ int)
#define ok(value,...)
smooth NULL
Definition: ftsmooth.c:416
LONG_PTR LPARAM
Definition: windef.h:208
#define WM_SETTEXT
Definition: winuser.h:1599
eMaj lines
Definition: tritemp.h:206
#define ES_AUTOVSCROLL
Definition: pedump.c:671
#define WS_HSCROLL
Definition: pedump.c:628
int ret
#define ECO_AUTOHSCROLL
Definition: richedit.h:458
static HWND new_richedit(HWND parent)
Definition: editor.c:72
#define GWL_STYLE
Definition: winuser.h:846
void redraw(int x, int y, int cx, int cy)
Definition: qtewin.cpp:1248
#define RICHEDIT_CLASS20A
Definition: richedit.h:43
#define WS_POPUP
Definition: pedump.c:616
unsigned int UINT
Definition: ndis.h:50
#define WS_VSCROLL
Definition: pedump.c:627
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 ES_AUTOHSCROLL
Definition: pedump.c:672
#define EM_REPLACESEL
Definition: winuser.h:1967
#define EM_GETOPTIONS
Definition: richedit.h:111
#define EM_GETLINECOUNT
Definition: winuser.h:1953

Referenced by START_TEST().

◆ test_background()

static void test_background ( void  )
static

Definition at line 8688 of file editor.c.

8689 {
8690  HWND hwndRichEdit = new_richedit(NULL);
8691 
8692  /* set the background color to black */
8693  ValidateRect(hwndRichEdit, NULL);
8694  SendMessageA(hwndRichEdit, EM_SETBKGNDCOLOR, FALSE, RGB(0, 0, 0));
8695  ok(GetUpdateRect(hwndRichEdit, NULL, FALSE), "Update rectangle is empty!\n");
8696 
8697  DestroyWindow(hwndRichEdit);
8698 }
LRESULT WINAPI SendMessageA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
BOOL WINAPI DestroyWindow(_In_ HWND)
#define ok(value,...)
smooth NULL
Definition: ftsmooth.c:416
#define EM_SETBKGNDCOLOR
Definition: richedit.h:100
#define RGB(r, g, b)
Definition: wingdi.h:2918
BOOL WINAPI ValidateRect(_In_opt_ HWND, _In_opt_ LPCRECT)
BOOL WINAPI GetUpdateRect(_In_ HWND, _Out_opt_ LPRECT, _In_ BOOL)
static HWND new_richedit(HWND parent)
Definition: editor.c:72

Referenced by START_TEST().

◆ test_dialogmode()

static void test_dialogmode ( void  )
static

Definition at line 7863 of file editor.c.

7864 {
7865  HWND hwRichEdit, hwParent, hwButton;
7866  MSG msg= {0};
7867  int lcount, r;
7868  WNDCLASSA cls;
7869 
7870  cls.style = 0;
7872  cls.cbClsExtra = 0;
7873  cls.cbWndExtra = 0;
7874  cls.hInstance = GetModuleHandleA(0);
7875  cls.hIcon = 0;
7876  cls.hCursor = LoadCursorA(0, (LPCSTR)IDC_ARROW);
7878  cls.lpszMenuName = NULL;
7879  cls.lpszClassName = "DialogModeParentClass";
7880  if(!RegisterClassA(&cls)) assert(0);
7881 
7882  hwParent = CreateWindowA("DialogModeParentClass", NULL, WS_OVERLAPPEDWINDOW,
7883  CW_USEDEFAULT, 0, 200, 120, NULL, NULL, GetModuleHandleA(0), NULL);
7884 
7885  /* Test richedit(ES_MULTILINE) */
7886 
7887  hwRichEdit = new_window(RICHEDIT_CLASS20A, ES_MULTILINE, hwParent);
7888 
7889  r = SendMessageA(hwRichEdit, WM_KEYDOWN, VK_RETURN, 0x1c0001);
7890  ok(0 == r, "expected 0, got %d\n", r);
7891  lcount = SendMessageA(hwRichEdit, EM_GETLINECOUNT, 0, 0);
7892  ok(2 == lcount, "expected 2, got %d\n", lcount);
7893 
7894  r = SendMessageA(hwRichEdit, WM_GETDLGCODE, 0, 0);
7895  ok(0x8f == r, "expected 0x8f, got 0x%x\n", r);
7896 
7897  r = SendMessageA(hwRichEdit, WM_KEYDOWN, VK_RETURN, 0x1c0001);
7898  ok(0 == r, "expected 0, got %d\n", r);
7899  lcount = SendMessageA(hwRichEdit, EM_GETLINECOUNT, 0, 0);
7900  ok(3 == lcount, "expected 3, got %d\n", lcount);
7901 
7902  r = SendMessageA(hwRichEdit, WM_GETDLGCODE, 0, (LPARAM)&msg);
7903  ok(0x8f == r, "expected 0x8f, got 0x%x\n", r);
7904  r = SendMessageA(hwRichEdit, WM_KEYDOWN, VK_RETURN, 0x1c0001);
7905  ok(0 == r, "expected 0, got %d\n", r);
7906  lcount = SendMessageA(hwRichEdit, EM_GETLINECOUNT, 0, 0);
7907  ok(3 == lcount, "expected 3, got %d\n", lcount);
7908 
7909  DestroyWindow(hwRichEdit);
7910 
7911  /* Test standalone richedit(ES_MULTILINE) */
7912 
7914 
7915  r = SendMessageA(hwRichEdit, WM_KEYDOWN, VK_RETURN, 0x1c0001);
7916  ok(0 == r, "expected 0, got %d\n", r);
7917  lcount = SendMessageA(hwRichEdit, EM_GETLINECOUNT, 0, 0);
7918  ok(2 == lcount, "expected 2, got %d\n", lcount);
7919 
7920  r = SendMessageA(hwRichEdit, WM_GETDLGCODE, 0, (LPARAM)&msg);
7921  ok(0x8f == r, "expected 0x8f, got 0x%x\n", r);
7922 
7923  r = SendMessageA(hwRichEdit, WM_KEYDOWN, VK_RETURN, 0x1c0001);
7924  ok(0 == r, "expected 0, got %d\n", r);
7925  lcount = SendMessageA(hwRichEdit, EM_GETLINECOUNT, 0, 0);
7926  ok(2 == lcount, "expected 2, got %d\n", lcount);
7927 
7928  DestroyWindow(hwRichEdit);
7929 
7930  /* Check a destination for messages */
7931 
7932  hwRichEdit = new_window(RICHEDIT_CLASS20A, ES_MULTILINE, hwParent);
7933 
7934  SetWindowLongA(hwRichEdit, GWL_STYLE, GetWindowLongA(hwRichEdit, GWL_STYLE)& ~WS_POPUP);
7935  SetParent( hwRichEdit, NULL);
7936 
7937  r = SendMessageA(hwRichEdit, WM_GETDLGCODE, 0, (LPARAM)&msg);
7938  ok(0x8f == r, "expected 0x8f, got 0x%x\n", r);
7939 
7940  memset(&dm_messages, 0, sizeof(dm_messages));
7941  r = SendMessageA(hwRichEdit, WM_KEYDOWN, VK_RETURN, 0x1c0001);
7942  ok(0 == r, "expected 0, got %d\n", r);
7943  test_dm_messages(0, 1, 0);
7944 
7945  memset(&dm_messages, 0, sizeof(dm_messages));
7946  r = SendMessageA(hwRichEdit, WM_KEYDOWN, VK_TAB, 0xf0001);
7947  ok(0 == r, "expected 0, got %d\n", r);
7948  test_dm_messages(0, 0, 1);
7949 
7950  DestroyWindow(hwRichEdit);
7951 
7952  /* Check messages from richedit(ES_MULTILINE) */
7953 
7954  hwRichEdit = new_window(RICHEDIT_CLASS20A, ES_MULTILINE, hwParent);
7955 
7956  memset(&dm_messages, 0, sizeof(dm_messages));
7957  r = SendMessageA(hwRichEdit, WM_KEYDOWN, VK_RETURN, 0x1c0001);
7958  ok(0 == r, "expected 0, got %d\n", r);
7959  test_dm_messages(0, 0, 0);
7960 
7961  lcount = SendMessageA(hwRichEdit, EM_GETLINECOUNT, 0, 0);
7962  ok(2 == lcount, "expected 2, got %d\n", lcount);
7963 
7964  memset(&dm_messages, 0, sizeof(dm_messages));
7965  r = SendMessageA(hwRichEdit, WM_KEYDOWN, VK_ESCAPE, 0x10001);
7966  ok(0 == r, "expected 0, got %d\n", r);
7967  test_dm_messages(0, 0, 0);
7968 
7969  memset(&dm_messages, 0, sizeof(dm_messages));
7970  r = SendMessageA(hwRichEdit, WM_KEYDOWN, VK_TAB, 0xf0001);
7971  ok(0 == r, "expected 0, got %d\n", r);
7972  test_dm_messages(0, 0, 0);
7973 
7974  memset(&dm_messages, 0, sizeof(dm_messages));
7975  r = SendMessageA(hwRichEdit, WM_GETDLGCODE, 0, (LPARAM)&msg);
7976  ok(0x8f == r, "expected 0x8f, got 0x%x\n", r);
7977  test_dm_messages(0, 0, 0);
7978 
7979  memset(&dm_messages, 0, sizeof(dm_messages));
7980  r = SendMessageA(hwRichEdit, WM_KEYDOWN, VK_RETURN, 0x1c0001);
7981  ok(0 == r, "expected 0, got %d\n", r);
7982  test_dm_messages(0, 1, 0);
7983 
7984  lcount = SendMessageA(hwRichEdit, EM_GETLINECOUNT, 0, 0);
7985  ok(2 == lcount, "expected 2, got %d\n", lcount);
7986 
7987  memset(&dm_messages, 0, sizeof(dm_messages));
7988  r = SendMessageA(hwRichEdit, WM_KEYDOWN, VK_ESCAPE, 0x10001);
7989  ok(0 == r, "expected 0, got %d\n", r);
7990  test_dm_messages(0, 0, 0);
7991 
7992  memset(&dm_messages, 0, sizeof(dm_messages));
7993  r = SendMessageA(hwRichEdit, WM_KEYDOWN, VK_TAB, 0xf0001);
7994  ok(0 == r, "expected 0, got %d\n", r);
7995  test_dm_messages(0, 0, 1);
7996 
7997  hwButton = CreateWindowA("BUTTON", "OK", WS_VISIBLE|WS_CHILD|BS_PUSHBUTTON,
7998  100, 100, 50, 20, hwParent, (HMENU)ID_RICHEDITTESTDBUTTON, GetModuleHandleA(0), NULL);
7999  ok(hwButton!=NULL, "CreateWindow failed with error code %d\n", GetLastError());
8000 
8001  memset(&dm_messages, 0, sizeof(dm_messages));
8002  r = SendMessageA(hwRichEdit, WM_KEYDOWN, VK_RETURN, 0x1c0001);
8003  ok(0 == r, "expected 0, got %d\n", r);
8004  test_dm_messages(0, 1, 1);
8005 
8006  lcount = SendMessageA(hwRichEdit, EM_GETLINECOUNT, 0, 0);
8007  ok(2 == lcount, "expected 2, got %d\n", lcount);
8008 
8009  DestroyWindow(hwButton);
8010  DestroyWindow(hwRichEdit);
8011 
8012  /* Check messages from richedit(ES_MULTILINE|ES_WANTRETURN) */
8013 
8014  hwRichEdit = new_window(RICHEDIT_CLASS20A, ES_MULTILINE|ES_WANTRETURN, hwParent);
8015 
8016  memset(&dm_messages, 0, sizeof(dm_messages));
8017  r = SendMessageA(hwRichEdit, WM_KEYDOWN, VK_RETURN, 0x1c0001);
8018  ok(0 == r, "expected 0, got %d\n", r);
8019  test_dm_messages(0, 0, 0);
8020 
8021  lcount = SendMessageA(hwRichEdit, EM_GETLINECOUNT, 0, 0);
8022  ok(2 == lcount, "expected 2, got %d\n", lcount);
8023 
8024  memset(&dm_messages, 0, sizeof(dm_messages));
8025  r = SendMessageA(hwRichEdit, WM_KEYDOWN, VK_ESCAPE, 0x10001);
8026  ok(0 == r, "expected 0, got %d\n", r);
8027  test_dm_messages(0, 0, 0);
8028 
8029  memset(&dm_messages, 0, sizeof(dm_messages));
8030  r = SendMessageA(hwRichEdit, WM_KEYDOWN, VK_TAB, 0xf0001);
8031  ok(0 == r, "expected 0, got %d\n", r);
8032  test_dm_messages(0, 0, 0);
8033 
8034  memset(&dm_messages, 0, sizeof(dm_messages));
8035  r = SendMessageA(hwRichEdit, WM_GETDLGCODE, 0, (LPARAM)&msg);
8036  ok(0x8f == r, "expected 0x8f, got 0x%x\n", r);
8037  test_dm_messages(0, 0, 0);
8038 
8039  memset(&dm_messages, 0, sizeof(dm_messages));
8040  r = SendMessageA(hwRichEdit, WM_KEYDOWN, VK_RETURN, 0x1c0001);
8041  ok(0 == r, "expected 0, got %d\n", r);
8042  test_dm_messages(0, 0, 0);
8043 
8044  lcount = SendMessageA(hwRichEdit, EM_GETLINECOUNT, 0, 0);
8045  ok(3 == lcount, "expected 3, got %d\n", lcount);
8046 
8047  memset(&dm_messages, 0, sizeof(dm_messages));
8048  r = SendMessageA(hwRichEdit, WM_KEYDOWN, VK_ESCAPE, 0x10001);
8049  ok(0 == r, "expected 0, got %d\n", r);
8050  test_dm_messages(0, 0, 0);
8051 
8052  memset(&dm_messages, 0, sizeof(dm_messages));
8053  r = SendMessageA(hwRichEdit, WM_KEYDOWN, VK_TAB, 0xf0001);
8054  ok(0 == r, "expected 0, got %d\n", r);
8055  test_dm_messages(0, 0, 1);
8056 
8057  hwButton = CreateWindowA("BUTTON", "OK", WS_VISIBLE|WS_CHILD|BS_PUSHBUTTON,
8058  100, 100, 50, 20, hwParent, (HMENU)ID_RICHEDITTESTDBUTTON, GetModuleHandleA(0), NULL);
8059  ok(hwButton!=NULL, "CreateWindow failed with error code %d\n", GetLastError());
8060 
8061  memset(&dm_messages, 0, sizeof(dm_messages));
8062  r = SendMessageA(hwRichEdit, WM_KEYDOWN, VK_RETURN, 0x1c0001);
8063  ok(0 == r, "expected 0, got %d\n", r);
8064  test_dm_messages(0, 0, 0);
8065 
8066  lcount = SendMessageA(hwRichEdit, EM_GETLINECOUNT, 0, 0);
8067  ok(4 == lcount, "expected 4, got %d\n", lcount);
8068 
8069  DestroyWindow(hwButton);
8070  DestroyWindow(hwRichEdit);
8071 
8072  /* Check messages from richedit(0) */
8073 
8074  hwRichEdit = new_window(RICHEDIT_CLASS20A, 0, hwParent);
8075 
8076  memset(&dm_messages, 0, sizeof(dm_messages));
8077  r = SendMessageA(hwRichEdit, WM_KEYDOWN, VK_RETURN, 0x1c0001);
8078  ok(0 == r, "expected 0, got %d\n", r);
8079  test_dm_messages(0, 0, 0);
8080 
8081  memset(&dm_messages, 0, sizeof(dm_messages));
8082  r = SendMessageA(hwRichEdit, WM_KEYDOWN, VK_ESCAPE, 0x10001);
8083  ok(0 == r, "expected 0, got %d\n", r);
8084  test_dm_messages(0, 0, 0);
8085 
8086  memset(&dm_messages, 0, sizeof(dm_messages));
8087  r = SendMessageA(hwRichEdit, WM_KEYDOWN, VK_TAB, 0xf0001);
8088  ok(0 == r, "expected 0, got %d\n", r);
8089  test_dm_messages(0, 0, 0);
8090 
8091  memset(&dm_messages, 0, sizeof(dm_messages));
8092  r = SendMessageA(hwRichEdit, WM_GETDLGCODE, 0, (LPARAM)&msg);
8093  ok(0x8b == r, "expected 0x8b, got 0x%x\n", r);
8094  test_dm_messages(0, 0, 0);
8095 
8096  memset(&dm_messages, 0, sizeof(dm_messages));
8097  r = SendMessageA(hwRichEdit, WM_KEYDOWN, VK_RETURN, 0x1c0001);
8098  ok(0 == r, "expected 0, got %d\n", r);
8099  test_dm_messages(0, 1, 0);
8100 
8101  memset(&dm_messages, 0, sizeof(dm_messages));
8102  r = SendMessageA(hwRichEdit, WM_KEYDOWN, VK_ESCAPE, 0x10001);
8103  ok(0 == r, "expected 0, got %d\n", r);
8104  test_dm_messages(0, 0, 0);
8105 
8106  memset(&dm_messages, 0, sizeof(dm_messages));
8107  r = SendMessageA(hwRichEdit, WM_KEYDOWN, VK_TAB, 0xf0001);
8108  ok(0 == r, "expected 0, got %d\n", r);
8109  test_dm_messages(0, 0, 1);
8110 
8111  hwButton = CreateWindowA("BUTTON", "OK", WS_VISIBLE|WS_CHILD|BS_PUSHBUTTON,
8112  100, 100, 50, 20, hwParent, (HMENU)ID_RICHEDITTESTDBUTTON, GetModuleHandleA(0), NULL);
8113  ok(hwButton!=NULL, "CreateWindow failed with error code %d\n", GetLastError());
8114 
8115  memset(&dm_messages, 0, sizeof(dm_messages));
8116  r = SendMessageA(hwRichEdit, WM_KEYDOWN, VK_RETURN, 0x1c0001);
8117  ok(0 == r, "expected 0, got %d\n", r);
8118  test_dm_messages(0, 1, 1);
8119 
8120  DestroyWindow(hwRichEdit);
8121 
8122  /* Check messages from richedit(ES_WANTRETURN) */
8123 
8124  hwRichEdit = new_window(RICHEDIT_CLASS20A, ES_WANTRETURN, hwParent);
8125 
8126  memset(&dm_messages, 0, sizeof(dm_messages));
8127  r = SendMessageA(hwRichEdit, WM_KEYDOWN, VK_RETURN, 0x1c0001);
8128  ok(0 == r, "expected 0, got %d\n", r);
8129  test_dm_messages(0, 0, 0);
8130 
8131  memset(&dm_messages, 0, sizeof(dm_messages));
8132  r = SendMessageA(hwRichEdit, WM_GETDLGCODE, 0, (LPARAM)&msg);
8133  ok(0x8b == r, "expected 0x8b, got 0x%x\n", r);
8134  test_dm_messages(0, 0, 0);
8135 
8136  memset(&dm_messages, 0, sizeof(dm_messages));
8137  r = SendMessageA(hwRichEdit, WM_KEYDOWN, VK_RETURN, 0x1c0001);
8138  ok(0 == r, "expected 0, got %d\n", r);
8139  test_dm_messages(0, 0, 0);
8140 
8141  hwButton = CreateWindowA("BUTTON", "OK", WS_VISIBLE|WS_CHILD|BS_PUSHBUTTON,
8142  100, 100, 50, 20, hwParent, (HMENU)ID_RICHEDITTESTDBUTTON, GetModuleHandleA(0), NULL);
8143  ok(hwButton!=NULL, "CreateWindow failed with error code %d\n", GetLastError());
8144 
8145  memset(&dm_messages, 0, sizeof(dm_messages));
8146  r = SendMessageA(hwRichEdit, WM_KEYDOWN, VK_RETURN, 0x1c0001);
8147  ok(0 == r, "expected 0, got %d\n", r);
8148  test_dm_messages(0, 0, 0);
8149 
8150  DestroyWindow(hwRichEdit);
8151  DestroyWindow(hwParent);
8152 }
HGDIOBJ WINAPI GetStockObject(_In_ int)
#define WM_GETDLGCODE
Definition: winuser.h:1671
HWND WINAPI SetParent(_In_ HWND, _In_opt_ HWND)
LRESULT WINAPI SendMessageA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
static struct dialog_mode_messages dm_messages
Definition: editor.c:7835
TW_UINT32 TW_UINT16 TW_UINT16 MSG
Definition: twain.h:1827
#define ID_RICHEDITTESTDBUTTON
Definition: editor.c:40
#define ES_MULTILINE
Definition: pedump.c:667
int cbClsExtra
Definition: winuser.h:3118
#define assert(x)
Definition: debug.h:53
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
LPCSTR lpszMenuName
Definition: winuser.h:3124
#define WHITE_BRUSH
Definition: wingdi.h:901
#define VK_TAB
Definition: winuser.h:2153
HBRUSH hbrBackground
Definition: winuser.h:3123
#define WS_CHILD
Definition: pedump.c:617
#define VK_ESCAPE
Definition: winuser.h:2168
BOOL WINAPI DestroyWindow(_In_ HWND)
#define VK_RETURN
Definition: winuser.h:2155
int cbWndExtra
Definition: winuser.h:3119
LONG WINAPI GetWindowLongA(_In_ HWND, _In_ int)
#define ok(value,...)
#define CreateWindowA(a, b, c, d, e, f, g, h, i, j, k)
Definition: winuser.h:4184
HCURSOR hCursor
Definition: winuser.h:3122
#define CW_USEDEFAULT
Definition: winuser.h:225
#define ES_WANTRETURN
Definition: pedump.c:676
smooth NULL
Definition: ftsmooth.c:416
#define WM_KEYDOWN
Definition: winuser.h:1691
LONG_PTR LPARAM
Definition: windef.h:208
const char * LPCSTR
Definition: xmlstorage.h:183
static HWND new_window(LPCSTR lpClassName, DWORD dwStyle, HWND parent)
Definition: editor.c:54
HMODULE WINAPI DECLSPEC_HOTPATCH GetModuleHandleA(LPCSTR lpModuleName)
Definition: loader.c:819
LPCSTR lpszClassName
Definition: winuser.h:3125
HCURSOR WINAPI LoadCursorA(_In_opt_ HINSTANCE, _In_ LPCSTR)
Definition: cursoricon.c:2059
#define BS_PUSHBUTTON
Definition: pedump.c:651
UINT style
Definition: winuser.h:3116
#define GWL_STYLE
Definition: winuser.h:846
HINSTANCE hInstance
Definition: winuser.h:3120
#define RICHEDIT_CLASS20A
Definition: richedit.h:43
#define WS_POPUP
Definition: pedump.c:616
LONG WINAPI SetWindowLongA(_In_ HWND, _In_ int, _In_ LONG)
WNDPROC lpfnWndProc
Definition: winuser.h:3117
#define msg(x)
Definition: auth_time.c:54
#define IDC_ARROW
Definition: winuser.h:682
#define WS_OVERLAPPEDWINDOW
Definition: pedump.c:637
#define test_dm_messages(wmclose, wmgetdefid, wmnextdlgctl)
Definition: editor.c:7837
static LRESULT CALLBACK dialog_mode_wnd_proc(HWND hwnd, UINT iMsg, WPARAM wParam, LPARAM lParam)
Definition: editor.c:7845
#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
ATOM WINAPI RegisterClassA(_In_ CONST WNDCLASSA *)
HICON hIcon
Definition: winuser.h:3121
#define EM_GETLINECOUNT
Definition: winuser.h:1953

Referenced by START_TEST().

◆ test_EM_AUTOURLDETECT()

static void test_EM_AUTOURLDETECT ( void  )
static

Definition at line 1924 of file editor.c.

1925 {
1926  /* DO NOT change the properties of the first two elements. To shorten the
1927  tests, all tests after WM_SETTEXT test just the first two elements -
1928  one non-URL and one URL */
1929  struct urls_s {
1930  const char *text;
1931  BOOL is_url;
1932  } urls[12] = {
1933  {"winehq.org", FALSE},
1934  {"http://www.winehq.org", TRUE},
1935  {"http//winehq.org", FALSE},
1936  {"ww.winehq.org", FALSE},
1937  {"www.winehq.org", TRUE},
1938  {"ftp://192.168.1.1", TRUE},
1939  {"ftp//192.168.1.1", FALSE},
1940  {"mailto:your@email.com", TRUE},
1941  {"prospero:prosperoserver", TRUE},
1942  {"telnet:test", TRUE},
1943  {"news:newserver", TRUE},
1944  {"wais:waisserver", TRUE}
1945  };
1946 
1947  int i, j;
1948  int urlRet=-1;
1949  HWND hwndRichEdit, parent;
1950 
1951  /* All of the following should cause the URL to be detected */
1952  const char * templates_delim[] = {
1953  "This is some text with X on it",
1954  "This is some text with (X) on it",
1955  "This is some text with X\r on it",
1956  "This is some text with ---X--- on it",
1957  "This is some text with \"X\" on it",
1958  "This is some text with 'X' on it",
1959  "This is some text with 'X' on it",
1960  "This is some text with :X: on it",
1961 
1962  "This text ends with X",
1963 
1964  "This is some text with X) on it",
1965  "This is some text with X--- on it",
1966  "This is some text with X\" on it",
1967  "This is some text with X' on it",
1968  "This is some text with X: on it",
1969 
1970  "This is some text with (X on it",
1971  "This is some text with \rX on it",
1972  "This is some text with ---X on it",
1973  "This is some text with \"X on it",
1974  "This is some text with 'X on it",
1975  "This is some text with :X on it",
1976  };
1977  /* None of these should cause the URL to be detected */
1978  const char * templates_non_delim[] = {
1979  "This is some text with |X| on it",
1980  "This is some text with *X* on it",
1981  "This is some text with /X/ on it",
1982  "This is some text with +X+ on it",
1983  "This is some text with %X% on it",
1984  "This is some text with #X# on it",
1985  "This is some text with @X@ on it",
1986  "This is some text with \\X\\ on it",
1987  "This is some text with |X on it",
1988  "This is some text with *X on it",
1989  "This is some text with /X on it",
1990  "This is some text with +X on it",
1991  "This is some text with %X on it",
1992  "This is some text with #X on it",
1993  "This is some text with @X on it",
1994  "This is some text with \\X on it",
1995  "This is some text with _X on it",
1996  };
1997  /* All of these cause the URL detection to be extended by one more byte,
1998  thus demonstrating that the tested character is considered as part
1999  of the URL. */
2000  const char * templates_xten_delim[] = {
2001  "This is some text with X| on it",
2002  "This is some text with X* on it",
2003  "This is some text with X/ on it",
2004  "This is some text with X+ on it",
2005  "This is some text with X% on it",
2006  "This is some text with X# on it",
2007  "This is some text with X@ on it",
2008  "This is some text with X\\ on it",
2009  "This is some text with X_ on it",
2010  };
2011  /* These delims act as neutral breaks. Whether the url is ended
2012  or not depends on the next non-neutral character. We'll test
2013  with Y unchanged, in which case the url should include the
2014  deliminator and the Y. We'll also test with the Y changed
2015  to a space, in which case the url stops before the
2016  deliminator. */
2017  const char * templates_neutral_delim[] = {
2018  "This is some text with X-Y on it",
2019  "This is some text with X--Y on it",
2020  "This is some text with X!Y on it",
2021  "This is some text with X[Y on it",
2022  "This is some text with X]Y on it",
2023  "This is some text with X{Y on it",
2024  "This is some text with X}Y on it",
2025  "This is some text with X(Y on it",
2026  "This is some text with X)Y on it",
2027  "This is some text with X\"Y on it",
2028  "This is some text with X;Y on it",
2029  "This is some text with X:Y on it",
2030  "This is some text with X'Y on it",
2031  "This is some text with X?Y on it",
2032  "This is some text with X<Y on it",
2033  "This is some text with X>Y on it",
2034  "This is some text with X.Y on it",
2035  "This is some text with X,Y on it",
2036  };
2037  char buffer[1024];
2038 
2040  hwndRichEdit = new_richedit(parent);
2041  /* Try and pass EM_AUTOURLDETECT some test wParam values */
2042  urlRet=SendMessageA(hwndRichEdit, EM_AUTOURLDETECT, FALSE, 0);
2043  ok(urlRet==0, "Good wParam: urlRet is: %d\n", urlRet);
2044  urlRet=SendMessageA(hwndRichEdit, EM_AUTOURLDETECT, 1, 0);
2045  ok(urlRet==0, "Good wParam2: urlRet is: %d\n", urlRet);
2046  /* Windows returns -2147024809 (0x80070057) on bad wParam values */
2047  urlRet=SendMessageA(hwndRichEdit, EM_AUTOURLDETECT, 8, 0);
2048  ok(urlRet==E_INVALIDARG, "Bad wParam: urlRet is: %d\n", urlRet);
2049  urlRet=SendMessageA(hwndRichEdit, EM_AUTOURLDETECT, (WPARAM)"h", (LPARAM)"h");
2050  ok(urlRet==E_INVALIDARG, "Bad wParam2: urlRet is: %d\n", urlRet);
2051  /* for each url, check the text to see if CFE_LINK effect is present */
2052  for (i = 0; i < sizeof(urls)/sizeof(struct urls_s); i++) {
2053 
2054  SendMessageA(hwndRichEdit, EM_AUTOURLDETECT, FALSE, 0);
2055  SendMessageA(hwndRichEdit, WM_SETTEXT, 0, (LPARAM)urls[i].text);
2056  check_CFE_LINK_rcvd(hwndRichEdit, FALSE, urls[i].text);
2057 
2058  /* Link detection should happen immediately upon WM_SETTEXT */
2059  SendMessageA(hwndRichEdit, EM_AUTOURLDETECT, TRUE, 0);
2060  SendMessageA(hwndRichEdit, WM_SETTEXT, 0, (LPARAM)urls[i].text);
2061  check_CFE_LINK_rcvd(hwndRichEdit, urls[i].is_url, urls[i].text);
2062  }
2063  DestroyWindow(hwndRichEdit);
2064 
2065  /* Test detection of URLs within normal text - WM_SETTEXT case. */
2066  for (i = 0; i < sizeof(urls)/sizeof(struct urls_s); i++) {
2067  hwndRichEdit = new_richedit(parent);
2068 
2069  for (j = 0; j < sizeof(templates_delim) / sizeof(const char *); j++) {
2070  char * at_pos;
2071  int at_offset;
2072  int end_offset;
2073 
2074  at_pos = strchr(templates_delim[j], 'X');
2075  at_offset = at_pos - templates_delim[j];
2076  memcpy(buffer, templates_delim[j], at_offset);
2077  buffer[at_offset] = '\0';
2078  strcat(buffer, urls[i].text);
2079  strcat(buffer, templates_delim[j] + at_offset + 1);
2080  end_offset = at_offset + strlen(urls[i].text);
2081 
2082  SendMessageA(hwndRichEdit, EM_AUTOURLDETECT, TRUE, 0);
2083  SendMessageA(hwndRichEdit, WM_SETTEXT, 0, (LPARAM)buffer);
2084 
2085  /* This assumes no templates start with the URL itself, and that they
2086  have at least two characters before the URL text */
2087  ok(!check_CFE_LINK_selection(hwndRichEdit, 0, 1),
2088  "CFE_LINK incorrectly set in (%d-%d), text: %s\n", 0, 1, buffer);
2089  ok(!check_CFE_LINK_selection(hwndRichEdit, at_offset -2, at_offset -1),
2090  "CFE_LINK incorrectly set in (%d-%d), text: %s\n", at_offset -2, at_offset -1, buffer);
2091  ok(!check_CFE_LINK_selection(hwndRichEdit, at_offset -1, at_offset),
2092  "CFE_LINK incorrectly set in (%d-%d), text: %s\n", at_offset -1, at_offset, buffer);
2093 
2094  if (urls[i].is_url)
2095  {
2096  ok(check_CFE_LINK_selection(hwndRichEdit, at_offset, at_offset +1),
2097  "CFE_LINK not set in (%d-%d), text: %s\n", at_offset, at_offset +1, buffer);
2098  ok(check_CFE_LINK_selection(hwndRichEdit, end_offset -1, end_offset),
2099  "CFE_LINK not set in (%d-%d), text: %s\n", end_offset -1, end_offset, buffer);
2100  }
2101  else
2102  {
2103  ok(!check_CFE_LINK_selection(hwndRichEdit, at_offset, at_offset +1),
2104  "CFE_LINK incorrectly set in (%d-%d), text: %s\n", at_offset, at_offset + 1, buffer);
2105  ok(!check_CFE_LINK_selection(hwndRichEdit, end_offset -1, end_offset),
2106  "CFE_LINK incorrectly set in (%d-%d), text: %s\n", end_offset -1, end_offset, buffer);
2107  }
2108  if (buffer[end_offset] != '\0')
2109  {
2110  ok(!check_CFE_LINK_selection(hwndRichEdit, end_offset, end_offset +1),
2111  "CFE_LINK incorrectly set in (%d-%d), text: %s\n", end_offset, end_offset + 1, buffer);
2112  if (buffer[end_offset +1] != '\0')
2113  {
2114  ok(!check_CFE_LINK_selection(hwndRichEdit, end_offset +1, end_offset +2),
2115  "CFE_LINK incorrectly set in (%d-%d), text: %s\n", end_offset +1, end_offset +2, buffer);
2116  }
2117  }
2118  }
2119 
2120  for (j = 0; j < sizeof(templates_non_delim) / sizeof(const char *); j++) {
2121  char * at_pos;
2122  int at_offset;
2123  int end_offset;
2124 
2125  at_pos = strchr(templates_non_delim[j], 'X');
2126  at_offset = at_pos - templates_non_delim[j];
2127  memcpy(buffer, templates_non_delim[j], at_offset);
2128  buffer[at_offset] = '\0';
2129  strcat(buffer, urls[i].text);
2130  strcat(buffer, templates_non_delim[j] + at_offset + 1);
2131  end_offset = at_offset + strlen(urls[i].text);
2132 
2133  SendMessageA(hwndRichEdit, EM_AUTOURLDETECT, TRUE, 0);
2134  SendMessageA(hwndRichEdit, WM_SETTEXT, 0, (LPARAM)buffer);
2135 
2136  /* This assumes no templates start with the URL itself, and that they
2137  have at least two characters before the URL text */
2138  ok(!check_CFE_LINK_selection(hwndRichEdit, 0, 1),
2139  "CFE_LINK incorrectly set in (%d-%d), text: %s\n", 0, 1, buffer);
2140  ok(!check_CFE_LINK_selection(hwndRichEdit, at_offset -2, at_offset -1),
2141  "CFE_LINK incorrectly set in (%d-%d), text: %s\n", at_offset -2, at_offset -1, buffer);
2142  ok(!check_CFE_LINK_selection(hwndRichEdit, at_offset -1, at_offset),
2143  "CFE_LINK incorrectly set in (%d-%d), text: %s\n", at_offset -1, at_offset, buffer);
2144 
2145  ok(!check_CFE_LINK_selection(hwndRichEdit, at_offset, at_offset +1),
2146  "CFE_LINK incorrectly set in (%d-%d), text: %s\n", at_offset, at_offset + 1, buffer);
2147  ok(!check_CFE_LINK_selection(hwndRichEdit, end_offset -1, end_offset),
2148  "CFE_LINK incorrectly set in (%d-%d), text: %s\n", end_offset -1, end_offset, buffer);
2149  if (buffer[end_offset] != '\0')
2150  {
2151  ok(!check_CFE_LINK_selection(hwndRichEdit, end_offset, end_offset +1),
2152  "CFE_LINK incorrectly set in (%d-%d), text: %s\n", end_offset, end_offset + 1, buffer);
2153  if (buffer[end_offset +1] != '\0')
2154  {
2155  ok(!check_CFE_LINK_selection(hwndRichEdit, end_offset +1, end_offset +2),
2156  "CFE_LINK incorrectly set in (%d-%d), text: %s\n", end_offset +1, end_offset +2, buffer);
2157  }
2158  }
2159  }
2160 
2161  for (j = 0; j < sizeof(templates_xten_delim) / sizeof(const char *); j++) {
2162  char * at_pos;
2163  int at_offset;
2164  int end_offset;
2165 
2166  at_pos = strchr(templates_xten_delim[j], 'X');
2167  at_offset = at_pos - templates_xten_delim[j];
2168  memcpy(buffer, templates_xten_delim[j], at_offset);
2169  buffer[at_offset] = '\0';
2170  strcat(buffer, urls[i].text);
2171  strcat(buffer, templates_xten_delim[j] + at_offset + 1);
2172  end_offset = at_offset + strlen(urls[i].text);
2173 
2174  SendMessageA(hwndRichEdit, EM_AUTOURLDETECT, TRUE, 0);
2175  SendMessageA(hwndRichEdit, WM_SETTEXT, 0, (LPARAM)buffer);
2176 
2177  /* This assumes no templates start with the URL itself, and that they
2178  have at least two characters before the URL text */
2179  ok(!check_CFE_LINK_selection(hwndRichEdit, 0, 1),
2180  "CFE_LINK incorrectly set in (%d-%d), text: %s\n", 0, 1, buffer);
2181  ok(!check_CFE_LINK_selection(hwndRichEdit, at_offset -2, at_offset -1),
2182  "CFE_LINK incorrectly set in (%d-%d), text: %s\n", at_offset -2, at_offset -1, buffer);
2183  ok(!check_CFE_LINK_selection(hwndRichEdit, at_offset -1, at_offset),
2184  "CFE_LINK incorrectly set in (%d-%d), text: %s\n", at_offset -1, at_offset, buffer);
2185 
2186  if (urls[i].is_url)
2187  {
2188  ok(check_CFE_LINK_selection(hwndRichEdit, at_offset, at_offset +1),
2189  "CFE_LINK not set in (%d-%d), text: %s\n", at_offset, at_offset +1, buffer);
2190  ok(check_CFE_LINK_selection(hwndRichEdit, end_offset -1, end_offset),
2191  "CFE_LINK not set in (%d-%d), text: %s\n", end_offset -1, end_offset, buffer);
2192  ok(check_CFE_LINK_selection(hwndRichEdit, end_offset, end_offset +1),
2193  "CFE_LINK not set in (%d-%d), text: %s\n", end_offset, end_offset +1, buffer);
2194  }
2195  else
2196  {
2197  ok(!check_CFE_LINK_selection(hwndRichEdit, at_offset, at_offset +1),
2198  "CFE_LINK incorrectly set in (%d-%d), text: %s\n", at_offset, at_offset + 1, buffer);
2199  ok(!check_CFE_LINK_selection(hwndRichEdit, end_offset -1, end_offset),
2200  "CFE_LINK incorrectly set in (%d-%d), text: %s\n", end_offset -1, end_offset, buffer);
2201  ok(!check_CFE_LINK_selection(hwndRichEdit, end_offset, end_offset +1),
2202  "CFE_LINK incorrectly set in (%d-%d), text: %s\n", end_offset, end_offset +1, buffer);
2203  }
2204  if (buffer[end_offset +1] != '\0')
2205  {
2206  ok(!check_CFE_LINK_selection(hwndRichEdit, end_offset +1, end_offset +2),
2207  "CFE_LINK incorrectly set in (%d-%d), text: %s\n", end_offset +1, end_offset + 2, buffer);
2208  if (buffer[end_offset +2] != '\0')
2209  {
2210  ok(!check_CFE_LINK_selection(hwndRichEdit, end_offset +2, end_offset +3),
2211  "CFE_LINK incorrectly set in (%d-%d), text: %s\n", end_offset +2, end_offset +3, buffer);
2212  }
2213  }
2214  }
2215 
2216  for (j = 0; j < sizeof(templates_neutral_delim) / sizeof(const char *); j++) {
2217  char * at_pos, * end_pos;
2218  int at_offset;
2219  int end_offset;
2220 
2221  if (!urls[i].is_url) continue;
2222 
2223  at_pos = strchr(templates_neutral_delim[j], 'X');
2224  at_offset = at_pos - templates_neutral_delim[j];
2225  memcpy(buffer, templates_neutral_delim[j], at_offset);
2226  buffer[at_offset] = '\0';
2227  strcat(buffer, urls[i].text);
2228  strcat(buffer, templates_neutral_delim[j] + at_offset + 1);
2229 
2230  end_pos = strchr(buffer, 'Y');
2231  end_offset = end_pos - buffer;
2232 
2233  SendMessageA(hwndRichEdit, EM_AUTOURLDETECT, TRUE, 0);
2234  SendMessageA(hwndRichEdit, WM_SETTEXT, 0, (LPARAM)buffer);
2235 
2236  /* This assumes no templates start with the URL itself, and that they
2237  have at least two characters before the URL text */
2238  ok(!check_CFE_LINK_selection(hwndRichEdit, 0, 1),
2239  "CFE_LINK incorrectly set in (%d-%d), text: %s\n", 0, 1, buffer);
2240  ok(!check_CFE_LINK_selection(hwndRichEdit, at_offset -2, at_offset -1),
2241  "CFE_LINK incorrectly set in (%d-%d), text: %s\n", at_offset -2, at_offset -1, buffer);
2242  ok(!check_CFE_LINK_selection(hwndRichEdit, at_offset -1, at_offset),
2243  "CFE_LINK incorrectly set in (%d-%d), text: %s\n", at_offset -1, at_offset, buffer);
2244 
2245  ok(check_CFE_LINK_selection(hwndRichEdit, at_offset, at_offset +1),
2246  "CFE_LINK not set in (%d-%d), text: %s\n", at_offset, at_offset +1, buffer);
2247  ok(check_CFE_LINK_selection(hwndRichEdit, end_offset -1, end_offset),
2248  "CFE_LINK not set in (%d-%d), text: %s\n", end_offset -1, end_offset, buffer);
2249  ok(check_CFE_LINK_selection(hwndRichEdit, end_offset, end_offset +1),
2250  "CFE_LINK not set in (%d-%d), text: %s\n", end_offset, end_offset +1, buffer);
2251 
2252  *end_pos = ' ';
2253 
2254  SendMessageA(hwndRichEdit, EM_AUTOURLDETECT, TRUE, 0);
2255  SendMessageA(hwndRichEdit, WM_SETTEXT, 0, (LPARAM)buffer);
2256 
2257  ok(check_CFE_LINK_selection(hwndRichEdit, at_offset, at_offset +1),
2258  "CFE_LINK not set in (%d-%d), text: %s\n", at_offset, at_offset +1, buffer);
2259  ok(!check_CFE_LINK_selection(hwndRichEdit, end_offset -1, end_offset),
2260  "CFE_LINK set in (%d-%d), text: %s\n", end_offset -1, end_offset, buffer);
2261  ok(!check_CFE_LINK_selection(hwndRichEdit, end_offset, end_offset +1),
2262  "CFE_LINK set in (%d-%d), text: %s\n", end_offset, end_offset +1, buffer);
2263  }
2264 
2265  DestroyWindow(hwndRichEdit);
2266  hwndRichEdit = NULL;
2267  }
2268 
2269  /* Test detection of URLs within normal text - WM_CHAR case. */
2270  /* Test only the first two URL examples for brevity */
2271  for (i = 0; i < 2; i++) {
2272  hwndRichEdit = new_richedit(parent);
2273 
2274  /* Also for brevity, test only the first three delimiters */
2275  for (j = 0; j < 3; j++) {
2276  char * at_pos;
2277  int at_offset;
2278  int end_offset;
2279  int u, v;
2280 
2281  at_pos = strchr(templates_delim[j], 'X');
2282  at_offset = at_pos - templates_delim[j];
2283  end_offset = at_offset + strlen(urls[i].text);
2284 
2285  SendMessageA(hwndRichEdit, EM_AUTOURLDETECT, TRUE, 0);
2286  SendMessageA(hwndRichEdit, WM_SETTEXT, 0, 0);
2287  for (u = 0; templates_delim[j][u]; u++) {
2288  if (templates_delim[j][u] == '\r') {
2289  simulate_typing_characters(hwndRichEdit, "\r");
2290  } else if (templates_delim[j][u] != 'X') {
2291  SendMessageA(hwndRichEdit, WM_CHAR, templates_delim[j][u], 1);
2292  } else {
2293  for (v = 0; urls[i].text[v]; v++) {
2294  SendMessageA(hwndRichEdit, WM_CHAR, urls[i].text[v], 1);
2295  }
2296  }
2297  }
2298  SendMessageA(hwndRichEdit, WM_GETTEXT, sizeof(buffer), (LPARAM)buffer);
2299 
2300  /* This assumes no templates start with the URL itself, and that they
2301  have at least two characters before the URL text */
2302  ok(!check_CFE_LINK_selection(hwndRichEdit, 0, 1),
2303  "CFE_LINK incorrectly set in (%d-%d), text: %s\n", 0, 1, buffer);
2304  ok(!check_CFE_LINK_selection(hwndRichEdit, at_offset -2, at_offset -1),
2305  "CFE_LINK incorrectly set in (%d-%d), text: %s\n", at_offset -2, at_offset -1, buffer);
2306  ok(!check_CFE_LINK_selection(hwndRichEdit, at_offset -1, at_offset),
2307  "CFE_LINK incorrectly set in (%d-%d), text: %s\n", at_offset -1, at_offset, buffer);
2308 
2309  if (urls[i].is_url)
2310  {
2311  ok(check_CFE_LINK_selection(hwndRichEdit, at_offset, at_offset +1),
2312  "CFE_LINK not set in (%d-%d), text: %s\n", at_offset, at_offset +1, buffer);
2313  ok(check_CFE_LINK_selection(hwndRichEdit, end_offset -1, end_offset),
2314  "CFE_LINK not set in (%d-%d), text: %s\n", end_offset -1, end_offset, buffer);
2315  }
2316  else
2317  {
2318  ok(!check_CFE_LINK_selection(hwndRichEdit, at_offset, at_offset +1),
2319  "CFE_LINK incorrectly set in (%d-%d), text: %s\n", at_offset, at_offset + 1, buffer);
2320  ok(!check_CFE_LINK_selection(hwndRichEdit, end_offset -1, end_offset),
2321  "CFE_LINK incorrectly set in (%d-%d), text: %s\n", end_offset -1, end_offset, buffer);
2322  }
2323  if (buffer[end_offset] != '\0')
2324  {
2325  ok(!check_CFE_LINK_selection(hwndRichEdit, end_offset, end_offset +1),
2326  "CFE_LINK incorrectly set in (%d-%d), text: %s\n", end_offset, end_offset + 1, buffer);
2327  if (buffer[end_offset +1] != '\0')
2328  {
2329  ok(!check_CFE_LINK_selection(hwndRichEdit, end_offset +1, end_offset +2),
2330  "CFE_LINK incorrectly set in (%d-%d), text: %s\n", end_offset +1, end_offset +2, buffer);
2331  }
2332  }
2333 
2334  /* The following will insert a paragraph break after the first character
2335  of the URL candidate, thus breaking the URL. It is expected that the
2336  CFE_LINK attribute should break across both pieces of the URL */
2337  SendMessageA(hwndRichEdit, EM_SETSEL, at_offset+1, at_offset+1);
2338  simulate_typing_characters(hwndRichEdit, "\r");
2339  SendMessageA(hwndRichEdit, WM_GETTEXT, sizeof(buffer), (LPARAM)buffer);
2340 
2341  ok(!check_CFE_LINK_selection(hwndRichEdit, 0, 1),
2342  "CFE_LINK incorrectly set in (%d-%d), text: %s\n", 0, 1, buffer);
2343  ok(!check_CFE_LINK_selection(hwndRichEdit, at_offset -2, at_offset -1),
2344  "CFE_LINK incorrectly set in (%d-%d), text: %s\n", at_offset -2, at_offset -1, buffer);
2345  ok(!check_CFE_LINK_selection(hwndRichEdit, at_offset -1, at_offset),
2346  "CFE_LINK incorrectly set in (%d-%d), text: %s\n", at_offset -1, at_offset, buffer);
2347 
2348  ok(!check_CFE_LINK_selection(hwndRichEdit, at_offset, at_offset +1),
2349  "CFE_LINK incorrectly set in (%d-%d), text: %s\n", at_offset, at_offset + 1, buffer);
2350  /* end_offset moved because of paragraph break */
2351  ok(!check_CFE_LINK_selection(hwndRichEdit, end_offset -1, end_offset),
2352  "CFE_LINK incorrectly set in (%d-%d), text: %s\n", end_offset, end_offset+1, buffer);
2353  ok(buffer[end_offset], "buffer \"%s\" ended prematurely. Is it missing a newline character?\n", buffer);
2354  if (buffer[end_offset] != 0 && buffer[end_offset+1] != '\0')
2355  {
2356  ok(!check_CFE_LINK_selection(hwndRichEdit, end_offset+1, end_offset +2),
2357  "CFE_LINK incorrectly set in (%d-%d), text: %s\n", end_offset+1, end_offset +2, buffer);
2358  if (buffer[end_offset +2] != '\0')
2359  {
2360  ok(!check_CFE_LINK_selection(hwndRichEdit, end_offset +2, end_offset +3),
2361  "CFE_LINK incorrectly set in (%d-%d), text: %s\n", end_offset +2, end_offset +3, buffer);
2362  }
2363  }
2364 
2365  /* The following will remove the just-inserted paragraph break, thus
2366  restoring the URL */
2367  SendMessageA(hwndRichEdit, EM_SETSEL, at_offset+2, at_offset+2);
2368  simulate_typing_characters(hwndRichEdit, "\b");
2369  SendMessageA(hwndRichEdit, WM_GETTEXT, sizeof(buffer), (LPARAM)buffer);
2370 
2371  ok(!check_CFE_LINK_selection(hwndRichEdit, 0, 1),
2372  "CFE_LINK incorrectly set in (%d-%d), text: %s\n", 0, 1, buffer);
2373  ok(!check_CFE_LINK_selection(hwndRichEdit, at_offset -2, at_offset -1),
2374  "CFE_LINK incorrectly set in (%d-%d), text: %s\n", at_offset -2, at_offset -1, buffer);
2375  ok(!check_CFE_LINK_selection(hwndRichEdit, at_offset -1, at_offset),
2376  "CFE_LINK incorrectly set in (%d-%d), text: %s\n", at_offset -1, at_offset, buffer);
2377 
2378  if (urls[i].is_url)
2379  {
2380  ok(check_CFE_LINK_selection(hwndRichEdit, at_offset, at_offset +1),
2381  "CFE_LINK not set in (%d-%d), text: %s\n", at_offset, at_offset +1, buffer);
2382  ok(check_CFE_LINK_selection(hwndRichEdit, end_offset -1, end_offset),
2383  "CFE_LINK not set in (%d-%d), text: %s\n", end_offset -1, end_offset, buffer);
2384  }
2385  else
2386  {
2387  ok(!check_CFE_LINK_selection(hwndRichEdit, at_offset, at_offset +1),
2388  "CFE_LINK incorrectly set in (%d-%d), text: %s\n", at_offset, at_offset + 1, buffer);
2389  ok(!check_CFE_LINK_selection(hwndRichEdit, end_offset -1, end_offset),
2390  "CFE_LINK incorrectly set in (%d-%d), text: %s\n", end_offset -1, end_offset, buffer);
2391  }
2392  if (buffer[end_offset] != '\0')
2393  {
2394  ok(!check_CFE_LINK_selection(hwndRichEdit, end_offset, end_offset +1),
2395  "CFE_LINK incorrectly set in (%d-%d), text: %s\n", end_offset, end_offset + 1, buffer);
2396  if (buffer[end_offset +1] != '\0')
2397  {
2398  ok(!check_CFE_LINK_selection(hwndRichEdit, end_offset +1, end_offset +2),
2399  "CFE_LINK incorrectly set in (%d-%d), text: %s\n", end_offset +1, end_offset +2, buffer);
2400  }
2401  }
2402  }
2403  DestroyWindow(hwndRichEdit);
2404  hwndRichEdit = NULL;
2405  }
2406 
2407  /* Test detection of URLs within normal text - EM_SETTEXTEX case. */
2408  /* Test just the first two URL examples for brevity */
2409  for (i = 0; i < 2; i++) {
2410  SETTEXTEX st;
2411 
2412  hwndRichEdit = new_richedit(parent);
2413 
2414  /* There are at least three ways in which EM_SETTEXTEX must cause URLs to
2415  be detected:
2416  1) Set entire text, a la WM_SETTEXT
2417  2) Set a selection of the text to the URL
2418  3) Set a portion of the text at a time, which eventually results in
2419  an URL
2420  All of them should give equivalent results
2421  */
2422 
2423  /* Set entire text in one go, like WM_SETTEXT */
2424  for (j = 0; j < sizeof(templates_delim) / sizeof(const char *); j++) {
2425  char * at_pos;
2426  int at_offset;
2427  int end_offset;
2428 
2429  st.codepage = CP_ACP;
2430  st.flags = ST_DEFAULT;
2431 
2432  at_pos = strchr(templates_delim[j], 'X');
2433  at_offset = at_pos - templates_delim[j];
2434  memcpy(buffer, templates_delim[j], at_offset);
2435  buffer[at_offset] = '\0';
2436  strcat(buffer, urls[i].text);
2437  strcat(buffer, templates_delim[j] + at_offset + 1);
2438  end_offset = at_offset + strlen(urls[i].text);
2439 
2440  SendMessageA(hwndRichEdit, EM_AUTOURLDETECT, TRUE, 0);
2441  SendMessageA(hwndRichEdit, EM_SETTEXTEX, (WPARAM)&st, (LPARAM)buffer);
2442 
2443  /* This assumes no templates start with the URL itself, and that they
2444  have at least two characters before the URL text */
2445  ok(!check_CFE_LINK_selection(hwndRichEdit, 0, 1),
2446  "CFE_LINK incorrectly set in (%d-%d), text: %s\n", 0, 1, buffer);
2447  ok(!check_CFE_LINK_selection(hwndRichEdit, at_offset -2, at_offset -1),
2448  "CFE_LINK incorrectly set in (%d-%d), text: %s\n", at_offset -2, at_offset -1, buffer);
2449  ok(!check_CFE_LINK_selection(hwndRichEdit, at_offset -1, at_offset),
2450  "CFE_LINK incorrectly set in (%d-%d), text: %s\n", at_offset -1, at_offset, buffer);
2451 
2452  if (urls[i].is_url)
2453  {
2454  ok(check_CFE_LINK_selection(hwndRichEdit, at_offset, at_offset +1),
2455  "CFE_LINK not set in (%d-%d), text: %s\n", at_offset, at_offset +1, buffer);
2456  ok(check_CFE_LINK_selection(hwndRichEdit, end_offset -1, end_offset),
2457  "CFE_LINK not set in (%d-%d), text: %s\n", end_offset -1, end_offset, buffer);
2458  }
2459  else
2460  {
2461  ok(!check_CFE_LINK_selection(hwndRichEdit, at_offset, at_offset +1),
2462  "CFE_LINK incorrectly set in (%d-%d), text: %s\n", at_offset, at_offset + 1, buffer);
2463  ok(!check_CFE_LINK_selection(hwndRichEdit, end_offset -1, end_offset),
2464  "CFE_LINK incorrectly set in (%d-%d), text: %s\n", end_offset -1, end_offset, buffer);
2465  }
2466  if (buffer[end_offset] != '\0')
2467  {
2468  ok(!check_CFE_LINK_selection(hwndRichEdit, end_offset, end_offset +1),
2469  "CFE_LINK incorrectly set in (%d-%d), text: %s\n", end_offset, end_offset + 1, buffer);
2470  if (buffer[end_offset +1] != '\0')
2471  {
2472  ok(!check_CFE_LINK_selection(hwndRichEdit, end_offset +1, end_offset +2),
2473  "CFE_LINK incorrectly set in (%d-%d), text: %s\n", end_offset +1, end_offset +2, buffer);
2474  }
2475  }
2476  }
2477 
2478  /* Set selection with X to the URL */
2479  for (j = 0; j < sizeof(templates_delim) / sizeof(const char *); j++) {
2480  char * at_pos;
2481  int at_offset;
2482  int end_offset;
2483 
2484  at_pos = strchr(templates_delim[j], 'X');
2485  at_offset = at_pos - templates_delim[j];
2486  end_offset = at_offset + strlen(urls[i].text);
2487 
2488  st.codepage = CP_ACP;
2489  st.flags = ST_DEFAULT;
2490  SendMessageA(hwndRichEdit, EM_AUTOURLDETECT, TRUE, 0);
2491  SendMessageA(hwndRichEdit, EM_SETTEXTEX, (WPARAM)&st, (LPARAM)templates_delim[j]);
2492  st.flags = ST_SELECTION;
2493  SendMessageA(hwndRichEdit, EM_SETSEL, at_offset, at_offset+1);
2494  SendMessageA(hwndRichEdit, EM_SETTEXTEX, (WPARAM)&st, (LPARAM)urls[i].text);
2495  SendMessageA(hwndRichEdit, WM_GETTEXT, sizeof(buffer), (LPARAM)buffer);
2496 
2497  /* This assumes no templates start with the URL itself, and that they
2498  have at least two characters before the URL text */
2499  ok(!check_CFE_LINK_selection(hwndRichEdit, 0, 1),
2500  "CFE_LINK incorrectly set in (%d-%d), text: %s\n", 0, 1, buffer);
2501  ok(!check_CFE_LINK_selection(hwndRichEdit, at_offset -2, at_offset -1),
2502  "CFE_LINK incorrectly set in (%d-%d), text: %s\n", at_offset -2, at_offset -1, buffer);
2503  ok(!check_CFE_LINK_selection(hwndRichEdit, at_offset -1, at_offset),
2504  "CFE_LINK incorrectly set in (%d-%d), text: %s\n", at_offset -1, at_offset, buffer);
2505 
2506  if (urls[i].is_url)
2507  {
2508  ok(check_CFE_LINK_selection(hwndRichEdit, at_offset, at_offset +1),
2509  "CFE_LINK not set in (%d-%d), text: %s\n", at_offset, at_offset +1, buffer);
2510  ok(check_CFE_LINK_selection(hwndRichEdit, end_offset -1, end_offset),
2511  "CFE_LINK not set in (%d-%d), text: %s\n", end_offset -1, end_offset, buffer);
2512  }
2513  else
2514  {
2515  ok(!check_CFE_LINK_selection(hwndRichEdit, at_offset, at_offset +1),
2516  "CFE_LINK incorrectly set in (%d-%d), text: %s\n", at_offset, at_offset + 1, buffer);
2517  ok(!check_CFE_LINK_selection(hwndRichEdit, end_offset -1, end_offset),
2518  "CFE_LINK incorrectly set in (%d-%d), text: %s\n", end_offset -1, end_offset, buffer);
2519  }
2520  if (buffer[end_offset] != '\0')
2521  {
2522  ok(!check_CFE_LINK_selection(hwndRichEdit, end_offset, end_offset +1),
2523  "CFE_LINK incorrectly set in (%d-%d), text: %s\n", end_offset, end_offset + 1, buffer);
2524  if (buffer[end_offset +1] != '\0')
2525  {
2526  ok(!check_CFE_LINK_selection(hwndRichEdit, end_offset +1, end_offset +2),
2527  "CFE_LINK incorrectly set in (%d-%d), text: %s\n", end_offset +1, end_offset +2, buffer);
2528  }
2529  }
2530  }
2531 
2532  /* Set selection with X to the first character of the URL, then the rest */
2533  for (j = 0; j < sizeof(templates_delim) / sizeof(const char *); j++) {
2534  char * at_pos;
2535  int at_offset;
2536  int end_offset;
2537 
2538  at_pos = strchr(templates_delim[j], 'X');
2539  at_offset = at_pos - templates_delim[j];
2540  end_offset = at_offset + strlen(urls[i].text);
2541 
2542  strcpy(buffer, "YY");
2543  buffer[0] = urls[i].text[0];
2544 
2545  st.codepage = CP_ACP;
2546  st.flags = ST_DEFAULT;
2547  SendMessageA(hwndRichEdit, EM_AUTOURLDETECT, TRUE, 0);
2548  SendMessageA(hwndRichEdit, EM_SETTEXTEX, (WPARAM)&st, (LPARAM)templates_delim[j]);
2549  st.flags = ST_SELECTION;
2550  SendMessageA(hwndRichEdit, EM_SETSEL, at_offset, at_offset+1);
2551  SendMessageA(hwndRichEdit, EM_SETTEXTEX, (WPARAM)&st, (LPARAM)buffer);
2552  SendMessageA(hwndRichEdit, EM_SETSEL, at_offset+1, at_offset+2);
2553  SendMessageA(hwndRichEdit, EM_SETTEXTEX, (WPARAM)&st, (LPARAM)(urls[i].text + 1));
2554  SendMessageA(hwndRichEdit, WM_GETTEXT, sizeof(buffer), (LPARAM)buffer);
2555 
2556  /* This assumes no templates start with the URL itself, and that they
2557  have at least two characters before the URL text */
2558  ok(!check_CFE_LINK_selection(hwndRichEdit, 0, 1),
2559  "CFE_LINK incorrectly set in (%d-%d), text: %s\n", 0, 1, buffer);
2560  ok(!check_CFE_LINK_selection(hwndRichEdit, at_offset -2, at_offset -1),
2561  "CFE_LINK incorrectly set in (%d-%d), text: %s\n", at_offset -2, at_offset -1, buffer);
2562  ok(!check_CFE_LINK_selection(hwndRichEdit, at_offset -1, at_offset),
2563  "CFE_LINK incorrectly set in (%d-%d), text: %s\n", at_offset -1, at_offset, buffer);
2564 
2565  if (urls[i].is_url)
2566  {
2567  ok(check_CFE_LINK_selection(hwndRichEdit, at_offset, at_offset +1),
2568  "CFE_LINK not set in (%d-%d), text: %s\n", at_offset, at_offset +1, buffer);
2569  ok(check_CFE_LINK_selection(hwndRichEdit, end_offset -1, end_offset),
2570  "CFE_LINK not set in (%d-%d), text: %s\n", end_offset -1, end_offset, buffer);
2571  }
2572  else
2573  {
2574  ok(!check_CFE_LINK_selection(hwndRichEdit, at_offset, at_offset +1),
2575  "CFE_LINK incorrectly set in (%d-%d), text: %s\n", at_offset, at_offset + 1, buffer);
2576  ok(!check_CFE_LINK_selection(hwndRichEdit, end_offset -1, end_offset),
2577  "CFE_LINK incorrectly set in (%d-%d), text: %s\n", end_offset -1, end_offset, buffer);
2578  }
2579  if (buffer[end_offset] != '\0')
2580  {
2581  ok(!check_CFE_LINK_selection(hwndRichEdit, end_offset, end_offset +1),
2582  "CFE_LINK incorrectly set in (%d-%d), text: %s\n", end_offset, end_offset + 1, buffer);
2583  if (buffer[end_offset +1] != '\0')
2584  {
2585  ok(!check_CFE_LINK_selection(hwndRichEdit, end_offset +1, end_offset +2),
2586  "CFE_LINK incorrectly set in (%d-%d), text: %s\n", end_offset +1, end_offset +2, buffer);
2587  }
2588  }
2589  }
2590 
2591  DestroyWindow(hwndRichEdit);
2592  hwndRichEdit = NULL;
2593  }
2594 
2595  /* Test detection of URLs within normal text - EM_REPLACESEL case. */
2596  /* Test just the first two URL examples for brevity */
2597  for (i = 0; i < 2; i++) {
2598  hwndRichEdit = new_richedit(parent);
2599 
2600  /* Set selection with X to the URL */
2601  for (j = 0; j < sizeof(templates_delim) / sizeof(const char *); j++) {
2602  char * at_pos;
2603  int at_offset;
2604  int end_offset;
2605 
2606  at_pos = strchr(templates_delim[j], 'X');
2607  at_offset = at_pos - templates_delim[j];
2608  end_offset = at_offset + strlen(urls[i].text);
2609 
2610  SendMessageA(hwndRichEdit, EM_AUTOURLDETECT, TRUE, 0);
2611  SendMessageA(hwndRichEdit, WM_SETTEXT, 0, (LPARAM)templates_delim[j]);
2612  SendMessageA(hwndRichEdit, EM_SETSEL, at_offset, at_offset+1);
2613  SendMessageA(hwndRichEdit, EM_REPLACESEL, 0, (LPARAM)urls[i].text);
2614  SendMessageA(hwndRichEdit, WM_GETTEXT, sizeof(buffer), (LPARAM)buffer);
2615 
2616  /* This assumes no templates start with the URL itself, and that they
2617  have at least two characters before the URL text */
2618  ok(!check_CFE_LINK_selection(hwndRichEdit, 0, 1),
2619  "CFE_LINK incorrectly set in (%d-%d), text: %s\n", 0, 1, buffer);
2620  ok(!check_CFE_LINK_selection(hwndRichEdit, at_offset -2, at_offset -1),
2621  "CFE_LINK incorrectly set in (%d-%d), text: %s\n", at_offset -2, at_offset -1, buffer);
2622  ok(!check_CFE_LINK_selection(hwndRichEdit, at_offset -1, at_offset),
2623  "CFE_LINK incorrectly set in (%d-%d), text: %s\n", at_offset -1, at_offset, buffer);
2624 
2625  if (urls[i].is_url)
2626  {
2627  ok(check_CFE_LINK_selection(hwndRichEdit, at_offset, at_offset +1),
2628  "CFE_LINK not set in (%d-%d), text: %s\n", at_offset, at_offset +1, buffer);
2629  ok(check_CFE_LINK_selection(hwndRichEdit, end_offset -1, end_offset),
2630  "CFE_LINK not set in (%d-%d), text: %s\n", end_offset -1, end_offset, buffer);
2631  }
2632  else
2633  {
2634  ok(!check_CFE_LINK_selection(hwndRichEdit, at_offset, at_offset +1),
2635  "CFE_LINK incorrectly set in (%d-%d), text: %s\n", at_offset, at_offset + 1, buffer);
2636  ok(!check_CFE_LINK_selection(hwndRichEdit, end_offset -1, end_offset),
2637  "CFE_LINK incorrectly set in (%d-%d), text: %s\n", end_offset -1, end_offset, buffer);
2638  }
2639  if (buffer[end_offset] != '\0')
2640  {
2641  ok(!check_CFE_LINK_selection(hwndRichEdit, end_offset, end_offset +1),
2642  "CFE_LINK incorrectly set in (%d-%d), text: %s\n", end_offset, end_offset + 1, buffer);
2643  if (buffer[end_offset +1] != '\0')
2644  {
2645  ok(!check_CFE_LINK_selection(hwndRichEdit, end_offset +1, end_offset +2),
2646  "CFE_LINK incorrectly set in (%d-%d), text: %s\n", end_offset +1, end_offset +2, buffer);
2647  }
2648  }
2649  }
2650 
2651  /* Set selection with X to the first character of the URL, then the rest */
2652  for (j = 0; j < sizeof(templates_delim) / sizeof(const char *); j++) {
2653  char * at_pos;
2654  int at_offset;
2655  int end_offset;
2656 
2657  at_pos = strchr(templates_delim[j], 'X');
2658  at_offset = at_pos - templates_delim[j];
2659  end_offset = at_offset + strlen(urls[i].text);
2660 
2661  strcpy(buffer, "YY");
2662  buffer[0] = urls[i].text[0];
2663 
2664  SendMessageA(hwndRichEdit, EM_AUTOURLDETECT, TRUE, 0);
2665  SendMessageA(hwndRichEdit, WM_SETTEXT, 0, (LPARAM)templates_delim[j]);
2666  SendMessageA(hwndRichEdit, EM_SETSEL, at_offset, at_offset+1);
2667  SendMessageA(hwndRichEdit, EM_REPLACESEL, 0, (LPARAM)buffer);
2668  SendMessageA(hwndRichEdit, EM_SETSEL, at_offset+1, at_offset+2);
2669  SendMessageA(hwndRichEdit, EM_REPLACESEL, 0, (LPARAM)(urls[i].text + 1));
2670  SendMessageA(hwndRichEdit, WM_GETTEXT, sizeof(buffer), (LPARAM)buffer);
2671 
2672  /* This assumes no templates start with the URL itself, and that they
2673  have at least two characters before the URL text */
2674  ok(!check_CFE_LINK_selection(hwndRichEdit, 0, 1),
2675  "CFE_LINK incorrectly set in (%d-%d), text: %s\n", 0, 1, buffer);
2676  ok(!check_CFE_LINK_selection(hwndRichEdit, at_offset -2, at_offset -1),
2677  "CFE_LINK incorrectly set in (%d-%d), text: %s\n", at_offset -2, at_offset -1, buffer);
2678  ok(!check_CFE_LINK_selection(hwndRichEdit, at_offset -1, at_offset),
2679  "CFE_LINK incorrectly set in (%d-%d), text: %s\n", at_offset -1, at_offset, buffer);
2680 
2681  if (urls[i].is_url)
2682  {
2683  ok(check_CFE_LINK_selection(hwndRichEdit, at_offset, at_offset +1),
2684  "CFE_LINK not set in (%d-%d), text: %s\n", at_offset, at_offset +1, buffer);
2685  ok(check_CFE_LINK_selection(hwndRichEdit, end_offset -1, end_offset),
2686  "CFE_LINK not set in (%d-%d), text: %s\n", end_offset -1, end_offset, buffer);
2687  }
2688  else
2689  {
2690  ok(!check_CFE_LINK_selection(hwndRichEdit, at_offset, at_offset +1),
2691  "CFE_LINK incorrectly set in (%d-%d), text: %s\n", at_offset, at_offset + 1, buffer);
2692  ok(!check_CFE_LINK_selection(hwndRichEdit, end_offset -1, end_offset),
2693  "CFE_LINK incorrectly set in (%d-%d), text: %s\n", end_offset -1, end_offset, buffer);
2694  }
2695  if (buffer[end_offset] != '\0')
2696  {
2697  ok(!check_CFE_LINK_selection(hwndRichEdit, end_offset, end_offset +1),
2698  "CFE_LINK incorrectly set in (%d-%d), text: %s\n", end_offset, end_offset + 1, buffer);
2699  if (buffer[end_offset +1] != '\0')
2700  {
2701  ok(!check_CFE_LINK_selection(hwndRichEdit, end_offset +1, end_offset +2),
2702  "CFE_LINK incorrectly set in (%d-%d), text: %s\n", end_offset +1, end_offset +2, buffer);
2703  }
2704  }
2705  }
2706 
2707  DestroyWindow(hwndRichEdit);
2708  hwndRichEdit = NULL;
2709  }
2710 
2712 }
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 * u
Definition: glfuncs.h:240
#define TRUE
Definition: types.h:120
#define WM_CHAR
Definition: winuser.h:1693
char * strcat(char *DstString, const char *SrcString)
Definition: utclib.c:568
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
LRESULT WINAPI SendMessageA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
const WCHAR * text
Definition: package.c:1827
#define CP_ACP
Definition: compat.h:99
#define WM_GETTEXT
Definition: winuser.h:1600
static BOOL check_CFE_LINK_selection(HWND hwnd, int sel_start, int sel_end)
Definition: editor.c:1896
static HWND new_static_wnd(HWND parent)
Definition: editor.c:1920
GLuint buffer
Definition: glext.h:5915
UINT_PTR WPARAM
Definition: windef.h:207
BOOL WINAPI DestroyWindow(_In_ HWND)
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
DWORD flags
Definition: richedit.h:1065
unsigned int BOOL
Definition: ntddk_ex.h:94
#define ok(value,...)
#define E_INVALIDARG
Definition: ddrawi.h:101
#define ST_DEFAULT
Definition: richedit.h:1070
smooth NULL
Definition: ftsmooth.c:416
LONG_PTR LPARAM
Definition: windef.h:208
#define WM_SETTEXT
Definition: winuser.h:1599
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 GLint GLint j
Definition: glfuncs.h:250
#define EM_AUTOURLDETECT
Definition: richedit.h:125
r parent
Definition: btrfs.c:2677
#define EM_SETSEL
Definition: winuser.h:1979
#define EM_SETTEXTEX
Definition: richedit.h:131
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
static void simulate_typing_characters(HWND hwnd, const char *szChars)
Definition: editor.c:104
#define ST_SELECTION
Definition: richedit.h:1072
static void check_CFE_LINK_rcvd(HWND hwnd, BOOL is_url, const char *url)
Definition: editor.c:1905
static HWND new_richedit(HWND parent)
Definition: editor.c:72
const GLdouble * v
Definition: gl.h:2040
UINT codepage
Definition: richedit.h:1066
char * strchr(const char *String, int ch)
Definition: utclib.c:501
char * strcpy(char *DstString, const char *SrcString)
Definition: utclib.c:388
#define EM_REPLACESEL
Definition: winuser.h:1967

Referenced by START_TEST().

◆ test_EM_CHARFROMPOS()

static void test_EM_CHARFROMPOS ( void  )
static

Definition at line 7136 of file editor.c.

7137 {
7138  HWND hwnd;
7139  int result;
7140  RECT rcClient;
7141  POINTL point;
7142  point.x = 0;
7143  point.y = 40;
7144 
7145  /* multi-line control inserts CR normally */
7146  hwnd = new_richedit(NULL);
7148  (LPARAM)"one two three four five six seven\reight");
7149  ok(result == 1, "Expected 1, got %d\n", result);
7150  GetClientRect(hwnd, &rcClient);
7151 
7153  ok(result == 34, "expected character index of 34 but got %d\n", result);
7154 
7155  /* Test with points outside the bounds of the richedit control. */
7156  point.x = -1;
7157  point.y = 40;
7159  todo_wine ok(result == 34, "expected character index of 34 but got %d\n", result);
7160 
7161  point.x = 1000;
7162  point.y = 0;
7164  todo_wine ok(result == 33, "expected character index of 33 but got %d\n", result);
7165 
7166  point.x = 1000;
7167  point.y = 36;
7169  todo_wine ok(result == 39, "expected character index of 39 but got %d\n", result);
7170 
7171  point.x = 1000;
7172  point.y = -1;
7174  todo_wine ok(result == 0, "expected character index of 0 but got %d\n", result);
7175 
7176  point.x = 1000;
7177  point.y = rcClient.bottom + 1;
7179  todo_wine ok(result == 34, "expected character index of 34 but got %d\n", result);
7180 
7181  point.x = 1000;
7182  point.y = rcClient.bottom;
7184  todo_wine ok(result == 39, "expected character index of 39 but got %d\n", result);
7185 
7187 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
LRESULT WINAPI SendMessageA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
BOOL WINAPI DestroyWindow(_In_ HWND)
POINTL point
Definition: edittest.c:50
LONG y
Definition: windef.h:315
#define EM_CHARFROMPOS
Definition: richedit.h:78
#define ok(value,...)
smooth NULL
Definition: ftsmooth.c:416
LONG_PTR LPARAM
Definition: windef.h:208
#define WM_SETTEXT
Definition: winuser.h:1599