[4/5] gdiplus: Implemented GdipGetCustomLineCapBaseInset + test

Nikolay Sivov bunglehead at gmail.com
Sat Jul 26 03:48:11 CDT 2008


Changelog:
    - Implemented GdipGetCustomLineCapBaseInset + test

---
 dlls/gdiplus/customlinecap.c       |    8 ++++----
 dlls/gdiplus/tests/customlinecap.c |   34 ++++++++++++++++++++++++++++++++++
 include/gdiplusflat.h              |    1 +
 3 files changed, 39 insertions(+), 4 deletions(-)

diff --git a/dlls/gdiplus/customlinecap.c b/dlls/gdiplus/customlinecap.c
index 721a4f5..d6af063 100644
--- a/dlls/gdiplus/customlinecap.c
+++ b/dlls/gdiplus/customlinecap.c
@@ -156,12 +156,12 @@ GpStatus WINGDIPAPI GdipSetCustomLineCapBaseCap(GpCustomLineCap* custom,
 GpStatus WINGDIPAPI GdipGetCustomLineCapBaseInset(GpCustomLineCap* custom,
     REAL* inset)
 {
-    static int calls;
+    if(!custom || !inset)
+        return InvalidParameter;
 
-    if(!(calls++))
-        FIXME("not implemented\n");
+    *inset = custom->inset;
 
-    return NotImplemented;
+    return Ok;
 }
 
 GpStatus WINGDIPAPI GdipSetCustomLineCapBaseInset(GpCustomLineCap* custom,
diff --git a/dlls/gdiplus/tests/customlinecap.c b/dlls/gdiplus/tests/customlinecap.c
index 9f3e6f0..c674c65 100644
--- a/dlls/gdiplus/tests/customlinecap.c
+++ b/dlls/gdiplus/tests/customlinecap.c
@@ -23,6 +23,7 @@
 #include "wine/test.h"
 
 #define expect(expected, got) ok(got == expected, "Expected %.8x, got %.8x\n", expected, got)
+#define expectf(expected, got) ok(got == expected, "Expected %.2f, got %.2f\n", expected, got)
 
 static void test_constructor_destructor(void)
 {
@@ -116,6 +117,38 @@ static void test_linejoin(void)
     GdipDeletePath(path);
 }
 
+static void test_inset(void)
+{
+    GpCustomLineCap *custom;
+    GpPath *path;
+    REAL inset;
+    GpStatus stat;
+
+    stat = GdipCreatePath(FillModeAlternate, &path);
+    expect(Ok, stat);
+    stat = GdipAddPathRectangle(path, 5.0, 5.0, 10.0, 10.0);
+    expect(Ok, stat);
+
+    stat = GdipCreateCustomLineCap(NULL, path, LineCapFlat, 0.0, &custom);
+    expect(Ok, stat);
+
+    /* NULL args */
+    stat = GdipGetCustomLineCapBaseInset(NULL, NULL);
+    expect(InvalidParameter, stat);
+    stat = GdipGetCustomLineCapBaseInset(NULL, &inset);
+    expect(InvalidParameter, stat);
+    stat = GdipGetCustomLineCapBaseInset(custom, NULL);
+    expect(InvalidParameter, stat);
+    /* valid args */
+    inset = (REAL)0xdeadbeef;
+    stat = GdipGetCustomLineCapBaseInset(custom, &inset);
+    expect(Ok, stat);
+    expectf(0.0, inset);
+
+    GdipDeleteCustomLineCap(custom);
+    GdipDeletePath(path);    
+}
+
 START_TEST(customlinecap)
 {
     struct GdiplusStartupInput gdiplusStartupInput;
@@ -130,6 +163,7 @@ START_TEST(customlinecap)
 
     test_constructor_destructor();
     test_linejoin();
+    test_inset();
 
     GdiplusShutdown(gdiplusToken);
 }
diff --git a/include/gdiplusflat.h b/include/gdiplusflat.h
index 37ef6e0..0138c8b 100644
--- a/include/gdiplusflat.h
+++ b/include/gdiplusflat.h
@@ -326,6 +326,7 @@ GpStatus WINGDIPAPI GdipDeleteCustomLineCap(GpCustomLineCap*);
 GpStatus WINGDIPAPI GdipSetCustomLineCapStrokeCaps(GpCustomLineCap*,GpLineCap,
     GpLineCap);
 GpStatus WINGDIPAPI GdipGetCustomLineCapBaseCap(GpCustomLineCap*,GpLineCap*);
+GpStatus WINGDIPAPI GdipGetCustomLineCapBaseInset(GpCustomLineCap*,REAL*);
 GpStatus WINGDIPAPI GdipGetCustomLineCapStrokeJoin(GpCustomLineCap*,GpLineJoin*);
 GpStatus WINGDIPAPI GdipSetCustomLineCapStrokeJoin(GpCustomLineCap*,GpLineJoin);
 
-- 
1.4.4.4






More information about the wine-patches mailing list