[PATCH 2/3] gdiplus: Add GdipGetPathGradientSurroundColorCount stub with tests

Justin Chevrier jchevrier at gmail.com
Sat Mar 27 16:55:27 CDT 2010


---
 dlls/gdiplus/brush.c       |   10 ++++++++
 dlls/gdiplus/gdiplus.spec  |    2 +-
 dlls/gdiplus/tests/brush.c |   56 ++++++++++++++++++++++++++++++++++++++++++++
 include/gdiplusflat.h      |    1 +
 4 files changed, 68 insertions(+), 1 deletions(-)

diff --git a/dlls/gdiplus/brush.c b/dlls/gdiplus/brush.c
index 5582a95..8994b87 100644
--- a/dlls/gdiplus/brush.c
+++ b/dlls/gdiplus/brush.c
@@ -1167,6 +1167,16 @@ GpStatus WINGDIPAPI GdipGetPathGradientSurroundColorsWithCount(GpPathGradient
     return NotImplemented;
 }
 
+GpStatus WINGDIPAPI GdipGetPathGradientSurroundColorCount(GpPathGradient *brush, INT *count)
+{
+    TRACE("(%p, %p)\n", brush, count);
+
+    if (!brush || !count)
+       return InvalidParameter;
+
+    return NotImplemented;
+}
+
 GpStatus WINGDIPAPI GdipGetPathGradientWrapMode(GpPathGradient *brush,
     GpWrapMode *wrapmode)
 {
diff --git a/dlls/gdiplus/gdiplus.spec b/dlls/gdiplus/gdiplus.spec
index e6cea5a..14e7fbf 100644
--- a/dlls/gdiplus/gdiplus.spec
+++ b/dlls/gdiplus/gdiplus.spec
@@ -338,7 +338,7 @@
 @ stub GdipGetPathGradientPresetBlendCount
 @ stdcall GdipGetPathGradientRect(ptr ptr)
 @ stdcall GdipGetPathGradientRectI(ptr ptr)
-@ stub GdipGetPathGradientSurroundColorCount
+@ stdcall GdipGetPathGradientSurroundColorCount(ptr ptr)
 @ stdcall GdipGetPathGradientSurroundColorsWithCount(ptr ptr ptr)
 @ stub GdipGetPathGradientTransform
 @ stdcall GdipGetPathGradientWrapMode(ptr ptr)
diff --git a/dlls/gdiplus/tests/brush.c b/dlls/gdiplus/tests/brush.c
index 0ee4dd4..0effcf4 100644
--- a/dlls/gdiplus/tests/brush.c
+++ b/dlls/gdiplus/tests/brush.c
@@ -646,6 +646,61 @@ static void test_linelinearblend(void)
     expect(Ok, status);
 }
 
+static void test_gradientsurroundcolorcount(void)
+{
+    GpStatus status;
+    GpPathGradient *grad;
+    ARGB *color;
+    INT count = 3;
+
+    status = GdipCreatePathGradient(blendcount_ptf, 2, WrapModeClamp, &grad);
+    expect(Ok, status);
+
+    color = GdipAlloc(sizeof(ARGB[3]));
+
+    status = GdipSetPathGradientSurroundColorsWithCount(grad, color, &count);
+    expect(InvalidParameter, status);
+    GdipFree(color);
+
+    count = 2;
+
+    color = GdipAlloc(sizeof(ARGB[2]));
+
+    color[0] = 0x00ff0000;
+    color[1] = 0x0000ff00;
+
+    status = GdipSetPathGradientSurroundColorsWithCount(NULL, color, &count);
+    expect(InvalidParameter, status);
+
+    status = GdipSetPathGradientSurroundColorsWithCount(grad, NULL, &count);
+    expect(InvalidParameter, status);
+
+    /* WinXP crashes on this test */
+    if(0)
+    {
+        status = GdipSetPathGradientSurroundColorsWithCount(grad, color, NULL);
+        expect(InvalidParameter, status);
+    }
+
+    status = GdipSetPathGradientSurroundColorsWithCount(grad, color, &count);
+    todo_wine expect(Ok, status);
+    expect(2, count);
+
+    status = GdipGetPathGradientSurroundColorCount(NULL, &count);
+    expect(InvalidParameter, status);
+
+    status = GdipGetPathGradientSurroundColorCount(grad, NULL);
+    expect(InvalidParameter, status);
+
+    count = 0;
+    status = GdipGetPathGradientSurroundColorCount(grad, &count);
+    todo_wine expect(Ok, status);
+    todo_wine expect(2, count);
+
+    GdipFree(color);
+    GdipDeleteBrush((GpBrush*)grad);
+}
+
 START_TEST(brush)
 {
     struct GdiplusStartupInput gdiplusStartupInput;
@@ -669,6 +724,7 @@ START_TEST(brush)
     test_gradientgetrect();
     test_lineblend();
     test_linelinearblend();
+    test_gradientsurroundcolorcount();
 
     GdiplusShutdown(gdiplusToken);
 }
diff --git a/include/gdiplusflat.h b/include/gdiplusflat.h
index 9672367..8312e16 100644
--- a/include/gdiplusflat.h
+++ b/include/gdiplusflat.h
@@ -563,6 +563,7 @@ GpStatus WINGDIPAPI GdipSetPathGradientSigmaBlend(GpPathGradient*,REAL,REAL);
 GpStatus WINGDIPAPI GdipSetPathGradientSurroundColorsWithCount(GpPathGradient*,
     GDIPCONST ARGB*,INT*);
 GpStatus WINGDIPAPI GdipSetPathGradientWrapMode(GpPathGradient*,GpWrapMode);
+GpStatus WINGDIPAPI GdipGetPathGradientSurroundColorCount(GpPathGradient*,INT*);
 
 /* PathIterator */
 GpStatus WINGDIPAPI GdipCreatePathIter(GpPathIterator**,GpPath*);
-- 
1.6.5.rc1




More information about the wine-patches mailing list