[PATCH 2/3] riched20: Refactor tests testing VK_RETURN

Huw Davies huw at codeweavers.com
Mon Dec 10 06:53:34 CST 2018


On Sun, Dec 09, 2018 at 11:51:56PM +0100, Fabian Maurer wrote:
> This is basically a no-op to make the tests and the following
> additions simpler
> 
> Signed-off-by: Fabian Maurer <dark.shadow4 at web.de>
> ---
>  dlls/riched20/tests/editor.c | 51 ++++++++++++++----------------------
>  dlls/riched32/tests/editor.c | 51 ++++++++++++++----------------------
>  2 files changed, 40 insertions(+), 62 deletions(-)
> 
> diff --git a/dlls/riched20/tests/editor.c b/dlls/riched20/tests/editor.c
> index 035869e134..5c2df7f86c 100644
> --- a/dlls/riched20/tests/editor.c
> +++ b/dlls/riched20/tests/editor.c
> @@ -8259,6 +8259,14 @@ static void test_EM_FINDWORDBREAK_A(void)
>      DestroyWindow(hwndRichEdit);
>  }
>  
> +static void format_test_result(char *target, const char *src)
> +{
> +    int i;
> +    for (i = 0; i < strlen(src); i++)
> +      sprintf(target + 2*i, "%02x", src[i] & 0xFF);
> +    target[2*i] = 0;
> +}
> +
>  /*
>   * This test attempts to show the effect of enter on a richedit
>   * control v1.0 inserts CRLF whereas for higher versions it only
> @@ -8285,13 +8293,12 @@ static void test_enter(void)
>    char expectedbuf[1024];
>    char resultbuf[1024];
>    HWND hwndRichEdit = new_richedit(NULL);
> -  UINT i,j;
> +  UINT i;
> +  char buf[1024] = {0};
> +  GETTEXTEX getText = {sizeof(buf)};
> +  LRESULT result;
>  
>    for (i = 0; i < ARRAY_SIZE(testenteritems); i++) {
> -
> -    char buf[1024] = {0};
> -    LRESULT result;
> -    GETTEXTEX getText;
>      const char *expected;

Might as well move expected to the outer block too.




More information about the wine-devel mailing list