richedit: Added tests for initial options.

Using the WS_VSCROLL style causes the ES_AUTOVSCROLL option to be set,
and using the WS_HSCROLL style causes the ES_AUTOHSCROLL flag to be
set (except with richedit v1.0).
This commit is contained in:
Dylan Smith 2009-01-15 14:46:18 -05:00 committed by Alexandre Julliard
parent 77a94bed98
commit 9a902f358b
2 changed files with 44 additions and 1 deletions

View file

@ -1452,7 +1452,7 @@ static void test_EM_GETSELTEXT(void)
/* FIXME: need to test unimplemented options and robustly test wparam */
static void test_EM_SETOPTIONS(void)
{
HWND hwndRichEdit = new_richedit(NULL);
HWND hwndRichEdit;
static const char text[] = "Hello. My name is RichEdit!";
char buffer[1024] = {0};
DWORD dwStyle, options, oldOptions;
@ -1460,6 +1460,27 @@ static void test_EM_SETOPTIONS(void)
ES_READONLY|ES_WANTRETURN|ES_SAVESEL|
ES_SELECTIONBAR|ES_VERTICAL;
/* Test initial options. */
hwndRichEdit = CreateWindow(RICHEDIT_CLASS, NULL, WS_POPUP,
0, 0, 200, 60, NULL, NULL,
hmoduleRichEdit, NULL);
ok(hwndRichEdit != NULL, "class: %s, error: %d\n",
RICHEDIT_CLASS, (int) GetLastError());
options = SendMessage(hwndRichEdit, EM_GETOPTIONS, 0, 0);
ok(options == 0, "Incorrect initial options %x\n", options);
DestroyWindow(hwndRichEdit);
hwndRichEdit = CreateWindow(RICHEDIT_CLASS, NULL,
WS_POPUP|WS_HSCROLL|WS_VSCROLL,
0, 0, 200, 60, NULL, NULL,
hmoduleRichEdit, NULL);
ok(hwndRichEdit != NULL, "class: %s, error: %d\n",
RICHEDIT_CLASS, (int) GetLastError());
options = SendMessage(hwndRichEdit, EM_GETOPTIONS, 0, 0);
/* WS_[VH]SCROLL cause the ECO_AUTO[VH]SCROLL options to be set */
todo_wine ok(options == (ECO_AUTOVSCROLL|ECO_AUTOHSCROLL),
"Incorrect initial options %x\n", options);
/* NEGATIVE TESTING - NO OPTIONS SET */
SendMessage(hwndRichEdit, WM_SETTEXT, 0, (LPARAM) text);
SendMessage(hwndRichEdit, EM_SETOPTIONS, ECOOP_SET, 0);

View file

@ -889,6 +889,27 @@ static void test_word_wrap(void)
DestroyWindow(hwnd);
}
static void test_EM_GETOPTIONS(void)
{
HWND hwnd;
DWORD options;
hwnd = CreateWindow(RICHEDIT_CLASS10A, NULL,
WS_POPUP,
0, 0, 200, 60, NULL, NULL, hmoduleRichEdit, NULL);
options = SendMessage(hwnd, EM_GETOPTIONS, 0, 0);
ok(options == 0, "Incorrect options %x\n", options);
DestroyWindow(hwnd);
hwnd = CreateWindow(RICHEDIT_CLASS10A, NULL,
WS_POPUP|WS_VSCROLL|WS_HSCROLL,
0, 0, 200, 60, NULL, NULL, hmoduleRichEdit, NULL);
options = SendMessage(hwnd, EM_GETOPTIONS, 0, 0);
todo_wine ok(options == ECO_AUTOVSCROLL,
"Incorrect initial options %x\n", options);
DestroyWindow(hwnd);
}
static void test_autoscroll(void)
{
HWND hwnd;
@ -942,6 +963,7 @@ START_TEST( editor )
test_EM_FINDTEXT();
test_EM_POSFROMCHAR();
test_word_wrap();
test_EM_GETOPTIONS();
test_autoscroll();
/* Set the environment variable WINETEST_RICHED32 to keep windows