Signed-off-by: Michael Stefaniuc mstefani@winehq.org --- dlls/riched20/tests/editor.c | 62 ++++++++++++++++++++----------------------- dlls/riched20/tests/richole.c | 4 +-- 2 files changed, 31 insertions(+), 35 deletions(-)
diff --git a/dlls/riched20/tests/editor.c b/dlls/riched20/tests/editor.c index 2a6907bfe7..85c607becf 100644 --- a/dlls/riched20/tests/editor.c +++ b/dlls/riched20/tests/editor.c @@ -340,14 +340,12 @@ static void test_EM_FINDTEXT(BOOL unicode) hwndRichEdit = new_richedit(NULL);
/* Empty rich edit control */ - run_tests_EM_FINDTEXT(hwndRichEdit, "1", find_tests, - sizeof(find_tests)/sizeof(struct find_s), unicode); + run_tests_EM_FINDTEXT(hwndRichEdit, "1", find_tests, ARRAY_SIZE(find_tests), unicode);
SendMessageA(hwndRichEdit, WM_SETTEXT, 0, (LPARAM)haystack);
/* Haystack text */ - run_tests_EM_FINDTEXT(hwndRichEdit, "2", find_tests2, - sizeof(find_tests2)/sizeof(struct find_s), unicode); + run_tests_EM_FINDTEXT(hwndRichEdit, "2", find_tests2, ARRAY_SIZE(find_tests2), unicode);
/* Setting a format on an arbitrary range should have no effect in search results. This tests correct offset reporting across runs. */ @@ -359,8 +357,7 @@ static void test_EM_FINDTEXT(BOOL unicode) SendMessageA(hwndRichEdit, EM_SETCHARFORMAT, SCF_SELECTION, (LPARAM)&cf2);
/* Haystack text, again */ - run_tests_EM_FINDTEXT(hwndRichEdit, "2-bis", find_tests2, - sizeof(find_tests2)/sizeof(struct find_s), unicode); + run_tests_EM_FINDTEXT(hwndRichEdit, "2-bis", find_tests2, ARRAY_SIZE(find_tests2), unicode);
/* Yet another range */ cf2.dwMask = CFM_BOLD | cf2.dwMask; @@ -369,8 +366,7 @@ static void test_EM_FINDTEXT(BOOL unicode) SendMessageA(hwndRichEdit, EM_SETCHARFORMAT, SCF_SELECTION, (LPARAM)&cf2);
/* Haystack text, again */ - run_tests_EM_FINDTEXT(hwndRichEdit, "2-bisbis", find_tests2, - sizeof(find_tests2)/sizeof(struct find_s), unicode); + run_tests_EM_FINDTEXT(hwndRichEdit, "2-bisbis", find_tests2, ARRAY_SIZE(find_tests2), unicode);
DestroyWindow(hwndRichEdit); } @@ -404,7 +400,7 @@ static void test_EM_GETLINE(void) SendMessageA(hwndRichEdit, WM_SETTEXT, 0, (LPARAM)text);
memset(origdest, 0xBB, nBuf); - for (i = 0; i < sizeof(gl)/sizeof(struct getline_s); i++) + for (i = 0; i < ARRAY_SIZE(gl); i++) { int nCopied; int expected_nCopied = min(gl[i].buffer_len, strlen(gl[i].text)); @@ -509,7 +505,7 @@ static void test_EM_LINELENGTH(void) {15, 4}, /* Line 3: |wine */ }; SendMessageA(hwndRichEdit, WM_SETTEXT, 0, (LPARAM)text1); - for (i = 0; i < sizeof(offset_test1)/sizeof(offset_test1[0]); i++) { + for (i = 0; i < ARRAY_SIZE(offset_test1); i++) { result = SendMessageA(hwndRichEdit, EM_LINELENGTH, offset_test1[i][0], 0); ok(result == offset_test1[i][1], "Length of line at offset %d is %ld, expected %d\n", offset_test1[i][0], result, offset_test1[i][1]); @@ -2049,7 +2045,7 @@ static void test_EM_AUTOURLDETECT(void) urlRet=SendMessageA(hwndRichEdit, EM_AUTOURLDETECT, (WPARAM)"h", (LPARAM)"h"); ok(urlRet==E_INVALIDARG, "Bad wParam2: urlRet is: %d\n", urlRet); /* for each url, check the text to see if CFE_LINK effect is present */ - for (i = 0; i < sizeof(urls)/sizeof(struct urls_s); i++) { + for (i = 0; i < ARRAY_SIZE(urls); i++) {
SendMessageA(hwndRichEdit, EM_AUTOURLDETECT, FALSE, 0); SendMessageA(hwndRichEdit, WM_SETTEXT, 0, (LPARAM)urls[i].text); @@ -2063,10 +2059,10 @@ static void test_EM_AUTOURLDETECT(void) DestroyWindow(hwndRichEdit);
/* Test detection of URLs within normal text - WM_SETTEXT case. */ - for (i = 0; i < sizeof(urls)/sizeof(struct urls_s); i++) { + for (i = 0; i < ARRAY_SIZE(urls); i++) { hwndRichEdit = new_richedit(parent);
- for (j = 0; j < sizeof(templates_delim) / sizeof(const char *); j++) { + for (j = 0; j < ARRAY_SIZE(templates_delim); j++) { char * at_pos; int at_offset; int end_offset; @@ -2117,7 +2113,7 @@ static void test_EM_AUTOURLDETECT(void) } }
- for (j = 0; j < sizeof(templates_non_delim) / sizeof(const char *); j++) { + for (j = 0; j < ARRAY_SIZE(templates_non_delim); j++) { char * at_pos; int at_offset; int end_offset; @@ -2158,7 +2154,7 @@ static void test_EM_AUTOURLDETECT(void) } }
- for (j = 0; j < sizeof(templates_xten_delim) / sizeof(const char *); j++) { + for (j = 0; j < ARRAY_SIZE(templates_xten_delim); j++) { char * at_pos; int at_offset; int end_offset; @@ -2213,7 +2209,7 @@ static void test_EM_AUTOURLDETECT(void) } }
- for (j = 0; j < sizeof(templates_neutral_delim) / sizeof(const char *); j++) { + for (j = 0; j < ARRAY_SIZE(templates_neutral_delim); j++) { char * at_pos, * end_pos; int at_offset; int end_offset; @@ -2421,7 +2417,7 @@ static void test_EM_AUTOURLDETECT(void) */
/* Set entire text in one go, like WM_SETTEXT */ - for (j = 0; j < sizeof(templates_delim) / sizeof(const char *); j++) { + for (j = 0; j < ARRAY_SIZE(templates_delim); j++) { char * at_pos; int at_offset; int end_offset; @@ -2476,7 +2472,7 @@ static void test_EM_AUTOURLDETECT(void) }
/* Set selection with X to the URL */ - for (j = 0; j < sizeof(templates_delim) / sizeof(const char *); j++) { + for (j = 0; j < ARRAY_SIZE(templates_delim); j++) { char * at_pos; int at_offset; int end_offset; @@ -2530,7 +2526,7 @@ static void test_EM_AUTOURLDETECT(void) }
/* Set selection with X to the first character of the URL, then the rest */ - for (j = 0; j < sizeof(templates_delim) / sizeof(const char *); j++) { + for (j = 0; j < ARRAY_SIZE(templates_delim); j++) { char * at_pos; int at_offset; int end_offset; @@ -2598,7 +2594,7 @@ static void test_EM_AUTOURLDETECT(void) hwndRichEdit = new_richedit(parent);
/* Set selection with X to the URL */ - for (j = 0; j < sizeof(templates_delim) / sizeof(const char *); j++) { + for (j = 0; j < ARRAY_SIZE(templates_delim); j++) { char * at_pos; int at_offset; int end_offset; @@ -2649,7 +2645,7 @@ static void test_EM_AUTOURLDETECT(void) }
/* Set selection with X to the first character of the URL, then the rest */ - for (j = 0; j < sizeof(templates_delim) / sizeof(const char *); j++) { + for (j = 0; j < ARRAY_SIZE(templates_delim); j++) { char * at_pos; int at_offset; int end_offset; @@ -4933,7 +4929,7 @@ static void test_EM_EXSETSEL(void) { HWND hwndRichEdit = new_richedit(NULL); int i; - const int num_tests = sizeof(exsetsel_tests)/sizeof(struct exsetsel_s); + const int num_tests = ARRAY_SIZE(exsetsel_tests);
/* sending some text to the window */ SendMessageA(hwndRichEdit, WM_SETTEXT, 0, (LPARAM)"testing selection"); @@ -4988,7 +4984,7 @@ static void test_EM_SETSEL(void) char buffA[32] = {0}; HWND hwndRichEdit = new_richedit(NULL); int i; - const int num_tests = sizeof(exsetsel_tests)/sizeof(struct exsetsel_s); + const int num_tests = ARRAY_SIZE(exsetsel_tests);
/* sending some text to the window */ SendMessageA(hwndRichEdit, WM_SETTEXT, 0, (LPARAM)"testing selection"); @@ -5623,7 +5619,7 @@ static void test_EM_FORMATRANGE(void)
SendMessageA(hwndRichEdit, EM_FORMATRANGE, FALSE, 0);
- for (i = 0; i < sizeof(fmtstrings)/sizeof(fmtstrings[0]); i++) + for (i = 0; i < ARRAY_SIZE(fmtstrings); i++) { GETTEXTLENGTHEX gtl; SIZE stringsize; @@ -5831,7 +5827,7 @@ static void test_EM_STREAMIN(void) };
const WCHAR streamText5[] = { 'T', 'e', 's', 't', 'S', 'o', 'm', 'e', 'T', 'e', 'x', 't' }; - int length5 = sizeof(streamText5) / sizeof(WCHAR); + int length5 = ARRAY_SIZE(streamText5); struct StringWithLength cookieForStream5 = { sizeof(streamText5), (char *)streamText5, @@ -6868,7 +6864,7 @@ static void test_EN_LINK(void) GetCursorPos(&orig_cursor_pos); SetCursorPos(0, 0);
- for (i = 0; i < sizeof(link_notify_tests)/sizeof(link_notify_tests[0]); i++) + for (i = 0; i < ARRAY_SIZE(link_notify_tests); i++) { link_notify_test("cursor position simulated", i, hwnd, parent, link_notify_tests[i].msg, link_notify_tests[i].wParam, link_notify_tests[i].lParam, @@ -6878,7 +6874,7 @@ static void test_EN_LINK(void) ClientToScreen(hwnd, &cursor_screen_pos); SetCursorPos(cursor_screen_pos.x, cursor_screen_pos.y);
- for (i = 0; i < sizeof(link_notify_tests)/sizeof(link_notify_tests[0]); i++) + for (i = 0; i < ARRAY_SIZE(link_notify_tests); i++) { link_notify_test("cursor position set", i, hwnd, parent, link_notify_tests[i].msg, link_notify_tests[i].wParam, link_notify_tests[i].lParam, @@ -8178,7 +8174,7 @@ static void test_EM_FINDWORDBREAK_W(void) int i; HWND hwndRichEdit = new_richeditW(NULL); ok(IsWindowUnicode(hwndRichEdit), "window should be unicode\n"); - for (i = 0; i < sizeof(delimiter_tests)/sizeof(delimiter_tests[0]); i++) + for (i = 0; i < ARRAY_SIZE(delimiter_tests); i++) { WCHAR wbuf[2]; int result; @@ -8212,7 +8208,7 @@ static void test_EM_FINDWORDBREAK_A(void) HWND hwndRichEdit = new_richedit(NULL);
ok(!IsWindowUnicode(hwndRichEdit), "window should not be unicode\n"); - for (i = 0; i < sizeof(delimiter_tests)/sizeof(delimiter_tests[0]); i++) + for (i = 0; i < ARRAY_SIZE(delimiter_tests); i++) { int result; char buf[2]; @@ -8256,7 +8252,7 @@ static void test_enter(void) HWND hwndRichEdit = new_richedit(NULL); UINT i,j;
- for (i = 0; i < sizeof(testenteritems)/sizeof(testenteritems[0]); i++) { + for (i = 0; i < ARRAY_SIZE(testenteritems); i++) {
char buf[1024] = {0}; LRESULT result; @@ -8538,7 +8534,7 @@ static void test_alignment_style(void) EDITSTREAM es; int i;
- for (i = 0; i < sizeof(align_style) / sizeof(align_style[0]); i++) + for (i = 0; i < ARRAY_SIZE(align_style); i++) { DWORD dwStyle, new_align;
@@ -8646,8 +8642,8 @@ static void test_rtf(void) result = SendMessageA( edit, EM_STREAMIN, SF_RTF, (LPARAM)&es ); ok( result == 11, "got %ld\n", result );
- result = SendMessageW( edit, WM_GETTEXT, sizeof(buf)/sizeof(buf[0]), (LPARAM)buf ); - ok( result == sizeof(expect_specials)/sizeof(expect_specials[0]), "got %ld\n", result ); + result = SendMessageW( edit, WM_GETTEXT, ARRAY_SIZE(buf), (LPARAM)buf ); + ok( result == ARRAY_SIZE(expect_specials), "got %ld\n", result ); ok( !memcmp( buf, expect_specials, sizeof(expect_specials) ), "got %s\n", wine_dbgstr_w(buf) );
/* Show that \rtlpar propagates to the second paragraph and is diff --git a/dlls/riched20/tests/richole.c b/dlls/riched20/tests/richole.c index c4fe425dfa..aaf52bcfdd 100644 --- a/dlls/riched20/tests/richole.c +++ b/dlls/riched20/tests/richole.c @@ -247,8 +247,8 @@ static void test_ITextDocument_Open(void) tomReadOnly|tomShareDenyWrite, tomReadOnly|tomShareDenyRead };
- int tomNumSingle = sizeof(tomConstantsSingle)/sizeof(tomConstantsSingle[0]); - int tomNumMulti = sizeof(tomConstantsMulti)/sizeof(tomConstantsMulti[0]); + int tomNumSingle = ARRAY_SIZE(tomConstantsSingle); + int tomNumMulti = ARRAY_SIZE(tomConstantsMulti); int i;
V_VT(&testfile) = VT_BSTR;