ReactOS  0.4.14-dev-606-g14ebc0b
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_null_bytes (DWORD_PTR cookie, BYTE *buf, LONG size, LONG *written)
 
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 format_test_result (char *target, const char *src)
 
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 6743 of file editor.c.

◆ CURSOR_CLIENT_Y

#define CURSOR_CLIENT_Y   5

Definition at line 6744 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:7886
#define ok(value,...)
Definition: atltest.h:57

Definition at line 7888 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 8505 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:415
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 6746 of file editor.c.

◆ WP_PARENT

#define WP_PARENT   1

Definition at line 6745 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 8507 of file editor.c.

8509 {
8510  CHARFORMAT2A cf;
8511  LRESULT res;
8512  BOOL isundo;
8513 
8514  cf.cbSize = sizeof(cf);
8515  cf.dwMask = CFM_SIZE;
8516 
8519  isundo = SendMessageA(hwnd, EM_CANUNDO, 0, 0);
8520  ok_(__FILE__,line)(res == expected_res, "EM_SETFONTSIZE unexpected return value: %lx.\n", res);
8521  ok_(__FILE__,line)(twips2points(cf.yHeight) == expected_size, "got wrong font size: %d, expected: %d\n",
8522  twips2points(cf.yHeight), expected_size);
8523  ok_(__FILE__,line)(isundo == expected_undo, "get wrong undo mark: %d, expected: %d.\n",
8524  isundo, expected_undo);
8525 }
static IClassFactory * cf
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
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:8500
GLuint res
Definition: glext.h:9613
#define EM_CANUNDO
Definition: winuser.h:1965
#define SCF_SELECTION
Definition: richedit.h:235
LONG_PTR LRESULT
Definition: windef.h:209
#define ok_(x1, x2)
Definition: atltest.h:61

◆ 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:403
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 1921 of file editor.c.

1922 {
1923  BOOL link_present = FALSE;
1924 
1925  link_present = check_CFE_LINK_selection(hwnd, 0, 1);
1926  if (is_url)
1927  { /* control text is url; should get CFE_LINK */
1928  ok(link_present, "URL Case: CFE_LINK not set for [%s].\n", url);
1929  }
1930  else
1931  {
1932  ok(!link_present, "Non-URL Case: CFE_LINK set for [%s].\n", url);
1933  }
1934 }
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:1912
unsigned int BOOL
Definition: ntddk_ex.h:94
static const WCHAR url[]
Definition: encode.c:1432
#define ok(value,...)
Definition: atltest.h:57

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 1912 of file editor.c.

1913 {
1914  CHARFORMAT2A text_format;
1915  text_format.cbSize = sizeof(text_format);
1916  SendMessageA(hwnd, EM_SETSEL, sel_start, sel_end);
1918  return (text_format.dwEffects & CFE_LINK) != 0;
1919 }
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:2000
#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 4930 of file editor.c.

4930  {
4931  CHARRANGE cr;
4932  LRESULT result;
4933  int start, end;
4934 
4935  cr.cpMin = setsel->min;
4936  cr.cpMax = setsel->max;
4937  result = SendMessageA(hwnd, EM_EXSETSEL, 0, (LPARAM)&cr);
4938 
4939  ok(result == setsel->expected_retval, "EM_EXSETSEL(%d): expected: %ld actual: %ld\n", id, setsel->expected_retval, result);
4940 
4942 
4943  todo_wine_if (setsel->todo)
4944  ok(start == setsel->expected_getsel_start && end == setsel->expected_getsel_end, "EM_EXSETSEL(%d): expected (%d,%d) actual:(%d,%d)\n",
4945  id, setsel->expected_getsel_start, setsel->expected_getsel_end, start, end);
4946 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
LRESULT expected_retval
Definition: editor.c:4895
LRESULT WINAPI SendMessageA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
BOOL todo
Definition: editor.c:4898
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:1979
LONG_PTR LPARAM
Definition: windef.h:208
#define todo_wine_if(is_todo)
Definition: test.h:164
#define d
Definition: ke_i.h:81
#define EM_EXSETSEL
Definition: richedit.h:88
LONG max
Definition: editor.c:4894
GLuint start
Definition: gl.h:1545
#define ok(value,...)
Definition: atltest.h:57
LONG min
Definition: editor.c:4893
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
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:403
LPCWSTR lpstrText
Definition: richedit.h:587
#define ok(value,...)
Definition: atltest.h:57
#define EM_FINDTEXTW
Definition: richedit.h:147
Definition: name.c:38
#define memset(x, y, z)
Definition: compat.h:39
#define HeapFree(x, y, z)
Definition: compat.h:402
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
LONG_PTR LPARAM
Definition: windef.h:208
GLfloat f
Definition: glext.h:7540
#define GetProcessHeap()
Definition: compat.h:403
#define EM_FINDTEXTEX
Definition: richedit.h:112
LPCWSTR lpstrText
Definition: richedit.h:600
#define ok(value,...)
Definition: atltest.h:57
CHARRANGE chrg
Definition: richedit.h:593
CHARRANGE chrg
Definition: richedit.h:599
Definition: name.c:38
#define memset(x, y, z)
Definition: compat.h:39
#define HeapFree(x, y, z)
Definition: compat.h:402
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 4987 of file editor.c.

4987  {
4988  LRESULT result;
4989  int start, end;
4990 
4991  result = SendMessageA(hwnd, EM_SETSEL, setsel->min, setsel->max);
4992 
4993  ok(result == setsel->expected_retval, "EM_SETSEL(%d): expected: %ld actual: %ld\n", id, setsel->expected_retval, result);
4994 
4996 
4997  todo_wine_if (setsel->todo)
4998  ok(start == setsel->expected_getsel_start && end == setsel->expected_getsel_end, "EM_SETSEL(%d): expected (%d,%d) actual:(%d,%d)\n",
4999  id, setsel->expected_getsel_start, setsel->expected_getsel_end, start, end);
5000 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
LRESULT expected_retval
Definition: editor.c:4895
LRESULT WINAPI SendMessageA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
BOOL todo
Definition: editor.c:4898
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:1979
LONG_PTR LPARAM
Definition: windef.h:208
#define todo_wine_if(is_todo)
Definition: test.h:164
#define d
Definition: ke_i.h:81
#define EM_SETSEL
Definition: winuser.h:2000
LONG max
Definition: editor.c:4894
GLuint start
Definition: gl.h:1545
#define ok(value,...)
Definition: atltest.h:57
LONG min
Definition: editor.c:4893
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 3808 of file editor.c.

3809 {
3810  const char *p = buf;
3811  int count = 0;
3812  while ((p = strstr( p, "\\par" )) != NULL)
3813  {
3814  if (!isalpha( p[4] ))
3815  count++;
3816  p++;
3817  }
3818  return count;
3819 }
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 7061 of file editor.c.

7062 {
7063  int length;
7064 
7065  /* MSDN lied, length is actually the number of bytes. */
7066  length = bytes / sizeof(WCHAR);
7067  switch(code)
7068  {
7069  case WB_ISDELIMITER:
7070  return text[pos] == 'X';
7071  case WB_LEFT:
7072  case WB_MOVEWORDLEFT:
7074  return pos-1;
7075  return min(customWordBreakProc(text, pos, bytes, WB_LEFTBREAK)-1, 0);
7076  case WB_LEFTBREAK:
7077  pos--;
7078  while (pos > 0 && !customWordBreakProc(text, pos, bytes, WB_ISDELIMITER))
7079  pos--;
7080  return pos;
7081  case WB_RIGHT:
7082  case WB_MOVEWORDRIGHT:
7084  return pos+1;
7086  case WB_RIGHTBREAK:
7087  pos++;
7089  pos++;
7090  return pos;
7091  default:
7092  ok(FALSE, "Unexpected code %d\n", code);
7093  break;
7094  }
7095  return 0;
7096 }
#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
__wchar_t WCHAR
Definition: xmlstorage.h:180
GLenum GLuint GLenum GLsizei length
Definition: glext.h:5579
#define ok(value,...)
Definition: atltest.h:57
#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:7061

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 7896 of file editor.c.

7897 {
7898  switch (iMsg)
7899  {
7900  case DM_GETDEFID:
7901  dm_messages.wm_getdefid++;
7903  case WM_NEXTDLGCTL:
7904  dm_messages.wm_nextdlgctl++;
7905  break;
7906  case WM_CLOSE:
7907  dm_messages.wm_close++;
7908  break;
7909  }
7910 
7911  return DefWindowProcA(hwnd, iMsg, wParam, lParam);
7912 }
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:7886
#define ID_RICHEDITTESTDBUTTON
Definition: editor.c:40
#define DM_GETDEFID
Definition: winuser.h:2080
#define DC_HASDEFID
Definition: winuser.h:2584
#define MAKELONG(a, b)
Definition: typedefs.h:248
static UINT WPARAM wParam
Definition: editor.c:2867
#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:2867

Referenced by test_dialogmode().

◆ EditStreamCallback()

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

Definition at line 5712 of file editor.c.

5714 {
5715  const char text[] = {'t','e','s','t'};
5716 
5717  if (sizeof(text) <= cb)
5718  {
5719  if ((int)dwCookie != nCallbackCount)
5720  {
5721  *pcb = 0;
5722  return 0;
5723  }
5724 
5725  memcpy (pbBuff, text, sizeof(text));
5726  *pcb = sizeof(text);
5727 
5728  nCallbackCount++;
5729 
5730  return 0;
5731  }
5732  else
5733  return 1; /* indicates callback failed */
5734 }
const WCHAR * text
Definition: package.c:1827
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
static HMODULE MODULEINFO DWORD cb
Definition: module.c:32
static int nCallbackCount
Definition: editor.c:5710

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 6748 of file editor.c.

6749 {
6750  if(message == WM_NOTIFY && ((NMHDR*)lParam)->code == EN_LINK)
6751  {
6752  enlink = *(ENLINK*)lParam;
6753  }
6755 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
Definition: tftpd.h:59
static UINT WPARAM wParam
Definition: editor.c:2867
LRESULT WINAPI DefWindowProcA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
static UINT WPARAM LPARAM lParam
Definition: editor.c:2867
#define EN_LINK
Definition: richedit.h:202
static ENLINK enlink
Definition: editor.c:6742
#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 8873 of file editor.c.

8876 {
8877  reobj->cbStruct = sizeof(*reobj);
8878  reobj->clsid = CLSID_NULL;
8879  reobj->cp = cp;
8880  reobj->poleobj = poleobj;
8881  reobj->pstg = pstg;
8882  reobj->polesite = polesite;
8883  reobj->sizel.cx = sizel_cx;
8884  reobj->sizel.cy = sizel_cy;
8885  reobj->dvaspect = aspect;
8886  reobj->dwFlags = flags;
8887  reobj->dwUser = user;
8888 }
#define CLSID_NULL
Definition: guiddef.h:99
GLbitfield flags
Definition: glext.h:7161
POINT cp
Definition: magnifier.c:59
void user(int argc, const char *argv[])
Definition: cmds.c:1350

Referenced by test_EM_SELECTIONTYPE().

◆ format_test_result()

static void format_test_result ( char target,
const char src 
)
static

Definition at line 8282 of file editor.c.

8283 {
8284  int i;
8285  for (i = 0; i < strlen(src); i++)
8286  sprintf(target + 2*i, "%02x", src[i] & 0xFF);
8287  target[2*i] = 0;
8288 }
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
#define sprintf(buf, format,...)
Definition: sprintf.c:55
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
GLenum src
Definition: glext.h:6340
GLenum target
Definition: glext.h:7315

Referenced by test_enter().

◆ get_scroll_pos_y()

static int get_scroll_pos_y ( HWND  hwnd)
static

Definition at line 518 of file editor.c.

519 {
520  POINT p = {-1, -1};
522  ok(p.x != -1 && p.y != -1, "p.x:%d p.y:%d\n", p.x, p.y);
523  return p.y;
524 }
#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)
LONG_PTR LPARAM
Definition: windef.h:208
#define ok(value,...)
Definition: atltest.h:57
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 }
WORD vk
Definition: input.c:82
unsigned int BOOL
Definition: ntddk_ex.h:94
_Check_return_ BOOL WINAPI GetKeyboardState(_Out_writes_(256) PBYTE lpKeyState)
unsigned char BYTE
Definition: mem.h:68
BOOL WINAPI SetKeyboardState(_In_reads_(256) LPBYTE)
#define ok(value,...)
Definition: atltest.h:57
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 6173 of file editor.c.

6174 {
6175  SETTEXTEX stex = { ST_DEFAULT, CP_ACP };
6176  return SendMessageA(hwnd, EM_SETTEXTEX, (WPARAM)&stex, 0) != 0;
6177 }
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:790
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 534 of file editor.c.

535 {
536  SendMessageA(hwnd, EM_LINESCROLL, 0, amount);
537 }
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:1986

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 6757 of file editor.c.

6759 {
6760  ENLINK junk_enlink;
6761 
6762  switch (msg)
6763  {
6764  case WM_LBUTTONDBLCLK:
6765  case WM_LBUTTONDOWN:
6766  case WM_LBUTTONUP:
6767  case WM_MOUSEHOVER:
6768  case WM_MOUSEMOVE:
6769  case WM_MOUSEWHEEL:
6770  case WM_RBUTTONDBLCLK:
6771  case WM_RBUTTONDOWN:
6772  case WM_RBUTTONUP:
6774  break;
6775  case WM_SETCURSOR:
6776  if (wParam == WP_PARENT)
6777  wParam = (WPARAM)parent;
6778  else if (wParam == WP_CHILD)
6779  wParam = (WPARAM)hwnd;
6780  break;
6781  }
6782 
6783  memset(&junk_enlink, 0x23, sizeof(junk_enlink));
6784  enlink = junk_enlink;
6785 
6787 
6788  if (notifies)
6789  {
6791  "%s test %i: Expected hwnd %p got %p\n", desc, i, hwnd, enlink.nmhdr.hwndFrom);
6792  ok(enlink.nmhdr.idFrom == 0,
6793  "%s test %i: Expected idFrom 0 got 0x%lx\n", desc, i, enlink.nmhdr.idFrom);
6794  ok(enlink.msg == msg,
6795  "%s test %i: Expected msg 0x%x got 0x%x\n", desc, i, msg, enlink.msg);
6796  if (msg == WM_SETCURSOR)
6797  {
6798  ok(enlink.wParam == 0,
6799  "%s test %i: Expected wParam 0 got 0x%lx\n", desc, i, enlink.wParam);
6800  }
6801  else
6802  {
6803  ok(enlink.wParam == wParam,
6804  "%s test %i: Expected wParam 0x%lx got 0x%lx\n", desc, i, wParam, enlink.wParam);
6805  }
6807  "%s test %i: Expected lParam 0x%lx got 0x%lx\n",
6809  ok(enlink.chrg.cpMin == 0 && enlink.chrg.cpMax == 31,
6810  "%s test %i: Expected link range [0,31) got [%i,%i)\n", desc, i, enlink.chrg.cpMin, enlink.chrg.cpMax);
6811  }
6812  else
6813  {
6814  ok(memcmp(&enlink, &junk_enlink, sizeof(enlink)) == 0,
6815  "%s test %i: Expected enlink to remain unmodified\n", desc, i);
6816  }
6817 }
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:1758
LRESULT WINAPI SendMessageA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define WM_MOUSEWHEEL
Definition: treelist.c:96
#define WM_MOUSEHOVER
Definition: commctrl.h:4970
#define MAKELPARAM(l, h)
Definition: winuser.h:3983
LONG cpMax
Definition: richedit.h:501
UINT_PTR WPARAM
Definition: windef.h:207
#define WP_PARENT
Definition: editor.c:6745
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
static const WCHAR desc[]
Definition: protectdata.c:36
UINT_PTR idFrom
Definition: winuser.h:3133
#define WP_CHILD
Definition: editor.c:6746
#define CURSOR_CLIENT_Y
Definition: editor.c:6744
#define WM_RBUTTONDOWN
Definition: winuser.h:1761
static UINT WPARAM wParam
Definition: editor.c:2867
r parent
Definition: btrfs.c:2869
#define WM_RBUTTONUP
Definition: winuser.h:1762
#define WM_LBUTTONDBLCLK
Definition: winuser.h:1760
HWND hwndFrom
Definition: winuser.h:3132
#define CURSOR_CLIENT_X
Definition: editor.c:6743
static UINT WPARAM LPARAM lParam
Definition: editor.c:2867
#define ok(value,...)
Definition: atltest.h:57
#define WM_LBUTTONUP
Definition: winuser.h:1759
#define WM_MOUSEMOVE
Definition: winuser.h:1757
#define msg(x)
Definition: auth_time.c:54
static ENLINK enlink
Definition: editor.c:6742
#define WM_RBUTTONDBLCLK
Definition: winuser.h:1763
#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 526 of file editor.c.

527 {
528  CHARRANGE cr;
529  cr.cpMax = charindex;
530  cr.cpMin = charindex;
531  SendMessageA(hwnd, EM_EXSETSEL, 0, (LPARAM)&cr);
532 }
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:2869
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:2869
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 1936 of file editor.c.

1936  {
1937  return new_window("Static", 0, parent);
1938 }
r parent
Definition: btrfs.c:2869
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 CreateWindowA(a, b, c, d, e, f, g, h, i, j, k)
Definition: winuser.h:4290
smooth NULL
Definition: ftsmooth.c:416
r parent
Definition: btrfs.c:2869
#define WS_HSCROLL
Definition: pedump.c:628
#define ok(value,...)
Definition: atltest.h:57
#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
char * wine_dbgstr_w(const wchar_t *wstr)
Definition: atltest.h:87
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
#define CreateWindowW(a, b, c, d, e, f, g, h, i, j, k)
Definition: winuser.h:4291
smooth NULL
Definition: ftsmooth.c:416
r parent
Definition: btrfs.c:2869
#define WS_HSCROLL
Definition: pedump.c:628
#define ok(value,...)
Definition: atltest.h:57
#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 6544 of file editor.c.

6545 {
6546  if(message == WM_COMMAND && (watchForEventMask & (wParam >> 16)))
6547  {
6549  }
6551 }
static int watchForEventMask
Definition: editor.c:6541
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:6539
static UINT WPARAM wParam
Definition: editor.c:2867
static int queriedEventMask
Definition: editor.c:6540
#define WM_COMMAND
Definition: winuser.h:1722
LRESULT WINAPI DefWindowProcA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
static UINT WPARAM LPARAM lParam
Definition: editor.c:2867

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 }
WORD vk
Definition: input.c:82
unsigned int BOOL
Definition: ntddk_ex.h:94
_Check_return_ BOOL WINAPI GetKeyboardState(_Out_writes_(256) PBYTE lpKeyState)
unsigned char BYTE
Definition: mem.h:68
BOOL WINAPI SetKeyboardState(_In_reads_(256) LPBYTE)
#define ok(value,...)
Definition: atltest.h:57
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 2869 of file editor.c.

2870 {
2871  LRESULT r;
2872 
2873  if (bailedOutOfRecursion) return 0;
2874  if (recursionLevel >= 32) {
2876  return 0;
2877  }
2878 
2879  recursionLevel++;
2880  switch (message) {
2881  case WM_SIZE:
2883  r = richeditProc(hwnd, message, wParam, lParam);
2884  /* Because, uhhhh... I never heard of ES_DISABLENOSCROLL */
2887  break;
2888  default:
2889  r = richeditProc(hwnd, message, wParam, lParam);
2890  break;
2891  }
2892  recursionLevel--;
2893  return r;
2894 }
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:2864
static UINT WPARAM wParam
Definition: editor.c:2867
#define WM_SIZE
Definition: winuser.h:1593
static BOOL bailedOutOfRecursion
Definition: editor.c:2866
static UINT WPARAM LPARAM lParam
Definition: editor.c:2867
static unsigned int WM_SIZE_recursionLevel
Definition: editor.c:2865
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:38

Referenced by test_EM_FINDTEXT().

◆ send_ctrl_key()

static LRESULT send_ctrl_key ( HWND  hwnd,
UINT  key 
)
static

Definition at line 5420 of file editor.c.

5421 {
5422  LRESULT result;
5426  return result;
5427 }
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:1697
static BOOL hold_key(int vk)
Definition: editor.c:117
#define VK_CONTROL
Definition: winuser.h:2178
LONG_PTR LRESULT
Definition: windef.h:209
GLuint64EXT * result
Definition: glext.h:11304
Definition: path.c:41

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:1699
LRESULT WINAPI SendMessageA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define WM_KEYDOWN
Definition: winuser.h:1697
#define WM_KEYUP
Definition: winuser.h:1698
int ret
#define ok(value,...)
Definition: atltest.h:57

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 8993 of file editor.c.

8994 {
8995  BOOL ret;
8996  /* Must explicitly LoadLibrary(). The test has no references to functions in
8997  * RICHED20.DLL, so the linker doesn't actually link to it. */
8998  hmoduleRichEdit = LoadLibraryA("riched20.dll");
8999  ok(hmoduleRichEdit != NULL, "error: %d\n", (int) GetLastError());
9001 
9003  test_WM_CHAR();
9006  test_EM_GETLINE();
9009  test_EM_SCROLL();
9011  test_WM_SETTEXT();
9017  test_WM_GETTEXT();
9021  test_ES_PASSWORD();
9026  test_WM_SETFONT();
9028  test_EM_SETSEL();
9029  test_EM_EXSETSEL();
9030  test_WM_PASTE();
9031  test_EM_STREAMIN();
9040  test_EM_REPLACESEL(1);
9041  test_EM_REPLACESEL(0);
9042  test_WM_NOTIFY();
9043  test_EN_LINK();
9045  test_eventMask();
9050  test_word_wrap();
9051  test_autoscroll();
9052  test_format_rect();
9054  test_zoom();
9055  test_dialogmode();
9058  test_enter();
9059  test_WM_CREATE();
9064  test_rtf();
9065  test_background();
9069 
9070  /* Set the environment variable WINETEST_RICHED20 to keep windows
9071  * responsive and open for 30 seconds. This is useful for debugging.
9072  */
9073  if (getenv( "WINETEST_RICHED20" )) {
9074  keep_responsive(30);
9075  }
9076 
9079  ok(ret, "error: %d\n", (int) GetLastError());
9080 }
static void test_EM_StreamIn_Undo(void)
Definition: editor.c:6100
static void test_WM_CHAR(void)
Definition: editor.c:6337
static void test_dialogmode(void)
Definition: editor.c:7914
static void test_EM_SELECTIONTYPE(void)
Definition: editor.c:8890
static void test_EM_EXLIMITTEXT(void)
Definition: editor.c:4499
static void test_background(void)
Definition: editor.c:8757
static void test_EM_EXSETSEL(void)
Definition: editor.c:4948
#define TRUE
Definition: types.h:120
static void test_unicode_conversions(void)
Definition: editor.c:6179
static void test_EM_GETTEXTLENGTHEX(void)
Definition: editor.c:6388
static void test_EM_SETTEXTMODE(void)
Definition: editor.c:1364
static void test_EM_STREAMOUT(void)
Definition: editor.c:3821
static void test_EM_SETSEL(void)
Definition: editor.c:5002
static HMODULE hmoduleRichEdit
Definition: editor.c:51
static void test_EM_SETFONTSIZE(void)
Definition: editor.c:8527
static void test_EM_CHARFROMPOS(void)
Definition: editor.c:7187
static void test_EM_SETREADONLY(void)
Definition: editor.c:8481
static void test_EM_GETLINE(void)
Definition: editor.c:390
static void test_EM_GETSELTEXT(void)
Definition: editor.c:1801
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
static void test_WM_GETTEXTLENGTH(void)
Definition: editor.c:8664
static void test_WM_SETFONT(void)
Definition: editor.c:4645
static void test_enter(void)
Definition: editor.c:8298
static void test_autoscroll(void)
Definition: editor.c:7336
static void test_eventMask(void)
Definition: editor.c:6554
static void test_EM_FINDWORDBREAK_W(void)
Definition: editor.c:8205
static void test_WM_GETTEXT(void)
Definition: editor.c:1650
static void test_EM_FINDTEXT(BOOL unicode)
Definition: editor.c:332
static void test_EM_STREAMOUT_empty_para(void)
Definition: editor.c:3976
static void test_zoom(void)
Definition: editor.c:7739
#define LANG_JAPANESE
Definition: nls.h:76
static void test_window_classes(void)
Definition: editor.c:8961
static void test_word_movement(void)
Definition: editor.c:7098
unsigned int BOOL
Definition: ntddk_ex.h:94
HINSTANCE WINAPI DECLSPEC_HOTPATCH LoadLibraryA(LPCSTR lpLibFileName)
Definition: loader.c:111
static void test_WM_GETDLGCODE(void)
Definition: editor.c:7558
static void test_EM_SETTEXTEX(void)
Definition: editor.c:3996
static void test_undo_coalescing(void)
Definition: editor.c:6944
smooth NULL
Definition: ftsmooth.c:416
static void test_EM_LIMITTEXT(void)
Definition: editor.c:4459
static void test_reset_default_para_fmt(void)
Definition: editor.c:8449
static void test_EM_STREAMIN(void)
Definition: editor.c:5826
#define FreeLibrary(x)
Definition: compat.h:413
static BOOL is_lang_japanese
Definition: editor.c:52
static void test_format_rect(void)
Definition: editor.c:7395
static void test_WM_NOTIFY(void)
Definition: editor.c:6648
static void test_WM_PASTE(void)
Definition: editor.c:5429
static void test_EM_SCROLL(void)
Definition: editor.c:2730
int ret
static void test_EN_LINK(void)
Definition: editor.c:6819
static void keep_responsive(time_t delay_time)
Definition: editor.c:86
static void test_ES_PASSWORD(void)
Definition: editor.c:3650
static void test_EM_STREAMOUT_FONTTBL(void)
Definition: editor.c:3923
static void test_EM_POSFROMCHAR(void)
Definition: editor.c:597
static void test_scrollbar_visibility(void)
Definition: editor.c:2896
static void test_rtf(void)
Definition: editor.c:8695
static void test_eop_char_fmt(void)
Definition: editor.c:8769
static void test_EM_SETOPTIONS(void)
Definition: editor.c:1840
_Check_return_ char *__cdecl getenv(_In_z_ const char *_VarName)
static void test_WM_SETTEXT(void)
Definition: editor.c:3693
static void test_EM_FORMATRANGE(void)
Definition: editor.c:5594
#define ok(value,...)
Definition: atltest.h:57
static void test_EM_LINELENGTH(void)
Definition: editor.c:462
static void test_EM_FINDWORDBREAK_A(void)
Definition: editor.c:8249
static void test_EM_GETTEXTRANGE(void)
Definition: editor.c:1717
static void test_word_wrap(void)
Definition: editor.c:7240
static void test_para_numbering(void)
Definition: editor.c:8805
LANGID WINAPI GetUserDefaultLangID(void)
Definition: lang.c:734
static void test_WM_CREATE(void)
Definition: editor.c:8408
static void test_EM_SETUNDOLIMIT(void)
Definition: editor.c:3586
HRESULT WINAPI OleFlushClipboard(void)
Definition: clipboard.c:2293
static void test_EM_GETMODIFY(void)
Definition: editor.c:4727
static void test_EM_REPLACESEL(int redraw)
Definition: editor.c:5045
static void test_EM_GETLIMITTEXT(void)
Definition: editor.c:4630
static void test_TM_PLAINTEXT(void)
Definition: editor.c:1540
static void test_EM_SETCHARFORMAT(void)
Definition: editor.c:750
static void test_SETPARAFORMAT(void)
Definition: editor.c:1506
static void test_alignment_style(void)
Definition: editor.c:8594
static void test_EM_AUTOURLDETECT(void)
Definition: editor.c:1940
static void test_EM_SCROLLCARET(void)
Definition: editor.c:539
#define PRIMARYLANGID(l)
Definition: nls.h:16

◆ test_alignment_style()

static void test_alignment_style ( void  )
static

Definition at line 8594 of file editor.c.

8595 {
8596  HWND richedit = NULL;
8597  PARAFORMAT2 pf;
8598  DWORD align_style[] = {ES_LEFT, ES_CENTER, ES_RIGHT, ES_RIGHT | ES_CENTER,
8600  ES_LEFT | ES_RIGHT | ES_CENTER};
8603  const char * streamtext =
8604  "{\\rtf1\\ansi\\ansicpg1252\\deff0\\deflang12298{\\fonttbl{\\f0\\fswiss\\fprq2\\fcharset0 System;}}\r\n"
8605  "\\viewkind4\\uc1\\pard\\f0\\fs17 TestSomeText\\par\r\n"
8606  "}\r\n";
8607  EDITSTREAM es;
8608  int i;
8609 
8610  for (i = 0; i < ARRAY_SIZE(align_style); i++)
8611  {
8612  DWORD dwStyle, new_align;
8613 
8614  richedit = new_windowW(RICHEDIT_CLASS20W, align_style[i], NULL);
8615  memset(&pf, 0, sizeof(pf));
8616  pf.cbSize = sizeof(PARAFORMAT2);
8617  pf.dwMask = -1;
8618 
8619  SendMessageW(richedit, EM_GETPARAFORMAT, 0, (LPARAM)&pf);
8620  ok(pf.wAlignment == align_mask[i], "(i = %d) got %d expected %d\n",
8621  i, pf.wAlignment, align_mask[i]);
8622  dwStyle = GetWindowLongW(richedit, GWL_STYLE);
8623  ok((i ? (dwStyle & align_style[i]) : (!(dwStyle & 0x0000000f))) ,
8624  "(i = %d) didn't set right align style: 0x%x\n", i, dwStyle);
8625 
8626 
8627  /* Based on test_reset_default_para_fmt() */
8628  new_align = (align_mask[i] == PFA_LEFT) ? PFA_RIGHT : PFA_LEFT;
8629  simulate_typing_characters(richedit, "123");
8630 
8631  SendMessageW(richedit, EM_SETSEL, 0, -1);
8632  pf.dwMask = PFM_ALIGNMENT;
8633  pf.wAlignment = new_align;
8634  SendMessageW(richedit, EM_SETPARAFORMAT, 0, (LPARAM)&pf);
8635 
8636  SendMessageW(richedit, EM_GETPARAFORMAT, 0, (LPARAM)&pf);
8637  ok(pf.wAlignment == new_align, "got %d expect %d\n", pf.wAlignment, new_align);
8638 
8639  SendMessageW(richedit, EM_SETSEL, 0, -1);
8640  SendMessageW(richedit, WM_CUT, 0, 0);
8641 
8642  SendMessageW(richedit, EM_GETPARAFORMAT, 0, (LPARAM)&pf);
8643  ok(pf.wAlignment == align_mask[i], "got %d expect %d\n", pf.wAlignment, align_mask[i]);
8644 
8645  DestroyWindow(richedit);
8646  }
8647 
8648  /* test with EM_STREAMIN */
8650  simulate_typing_characters(richedit, "abc");
8651  es.dwCookie = (DWORD_PTR)&streamtext;
8652  es.dwError = 0;
8653  es.pfnCallback = test_EM_STREAMIN_esCallback;
8654  SendMessageW(richedit, EM_STREAMIN, SF_RTF, (LPARAM)&es);
8655  SendMessageW(richedit, EM_SETSEL, 0, -1);
8656  memset(&pf, 0, sizeof(pf));
8657  pf.cbSize = sizeof(PARAFORMAT2);
8658  pf.dwMask = -1;
8660  ok(pf.wAlignment == PFA_LEFT, "got %d expected PFA_LEFT\n", pf.wAlignment);
8661  DestroyWindow(richedit);
8662 }
#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:1843
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
static DWORD CALLBACK test_EM_STREAMIN_esCallback(DWORD_PTR dwCookie, LPBYTE pbBuff, LONG cb, LONG *pcb)
Definition: editor.c:5736
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:2000
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
#define ARRAY_SIZE(a)
Definition: main.h:24
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define ok(value,...)
Definition: atltest.h:57
#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 7336 of file editor.c.

7337 {
7339  int lines, ret, redraw;
7340  POINT pt;
7341 
7342  for (redraw = 0; redraw <= 1; redraw++) {
7343  trace("testing with WM_SETREDRAW=%d\n", redraw);
7345  SendMessageA(hwnd, EM_REPLACESEL, 0, (LPARAM)"1\n2\n3\n4\n5\n6\n7\n8");
7347  ok(lines == 8, "%d lines instead of 8\n", lines);
7349  ok(ret == 1, "EM_GETSCROLLPOS returned %d instead of 1\n", ret);
7350  ok(pt.y != 0, "Didn't scroll down after replacing text.\n");
7352  ok(ret & WS_VSCROLL, "Scrollbar was not shown yet (style=%x).\n", (UINT)ret);
7353 
7354  SendMessageA(hwnd, WM_SETTEXT, 0, 0);
7356  ok(lines == 1, "%d lines instead of 1\n", lines);
7358  ok(ret == 1, "EM_GETSCROLLPOS returned %d instead of 1\n", ret);
7359  ok(pt.y == 0, "y scroll position is %d after clearing text.\n", pt.y);
7361  ok(!(ret & WS_VSCROLL), "Scrollbar is still shown (style=%x).\n", (UINT)ret);
7362  }
7363 
7366 
7367  /* The WS_VSCROLL and WS_HSCROLL styles implicitly set
7368  * auto vertical/horizontal scrolling options. */
7371  0, 0, 200, 60, NULL, NULL, hmoduleRichEdit, NULL);
7372  ok(hwnd != NULL, "class: %s, error: %d\n", RICHEDIT_CLASS20A, (int) GetLastError());
7373  ret = SendMessageA(hwnd, EM_GETOPTIONS, 0, 0);
7374  ok(ret & ECO_AUTOVSCROLL, "ECO_AUTOVSCROLL isn't set.\n");
7375  ok(ret & ECO_AUTOHSCROLL, "ECO_AUTOHSCROLL isn't set.\n");
7377  ok(!(ret & ES_AUTOVSCROLL), "ES_AUTOVSCROLL is set.\n");
7378  ok(!(ret & ES_AUTOHSCROLL), "ES_AUTOHSCROLL is set.\n");
7380 
7383  0, 0, 200, 60, NULL, NULL, hmoduleRichEdit, NULL);
7384  ok(hwnd != NULL, "class: %s, error: %d\n", RICHEDIT_CLASS20A, (int) GetLastError());
7385  ret = SendMessageA(hwnd, EM_GETOPTIONS, 0, 0);
7386  ok(!(ret & ECO_AUTOVSCROLL), "ECO_AUTOVSCROLL is set.\n");
7387  ok(!(ret & ECO_AUTOHSCROLL), "ECO_AUTOHSCROLL is set.\n");
7389  ok(!(ret & ES_AUTOVSCROLL), "ES_AUTOVSCROLL is set.\n");
7390  ok(!(ret & ES_AUTOHSCROLL), "ES_AUTOHSCROLL is set.\n");
7392 }
#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 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)
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 trace
Definition: atltest.h:70
#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 ok(value,...)
Definition: atltest.h:57
#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:1988
#define EM_GETOPTIONS
Definition: richedit.h:111
#define EM_GETLINECOUNT
Definition: winuser.h:1974

Referenced by START_TEST().

◆ test_background()

static void test_background ( void  )
static

Definition at line 8757 of file editor.c.

8758 {
8759  HWND hwndRichEdit = new_richedit(NULL);
8760 
8761  /* set the background color to black */
8762  ValidateRect(hwndRichEdit, NULL);
8763  SendMessageA(hwndRichEdit, EM_SETBKGNDCOLOR, FALSE, RGB(0, 0, 0));
8764  ok(GetUpdateRect(hwndRichEdit, NULL, FALSE), "Update rectangle is empty!\n");
8765 
8766  DestroyWindow(hwndRichEdit);
8767 }
LRESULT WINAPI SendMessageA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
BOOL WINAPI DestroyWindow(_In_ HWND)
smooth NULL
Definition: ftsmooth.c:416
#define EM_SETBKGNDCOLOR
Definition: richedit.h:100
#define RGB(r, g, b)
Definition: wingdi.h:2939
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
#define ok(value,...)
Definition: atltest.h:57

Referenced by START_TEST().

◆ test_dialogmode()

static void test_dialogmode ( void  )
static

Definition at line 7914 of file editor.c.

7915 {
7916  HWND hwRichEdit, hwParent, hwButton;
7917  MSG msg= {0};
7918  int lcount, r;
7919  WNDCLASSA cls;
7920 
7921  cls.style = 0;
7923  cls.cbClsExtra = 0;
7924  cls.cbWndExtra = 0;
7925  cls.hInstance = GetModuleHandleA(0);
7926  cls.hIcon = 0;
7927  cls.hCursor = LoadCursorA(0, (LPCSTR)IDC_ARROW);
7929  cls.lpszMenuName = NULL;
7930  cls.lpszClassName = "DialogModeParentClass";
7931  if(!RegisterClassA(&cls)) assert(0);
7932 
7933  hwParent = CreateWindowA("DialogModeParentClass", NULL, WS_OVERLAPPEDWINDOW,
7934  CW_USEDEFAULT, 0, 200, 120, NULL, NULL, GetModuleHandleA(0), NULL);
7935 
7936  /* Test richedit(ES_MULTILINE) */
7937 
7938  hwRichEdit = new_window(RICHEDIT_CLASS20A, ES_MULTILINE, hwParent);
7939 
7940  r = SendMessageA(hwRichEdit, WM_KEYDOWN, VK_RETURN, 0x1c0001);
7941  ok(0 == r, "expected 0, got %d\n", r);
7942  lcount = SendMessageA(hwRichEdit, EM_GETLINECOUNT, 0, 0);
7943  ok(2 == lcount, "expected 2, got %d\n", lcount);
7944 
7945  r = SendMessageA(hwRichEdit, WM_GETDLGCODE, 0, 0);
7946  ok(0x8f == r, "expected 0x8f, got 0x%x\n", r);
7947 
7948  r = SendMessageA(hwRichEdit, WM_KEYDOWN, VK_RETURN, 0x1c0001);
7949  ok(0 == r, "expected 0, got %d\n", r);
7950  lcount = SendMessageA(hwRichEdit, EM_GETLINECOUNT, 0, 0);
7951  ok(3 == lcount, "expected 3, got %d\n", lcount);
7952 
7953  r = SendMessageA(hwRichEdit, WM_GETDLGCODE, 0, (LPARAM)&msg);
7954  ok(0x8f == r, "expected 0x8f, got 0x%x\n", r);
7955  r = SendMessageA(hwRichEdit, WM_KEYDOWN, VK_RETURN, 0x1c0001);
7956  ok(0 == r, "expected 0, got %d\n", r);
7957  lcount = SendMessageA(hwRichEdit, EM_GETLINECOUNT, 0, 0);
7958  ok(3 == lcount, "expected 3, got %d\n", lcount);
7959 
7960  DestroyWindow(hwRichEdit);
7961 
7962  /* Test standalone richedit(ES_MULTILINE) */
7963 
7965 
7966  r = SendMessageA(hwRichEdit, WM_KEYDOWN, VK_RETURN, 0x1c0001);
7967  ok(0 == r, "expected 0, got %d\n", r);
7968  lcount = SendMessageA(hwRichEdit, EM_GETLINECOUNT, 0, 0);
7969  ok(2 == lcount, "expected 2, got %d\n", lcount);
7970 
7971  r = SendMessageA(hwRichEdit, WM_GETDLGCODE, 0, (LPARAM)&msg);
7972  ok(0x8f == r, "expected 0x8f, got 0x%x\n", r);
7973 
7974  r = SendMessageA(hwRichEdit, WM_KEYDOWN, VK_RETURN, 0x1c0001);
7975  ok(0 == r, "expected 0, got %d\n", r);
7976  lcount = SendMessageA(hwRichEdit, EM_GETLINECOUNT, 0, 0);
7977  ok(2 == lcount, "expected 2, got %d\n", lcount);
7978 
7979  DestroyWindow(hwRichEdit);
7980 
7981  /* Check a destination for messages */
7982 
7983  hwRichEdit = new_window(RICHEDIT_CLASS20A, ES_MULTILINE, hwParent);
7984 
7985  SetWindowLongA(hwRichEdit, GWL_STYLE, GetWindowLongA(hwRichEdit, GWL_STYLE)& ~WS_POPUP);
7986  SetParent( hwRichEdit, NULL);
7987 
7988  r = SendMessageA(hwRichEdit, WM_GETDLGCODE, 0, (LPARAM)&msg);
7989  ok(0x8f == r, "expected 0x8f, got 0x%x\n", r);
7990 
7991  memset(&dm_messages, 0, sizeof(dm_messages));
7992  r = SendMessageA(hwRichEdit, WM_KEYDOWN, VK_RETURN, 0x1c0001);
7993  ok(0 == r, "expected 0, got %d\n", r);
7994  test_dm_messages(0, 1, 0);
7995 
7996  memset(&dm_messages, 0, sizeof(dm_messages));
7997  r = SendMessageA(hwRichEdit, WM_KEYDOWN, VK_TAB, 0xf0001);
7998  ok(0 == r, "expected 0, got %d\n", r);
7999  test_dm_messages(0, 0, 1);
8000 
8001  DestroyWindow(hwRichEdit);
8002 
8003  /* Check messages from richedit(ES_MULTILINE) */
8004 
8005  hwRichEdit = new_window(RICHEDIT_CLASS20A, ES_MULTILINE, hwParent);
8006 
8007  memset(&dm_messages, 0, sizeof(dm_messages));
8008  r = SendMessageA(hwRichEdit, WM_KEYDOWN, VK_RETURN, 0x1c0001);
8009  ok(0 == r, "expected 0, got %d\n", r);
8010  test_dm_messages(0, 0, 0);
8011 
8012  lcount = SendMessageA(hwRichEdit, EM_GETLINECOUNT, 0, 0);
8013  ok(2 == lcount, "expected 2, got %d\n", lcount);
8014 
8015  memset(&dm_messages, 0, sizeof(dm_messages));
8016  r = SendMessageA(hwRichEdit, WM_KEYDOWN, VK_ESCAPE, 0x10001);
8017  ok(0 == r, "expected 0, got %d\n", r);
8018  test_dm_messages(0, 0, 0);
8019 
8020  memset(&dm_messages, 0, sizeof(dm_messages));
8021  r = SendMessageA(hwRichEdit, WM_KEYDOWN, VK_TAB, 0xf0001);
8022  ok(0 == r, "expected 0, got %d\n", r);
8023  test_dm_messages(0, 0, 0);
8024 
8025  memset(&dm_messages, 0, sizeof(dm_messages));
8026  r = SendMessageA(hwRichEdit, WM_GETDLGCODE, 0, (LPARAM)&msg);
8027  ok(0x8f == r, "expected 0x8f, got 0x%x\n", r);
8028  test_dm_messages(0, 0, 0);
8029 
8030  memset(&dm_messages, 0, sizeof(dm_messages));
8031  r = SendMessageA(hwRichEdit, WM_KEYDOWN, VK_RETURN, 0x1c0001);
8032  ok(0 == r, "expected 0, got %d\n", r);
8033  test_dm_messages(0, 1, 0);
8034 
8035  lcount = SendMessageA(hwRichEdit, EM_GETLINECOUNT, 0, 0);
8036  ok(2 == lcount, "expected 2, got %d\n", lcount);
8037 
8038  memset(&dm_messages, 0, sizeof(dm_messages));
8039  r = SendMessageA(hwRichEdit, WM_KEYDOWN, VK_ESCAPE, 0x10001);
8040  ok(0 == r, "expected 0, got %d\n", r);
8041  test_dm_messages(0, 0, 0);
8042 
8043  memset(&dm_messages, 0, sizeof(dm_messages));
8044  r = SendMessageA(hwRichEdit, WM_KEYDOWN, VK_TAB, 0xf0001);
8045  ok(0 == r, "expected 0, got %d\n", r);
8046  test_dm_messages(0, 0, 1);
8047 
8048  hwButton = CreateWindowA("BUTTON", "OK", WS_VISIBLE|WS_CHILD|BS_PUSHBUTTON,
8049  100, 100, 50, 20, hwParent, (HMENU)ID_RICHEDITTESTDBUTTON, GetModuleHandleA(0), NULL);
8050  ok(hwButton!=NULL, "CreateWindow failed with error code %d\n", GetLastError());
8051 
8052  memset(&dm_messages, 0, sizeof(dm_messages));
8053  r = SendMessageA(hwRichEdit, WM_KEYDOWN, VK_RETURN, 0x1c0001);
8054  ok(0 == r, "expected 0, got %d\n", r);
8055  test_dm_messages(0, 1, 1);
8056 
8057  lcount = SendMessageA(hwRichEdit, EM_GETLINECOUNT, 0, 0);
8058  ok(2 == lcount, "expected 2, got %d\n", lcount);
8059 
8060  DestroyWindow(hwButton);
8061  DestroyWindow(hwRichEdit);
8062 
8063  /* Check messages from richedit(ES_MULTILINE|ES_WANTRETURN) */
8064 
8065  hwRichEdit = new_window(RICHEDIT_CLASS20A, ES_MULTILINE|ES_WANTRETURN, hwParent);
8066 
8067  memset(&dm_messages, 0, sizeof(dm_messages));
8068  r = SendMessageA(hwRichEdit, WM_KEYDOWN, VK_RETURN, 0x1c0001);
8069  ok(0 == r, "expected 0, got %d\n", r);
8070  test_dm_messages(0, 0, 0);
8071 
8072  lcount = SendMessageA(hwRichEdit, EM_GETLINECOUNT, 0, 0);
8073  ok(2 == lcount, "expected 2, got %d\n", lcount);
8074 
8075  memset(&dm_messages, 0, sizeof(dm_messages));
8076  r = SendMessageA(hwRichEdit, WM_KEYDOWN, VK_ESCAPE, 0x10001);
8077  ok(0 == r, "expected 0, got %d\n", r);
8078  test_dm_messages(0, 0, 0);
8079 
8080  memset(&dm_messages, 0, sizeof(dm_messages));
8081  r = SendMessageA(hwRichEdit, WM_KEYDOWN, VK_TAB, 0xf0001);
8082  ok(0 == r, "expected 0, got %d\n", r);
8083  test_dm_messages(0, 0, 0);
8084 
8085  memset(&dm_messages, 0, sizeof(dm_messages));
8086  r = SendMessageA(hwRichEdit, WM_GETDLGCODE, 0, (LPARAM)&msg);
8087  ok(0x8f == r, "expected 0x8f, got 0x%x\n", r);
8088  test_dm_messages(0, 0, 0);
8089 
8090  memset(&dm_messages, 0, sizeof(dm_messages));
8091  r = SendMessageA(hwRichEdit, WM_KEYDOWN, VK_RETURN, 0x1c0001);
8092  ok(0 == r, "expected 0, got %d\n", r);
8093  test_dm_messages(0, 0, 0);
8094 
8095  lcount = SendMessageA(hwRichEdit, EM_GETLINECOUNT, 0, 0);
8096  ok(3 == lcount, "expected 3, got %d\n", lcount);
8097 
8098  memset(&dm_messages, 0, sizeof(dm_messages));
8099  r = SendMessageA(hwRichEdit, WM_KEYDOWN, VK_ESCAPE, 0x10001);
8100  ok(0 == r, "expected 0, got %d\n", r);
8101  test_dm_messages(0, 0, 0);
8102 
8103  memset(&dm_messages, 0, sizeof(dm_messages));
8104  r = SendMessageA(hwRichEdit, WM_KEYDOWN, VK_TAB, 0xf0001);
8105  ok(0 == r, "expected 0, got %d\n", r);
8106  test_dm_messages(0, 0, 1);
8107 
8108  hwButton = CreateWindowA("BUTTON", "OK", WS_VISIBLE|WS_CHILD|BS_PUSHBUTTON,
8109  100, 100, 50, 20, hwParent, (HMENU)ID_RICHEDITTESTDBUTTON, GetModuleHandleA(0), NULL);
8110  ok(hwButton!=NULL, "CreateWindow failed with error code %d\n", GetLastError());
8111 
8112  memset(&dm_messages, 0, sizeof(dm_messages));
8113  r = SendMessageA(hwRichEdit, WM_KEYDOWN, VK_RETURN, 0x1c0001);
8114  ok(0 == r, "expected 0, got %d\n", r);
8115  test_dm_messages(0, 0, 0);
8116 
8117  lcount = SendMessageA(hwRichEdit, EM_GETLINECOUNT, 0, 0);
8118  ok(4 == lcount, "expected 4, got %d\n", lcount);
8119 
8120  DestroyWindow(hwButton);
8121  DestroyWindow(hwRichEdit);
8122 
8123  /* Check messages from richedit(0) */
8124 
8125  hwRichEdit = new_window(RICHEDIT_CLASS20A, 0, hwParent);
8126 
8127  memset(&dm_messages, 0, sizeof(dm_messages));
8128  r = SendMessageA(hwRichEdit, WM_KEYDOWN, VK_RETURN, 0x1c0001);
8129  ok(0 == r, "expected 0, got %d\n", r);
8130  test_dm_messages(0, 0, 0);
8131 
8132  memset(&dm_messages, 0, sizeof(dm_messages));
8133  r = SendMessageA(hwRichEdit, WM_KEYDOWN, VK_ESCAPE, 0x10001);
8134  ok(0 == r, "expected 0, got %d\n", r);
8135  test_dm_messages(0, 0, 0);
8136 
8137  memset(&dm_messages, 0, sizeof(dm_messages));
8138  r = SendMessageA(hwRichEdit, WM_KEYDOWN, VK_TAB, 0xf0001);
8139  ok(0 == r, "expected 0, got %d\n", r);
8140  test_dm_messages(0, 0, 0);
8141 
8142  memset(&dm_messages, 0, sizeof(dm_messages));
8143  r = SendMessageA(hwRichEdit, WM_GETDLGCODE, 0, (LPARAM)&msg);
8144  ok(0x8b == r, "expected 0x8b, got 0x%x\n", r);
8145  test_dm_messages(0, 0, 0);
8146 
8147  memset(&dm_messages, 0, sizeof(dm_messages));
8148  r = SendMessageA(hwRichEdit, WM_KEYDOWN, VK_RETURN, 0x1c0001);
8149  ok(0 == r, "expected 0, got %d\n", r);
8150  test_dm_messages(0, 1, 0);
8151 
8152  memset(&dm_messages, 0, sizeof(dm_messages));
8153  r = SendMessageA(hwRichEdit, WM_KEYDOWN, VK_ESCAPE, 0x10001);
8154  ok(0 == r, "expected 0, got %d\n", r);
8155  test_dm_messages(0, 0, 0);
8156 
8157  memset(&dm_messages, 0, sizeof(dm_messages));
8158  r = SendMessageA(hwRichEdit, WM_KEYDOWN, VK_TAB, 0xf0001);
8159  ok(0 == r, "expected 0, got %d\n", r);
8160  test_dm_messages(0, 0, 1);
8161 
8162  hwButton = CreateWindowA("BUTTON", "OK", WS_VISIBLE|WS_CHILD|BS_PUSHBUTTON,
8163  100, 100, 50, 20, hwParent, (HMENU)ID_RICHEDITTESTDBUTTON, GetModuleHandleA(0), NULL);
8164  ok(hwButton!=NULL, "CreateWindow failed with error code %d\n", GetLastError());
8165 
8166  memset(&dm_messages, 0, sizeof(dm_messages));
8167  r = SendMessageA(hwRichEdit, WM_KEYDOWN, VK_RETURN, 0x1c0001);
8168  ok(0 == r, "expected 0, got %d\n", r);
8169  test_dm_messages(0, 1, 1);
8170 
8171  DestroyWindow(hwRichEdit);
8172 
8173  /* Check messages from richedit(ES_WANTRETURN) */
8174 
8175  hwRichEdit = new_window(RICHEDIT_CLASS20A, ES_WANTRETURN, hwParent);
8176 
8177  memset(&dm_messages, 0, sizeof(dm_messages));
8178  r = SendMessageA(hwRichEdit, WM_KEYDOWN, VK_RETURN, 0x1c0001);
8179  ok(0 == r, "expected 0, got %d\n", r);
8180  test_dm_messages(0, 0, 0);
8181 
8182  memset(&dm_messages, 0, sizeof(dm_messages));
8183  r = SendMessageA(hwRichEdit, WM_GETDLGCODE, 0, (LPARAM)&msg);
8184  ok(0x8b == r, "expected 0x8b, got 0x%x\n", r);
8185  test_dm_messages(0, 0, 0);
8186 
8187  memset(&dm_messages, 0, sizeof(dm_messages));
8188  r = SendMessageA(hwRichEdit, WM_KEYDOWN, VK_RETURN, 0x1c0001);
8189  ok(0 == r, "expected 0, got %d\n", r);
8190  test_dm_messages(0, 0, 0);
8191 
8192  hwButton = CreateWindowA("BUTTON", "OK", WS_VISIBLE|WS_CHILD|BS_PUSHBUTTON,
8193  100, 100, 50, 20, hwParent, (HMENU)ID_RICHEDITTESTDBUTTON, GetModuleHandleA(0), NULL);
8194  ok(hwButton!=NULL, "CreateWindow failed with error code %d\n", GetLastError());
8195 
8196  memset(&dm_messages, 0, sizeof(dm_messages));
8197  r = SendMessageA(hwRichEdit, WM_KEYDOWN, VK_RETURN, 0x1c0001);
8198  ok(0 == r, "expected 0, got %d\n", r);
8199  test_dm_messages(0, 0, 0);
8200 
8201  DestroyWindow(hwRichEdit);
8202  DestroyWindow(hwParent);
8203 }
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:7886
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:3140
#define assert(x)
Definition: debug.h:53
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
LPCSTR lpszMenuName
Definition: winuser.h:3146
#define WHITE_BRUSH
Definition: wingdi.h:901
#define VK_TAB
Definition: winuser.h:2174
HBRUSH hbrBackground
Definition: winuser.h:3145
#define WS_CHILD
Definition: pedump.c:617
#define VK_ESCAPE
Definition: winuser.h:2189
BOOL WINAPI DestroyWindow(_In_ HWND)
#define VK_RETURN
Definition: winuser.h:2176
int cbWndExtra
Definition: winuser.h:3141
LONG WINAPI GetWindowLongA(_In_ HWND, _In_ int)
#define CreateWindowA(a, b, c, d, e, f, g, h, i, j, k)
Definition: winuser.h:4290
HCURSOR hCursor
Definition: winuser.h:3144
#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:1697
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:821
LPCSTR lpszClassName
Definition: winuser.h:3147
HCURSOR WINAPI LoadCursorA(_In_opt_ HINSTANCE, _In_ LPCSTR)
Definition: cursoricon.c:2059
#define BS_PUSHBUTTON
Definition: pedump.c:651
UINT style
Definition: winuser.h:3138
#define GWL_STYLE
Definition: winuser.h:846
HINSTANCE hInstance
Definition: winuser.h:3142
#define ok(value,...)
Definition: atltest.h:57
#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:3139
#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:7888
static LRESULT CALLBACK dialog_mode_wnd_proc(HWND hwnd, UINT iMsg, WPARAM wParam, LPARAM lParam)
Definition: editor.c:7896
#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:3143
#define EM_GETLINECOUNT
Definition: winuser.h:1974

Referenced by START_TEST().

◆ test_EM_AUTOURLDETECT()

static void test_EM_AUTOURLDETECT ( void  )
static

Definition at line 1940 of file editor.c.

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

Referenced by START_TEST().

◆ test_EM_CHARFROMPOS()

static void test_EM_CHARFROMPOS ( void  )
static

Definition at line 7187 of file editor.c.

7188 {
7189  HWND hwnd;
7190  int result;
7191  RECT rcClient;
7192  POINTL point;
7193  point.x = 0;
7194  point.y = 40;
7195 
7196  /* multi-line control inserts CR normally */
7197  hwnd = new_richedit(NULL);
7199  (LPARAM)"one two three four five six seven\reight");
7200  ok(result == 1, "Expected 1, got %d\n", result);
7201  GetClientRect(hwnd, &rcClient);
7202 
7204  ok(result == 34, "expected character index of 34 but got %d\n", result);
7205 
7206  /* Test with points outside the bounds of the richedit control. */
7207  point.x = -1;
7208  point.y = 40;
7210  todo_wine ok(result == 34, "expected character index of 34 but got %d\n", result);
7211 
7212  point.x = 1000;
7213  point.y = 0;
7215  todo_wine ok(result == 33, "expected character index of 33 but got %d\n", result);
7216 
7217  point.x = 1000;
7218  point.y = 36;
7220  todo_wine ok(result == 39, "expected character index of 39 but got %d\n", result);
7221 
7222  point.x = 1000;
7223  point.y = -1;