[2/3] gdiplus: Fix test for PathIterator + make it pass on native and Wine (try2)

James Hawkins truiken at gmail.com
Sat Jul 12 16:21:35 CDT 2008


On Sat, Jul 12, 2008 at 4:11 PM, Nikolay Sivov <bunglehead at gmail.com> wrote:
> Changelog:
>    - Fix test for PathIterator + make it pass on native and Wine
> ---
>  dlls/gdiplus/pathiterator.c       |    3 ++-
>  dlls/gdiplus/tests/pathiterator.c |    5 +++--
>  2 files changed, 5 insertions(+), 3 deletions(-)
>
> diff --git a/dlls/gdiplus/pathiterator.c b/dlls/gdiplus/pathiterator.c
> index 55b0782..3d3b1dc 100644
> --- a/dlls/gdiplus/pathiterator.c
> +++ b/dlls/gdiplus/pathiterator.c
> @@ -140,7 +140,8 @@ GpStatus WINGDIPAPI GdipPathIterNextMarker(GpPathIterator* iterator, INT *result
>     /* first call could start with second point as all subsequent, cause
>        path couldn't contain only one */
>     for(i = iterator->marker_pos + 1; i < iterator->pathdata.Count; i++){
> -        if(iterator->pathdata.Types[i] & PathPointTypePathMarker){
> +        if((iterator->pathdata.Types[i] & PathPointTypePathMarker) ||
> +           (i == iterator->pathdata.Count - 1)){
>             *startIndex = iterator->marker_pos;
>             if(iterator->marker_pos > 0) (*startIndex)++;
>             *endIndex   = iterator->marker_pos = i;
> diff --git a/dlls/gdiplus/tests/pathiterator.c b/dlls/gdiplus/tests/pathiterator.c
> index 071c1d5..90725dc 100644
> --- a/dlls/gdiplus/tests/pathiterator.c
> +++ b/dlls/gdiplus/tests/pathiterator.c
> @@ -95,7 +95,8 @@ static void test_nextmarker(void)
>     GpPath *path;
>     GpPathIterator *iter;
>     GpStatus stat;
> -    INT start, end, result;
> +    INT start, end;
> +    INT result = (INT)0xdeadbeef;
>
>     /* NULL args
>        BOOL out argument is local in wrapper class method,
> @@ -114,7 +115,7 @@ static void test_nextmarker(void)
>     GdipCreatePathIter(&iter, path);
>     stat = GdipPathIterNextMarker(iter, &result, &start, &end);
>     expect(Ok, stat);
> -    expect(0, result);
> +    expect(TRUE, (result == 4) && (start == 0) && (end == 3));

Please break these out into their own tests.  Like I said before, they
are independent, and if one of them fails, it's impossible to tell
from the test results which one is wrong.  Also, none of the tests
should be (returned == expected) == TRUE.  It should simply be
expect(expected, returned).

-- 
James Hawkins



More information about the wine-devel mailing list