On Sat, Jul 12, 2008 at 11:56 AM, Nikolay Sivov <[EMAIL PROTECTED]> wrote:
> Changelog:
>    -  Fix GdipPathIterNextMarker behaviour on path without markers. Make 
> tests pass on native.
>
> ---
>  dlls/gdiplus/pathiterator.c       |    3 ++-
>  dlls/gdiplus/tests/pathiterator.c |    6 +++---
>  2 files changed, 5 insertions(+), 4 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..6498bb3 100644
> --- a/dlls/gdiplus/tests/pathiterator.c
> +++ b/dlls/gdiplus/tests/pathiterator.c
> @@ -114,7 +114,7 @@ static void test_nextmarker(void)
>     GdipCreatePathIter(&iter, path);
>     stat = GdipPathIterNextMarker(iter, &result, &start, &end);
>     expect(Ok, stat);
> -    expect(0, result);
> +    if(stat == Ok) expect(TRUE, (result == 4) && (start == 0) && (end == 3));

Why are you checking if stat == Ok?  You're linking what should be
separate tests together.  You also need to put each of these checks
into separate tests.  If the test fails, you have no idea (without
debugging further) which one of those checks fails.  They're called
unit tests for a reason.

>     GdipDeletePathIter(iter);
>
>     /* one marker */
> @@ -125,7 +125,7 @@ static void test_nextmarker(void)
>     expect(TRUE, (start == 0) && (end == 3) && (result == 4));
>     stat = GdipPathIterNextMarker(iter, &result, &start, &end);
>     expect(Ok, stat);
> -    expect(0, result);
> +    if(stat == Ok) expect(0, result);

Same thing as above.

>     GdipDeletePathIter(iter);
>
>     /* two markers */
> @@ -140,7 +140,7 @@ static void test_nextmarker(void)
>     expect(TRUE, (start == 4) && (end == 5) && (result == 2));
>     stat = GdipPathIterNextMarker(iter, &result, &start, &end);
>     expect(Ok, stat);
> -    expect(0, result);
> +    if(stat == Ok) expect(0, result);

Same.

-- 
James Hawkins


Reply via email to