riched20/tests: Use BOOL type where appropriate.

This commit is contained in:
Frédéric Delanoy 2013-10-07 22:49:38 +02:00 committed by Alexandre Julliard
parent f03d251ef2
commit c388cce8aa
1 changed files with 20 additions and 20 deletions

View File

@ -1637,27 +1637,27 @@ static void test_EM_SETOPTIONS(void)
DestroyWindow(hwndRichEdit); DestroyWindow(hwndRichEdit);
} }
static int check_CFE_LINK_selection(HWND hwnd, int sel_start, int sel_end) static BOOL check_CFE_LINK_selection(HWND hwnd, int sel_start, int sel_end)
{ {
CHARFORMAT2W text_format; CHARFORMAT2W text_format;
text_format.cbSize = sizeof(text_format); text_format.cbSize = sizeof(text_format);
SendMessage(hwnd, EM_SETSEL, sel_start, sel_end); SendMessage(hwnd, EM_SETSEL, sel_start, sel_end);
SendMessage(hwnd, EM_GETCHARFORMAT, SCF_SELECTION, (LPARAM) &text_format); SendMessage(hwnd, EM_GETCHARFORMAT, SCF_SELECTION, (LPARAM) &text_format);
return (text_format.dwEffects & CFE_LINK) ? 1 : 0; return (text_format.dwEffects & CFE_LINK) != 0;
} }
static void check_CFE_LINK_rcvd(HWND hwnd, int is_url, const char * url) static void check_CFE_LINK_rcvd(HWND hwnd, BOOL is_url, const char * url)
{ {
int link_present = 0; BOOL link_present = FALSE;
link_present = check_CFE_LINK_selection(hwnd, 0, 1); link_present = check_CFE_LINK_selection(hwnd, 0, 1);
if (is_url) if (is_url)
{ /* control text is url; should get CFE_LINK */ { /* control text is url; should get CFE_LINK */
ok(0 != link_present, "URL Case: CFE_LINK not set for [%s].\n", url); ok(link_present, "URL Case: CFE_LINK not set for [%s].\n", url);
} }
else else
{ {
ok(0 == link_present, "Non-URL Case: CFE_LINK set for [%s].\n", url); ok(!link_present, "Non-URL Case: CFE_LINK set for [%s].\n", url);
} }
} }
@ -1672,20 +1672,20 @@ static void test_EM_AUTOURLDETECT(void)
one non-URL and one URL */ one non-URL and one URL */
struct urls_s { struct urls_s {
const char *text; const char *text;
int is_url; BOOL is_url;
} urls[12] = { } urls[12] = {
{"winehq.org", 0}, {"winehq.org", FALSE},
{"http://www.winehq.org", 1}, {"http://www.winehq.org", TRUE},
{"http//winehq.org", 0}, {"http//winehq.org", FALSE},
{"ww.winehq.org", 0}, {"ww.winehq.org", FALSE},
{"www.winehq.org", 1}, {"www.winehq.org", TRUE},
{"ftp://192.168.1.1", 1}, {"ftp://192.168.1.1", TRUE},
{"ftp//192.168.1.1", 0}, {"ftp//192.168.1.1", FALSE},
{"mailto:your@email.com", 1}, {"mailto:your@email.com", TRUE},
{"prospero:prosperoserver", 1}, {"prospero:prosperoserver", TRUE},
{"telnet:test", 1}, {"telnet:test", TRUE},
{"news:newserver", 1}, {"news:newserver", TRUE},
{"wais:waisserver", 1} {"wais:waisserver", TRUE}
}; };
int i, j; int i, j;
@ -1769,7 +1769,7 @@ static void test_EM_AUTOURLDETECT(void)
SendMessage(hwndRichEdit, EM_AUTOURLDETECT, FALSE, 0); SendMessage(hwndRichEdit, EM_AUTOURLDETECT, FALSE, 0);
SendMessage(hwndRichEdit, WM_SETTEXT, 0, (LPARAM) urls[i].text); SendMessage(hwndRichEdit, WM_SETTEXT, 0, (LPARAM) urls[i].text);
check_CFE_LINK_rcvd(hwndRichEdit, 0, urls[i].text); check_CFE_LINK_rcvd(hwndRichEdit, FALSE, urls[i].text);
/* Link detection should happen immediately upon WM_SETTEXT */ /* Link detection should happen immediately upon WM_SETTEXT */
SendMessage(hwndRichEdit, EM_AUTOURLDETECT, TRUE, 0); SendMessage(hwndRichEdit, EM_AUTOURLDETECT, TRUE, 0);