ReactOS 0.4.15-dev-8428-g6910fa6
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)
@ wparam
Definition: SystemMenu.c:30
#define NULL
Definition: types.h:112
#define CP_ACP
Definition: compat.h:109
#define GT_DEFAULT
Definition: richedit.h:1036
#define EM_GETTEXTEX
Definition: richedit.h:128
int ret
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4023
LONG_PTR LPARAM
Definition: windef.h:208
UINT_PTR WPARAM
Definition: windef.h:207
LRESULT WINAPI SendMessageA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define WM_GETTEXT
Definition: winuser.h:1618

◆ 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)
int WINAPI lstrcmpA(LPCSTR str1, LPCSTR str2)
Definition: locale.c:4194
DWORD WINAPI GetLastError(void)
Definition: except.c:1042

◆ 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)
int WINAPI lstrcmpW(LPCWSTR str1, LPCWSTR str2)
Definition: locale.c:4242
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)

◆ 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, szString1, -1, string1, MAX_PATH, NULL, NULL); \
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 MAX_PATH
Definition: compat.h:34
#define WideCharToMultiByte
Definition: compat.h:111
GLint GLint GLsizei GLsizei GLsizei GLint GLenum format
Definition: gl.h:1546
static CHAR string2[MAX_PATH]
Definition: editor.c:42
static CHAR string1[MAX_PATH]
Definition: editor.c:42
static CHAR string3[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)
#define ST_DEFAULT
Definition: richedit.h:1070
#define EM_SETTEXTEX
Definition: richedit.h:131
#define WM_SETTEXT
Definition: winuser.h:1617

◆ 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)

◆ 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)
#define ok(value,...)
Definition: atltest.h:57
static struct dialog_mode_messages dm_messages
Definition: editor.c:7886

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);
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
GLboolean GLboolean GLboolean GLboolean a
Definition: glext.h:6204
GLuint64EXT * result
Definition: glext.h:11304
int WINAPI lstrlenA(LPCSTR lpString)
Definition: lstring.c:145

◆ 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);
#define lstrlenW
Definition: compat.h:750

◆ 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{
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}
#define ok_(x1, x2)
Definition: atltest.h:61
unsigned int BOOL
Definition: ntddk_ex.h:94
GLsizeiptr size
Definition: glext.h:5919
GLuint res
Definition: glext.h:9613
static LONG twips2points(LONG value)
Definition: editor.c:8500
#define SCF_SELECTION
Definition: richedit.h:235
#define EM_GETCHARFORMAT
Definition: richedit.h:91
#define EM_SETFONTSIZE
Definition: richedit.h:168
#define CFM_SIZE
Definition: richedit.h:362
Definition: parser.c:49
LONG_PTR LRESULT
Definition: windef.h:209
#define EM_CANUNDO
Definition: winuser.h:1983

◆ 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));
236 return ret;
237}
#define GetProcessHeap()
Definition: compat.h:736
#define HeapAlloc
Definition: compat.h:733
#define MultiByteToWideChar
Definition: compat.h:110
unsigned long DWORD
Definition: ntddk_ex.h:95
GLenum GLsizei len
Definition: glext.h:6722
const WCHAR * str
__wchar_t WCHAR
Definition: xmlstorage.h:180

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}
#define FALSE
Definition: types.h:117
static const WCHAR url[]
Definition: encode.c:1432
static BOOL check_CFE_LINK_selection(HWND hwnd, int sel_start, int sel_end)
Definition: editor.c:1912

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}
#define CFE_LINK
Definition: richedit.h:411
DWORD dwEffects
Definition: richedit.h:284
#define EM_SETSEL
Definition: winuser.h:2018

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;
4933 int start, end;
4934
4935 cr.cpMin = setsel->min;
4936 cr.cpMax = setsel->max;
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}
GLuint start
Definition: gl.h:1545
GLuint GLuint end
Definition: gl.h:1545
GLdouble n
Definition: glext.h:7729
#define d
Definition: ke_i.h:81
BOOL expected
Definition: store.c:2063
#define todo_wine_if(is_todo)
Definition: custom.c:76
#define EM_EXSETSEL
Definition: richedit.h:88
LONG cpMax
Definition: richedit.h:501
LONG cpMin
Definition: richedit.h:500
LRESULT expected_retval
Definition: editor.c:4895
LONG max
Definition: editor.c:4894
BOOL todo
Definition: editor.c:4898
LONG min
Definition: editor.c:4893
#define EM_GETSEL
Definition: winuser.h:1997

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}
#define HeapFree(x, y, z)
Definition: compat.h:735
GLfloat f
Definition: glext.h:7540
static WCHAR * atowstr(const char *str)
Definition: editor.c:229
#define EM_FINDTEXTW
Definition: richedit.h:147
#define EM_FINDTEXT
Definition: richedit.h:89
#define memset(x, y, z)
Definition: compat.h:39
CHARRANGE chrg
Definition: richedit.h:581
LPCSTR lpstrText
Definition: richedit.h:582
CHARRANGE chrg
Definition: richedit.h:586
LPCWSTR lpstrText
Definition: richedit.h:587
Definition: name.c:39

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}
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
#define EM_FINDTEXTEX
Definition: richedit.h:112
LPCSTR lpstrText
Definition: richedit.h:594
CHARRANGE chrg
Definition: richedit.h:593
CHARRANGE chrgText
Definition: richedit.h:595
CHARRANGE chrg
Definition: richedit.h:599
CHARRANGE chrgText
Definition: richedit.h:601
LPCWSTR lpstrText
Definition: richedit.h:600

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 {
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}

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}
#define isalpha(c)
Definition: acclib.h:74
char * strstr(char *String1, char *String2)
Definition: utclib.c:653
GLuint GLuint GLsizei count
Definition: gl.h:1545
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;
7076 case WB_LEFTBREAK:
7077 pos--;
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}
static unsigned char bytes[4]
Definition: adnsresfilter.c:74
const WCHAR * text
Definition: package.c:1799
GLuint GLsizei GLsizei * length
Definition: glext.h:6040
static LONG CALLBACK customWordBreakProc(WCHAR *text, int pos, int bytes, int code)
Definition: editor.c:7061
#define min(a, b)
Definition: monoChain.cc:55
#define WB_MOVEWORDRIGHT
Definition: richedit.h:1002
#define WB_RIGHTBREAK
Definition: richedit.h:1006
#define WB_MOVEWORDLEFT
Definition: richedit.h:1000
#define WB_LEFTBREAK
Definition: richedit.h:1004
Definition: inflate.c:139
#define WB_ISDELIMITER
Definition: winuser.h:549
#define WB_LEFT
Definition: winuser.h:550
#define WB_RIGHT
Definition: winuser.h:551

Referenced by customWordBreakProc(), and 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}
WPARAM wParam
Definition: combotst.c:138
LPARAM lParam
Definition: combotst.c:139
#define ID_RICHEDITTESTDBUTTON
Definition: editor.c:40
#define MAKELONG(a, b)
Definition: typedefs.h:249
#define WM_CLOSE
Definition: winuser.h:1621
LRESULT WINAPI DefWindowProcA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define DC_HASDEFID
Definition: winuser.h:2609
#define WM_NEXTDLGCTL
Definition: winuser.h:1643
#define DM_GETDEFID
Definition: winuser.h:2098

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
5729
5730 return 0;
5731 }
5732 else
5733 return 1; /* indicates callback failed */
5734}
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
static HMODULE MODULEINFO DWORD cb
Definition: module.c:33
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}
static ENLINK enlink
Definition: editor.c:6742
#define EN_LINK
Definition: richedit.h:202
#define WM_NOTIFY
Definition: richedit.h:61
Definition: tftpd.h:60

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

8905{
8906 reobj->cbStruct = sizeof(*reobj);
8907 reobj->clsid = CLSID_NULL;
8908 reobj->cp = cp;
8909 reobj->poleobj = poleobj;
8910 reobj->pstg = pstg;
8911 reobj->polesite = polesite;
8912 reobj->sizel.cx = sizel_cx;
8913 reobj->sizel.cy = sizel_cy;
8914 reobj->dvaspect = aspect;
8915 reobj->dwFlags = flags;
8916 reobj->dwUser = user;
8917}
void user(int argc, const char *argv[])
Definition: cmds.c:1350
GLbitfield flags
Definition: glext.h:7161
POINT cp
Definition: magnifier.c:59
#define CLSID_NULL
Definition: guiddef.h:99
LONG cx
Definition: kdterminal.h:27
LONG cy
Definition: kdterminal.h:28
DWORD dwUser
Definition: richole.idl:67
CLSID clsid
Definition: richole.idl:60
DWORD dwFlags
Definition: richole.idl:66
LPSTORAGE pstg
Definition: richole.idl:62
LPOLEOBJECT poleobj
Definition: richole.idl:61
DWORD dvaspect
Definition: richole.idl:65
LPOLECLIENTSITE polesite
Definition: richole.idl:63
DWORD cbStruct
Definition: richole.idl:58
LONG cp
Definition: richole.idl:59
SIZEL sizel
Definition: richole.idl:64

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}
GLenum src
Definition: glext.h:6340
GLenum target
Definition: glext.h:7315
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 sprintf(buf, format,...)
Definition: sprintf.c:55

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

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:77
BOOL WINAPI SetKeyboardState(_In_reads_(256) LPBYTE)
_Check_return_ BOOL WINAPI GetKeyboardState(_Out_writes_(256) PBYTE lpKeyState)
unsigned char BYTE
Definition: xxhash.c:193

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}

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}
#define msg(x)
Definition: auth_time.c:54
__kernel_time_t time_t
Definition: linux.h:252
__u16 time
Definition: mkdosfs.c:8
VOID WINAPI DECLSPEC_HOTPATCH Sleep(IN DWORD dwMilliseconds)
Definition: synch.c:790
TW_UINT32 TW_UINT16 TW_UINT16 MSG
Definition: twain.h:1829
LRESULT WINAPI DispatchMessageA(_In_ const MSG *)
BOOL WINAPI TranslateMessage(_In_ const MSG *)
#define PM_REMOVE
Definition: winuser.h:1196
BOOL WINAPI PeekMessageA(_Out_ LPMSG, _In_opt_ HWND, _In_ UINT, _In_ UINT, _In_ UINT)

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}
#define EM_LINESCROLL
Definition: winuser.h:2004

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 {
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}
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
Definition: utclib.c:112
r parent
Definition: btrfs.c:3010
static const WCHAR desc[]
Definition: protectdata.c:36
#define CURSOR_CLIENT_Y
Definition: editor.c:6744
#define WP_PARENT
Definition: editor.c:6745
#define CURSOR_CLIENT_X
Definition: editor.c:6743
#define WP_CHILD
Definition: editor.c:6746
#define WM_MOUSEHOVER
Definition: commctrl.h:4974
UINT_PTR idFrom
Definition: winuser.h:3158
HWND hwndFrom
Definition: winuser.h:3157
#define WM_MOUSEWHEEL
Definition: treelist.c:96
#define MAKELPARAM(l, h)
Definition: winuser.h:4008
#define WM_LBUTTONDBLCLK
Definition: winuser.h:1778
#define WM_RBUTTONUP
Definition: winuser.h:1780
#define WM_RBUTTONDBLCLK
Definition: winuser.h:1781
#define WM_MOUSEMOVE
Definition: winuser.h:1775
#define WM_LBUTTONDOWN
Definition: winuser.h:1776
#define WM_RBUTTONDOWN
Definition: winuser.h:1779
#define WM_LBUTTONUP
Definition: winuser.h:1777
#define WM_SETCURSOR
Definition: winuser.h:1636

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;
532}

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}
Arabic default style
Definition: afstyles.h:94

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 HWND new_windowW(LPCWSTR lpClassName, DWORD dwStyle, HWND parent)
Definition: editor.c:63
static const WCHAR RICHEDIT_CLASS20W[]
Definition: richedit.h:50

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}

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}
static HMODULE hmoduleRichEdit
Definition: editor.c:51
#define WS_POPUP
Definition: pedump.c:616
#define WS_VSCROLL
Definition: pedump.c:627
#define WS_VISIBLE
Definition: pedump.c:620
#define WS_HSCROLL
Definition: pedump.c:628
#define CreateWindowA(a, b, c, d, e, f, g, h, i, j, k)
Definition: winuser.h:4315

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}
#define wine_dbgstr_w
Definition: kernel32.h:34
#define CreateWindowW(a, b, c, d, e, f, g, h, i, j, k)
Definition: winuser.h:4316

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 queriedEventMask
Definition: editor.c:6540
static HWND eventMaskEditHwnd
Definition: editor.c:6539
static int watchForEventMask
Definition: editor.c:6541
#define EM_GETEVENTMASK
Definition: richedit.h:92
#define WM_COMMAND
Definition: winuser.h:1740

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}

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
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 }
2893 return r;
2894}
#define TRUE
Definition: types.h:120
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
static unsigned int recursionLevel
Definition: editor.c:2864
static unsigned int WM_SIZE_recursionLevel
Definition: editor.c:2865
static BOOL bailedOutOfRecursion
Definition: editor.c:2866
#define WM_SIZE
Definition: winuser.h:1611
#define SB_VERT
Definition: winuser.h:553
BOOL WINAPI ShowScrollBar(_In_ HWND, _In_ int, _In_ BOOL)

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}
static TAGID TAGID find
Definition: db.cpp:155
static void check_EM_FINDTEXT(HWND hwnd, const char *name, struct find_s *f, int id, BOOL unicode)
Definition: editor.c:239
static void check_EM_FINDTEXTEX(HWND hwnd, const char *name, struct find_s *f, int id, BOOL unicode)
Definition: editor.c:275

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{
5426 return result;
5427}
static BOOL hold_key(int vk)
Definition: editor.c:117
static BOOL release_key(int vk)
Definition: editor.c:131
Definition: copy.c:22
#define VK_CONTROL
Definition: winuser.h:2203
#define WM_KEYDOWN
Definition: winuser.h:1715

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}
#define WM_KEYUP
Definition: winuser.h:1716
#define WM_CHAR
Definition: winuser.h:1717

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

9023{
9024 BOOL ret;
9025 /* Must explicitly LoadLibrary(). The test has no references to functions in
9026 * RICHED20.DLL, so the linker doesn't actually link to it. */
9027 hmoduleRichEdit = LoadLibraryA("riched20.dll");
9028 ok(hmoduleRichEdit != NULL, "error: %d\n", (int) GetLastError());
9030
9032 test_WM_CHAR();
9059 test_WM_PASTE();
9072 test_EN_LINK();
9083 test_zoom();
9087 test_enter();
9093 test_rtf();
9098
9099 /* Set the environment variable WINETEST_RICHED20 to keep windows
9100 * responsive and open for 30 seconds. This is useful for debugging.
9101 */
9102 if (getenv( "WINETEST_RICHED20" )) {
9103 keep_responsive(30);
9104 }
9105
9108 ok(ret, "error: %d\n", (int) GetLastError());
9109}
#define FreeLibrary(x)
Definition: compat.h:748
HINSTANCE WINAPI DECLSPEC_HOTPATCH LoadLibraryA(LPCSTR lpLibFileName)
Definition: loader.c:111
LANGID WINAPI GetUserDefaultLangID(void)
Definition: locale.c:1176
HRESULT WINAPI OleFlushClipboard(void)
Definition: clipboard.c:2293
_Check_return_ char *__cdecl getenv(_In_z_ const char *_VarName)
static void test_EM_SELECTIONTYPE(void)
Definition: editor.c:8919
static void test_EM_FORMATRANGE(void)
Definition: editor.c:5594
static void test_SETPARAFORMAT(void)
Definition: editor.c:1506
static void test_WM_PASTE(void)
Definition: editor.c:5429
static void test_EM_EXSETSEL(void)
Definition: editor.c:4948
static void test_EM_GETSELTEXT(void)
Definition: editor.c:1801
static void test_WM_GETTEXT(void)
Definition: editor.c:1650
static void test_EM_StreamIn_Undo(void)
Definition: editor.c:6100
static void test_EM_SETOPTIONS(void)
Definition: editor.c:1840
static void test_EM_FINDWORDBREAK_W(void)
Definition: editor.c:8205
static void test_WM_SETFONT(void)
Definition: editor.c:4645
static void test_undo_coalescing(void)
Definition: editor.c:6944
static void test_EM_GETTEXTLENGTHEX(void)
Definition: editor.c:6388
static void test_EM_STREAMOUT_FONTTBL(void)
Definition: editor.c:3923
static void test_EM_GETLINE(void)
Definition: editor.c:390
static void test_WM_GETTEXTLENGTH(void)
Definition: editor.c:8693
static void test_EM_SCROLL(void)
Definition: editor.c:2730
static void test_EM_GETLIMITTEXT(void)
Definition: editor.c:4630
static void test_EN_LINK(void)
Definition: editor.c:6819
static void test_unicode_conversions(void)
Definition: editor.c:6179
static void test_EM_STREAMIN(void)
Definition: editor.c:5826
static void test_EM_STREAMOUT(void)
Definition: editor.c:3821
static void test_EM_AUTOURLDETECT(void)
Definition: editor.c:1940
static void test_EM_REPLACESEL(int redraw)
Definition: editor.c:5045
static void test_WM_CREATE(void)
Definition: editor.c:8408
static void test_WM_SETTEXT(void)
Definition: editor.c:3693
static void test_EM_SETCHARFORMAT(void)
Definition: editor.c:750
static void test_background(void)
Definition: editor.c:8786
static BOOL is_lang_japanese
Definition: editor.c:52
static void test_dialogmode(void)
Definition: editor.c:7914
static void test_EM_SETTEXTMODE(void)
Definition: editor.c:1364
static void test_format_rect(void)
Definition: editor.c:7395
static void test_eventMask(void)
Definition: editor.c:6554
static void test_EM_LINELENGTH(void)
Definition: editor.c:462
static void test_scrollbar_visibility(void)
Definition: editor.c:2896
static void keep_responsive(time_t delay_time)
Definition: editor.c:86
static void test_EM_CHARFROMPOS(void)
Definition: editor.c:7187
static void test_EM_SETFONTSIZE(void)
Definition: editor.c:8527
static void test_EM_SETSEL(void)
Definition: editor.c:5002
static void test_rtf(void)
Definition: editor.c:8724
static void test_WM_GETDLGCODE(void)
Definition: editor.c:7558
static void test_EM_SCROLLCARET(void)
Definition: editor.c:539
static void test_EM_SETUNDOLIMIT(void)
Definition: editor.c:3586
static void test_EM_STREAMOUT_empty_para(void)
Definition: editor.c:3976
static void test_EM_LIMITTEXT(void)
Definition: editor.c:4459
static void test_autoscroll(void)
Definition: editor.c:7336
static void test_word_wrap(void)
Definition: editor.c:7240
static void test_enter(void)
Definition: editor.c:8298
static void test_EM_FINDWORDBREAK_A(void)
Definition: editor.c:8249
static void test_reset_default_para_fmt(void)
Definition: editor.c:8449
static void test_window_classes(void)
Definition: editor.c:8990
static void test_EM_POSFROMCHAR(void)
Definition: editor.c:597
static void test_zoom(void)
Definition: editor.c:7739
static void test_ES_PASSWORD(void)
Definition: editor.c:3650
static void test_EM_EXLIMITTEXT(void)
Definition: editor.c:4499
static void test_WM_CHAR(void)
Definition: editor.c:6337
static void test_eop_char_fmt(void)
Definition: editor.c:8798
static void test_word_movement(void)
Definition: editor.c:7098
static void test_para_numbering(void)
Definition: editor.c:8834
static void test_EM_GETTEXTRANGE(void)
Definition: editor.c:1717
static void test_alignment_style(void)
Definition: editor.c:8594
static void test_EM_SETTEXTEX(void)
Definition: editor.c:3996
static void test_WM_NOTIFY(void)
Definition: editor.c:6648
static void test_EM_SETREADONLY(void)
Definition: editor.c:8481
static void test_TM_PLAINTEXT(void)
Definition: editor.c:1540
static void test_EM_GETMODIFY(void)
Definition: editor.c:4727
static void test_EM_FINDTEXT(void)
Definition: editor.c:779
#define LANG_JAPANESE
Definition: nls.h:76
#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,
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 /* Test out of bounds tab count */
8646 pf.dwMask = PFM_TABSTOPS;
8647 pf.cTabCount = -25000;
8648 SendMessageW(richedit, EM_SETPARAFORMAT, 0, (LPARAM)&pf);
8649 ok(pf.cTabCount == -25000, "Got %d\n", pf.cTabCount);
8650 SendMessageW(richedit, EM_GETPARAFORMAT, 0, (LPARAM)&pf);
8651 ok(pf.cTabCount == 0, "Got %d\n", pf.cTabCount);
8652 pf.dwMask = PFM_TABSTOPS;
8653 pf.cTabCount = 25000;
8654 SendMessageW(richedit, EM_SETPARAFORMAT, 0, (LPARAM)&pf);
8655 ok(pf.cTabCount == 25000, "Got %d\n", pf.cTabCount);
8656 SendMessageW(richedit, EM_GETPARAFORMAT, 0, (LPARAM)&pf);
8657 ok(pf.cTabCount == 32, "Got %d\n", pf.cTabCount);
8658 pf.dwMask = PFM_TABSTOPS;
8659 pf.cTabCount = 32;
8660 SendMessageW(richedit, EM_SETPARAFORMAT, 0, (LPARAM)&pf);
8661 SendMessageW(richedit, EM_GETPARAFORMAT, 0, (LPARAM)&pf);
8662 ok(pf.cTabCount == 32, "Got %d\n", pf.cTabCount);
8663 pf.dwMask = PFM_TABSTOPS;
8664 pf.cTabCount = 33;
8665 SendMessageW(richedit, EM_SETPARAFORMAT, 0, (LPARAM)&pf);
8666 SendMessageW(richedit, EM_GETPARAFORMAT, 0, (LPARAM)&pf);
8667 ok(pf.cTabCount == 32, "Got %d\n", pf.cTabCount);
8668 pf.dwMask = PFM_TABSTOPS;
8669 pf.cTabCount = 1;
8670 SendMessageW(richedit, EM_SETPARAFORMAT, 0, (LPARAM)&pf);
8671 SendMessageW(richedit, EM_GETPARAFORMAT, 0, (LPARAM)&pf);
8672 ok(pf.cTabCount == 1, "Got %d\n", pf.cTabCount);
8673
8674 DestroyWindow(richedit);
8675 }
8676
8677 /* test with EM_STREAMIN */
8679 simulate_typing_characters(richedit, "abc");
8680 es.dwCookie = (DWORD_PTR)&streamtext;
8681 es.dwError = 0;
8682 es.pfnCallback = test_EM_STREAMIN_esCallback;
8683 SendMessageW(richedit, EM_STREAMIN, SF_RTF, (LPARAM)&es);
8684 SendMessageW(richedit, EM_SETSEL, 0, -1);
8685 memset(&pf, 0, sizeof(pf));
8686 pf.cbSize = sizeof(PARAFORMAT2);
8687 pf.dwMask = -1;
8689 ok(pf.wAlignment == PFA_LEFT, "got %d expected PFA_LEFT\n", pf.wAlignment);
8690 DestroyWindow(richedit);
8691}
#define ARRAY_SIZE(A)
Definition: main.h:33
#define es
Definition: i386-dis.c:440
static void simulate_typing_characters(HWND hwnd, const char *szChars)
Definition: editor.c:104
static DWORD CALLBACK test_EM_STREAMIN_esCallback(DWORD_PTR dwCookie, LPBYTE pbBuff, LONG cb, LONG *pcb)
Definition: editor.c:5736
#define ES_LEFT
Definition: pedump.c:664
#define ES_CENTER
Definition: pedump.c:665
#define ES_RIGHT
Definition: pedump.c:666
#define PFA_RIGHT
Definition: richedit.h:922
#define PFA_CENTER
Definition: richedit.h:923
#define PFA_LEFT
Definition: richedit.h:921
#define EM_STREAMIN
Definition: richedit.h:106
#define SF_RTF
Definition: richedit.h:721
#define EM_GETPARAFORMAT
Definition: richedit.h:94
struct _paraformat2 PARAFORMAT2
#define PFM_ALIGNMENT
Definition: richedit.h:841
#define PFM_TABSTOPS
Definition: richedit.h:842
#define EM_SETPARAFORMAT
Definition: richedit.h:104
WORD wAlignment
Definition: richedit.h:673
DWORD dwMask
Definition: richedit.h:667
UINT cbSize
Definition: richedit.h:666
SHORT cTabCount
Definition: richedit.h:674
#define DWORD_PTR
Definition: treelist.c:76
LONG WINAPI GetWindowLongW(_In_ HWND, _In_ int)
#define WM_CUT
Definition: winuser.h:1861
#define GWL_STYLE
Definition: winuser.h:852
BOOL WINAPI DestroyWindow(_In_ HWND)

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
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());
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());
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 trace
Definition: atltest.h:70
#define pt(x, y)
Definition: drawing.c:79
static HWND new_richedit(HWND parent)
Definition: editor.c:72
unsigned int UINT
Definition: ndis.h:50
#define ES_AUTOVSCROLL
Definition: pedump.c:671
#define ES_AUTOHSCROLL
Definition: pedump.c:672
void redraw(int x, int y, int cx, int cy)
Definition: qtewin.cpp:1248
#define EM_GETOPTIONS
Definition: richedit.h:111
#define ECO_AUTOHSCROLL
Definition: richedit.h:458
#define ECO_AUTOVSCROLL
Definition: richedit.h:457
eMaj lines
Definition: tritemp.h:206
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)
LONG WINAPI GetWindowLongA(_In_ HWND, _In_ int)
#define EM_REPLACESEL
Definition: winuser.h:2006
#define EM_GETLINECOUNT
Definition: winuser.h:1992
#define WM_SETREDRAW
Definition: winuser.h:1616

Referenced by START_TEST().

◆ test_background()

static void test_background ( void  )
static

Definition at line 8786 of file editor.c.

8787{
8788 HWND hwndRichEdit = new_richedit(NULL);
8789
8790 /* set the background color to black */
8791 ValidateRect(hwndRichEdit, NULL);
8792 SendMessageA(hwndRichEdit, EM_SETBKGNDCOLOR, FALSE, RGB(0, 0, 0));
8793 ok(GetUpdateRect(hwndRichEdit, NULL, FALSE), "Update rectangle is empty!\n");
8794
8795 DestroyWindow(hwndRichEdit);
8796}
#define RGB(r, g, b)
Definition: precomp.h:71
#define EM_SETBKGNDCOLOR
Definition: richedit.h:100
BOOL WINAPI ValidateRect(_In_opt_ HWND, _In_opt_ LPCRECT)
BOOL WINAPI GetUpdateRect(_In_ HWND, _Out_opt_ LPRECT, _In_ BOOL)

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;
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}
HMODULE WINAPI DECLSPEC_HOTPATCH GetModuleHandleA(LPCSTR lpModuleName)
Definition: loader.c:812
#define assert(x)
Definition: debug.h:53
static LRESULT CALLBACK dialog_mode_wnd_proc(HWND hwnd, UINT iMsg, WPARAM wParam, LPARAM lParam)
Definition: editor.c:7896
#define test_dm_messages(wmclose, wmgetdefid, wmnextdlgctl)
Definition: editor.c:7888
static const CLSID *static CLSID *static const GUID VARIANT VARIANT *static IServiceProvider DWORD *static HMENU
Definition: ordinal.c:63
#define WS_CHILD
Definition: pedump.c:617
#define WS_OVERLAPPEDWINDOW
Definition: pedump.c:637
#define ES_WANTRETURN
Definition: pedump.c:676
#define BS_PUSHBUTTON
Definition: pedump.c:651
HBRUSH hbrBackground
Definition: winuser.h:3170
HICON hIcon
Definition: winuser.h:3168
HINSTANCE hInstance
Definition: winuser.h:3167
HCURSOR hCursor
Definition: winuser.h:3169
int cbWndExtra
Definition: winuser.h:3166
UINT style
Definition: winuser.h:3163
LPCSTR lpszMenuName
Definition: winuser.h:3171
LPCSTR lpszClassName
Definition: winuser.h:3172
WNDPROC lpfnWndProc
Definition: winuser.h:3164
int cbClsExtra
Definition: winuser.h:3165
HGDIOBJ WINAPI GetStockObject(_In_ int)
#define WHITE_BRUSH
Definition: wingdi.h:902
#define VK_TAB
Definition: winuser.h:2199
LONG WINAPI SetWindowLongA(_In_ HWND, _In_ int, _In_ LONG)
HWND WINAPI SetParent(_In_ HWND, _In_opt_ HWND)
#define IDC_ARROW
Definition: winuser.h:687
ATOM WINAPI RegisterClassA(_In_ CONST WNDCLASSA *)
#define VK_RETURN
Definition: winuser.h:2201
#define CW_USEDEFAULT
Definition: winuser.h:225
#define VK_ESCAPE
Definition: winuser.h:2214
#define WM_GETDLGCODE
Definition: winuser.h:1689
HCURSOR WINAPI LoadCursorA(_In_opt_ HINSTANCE, _In_ LPCSTR)
Definition: cursoricon.c:2134
const char * LPCSTR
Definition: xmlstorage.h:183

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}
char * strcat(char *DstString, const char *SrcString)
Definition: utclib.c:568
char * strcpy(char *DstString, const char *SrcString)
Definition: utclib.c:388
char * strchr(const char *String, int ch)
Definition: utclib.c:501
#define E_INVALIDARG
Definition: ddrawi.h:101
const GLdouble * v
Definition: gl.h:2040
GLuint buffer
Definition: glext.h:5915
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
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
static void check_CFE_LINK_rcvd(HWND hwnd, BOOL is_url, const char *url)
Definition: editor.c:1921
static HWND new_static_wnd(HWND parent)
Definition: editor.c:1936
#define EM_AUTOURLDETECT
Definition: richedit.h:125
#define ST_SELECTION
Definition: richedit.h:1072
UINT codepage
Definition: richedit.h:1066
DWORD flags
Definition: richedit.h:1065

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 */
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;
7225 todo_wine ok(result == 0, "expected character index of 0 but got %d\n", result);
7226
7227 point.x = 1000;
7228 point.y = rcClient.bottom + 1;
7230 todo_wine ok(result == 34, "expected character index of 34 but got %d\n", result);
7231
7232 point.x = 1000;
7233 point.y = rcClient.bottom;
7235 todo_wine ok(result == 39, "expected character index of 39 but got %d\n", result);
7236
7238}
POINTL point
Definition: edittest.c:50
#define todo_wine
Definition: custom.c:79
#define EM_CHARFROMPOS
Definition: richedit.h:78
LONG y
Definition: windef.h:330
LONG x
Definition: windef.h:329
LONG bottom
Definition: windef.h:309
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)

Referenced by START_TEST().

◆ test_EM_EXLIMITTEXT()

static void test_EM_EXLIMITTEXT ( void  )
static

Definition at line 4499 of file editor.c.

4500{
4501 int i, selBegin, selEnd, len1, len2;
4502 int result;
4503 char text[1024 + 1];
4504 char buffer[1024 + 1];
4505 int textlimit = 0; /* multiple of 100 */
4506 HWND hwndRichEdit = new_richedit(NULL);
4507
4508 i = SendMessageA(hwndRichEdit, EM_GETLIMITTEXT, 0, 0);
4509 ok(32767 == i, "EM_EXLIMITTEXT: expected: %d, actual: %d\n", 32767, i); /* default */
4510
4511 textlimit = 256000;
4512 SendMessageA(hwndRichEdit, EM_EXLIMITTEXT, 0, textlimit);
4513 i = SendMessageA(hwndRichEdit, EM_GETLIMITTEXT, 0, 0);
4514 /* set higher */
4515 ok(textlimit == i, "EM_EXLIMITTEXT: expected: %d, actual: %d\n", textlimit, i);
4516
4517 textlimit = 1000;
4518 SendMessageA(hwndRichEdit, EM_EXLIMITTEXT, 0, textlimit);
4519 i = SendMessageA(hwndRichEdit, EM_GETLIMITTEXT, 0, 0);
4520 /* set lower */
4521 ok(textlimit == i, "EM_EXLIMITTEXT: expected: %d, actual: %d\n", textlimit, i);
4522
4523 SendMessageA(hwndRichEdit, EM_EXLIMITTEXT, 0, 0);
4524 i = SendMessageA(hwndRichEdit, EM_GETLIMITTEXT, 0, 0);
4525 /* default for WParam = 0 */
4526 ok(65536 == i, "EM_EXLIMITTEXT: expected: %d, actual: %d\n", 65536, i);
4527
4528 textlimit = sizeof(text)-1;
4529 memset(text, 'W', textlimit);
4530 text[sizeof(text)-1] = 0;
4531 SendMessageA(hwndRichEdit, EM_EXLIMITTEXT, 0, textlimit);
4532 /* maxed out text */
4533 SendMessageA(hwndRichEdit, WM_SETTEXT, 0, (LPARAM)text);
4534
4535 SendMessageA(hwndRichEdit, EM_SETSEL, 0, -1); /* select everything */
4536 SendMessageA(hwndRichEdit, EM_GETSEL, (WPARAM)&selBegin, (LPARAM)&selEnd);
4537 len1 = selEnd - selBegin;
4538
4539 SendMessageA(hwndRichEdit, WM_KEYDOWN, VK_BACK, 1);
4540 SendMessageA(hwndRichEdit, WM_CHAR, VK_BACK, 1);
4541 SendMessageA(hwndRichEdit, WM_KEYUP, VK_BACK, 1);
4542 SendMessageA(hwndRichEdit, EM_SETSEL, 0, -1);
4543 SendMessageA(hwndRichEdit, EM_GETSEL, (WPARAM)&selBegin, (LPARAM)&selEnd);
4544 len2 = selEnd - selBegin;
4545
4546 ok(len1 != len2,
4547 "EM_EXLIMITTEXT: Change Expected\nOld Length: %d, New Length: %d, Limit: %d\n",
4548 len1,len2,i);
4549
4550 SendMessageA(hwndRichEdit, WM_KEYDOWN, 'A', 1);
4551 SendMessageA(hwndRichEdit, WM_CHAR, 'A', 1);
4552 SendMessageA(hwndRichEdit, WM_KEYUP, 'A', 1);
4553 SendMessageA(hwndRichEdit, EM_SETSEL, 0, -1);
4554 SendMessageA(hwndRichEdit, EM_GETSEL, (WPARAM)&selBegin, (LPARAM)&selEnd);
4555 len1 = selEnd - selBegin;
4556
4557 ok(len1 != len2,
4558 "EM_EXLIMITTEXT: Change Expected\nOld Length: %d, New Length: %d, Limit: %d\n",
4559 len1,len2,i);
4560
4561 SendMessageA(hwndRichEdit, WM_KEYDOWN, 'A', 1);
4562 SendMessageA(hwndRichEdit, WM_CHAR, 'A', 1);
4563 SendMessageA(hwndRichEdit, WM_KEYUP, 'A', 1); /* full; should be no effect */
4564 SendMessageA(hwndRichEdit, EM_SETSEL, 0, -1);
4565 SendMessageA(hwndRichEdit, EM_GETSEL, (WPARAM)&selBegin, (LPARAM)&selEnd);
4566 len2 = selEnd - selBegin;
4567
4568 ok(len1 == len2,
4569 "EM_EXLIMITTEXT: No Change Expected\nOld Length: %d, New Length: %d, Limit: %d\n",
4570 len1,len2,i);
4571
4572 /* set text up to the limit, select all the text, then add a char */
4573 textlimit = 5;
4574 memset(text, 'W', textlimit);
4575 text[textlimit] = 0;
4576 SendMessageA(hwndRichEdit, EM_EXLIMITTEXT, 0, textlimit);
4577 SendMessageA(hwndRichEdit, WM_SETTEXT, 0, (LPARAM)text);
4578 SendMessageA(hwndRichEdit, EM_SETSEL, 0, -1);
4579 SendMessageA(hwndRichEdit, WM_CHAR, 'A', 1);
4580 SendMessageA(hwndRichEdit, WM_GETTEXT, 1024, (LPARAM)buffer);
4581 result = strcmp(buffer, "A");
4582 ok(0 == result, "got string = \"%s\"\n", buffer);
4583
4584 /* WM_SETTEXT not limited */
4585 textlimit = 10;
4586 memset(text, 'W', textlimit);
4587 text[textlimit] = 0;
4588 SendMessageA(hwndRichEdit, EM_EXLIMITTEXT, 0, textlimit-5);
4589 SendMessageA(hwndRichEdit, WM_SETTEXT, 0, (LPARAM)text);
4590 SendMessageA(hwndRichEdit, WM_GETTEXT, 1024, (LPARAM)buffer);
4591 i = strlen(buffer);
4592 ok(10 == i, "expected 10 chars\n");
4593 i = SendMessageA(hwndRichEdit, EM_GETLIMITTEXT, 0, 0);
4594 ok(10 == i, "EM_EXLIMITTEXT: expected: %d, actual: %d\n", 10, i);
4595
4596 /* try inserting more text at end */
4597 i = SendMessageA(hwndRichEdit, WM_CHAR, 'A', 0);
4598 ok(0 == i, "WM_CHAR wasn't processed\n");
4599 SendMessageA(hwndRichEdit, WM_GETTEXT, 1024, (LPARAM)buffer);
4600 i = strlen(buffer);
4601 ok(10 == i, "expected 10 chars, got %i\n", i);
4602 i = SendMessageA(hwndRichEdit, EM_GETLIMITTEXT, 0, 0);
4603 ok(10 == i, "EM_EXLIMITTEXT: expected: %d, actual: %d\n", 10, i);
4604
4605 /* try inserting text at beginning */
4606 SendMessageA(hwndRichEdit, EM_SETSEL, 0, 0);
4607 i = SendMessageA(hwndRichEdit, WM_CHAR, 'A', 0);
4608 ok(0 == i, "WM_CHAR wasn't processed\n");
4609 SendMessageA(hwndRichEdit, WM_GETTEXT, 1024, (LPARAM)buffer);
4610 i = strlen(buffer);
4611 ok(10 == i, "expected 10 chars, got %i\n", i);
4612 i = SendMessageA(hwndRichEdit, EM_GETLIMITTEXT, 0, 0);
4613 ok(10 == i, "EM_EXLIMITTEXT: expected: %d, actual: %d\n", 10, i);
4614
4615 /* WM_CHAR is limited */
4616 textlimit = 1;
4617 SendMessageA(hwndRichEdit, EM_EXLIMITTEXT, 0, textlimit);
4618 SendMessageA(hwndRichEdit, EM_SETSEL, 0, -1); /* select everything */
4619 i = SendMessageA(hwndRichEdit, WM_CHAR, 'A', 0);
4620 ok(0 == i, "WM_CHAR wasn't processed\n");
4621 i = SendMessageA(hwndRichEdit, WM_CHAR, 'A', 0);
4622 ok(0 == i, "WM_CHAR wasn't processed\n");
4623 SendMessageA(hwndRichEdit, WM_GETTEXT, 1024, (LPARAM)buffer);
4624 i = strlen(buffer);
4625 ok(1 == i, "expected 1 chars, got %i instead\n", i);
4626
4627 DestroyWindow(hwndRichEdit);
4628}
#define EM_EXLIMITTEXT
Definition: richedit.h:86
#define EM_GETLIMITTEXT
Definition: richedit.h:74
#define VK_BACK
Definition: winuser.h:2198

Referenced by START_TEST().

◆ test_EM_EXSETSEL()

static void test_EM_EXSETSEL ( void  )
static

Definition at line 4948 of file editor.c.

4949{
4950 HWND hwndRichEdit = new_richedit(NULL);
4951 int i;
4952 const int num_tests = ARRAY_SIZE(exsetsel_tests);
4953
4954 /* sending some text to the window */
4955 SendMessageA(hwndRichEdit, WM_SETTEXT, 0, (LPARAM)"testing selection");
4956 /* 01234567890123456*/
4957 /* 10 */
4958
4959 for (i = 0; i < num_tests; i++) {
4960 check_EM_EXSETSEL(hwndRichEdit, &exsetsel_tests[i], i);
4961 }
4962
4963 if (!is_lang_japanese)
4964 skip("Skip multibyte character tests on non-Japanese platform\n");
4965 else
4966 {
4967 CHARRANGE cr;
4968 char bufA[MAX_BUF_LEN] = {0};
4970
4971 /* Test with multibyte character */
4972 SendMessageA(hwndRichEdit, WM_SETTEXT, 0, (LPARAM)"abcdef\x8e\xf0ghijk");
4973 /* 012345 6 78901 */
4974 cr.cpMin = 4; cr.cpMax = 8;
4975 result = SendMessageA(hwndRichEdit, EM_EXSETSEL, 0, (LPARAM)&cr);
4976 ok(result == 8, "EM_EXSETSEL return %ld expected 8\n", result);
4977 result = SendMessageA(hwndRichEdit, EM_GETSELTEXT, sizeof(bufA), (LPARAM)bufA);
4978 ok(!strcmp(bufA, "ef\x8e\xf0g"), "EM_GETSELTEXT return incorrect string\n");
4979 SendMessageA(hwndRichEdit, EM_EXGETSEL, 0, (LPARAM)&cr);
4980 ok(cr.cpMin == 4, "Selection start incorrectly: %d expected 4\n", cr.cpMin);
4981 ok(cr.cpMax == 8, "Selection end incorrectly: %d expected 8\n", cr.cpMax);
4982 }
4983
4984 DestroyWindow(hwndRichEdit);
4985}
#define skip(...)
Definition: atltest.h:64
static const struct exsetsel_s exsetsel_tests[]
Definition: editor.c:4901
static void check_EM_EXSETSEL(HWND hwnd, const struct exsetsel_s *setsel, int id)
Definition: editor.c:4930
#define MAX_BUF_LEN
#define EM_GETSELTEXT
Definition: richedit.h:95
#define EM_EXGETSEL
Definition: richedit.h:85

Referenced by START_TEST().

◆ test_EM_FINDTEXT()

static void test_EM_FINDTEXT ( BOOL  unicode)
static

Definition at line 332 of file editor.c.

333{
334 HWND hwndRichEdit;
335 CHARFORMAT2A cf2;
336
337 if(unicode)
338 hwndRichEdit = new_richeditW(NULL);
339 else
340 hwndRichEdit = new_richedit(NULL);
341
342 /* Empty rich edit control */
343 run_tests_EM_FINDTEXT(hwndRichEdit, "1", find_tests, ARRAY_SIZE(find_tests), unicode);
344
345 SendMessageA(hwndRichEdit, WM_SETTEXT, 0, (LPARAM)haystack);
346
347 /* Haystack text */
348 run_tests_EM_FINDTEXT(hwndRichEdit, "2", find_tests2, ARRAY_SIZE(find_tests2), unicode);
349
350 /* Setting a format on an arbitrary range should have no effect in search
351 results. This tests correct offset reporting across runs. */
352 cf2.cbSize = sizeof(CHARFORMAT2A);
353 SendMessageA(hwndRichEdit, EM_GETCHARFORMAT, SCF_DEFAULT, (LPARAM)&cf2);
354 cf2.dwMask = CFM_ITALIC | cf2.dwMask;
355 cf2.dwEffects = CFE_ITALIC ^ cf2.dwEffects;
356 SendMessageA(hwndRichEdit, EM_SETSEL, 6, 20);
357 SendMessageA(hwndRichEdit, EM_SETCHARFORMAT, SCF_SELECTION, (LPARAM)&cf2);
358
359 /* Haystack text, again */
360 run_tests_EM_FINDTEXT(hwndRichEdit, "2-bis", find_tests2, ARRAY_SIZE(find_tests2), unicode);
361
362 /* Yet another range */
363 cf2.dwMask = CFM_BOLD | cf2.dwMask;
364 cf2.dwEffects = CFE_BOLD ^ cf2.dwEffects;
365 SendMessageA(hwndRichEdit, EM_SETSEL, 11, 15);
366 SendMessageA(hwndRichEdit, EM_SETCHARFORMAT, SCF_SELECTION, (LPARAM)&cf2);
367
368 /* Haystack text, again */
369 run_tests_EM_FINDTEXT(hwndRichEdit, "2-bisbis", find_tests2, ARRAY_SIZE(find_tests2), unicode);
370
371 DestroyWindow(hwndRichEdit);
372}
static HWND new_richeditW(HWND parent)
Definition: editor.c:80
static void run_tests_EM_FINDTEXT(HWND hwnd, const char *name, struct find_s *find, int num_tests, BOOL unicode)
Definition: editor.c:321
static struct find_s find_tests2[]
Definition: editor.c:166
static struct find_s find_tests[]
Definition: editor.c:157
static const char haystack[]
Definition: editor.c:145
#define CFE_BOLD
Definition: richedit.h:406
#define CFE_ITALIC
Definition: richedit.h:407
#define SCF_DEFAULT
Definition: richedit.h:234
#define EM_SETCHARFORMAT
Definition: richedit.h:101
#define CFM_ITALIC
Definition: richedit.h:333
struct _charformat2a CHARFORMAT2A
#define CFM_BOLD
Definition: richedit.h:332
DWORD dwMask
Definition: richedit.h:283

◆ test_EM_FINDWORDBREAK_A()

static void test_EM_FINDWORDBREAK_A ( void  )
static

Definition at line 8249 of file editor.c.

8250{
8251 static const struct {
8252 WCHAR c;
8253 BOOL isdelimiter; /* expected result of WB_ISDELIMITER */
8254 } delimiter_tests[] = {
8255 {0x0a, FALSE}, /* newline */
8256 {0x0b, FALSE}, /* vertical tab */
8257 {0x0c, FALSE}, /* form feed */
8258 {0x0d, FALSE}, /* carriage return */
8259 {0x20, TRUE}, /* space */
8260 {0x61, FALSE}, /* capital letter a */
8261 };
8262 int i;
8263 HWND hwndRichEdit = new_richedit(NULL);
8264
8265 ok(!IsWindowUnicode(hwndRichEdit), "window should not be unicode\n");
8266 for (i = 0; i < ARRAY_SIZE(delimiter_tests); i++)
8267 {
8268 int result;
8269 char buf[2];
8270 buf[0] = delimiter_tests[i].c;
8271 buf[1] = 0;
8272 SendMessageA(hwndRichEdit, WM_SETTEXT, 0, (LPARAM)buf);
8274 todo_wine_if (buf[0] == 0x20)
8275 ok(result == delimiter_tests[i].isdelimiter,
8276 "wanted ISDELIMITER_A(0x%x) %d, got %d\n",
8277 delimiter_tests[i].c, delimiter_tests[i].isdelimiter, result);
8278 }
8279 DestroyWindow(hwndRichEdit);
8280}
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
const GLubyte * c
Definition: glext.h:8905
#define c
Definition: ke_i.h:80
#define EM_FINDWORDBREAK
Definition: richedit.h:109
BOOL WINAPI IsWindowUnicode(_In_ HWND)

Referenced by START_TEST().

◆ test_EM_FINDWORDBREAK_W()

static void test_EM_FINDWORDBREAK_W ( void  )
static

Definition at line 8205 of file editor.c.

8206{
8207 static const struct {
8208 WCHAR c;
8209 BOOL isdelimiter; /* expected result of WB_ISDELIMITER */
8210 } delimiter_tests[] = {
8211 {0x0a, FALSE}, /* newline */
8212 {0x0b, FALSE}, /* vertical tab */
8213 {0x0c, FALSE}, /* form feed */
8214 {0x0d, FALSE}, /* carriage return */
8215 {0x20, TRUE}, /* space */
8216 {0x61, FALSE}, /* capital letter a */
8217 {0xa0, FALSE}, /* no-break space */
8218 {0x2000, FALSE}, /* en quad */
8219 {0x3000, FALSE}, /* Ideographic space */
8220 {0x1100, FALSE}, /* Hangul Choseong Kiyeok (G sound) Ordinary Letter*/
8221 {0x11ff, FALSE}, /* Hangul Jongseoung Kiyeok-Hieuh (Hard N sound) Ordinary Letter*/
8222 {0x115f, FALSE}, /* Hangul Choseong Filler (no sound, used with two letter Hangul words) Ordinary Letter */
8223 {0xac00, FALSE}, /* Hangul character GA*/
8224 {0xd7af, FALSE}, /* End of Hangul character chart */
8225 {0xf020, TRUE}, /* MS private for CP_SYMBOL round trip?, see kb897872 */
8226 {0xff20, FALSE}, /* fullwidth commercial @ */
8227 {WCH_EMBEDDING, FALSE}, /* object replacement character*/
8228 };
8229 int i;
8230 HWND hwndRichEdit = new_richeditW(NULL);
8231 ok(IsWindowUnicode(hwndRichEdit), "window should be unicode\n");
8232 for (i = 0; i < ARRAY_SIZE(delimiter_tests); i++)
8233 {
8234 WCHAR wbuf[2];
8235 int result;
8236
8237 wbuf[0] = delimiter_tests[i].c;
8238 wbuf[1] = 0;
8239 SendMessageW(hwndRichEdit, WM_SETTEXT, 0, (LPARAM)wbuf);
8241 todo_wine_if (wbuf[0] == 0x20 || wbuf[0] == 0xf020)
8242 ok(result == delimiter_tests[i].isdelimiter,
8243 "wanted ISDELIMITER_W(0x%x) %d, got %d\n",
8244 delimiter_tests[i].c, delimiter_tests[i].isdelimiter, result);
8245 }
8246 DestroyWindow(hwndRichEdit);
8247}
#define WCH_EMBEDDING
Definition: richedit.h:1024

Referenced by START_TEST().

◆ test_EM_FORMATRANGE()

static void test_EM_FORMATRANGE ( void  )
static

Definition at line 5594 of file editor.c.

5595{
5596 int r, i, tpp_x, tpp_y;
5597 HDC hdc;
5598 HWND hwndRichEdit = new_richedit(NULL);
5599 FORMATRANGE fr;
5600 BOOL skip_non_english;
5601 static const struct {
5602 const char *string; /* The string */
5603 int first; /* First 'pagebreak', 0 for don't care */
5604 int second; /* Second 'pagebreak', 0 for don't care */
5605 } fmtstrings[] = {
5606 {"WINE wine", 0, 0},
5607 {"WINE wineWine", 0, 0},
5608 {"WINE\r\nwine\r\nwine", 5, 10},
5609 {"WINE\r\nWINEwine\r\nWINEwine", 5, 14},
5610 {"WINE\r\n\r\nwine\r\nwine", 5, 6}
5611 };
5612
5613 skip_non_english = (PRIMARYLANGID(GetUserDefaultLangID()) != LANG_ENGLISH);
5614 if (skip_non_english)
5615 skip("Skipping some tests on non-English platform\n");
5616
5617 hdc = GetDC(hwndRichEdit);
5618 ok(hdc != NULL, "Could not get HDC\n");
5619
5620 /* Calculate the twips per pixel */
5621 tpp_x = 1440 / GetDeviceCaps(hdc, LOGPIXELSX);
5622 tpp_y = 1440 / GetDeviceCaps(hdc, LOGPIXELSY);
5623
5624 /* Test the simple case where all the text fits in the page rect. */
5625 SendMessageA(hwndRichEdit, WM_SETTEXT, 0, (LPARAM)"a");
5626 fr.hdc = fr.hdcTarget = hdc;
5627 fr.rc.top = fr.rcPage.top = fr.rc.left = fr.rcPage.left = 0;
5628 fr.rc.right = fr.rcPage.right = 500 * tpp_x;
5629 fr.rc.bottom = fr.rcPage.bottom = 500 * tpp_y;
5630 fr.chrg.cpMin = 0;
5631 fr.chrg.cpMax = -1;
5632 r = SendMessageA(hwndRichEdit, EM_FORMATRANGE, FALSE, (LPARAM)&fr);
5633 todo_wine ok(r == 2, "r=%d expected r=2\n", r);
5634
5635 SendMessageA(hwndRichEdit, WM_SETTEXT, 0, (LPARAM)"ab");
5636 fr.rc.bottom = fr.rcPage.bottom;