gdiplus/tests: Dinamically load gdiplus.dll.
Nicolas Le Cam
niko.lecam at gmail.com
Sun Feb 22 15:24:55 CST 2009
---
dlls/gdiplus/tests/Makefile.in | 2 +-
dlls/gdiplus/tests/brush.c | 253 +++++++----
dlls/gdiplus/tests/customlinecap.c | 161 +++++--
dlls/gdiplus/tests/font.c | 209 ++++++---
dlls/gdiplus/tests/graphics.c | 887 ++++++++++++++++++++++++-----------
dlls/gdiplus/tests/graphicspath.c | 514 +++++++++++++--------
dlls/gdiplus/tests/image.c | 335 +++++++++-----
dlls/gdiplus/tests/matrix.c | 184 +++++---
dlls/gdiplus/tests/pathiterator.c | 434 +++++++++++-------
dlls/gdiplus/tests/pen.c | 268 +++++++----
dlls/gdiplus/tests/region.c | 571 ++++++++++++++---------
dlls/gdiplus/tests/stringformat.c | 262 +++++++----
12 files changed, 2653 insertions(+), 1427 deletions(-)
diff --git a/dlls/gdiplus/tests/Makefile.in b/dlls/gdiplus/tests/Makefile.in
index ac5589d..7dd3cf8 100644
--- a/dlls/gdiplus/tests/Makefile.in
+++ b/dlls/gdiplus/tests/Makefile.in
@@ -3,7 +3,7 @@ TOPOBJDIR = ../../..
SRCDIR = @srcdir@
VPATH = @srcdir@
TESTDLL = gdiplus.dll
-IMPORTS = gdiplus ole32 user32 gdi32 kernel32
+IMPORTS = ole32 user32 gdi32 kernel32
CTESTS = \
brush.c \
diff --git a/dlls/gdiplus/tests/brush.c b/dlls/gdiplus/tests/brush.c
index d2cbd3c..54a5271 100644
--- a/dlls/gdiplus/tests/brush.c
+++ b/dlls/gdiplus/tests/brush.c
@@ -26,19 +26,113 @@
#define expect(expected, got) ok(got == expected, "Expected %.8x, got %.8x\n", expected, got)
#define expectf(expected, got) ok(fabs(expected - got) < 0.0001, "Expected %.2f, got %.2f\n", expected, got)
+static GpStatus (WINGDIPAPI * pGdipCreateBitmapFromGraphics)(INT,INT,
+ GpGraphics*,GpBitmap**);
+static GpStatus (WINGDIPAPI * pGdipDeleteBrush)(GpBrush*);
+static GpStatus (WINGDIPAPI * pGdipGetBrushType)(GpBrush*,GpBrushType*);
+static GpStatus (WINGDIPAPI * pGdipCreateFromHDC)(HDC,GpGraphics**);
+static GpStatus (WINGDIPAPI * pGdipDeleteGraphics)(GpGraphics*);
+static GpStatus (WINGDIPAPI * pGdipDisposeImage)(GpImage*);
+static GpStatus (WINGDIPAPI * pGdipCreateLineBrush)(GDIPCONST GpPointF*,
+ GDIPCONST GpPointF*,ARGB,ARGB,GpWrapMode,GpLineGradient**);
+static GpStatus (WINGDIPAPI * pGdipCreateLineBrushFromRect)(GDIPCONST GpRectF*,
+ ARGB,ARGB,LinearGradientMode,GpWrapMode,GpLineGradient**);
+static GpStatus (WINGDIPAPI * pGdipGetLineGammaCorrection)(GpLineGradient*,
+ BOOL*);
+static GpStatus (WINGDIPAPI * pGdipGetLineRect)(GpLineGradient*,GpRectF*);
+static GpStatus (WINGDIPAPI * pGdipCreateMatrix2)(REAL,REAL,REAL,REAL,REAL,REAL,
+ GpMatrix**);
+static GpStatus (WINGDIPAPI * pGdipDeleteMatrix)(GpMatrix*);
+static GpStatus (WINGDIPAPI * pGdipIsMatrixEqual)(GDIPCONST GpMatrix*,
+ GDIPCONST GpMatrix*,BOOL*);
+static GpStatus (WINGDIPAPI * pGdipIsMatrixIdentity)(GDIPCONST GpMatrix*,BOOL*);
+static GpStatus (WINGDIPAPI * pGdipCreatePathGradient)(GDIPCONST GpPointF*,INT,
+ GpWrapMode,GpPathGradient**);
+static GpStatus (WINGDIPAPI * pGdipGetPathGradientBlend)(GpPathGradient*,REAL*,
+ REAL*,INT);
+static GpStatus (WINGDIPAPI * pGdipGetPathGradientBlendCount)(GpPathGradient*,
+ INT*);
+static GpStatus (WINGDIPAPI * pGdipGetPathGradientRect)(GpPathGradient*,
+ GpRectF*);
+static GpStatus (WINGDIPAPI * pGdipCreateSolidFill)(ARGB,GpSolidFill**);
+static GpStatus (WINGDIPAPI * pGdipCreateTexture)(GpImage*,GpWrapMode,
+ GpTexture**);
+static GpStatus (WINGDIPAPI * pGdipGetTextureTransform)(GpTexture*,GpMatrix*);
+static GpStatus (WINGDIPAPI * pGdipGetTextureWrapMode)(GpTexture*,GpWrapMode*);
+static void (WINAPI * pGdiplusShutdown)(ULONG_PTR);
+static Status (WINAPI * pGdiplusStartup)(ULONG_PTR*,
+ const struct GdiplusStartupInput*,struct GdiplusStartupOutput*);
+static GpStatus (WINGDIPAPI * pGdipResetTextureTransform)(GpTexture*);
+static GpStatus (WINGDIPAPI * pGdipSetTextureTransform)(GpTexture*,
+ GDIPCONST GpMatrix*);
+static GpStatus (WINGDIPAPI * pGdipSetTextureWrapMode)(GpTexture*,GpWrapMode);
+
+static HMODULE hGdiPlus = 0;
+
+static BOOL InitFunctionPtrs(void)
+{
+ hGdiPlus = LoadLibraryA("gdiplus.dll");
+ if (!hGdiPlus)
+ {
+ trace("Could not load gdiplus.dll\n");
+ return FALSE;
+ }
+
+#define GDIPLUS_GET_PROC(func) \
+ p ## func = (void*)GetProcAddress(hGdiPlus, #func); \
+ if (!p ## func) \
+ { \
+ trace("GetProcAddress(%s) failed\n", #func); \
+ FreeLibrary(hGdiPlus); \
+ return FALSE; \
+ }
+
+ GDIPLUS_GET_PROC(GdipCreateBitmapFromGraphics)
+ GDIPLUS_GET_PROC(GdipCreateFromHDC)
+ GDIPLUS_GET_PROC(GdipCreateLineBrush)
+ GDIPLUS_GET_PROC(GdipCreateLineBrushFromRect)
+ GDIPLUS_GET_PROC(GdipCreateMatrix2)
+ GDIPLUS_GET_PROC(GdipCreatePathGradient)
+ GDIPLUS_GET_PROC(GdipCreateSolidFill)
+ GDIPLUS_GET_PROC(GdipCreateTexture)
+ GDIPLUS_GET_PROC(GdipDeleteBrush)
+ GDIPLUS_GET_PROC(GdipDeleteGraphics)
+ GDIPLUS_GET_PROC(GdipDeleteMatrix)
+ GDIPLUS_GET_PROC(GdipDisposeImage)
+ GDIPLUS_GET_PROC(GdipGetBrushType)
+ GDIPLUS_GET_PROC(GdipGetLineGammaCorrection)
+ GDIPLUS_GET_PROC(GdipGetLineRect)
+ GDIPLUS_GET_PROC(GdipGetPathGradientBlend)
+ GDIPLUS_GET_PROC(GdipGetPathGradientBlendCount)
+ GDIPLUS_GET_PROC(GdipGetPathGradientRect)
+ GDIPLUS_GET_PROC(GdipGetTextureTransform)
+ GDIPLUS_GET_PROC(GdipGetTextureWrapMode)
+ GDIPLUS_GET_PROC(GdipIsMatrixEqual)
+ GDIPLUS_GET_PROC(GdipIsMatrixIdentity)
+ GDIPLUS_GET_PROC(GdiplusShutdown)
+ GDIPLUS_GET_PROC(GdiplusStartup)
+ GDIPLUS_GET_PROC(GdipResetTextureTransform)
+ GDIPLUS_GET_PROC(GdipSetTextureTransform)
+ GDIPLUS_GET_PROC(GdipSetTextureWrapMode)
+
+#undef GDIPLUS_GET_PROC
+
+ return TRUE;
+}
+
static void test_constructor_destructor(void)
{
GpStatus status;
GpSolidFill *brush = NULL;
- status = GdipCreateSolidFill((ARGB)0xdeadbeef, &brush);
+ status = pGdipCreateSolidFill((ARGB)0xdeadbeef, &brush);
expect(Ok, status);
ok(brush != NULL, "Expected brush to be initialized\n");
- status = GdipDeleteBrush(NULL);
+ status = pGdipDeleteBrush(NULL);
expect(InvalidParameter, status);
- status = GdipDeleteBrush((GpBrush*) brush);
+ status = pGdipDeleteBrush((GpBrush*) brush);
expect(Ok, status);
}
@@ -48,13 +142,13 @@ static void test_type(void)
GpBrushType bt;
GpSolidFill *brush = NULL;
- GdipCreateSolidFill((ARGB)0xdeadbeef, &brush);
+ pGdipCreateSolidFill((ARGB)0xdeadbeef, &brush);
- status = GdipGetBrushType((GpBrush*)brush, &bt);
+ status = pGdipGetBrushType((GpBrush*)brush, &bt);
expect(Ok, status);
expect(BrushTypeSolidColor, bt);
- GdipDeleteBrush((GpBrush*) brush);
+ pGdipDeleteBrush((GpBrush*) brush);
}
static GpPointF blendcount_ptf[] = {{0.0, 0.0},
{50.0, 50.0}};
@@ -64,21 +158,21 @@ static void test_gradientblendcount(void)
GpPathGradient *brush;
INT count;
- status = GdipCreatePathGradient(blendcount_ptf, 2, WrapModeClamp, &brush);
+ status = pGdipCreatePathGradient(blendcount_ptf, 2, WrapModeClamp, &brush);
expect(Ok, status);
- status = GdipGetPathGradientBlendCount(NULL, NULL);
+ status = pGdipGetPathGradientBlendCount(NULL, NULL);
expect(InvalidParameter, status);
- status = GdipGetPathGradientBlendCount(NULL, &count);
+ status = pGdipGetPathGradientBlendCount(NULL, &count);
expect(InvalidParameter, status);
- status = GdipGetPathGradientBlendCount(brush, NULL);
+ status = pGdipGetPathGradientBlendCount(brush, NULL);
expect(InvalidParameter, status);
- status = GdipGetPathGradientBlendCount(brush, &count);
+ status = pGdipGetPathGradientBlendCount(brush, &count);
expect(Ok, status);
expect(1, count);
- GdipDeleteBrush((GpBrush*) brush);
+ pGdipDeleteBrush((GpBrush*) brush);
}
static GpPointF getblend_ptf[] = {{0.0, 0.0},
@@ -90,29 +184,29 @@ static void test_getblend(void)
REAL blends[4];
REAL pos[4];
- status = GdipCreatePathGradient(getblend_ptf, 2, WrapModeClamp, &brush);
+ status = pGdipCreatePathGradient(getblend_ptf, 2, WrapModeClamp, &brush);
expect(Ok, status);
/* check some invalid parameters combinations */
- status = GdipGetPathGradientBlend(NULL, NULL, NULL, -1);
+ status = pGdipGetPathGradientBlend(NULL, NULL, NULL, -1);
expect(InvalidParameter, status);
- status = GdipGetPathGradientBlend(brush,NULL, NULL, -1);
+ status = pGdipGetPathGradientBlend(brush,NULL, NULL, -1);
expect(InvalidParameter, status);
- status = GdipGetPathGradientBlend(NULL, blends,NULL, -1);
+ status = pGdipGetPathGradientBlend(NULL, blends,NULL, -1);
expect(InvalidParameter, status);
- status = GdipGetPathGradientBlend(NULL, NULL, pos, -1);
+ status = pGdipGetPathGradientBlend(NULL, NULL, pos, -1);
expect(InvalidParameter, status);
- status = GdipGetPathGradientBlend(NULL, NULL, NULL, 1);
+ status = pGdipGetPathGradientBlend(NULL, NULL, NULL, 1);
expect(InvalidParameter, status);
blends[0] = (REAL)0xdeadbeef;
pos[0] = (REAL)0xdeadbeef;
- status = GdipGetPathGradientBlend(brush, blends, pos, 1);
+ status = pGdipGetPathGradientBlend(brush, blends, pos, 1);
expect(Ok, status);
expectf(1.0, blends[0]);
expectf((REAL)0xdeadbeef, pos[0]);
- GdipDeleteBrush((GpBrush*) brush);
+ pGdipDeleteBrush((GpBrush*) brush);
}
static GpPointF getbounds_ptf[] = {{0.0, 20.0},
@@ -125,24 +219,24 @@ static void test_getbounds(void)
GpPathGradient *brush;
GpRectF bounds;
- status = GdipCreatePathGradient(getbounds_ptf, 4, WrapModeClamp, &brush);
+ status = pGdipCreatePathGradient(getbounds_ptf, 4, WrapModeClamp, &brush);
expect(Ok, status);
- status = GdipGetPathGradientRect(NULL, NULL);
+ status = pGdipGetPathGradientRect(NULL, NULL);
expect(InvalidParameter, status);
- status = GdipGetPathGradientRect(brush, NULL);
+ status = pGdipGetPathGradientRect(brush, NULL);
expect(InvalidParameter, status);
- status = GdipGetPathGradientRect(NULL, &bounds);
+ status = pGdipGetPathGradientRect(NULL, &bounds);
expect(InvalidParameter, status);
- status = GdipGetPathGradientRect(brush, &bounds);
+ status = pGdipGetPathGradientRect(brush, &bounds);
expect(Ok, status);
expectf(0.0, bounds.X);
expectf(20.0, bounds.Y);
expectf(50.0, bounds.Width);
expectf(30.0, bounds.Height);
- GdipDeleteBrush((GpBrush*) brush);
+ pGdipDeleteBrush((GpBrush*) brush);
}
static void test_getgamma(void)
@@ -155,18 +249,18 @@ static void test_getgamma(void)
start.X = start.Y = 0.0;
end.X = end.Y = 100.0;
- status = GdipCreateLineBrush(&start, &end, (ARGB)0xdeadbeef, 0xdeadbeef, WrapModeTile, &line);
+ status = pGdipCreateLineBrush(&start, &end, (ARGB)0xdeadbeef, 0xdeadbeef, WrapModeTile, &line);
expect(Ok, status);
/* NULL arguments */
- status = GdipGetLineGammaCorrection(NULL, NULL);
+ status = pGdipGetLineGammaCorrection(NULL, NULL);
expect(InvalidParameter, status);
- status = GdipGetLineGammaCorrection(line, NULL);
+ status = pGdipGetLineGammaCorrection(line, NULL);
expect(InvalidParameter, status);
- status = GdipGetLineGammaCorrection(NULL, &gamma);
+ status = pGdipGetLineGammaCorrection(NULL, &gamma);
expect(InvalidParameter, status);
- GdipDeleteBrush((GpBrush*)line);
+ pGdipDeleteBrush((GpBrush*)line);
}
static void test_transform(void)
@@ -179,58 +273,58 @@ static void test_transform(void)
GpMatrix *m, *m1;
BOOL res;
- status = GdipCreateMatrix2(2.0, 0.0, 0.0, 0.0, 0.0, 0.0, &m);
+ status = pGdipCreateMatrix2(2.0, 0.0, 0.0, 0.0, 0.0, 0.0, &m);
expect(Ok, status);
- status = GdipCreateFromHDC(hdc, &graphics);
+ status = pGdipCreateFromHDC(hdc, &graphics);
expect(Ok, status);
- status = GdipCreateBitmapFromGraphics(1, 1, graphics, &bitmap);
+ status = pGdipCreateBitmapFromGraphics(1, 1, graphics, &bitmap);
expect(Ok, status);
- status = GdipCreateTexture((GpImage*)bitmap, WrapModeTile, &texture);
+ status = pGdipCreateTexture((GpImage*)bitmap, WrapModeTile, &texture);
expect(Ok, status);
/* NULL */
- status = GdipGetTextureTransform(NULL, NULL);
+ status = pGdipGetTextureTransform(NULL, NULL);
expect(InvalidParameter, status);
- status = GdipGetTextureTransform(texture, NULL);
+ status = pGdipGetTextureTransform(texture, NULL);
expect(InvalidParameter, status);
/* get default value - identity matrix */
- status = GdipGetTextureTransform(texture, m);
+ status = pGdipGetTextureTransform(texture, m);
expect(Ok, status);
- status = GdipIsMatrixIdentity(m, &res);
+ status = pGdipIsMatrixIdentity(m, &res);
expect(Ok, status);
expect(TRUE, res);
/* set and get then */
- status = GdipCreateMatrix2(2.0, 0.0, 0.0, 2.0, 0.0, 0.0, &m1);
+ status = pGdipCreateMatrix2(2.0, 0.0, 0.0, 2.0, 0.0, 0.0, &m1);
expect(Ok, status);
- status = GdipSetTextureTransform(texture, m1);
+ status = pGdipSetTextureTransform(texture, m1);
expect(Ok, status);
- status = GdipGetTextureTransform(texture, m);
+ status = pGdipGetTextureTransform(texture, m);
expect(Ok, status);
- status = GdipIsMatrixEqual(m, m1, &res);
+ status = pGdipIsMatrixEqual(m, m1, &res);
expect(Ok, status);
expect(TRUE, res);
/* reset */
- status = GdipResetTextureTransform(texture);
+ status = pGdipResetTextureTransform(texture);
expect(Ok, status);
- status = GdipGetTextureTransform(texture, m);
+ status = pGdipGetTextureTransform(texture, m);
expect(Ok, status);
- status = GdipIsMatrixIdentity(m, &res);
+ status = pGdipIsMatrixIdentity(m, &res);
expect(Ok, status);
expect(TRUE, res);
- status = GdipDeleteBrush((GpBrush*)texture);
+ status = pGdipDeleteBrush((GpBrush*)texture);
expect(Ok, status);
- status = GdipDeleteMatrix(m1);
+ status = pGdipDeleteMatrix(m1);
expect(Ok, status);
- status = GdipDeleteMatrix(m);
+ status = pGdipDeleteMatrix(m);
expect(Ok, status);
- status = GdipDisposeImage((GpImage*)bitmap);
+ status = pGdipDisposeImage((GpImage*)bitmap);
expect(Ok, status);
- status = GdipDeleteGraphics(graphics);
+ status = pGdipDeleteGraphics(graphics);
expect(Ok, status);
ReleaseDC(0, hdc);
}
@@ -244,41 +338,41 @@ static void test_texturewrap(void)
HDC hdc = GetDC(0);
GpWrapMode wrap;
- status = GdipCreateFromHDC(hdc, &graphics);
+ status = pGdipCreateFromHDC(hdc, &graphics);
expect(Ok, status);
- status = GdipCreateBitmapFromGraphics(1, 1, graphics, &bitmap);
+ status = pGdipCreateBitmapFromGraphics(1, 1, graphics, &bitmap);
expect(Ok, status);
- status = GdipCreateTexture((GpImage*)bitmap, WrapModeTile, &texture);
+ status = pGdipCreateTexture((GpImage*)bitmap, WrapModeTile, &texture);
expect(Ok, status);
/* NULL */
- status = GdipGetTextureWrapMode(NULL, NULL);
+ status = pGdipGetTextureWrapMode(NULL, NULL);
expect(InvalidParameter, status);
- status = GdipGetTextureWrapMode(texture, NULL);
+ status = pGdipGetTextureWrapMode(texture, NULL);
expect(InvalidParameter, status);
- status = GdipGetTextureWrapMode(NULL, &wrap);
+ status = pGdipGetTextureWrapMode(NULL, &wrap);
expect(InvalidParameter, status);
/* get */
wrap = WrapModeClamp;
- status = GdipGetTextureWrapMode(texture, &wrap);
+ status = pGdipGetTextureWrapMode(texture, &wrap);
expect(Ok, status);
expect(WrapModeTile, wrap);
/* set, then get */
wrap = WrapModeClamp;
- status = GdipSetTextureWrapMode(texture, wrap);
+ status = pGdipSetTextureWrapMode(texture, wrap);
expect(Ok, status);
wrap = WrapModeTile;
- status = GdipGetTextureWrapMode(texture, &wrap);
+ status = pGdipGetTextureWrapMode(texture, &wrap);
expect(Ok, status);
expect(WrapModeClamp, wrap);
- status = GdipDeleteBrush((GpBrush*)texture);
+ status = pGdipDeleteBrush((GpBrush*)texture);
expect(Ok, status);
- status = GdipDisposeImage((GpImage*)bitmap);
+ status = pGdipDisposeImage((GpImage*)bitmap);
expect(Ok, status);
- status = GdipDeleteGraphics(graphics);
+ status = pGdipDeleteGraphics(graphics);
expect(Ok, status);
ReleaseDC(0, hdc);
}
@@ -292,56 +386,56 @@ static void test_gradientgetrect(void)
pt1.X = pt1.Y = 1.0;
pt2.X = pt2.Y = 100.0;
- status = GdipCreateLineBrush(&pt1, &pt2, 0, 0, WrapModeTile, &brush);
+ status = pGdipCreateLineBrush(&pt1, &pt2, 0, 0, WrapModeTile, &brush);
expect(Ok, status);
memset(&rectf, 0, sizeof(GpRectF));
- status = GdipGetLineRect(brush, &rectf);
+ status = pGdipGetLineRect(brush, &rectf);
expect(Ok, status);
expectf(1.0, rectf.X);
expectf(1.0, rectf.Y);
expectf(99.0, rectf.Width);
expectf(99.0, rectf.Height);
- status = GdipDeleteBrush((GpBrush*)brush);
+ status = pGdipDeleteBrush((GpBrush*)brush);
/* vertical gradient */
pt1.X = pt1.Y = pt2.X = 0.0;
pt2.Y = 10.0;
- status = GdipCreateLineBrush(&pt1, &pt2, 0, 0, WrapModeTile, &brush);
+ status = pGdipCreateLineBrush(&pt1, &pt2, 0, 0, WrapModeTile, &brush);
expect(Ok, status);
memset(&rectf, 0, sizeof(GpRectF));
- status = GdipGetLineRect(brush, &rectf);
+ status = pGdipGetLineRect(brush, &rectf);
expect(Ok, status);
todo_wine expectf(-5.0, rectf.X);
expectf(0.0, rectf.Y);
todo_wine expectf(10.0, rectf.Width);
expectf(10.0, rectf.Height);
- status = GdipDeleteBrush((GpBrush*)brush);
+ status = pGdipDeleteBrush((GpBrush*)brush);
/* horizontal gradient */
pt1.X = pt1.Y = pt2.Y = 0.0;
pt2.X = 10.0;
- status = GdipCreateLineBrush(&pt1, &pt2, 0, 0, WrapModeTile, &brush);
+ status = pGdipCreateLineBrush(&pt1, &pt2, 0, 0, WrapModeTile, &brush);
expect(Ok, status);
memset(&rectf, 0, sizeof(GpRectF));
- status = GdipGetLineRect(brush, &rectf);
+ status = pGdipGetLineRect(brush, &rectf);
expect(Ok, status);
expectf(0.0, rectf.X);
todo_wine expectf(-5.0, rectf.Y);
expectf(10.0, rectf.Width);
todo_wine expectf(10.0, rectf.Height);
- status = GdipDeleteBrush((GpBrush*)brush);
+ status = pGdipDeleteBrush((GpBrush*)brush);
/* from rect with LinearGradientModeHorizontal */
rectf.X = rectf.Y = 10.0;
rectf.Width = rectf.Height = 100.0;
- status = GdipCreateLineBrushFromRect(&rectf, 0, 0, LinearGradientModeHorizontal,
+ status = pGdipCreateLineBrushFromRect(&rectf, 0, 0, LinearGradientModeHorizontal,
WrapModeTile, &brush);
expect(Ok, status);
memset(&rectf, 0, sizeof(GpRectF));
- status = GdipGetLineRect(brush, &rectf);
+ status = pGdipGetLineRect(brush, &rectf);
expect(Ok, status);
expectf(10.0, rectf.X);
expectf(10.0, rectf.Y);
expectf(100.0, rectf.Width);
expectf(100.0, rectf.Height);
- status = GdipDeleteBrush((GpBrush*)brush);
+ status = pGdipDeleteBrush((GpBrush*)brush);
}
START_TEST(brush)
@@ -349,12 +443,15 @@ START_TEST(brush)
struct GdiplusStartupInput gdiplusStartupInput;
ULONG_PTR gdiplusToken;
+ if (!InitFunctionPtrs())
+ return;
+
gdiplusStartupInput.GdiplusVersion = 1;
gdiplusStartupInput.DebugEventCallback = NULL;
gdiplusStartupInput.SuppressBackgroundThread = 0;
gdiplusStartupInput.SuppressExternalCodecs = 0;
- GdiplusStartup(&gdiplusToken, &gdiplusStartupInput, NULL);
+ pGdiplusStartup(&gdiplusToken, &gdiplusStartupInput, NULL);
test_constructor_destructor();
test_type();
@@ -366,5 +463,7 @@ START_TEST(brush)
test_texturewrap();
test_gradientgetrect();
- GdiplusShutdown(gdiplusToken);
+ pGdiplusShutdown(gdiplusToken);
+
+ FreeLibrary(hGdiPlus);
}
diff --git a/dlls/gdiplus/tests/customlinecap.c b/dlls/gdiplus/tests/customlinecap.c
index 78a8c70..6fdbb50 100644
--- a/dlls/gdiplus/tests/customlinecap.c
+++ b/dlls/gdiplus/tests/customlinecap.c
@@ -25,45 +25,101 @@
#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 GpStatus (WINGDIPAPI * pGdipCreateCustomLineCap)(GpPath*,GpPath*,
+ GpLineCap,REAL,GpCustomLineCap**);
+static GpStatus (WINGDIPAPI * pGdipDeleteCustomLineCap)(GpCustomLineCap*);
+static GpStatus (WINGDIPAPI * pGdipGetCustomLineCapBaseInset)(GpCustomLineCap*,
+ REAL*);
+static GpStatus (WINGDIPAPI * pGdipGetCustomLineCapStrokeJoin)(GpCustomLineCap*,
+ GpLineJoin*);
+static GpStatus (WINGDIPAPI * pGdipSetCustomLineCapStrokeJoin)(GpCustomLineCap*,
+ GpLineJoin);
+static GpStatus (WINGDIPAPI * pGdipGetCustomLineCapWidthScale)(GpCustomLineCap*,
+ REAL*);
+static GpStatus (WINGDIPAPI * pGdipAddPathRectangle)(GpPath*,REAL,REAL,REAL,
+ REAL);
+static GpStatus (WINGDIPAPI * pGdipCreatePath)(GpFillMode,GpPath**);
+static GpStatus (WINGDIPAPI * pGdipDeletePath)(GpPath*);
+static Status (WINAPI * pGdiplusStartup)(ULONG_PTR*,
+ const struct GdiplusStartupInput*,struct GdiplusStartupOutput*);
+static void (WINAPI * pGdiplusShutdown)(ULONG_PTR);
+
+static HMODULE hGdiPlus = 0;
+
+static BOOL InitFunctionPtrs(void)
+{
+ hGdiPlus = LoadLibraryA("gdiplus.dll");
+ if (!hGdiPlus)
+ {
+ trace("Could not load gdiplus.dll\n");
+ return FALSE;
+ }
+
+#define GDIPLUS_GET_PROC(func) \
+ p ## func = (void*)GetProcAddress(hGdiPlus, #func); \
+ if (!p ## func) \
+ { \
+ trace("GetProcAddress(%s) failed\n", #func); \
+ FreeLibrary(hGdiPlus); \
+ return FALSE; \
+ }
+
+ GDIPLUS_GET_PROC(GdipAddPathRectangle)
+ GDIPLUS_GET_PROC(GdipCreateCustomLineCap)
+ GDIPLUS_GET_PROC(GdipCreatePath)
+ GDIPLUS_GET_PROC(GdipDeleteCustomLineCap)
+ GDIPLUS_GET_PROC(GdipDeletePath)
+ GDIPLUS_GET_PROC(GdipGetCustomLineCapBaseInset)
+ GDIPLUS_GET_PROC(GdipGetCustomLineCapStrokeJoin)
+ GDIPLUS_GET_PROC(GdipGetCustomLineCapWidthScale)
+ GDIPLUS_GET_PROC(GdiplusShutdown)
+ GDIPLUS_GET_PROC(GdiplusStartup)
+ GDIPLUS_GET_PROC(GdipSetCustomLineCapStrokeJoin)
+
+#undef GDIPLUS_GET_PROC
+
+ return TRUE;
+}
+
static void test_constructor_destructor(void)
{
GpCustomLineCap *custom;
GpPath *path, *path2;
GpStatus stat;
- stat = GdipCreatePath(FillModeAlternate, &path);
+ stat = pGdipCreatePath(FillModeAlternate, &path);
expect(Ok, stat);
- stat = GdipAddPathRectangle(path, 5.0, 5.0, 10.0, 10.0);
+ stat = pGdipAddPathRectangle(path, 5.0, 5.0, 10.0, 10.0);
expect(Ok, stat);
- stat = GdipCreatePath(FillModeAlternate, &path2);
+ stat = pGdipCreatePath(FillModeAlternate, &path2);
expect(Ok, stat);
- stat = GdipAddPathRectangle(path2, 5.0, 5.0, 10.0, 10.0);
+ stat = pGdipAddPathRectangle(path2, 5.0, 5.0, 10.0, 10.0);
expect(Ok, stat);
/* NULL args */
- stat = GdipCreateCustomLineCap(NULL, NULL, LineCapFlat, 0.0, NULL);
+ stat = pGdipCreateCustomLineCap(NULL, NULL, LineCapFlat, 0.0, NULL);
expect(InvalidParameter, stat);
- stat = GdipCreateCustomLineCap(path, NULL, LineCapFlat, 0.0, NULL);
+ stat = pGdipCreateCustomLineCap(path, NULL, LineCapFlat, 0.0, NULL);
expect(InvalidParameter, stat);
- stat = GdipCreateCustomLineCap(NULL, path, LineCapFlat, 0.0, NULL);
+ stat = pGdipCreateCustomLineCap(NULL, path, LineCapFlat, 0.0, NULL);
expect(InvalidParameter, stat);
- stat = GdipCreateCustomLineCap(NULL, NULL, LineCapFlat, 0.0, &custom);
+ stat = pGdipCreateCustomLineCap(NULL, NULL, LineCapFlat, 0.0, &custom);
expect(InvalidParameter, stat);
- stat = GdipDeleteCustomLineCap(NULL);
+ stat = pGdipDeleteCustomLineCap(NULL);
expect(InvalidParameter, stat);
/* valid args */
- stat = GdipCreateCustomLineCap(NULL, path2, LineCapFlat, 0.0, &custom);
+ stat = pGdipCreateCustomLineCap(NULL, path2, LineCapFlat, 0.0, &custom);
expect(Ok, stat);
- stat = GdipDeleteCustomLineCap(custom);
+ stat = pGdipDeleteCustomLineCap(custom);
expect(Ok, stat);
/* it's strange but native returns NotImplemented on stroke == NULL */
- stat = GdipCreateCustomLineCap(path, NULL, LineCapFlat, 10.0, &custom);
+ stat = pGdipCreateCustomLineCap(path, NULL, LineCapFlat, 10.0, &custom);
todo_wine expect(NotImplemented, stat);
- GdipDeletePath(path2);
- GdipDeletePath(path);
+ pGdipDeletePath(path2);
+ pGdipDeletePath(path);
}
static void test_linejoin(void)
@@ -73,48 +129,48 @@ static void test_linejoin(void)
GpLineJoin join;
GpStatus stat;
- stat = GdipCreatePath(FillModeAlternate, &path);
+ stat = pGdipCreatePath(FillModeAlternate, &path);
expect(Ok, stat);
- stat = GdipAddPathRectangle(path, 5.0, 5.0, 10.0, 10.0);
+ stat = pGdipAddPathRectangle(path, 5.0, 5.0, 10.0, 10.0);
expect(Ok, stat);
- stat = GdipCreateCustomLineCap(NULL, path, LineCapFlat, 0.0, &custom);
+ stat = pGdipCreateCustomLineCap(NULL, path, LineCapFlat, 0.0, &custom);
expect(Ok, stat);
/* NULL args */
- stat = GdipGetCustomLineCapStrokeJoin(NULL, NULL);
+ stat = pGdipGetCustomLineCapStrokeJoin(NULL, NULL);
expect(InvalidParameter, stat);
- stat = GdipGetCustomLineCapStrokeJoin(custom, NULL);
+ stat = pGdipGetCustomLineCapStrokeJoin(custom, NULL);
expect(InvalidParameter, stat);
- stat = GdipGetCustomLineCapStrokeJoin(NULL, &join);
+ stat = pGdipGetCustomLineCapStrokeJoin(NULL, &join);
expect(InvalidParameter, stat);
- stat = GdipSetCustomLineCapStrokeJoin(NULL, LineJoinBevel);
+ stat = pGdipSetCustomLineCapStrokeJoin(NULL, LineJoinBevel);
expect(InvalidParameter, stat);
/* LineJoinMiter is default */
- stat = GdipGetCustomLineCapStrokeJoin(custom, &join);
+ stat = pGdipGetCustomLineCapStrokeJoin(custom, &join);
expect(Ok, stat);
expect(LineJoinMiter, join);
/* set/get */
- stat = GdipSetCustomLineCapStrokeJoin(custom, LineJoinBevel);
+ stat = pGdipSetCustomLineCapStrokeJoin(custom, LineJoinBevel);
expect(Ok, stat);
- stat = GdipGetCustomLineCapStrokeJoin(custom, &join);
+ stat = pGdipGetCustomLineCapStrokeJoin(custom, &join);
expect(Ok, stat);
expect(LineJoinBevel, join);
- stat = GdipSetCustomLineCapStrokeJoin(custom, LineJoinRound);
+ stat = pGdipSetCustomLineCapStrokeJoin(custom, LineJoinRound);
expect(Ok, stat);
- stat = GdipGetCustomLineCapStrokeJoin(custom, &join);
+ stat = pGdipGetCustomLineCapStrokeJoin(custom, &join);
expect(Ok, stat);
expect(LineJoinRound, join);
- stat = GdipSetCustomLineCapStrokeJoin(custom, LineJoinMiterClipped);
+ stat = pGdipSetCustomLineCapStrokeJoin(custom, LineJoinMiterClipped);
expect(Ok, stat);
- stat = GdipGetCustomLineCapStrokeJoin(custom, &join);
+ stat = pGdipGetCustomLineCapStrokeJoin(custom, &join);
expect(Ok, stat);
expect(LineJoinMiterClipped, join);
- GdipDeleteCustomLineCap(custom);
- GdipDeletePath(path);
+ pGdipDeleteCustomLineCap(custom);
+ pGdipDeletePath(path);
}
static void test_inset(void)
@@ -124,29 +180,29 @@ static void test_inset(void)
REAL inset;
GpStatus stat;
- stat = GdipCreatePath(FillModeAlternate, &path);
+ stat = pGdipCreatePath(FillModeAlternate, &path);
expect(Ok, stat);
- stat = GdipAddPathRectangle(path, 5.0, 5.0, 10.0, 10.0);
+ stat = pGdipAddPathRectangle(path, 5.0, 5.0, 10.0, 10.0);
expect(Ok, stat);
- stat = GdipCreateCustomLineCap(NULL, path, LineCapFlat, 0.0, &custom);
+ stat = pGdipCreateCustomLineCap(NULL, path, LineCapFlat, 0.0, &custom);
expect(Ok, stat);
/* NULL args */
- stat = GdipGetCustomLineCapBaseInset(NULL, NULL);
+ stat = pGdipGetCustomLineCapBaseInset(NULL, NULL);
expect(InvalidParameter, stat);
- stat = GdipGetCustomLineCapBaseInset(NULL, &inset);
+ stat = pGdipGetCustomLineCapBaseInset(NULL, &inset);
expect(InvalidParameter, stat);
- stat = GdipGetCustomLineCapBaseInset(custom, NULL);
+ stat = pGdipGetCustomLineCapBaseInset(custom, NULL);
expect(InvalidParameter, stat);
/* valid args */
inset = (REAL)0xdeadbeef;
- stat = GdipGetCustomLineCapBaseInset(custom, &inset);
+ stat = pGdipGetCustomLineCapBaseInset(custom, &inset);
expect(Ok, stat);
expectf(0.0, inset);
- GdipDeleteCustomLineCap(custom);
- GdipDeletePath(path);
+ pGdipDeleteCustomLineCap(custom);
+ pGdipDeletePath(path);
}
static void test_scale(void)
@@ -156,29 +212,29 @@ static void test_scale(void)
REAL scale;
GpStatus stat;
- stat = GdipCreatePath(FillModeAlternate, &path);
+ stat = pGdipCreatePath(FillModeAlternate, &path);
expect(Ok, stat);
- stat = GdipAddPathRectangle(path, 5.0, 5.0, 10.0, 10.0);
+ stat = pGdipAddPathRectangle(path, 5.0, 5.0, 10.0, 10.0);
expect(Ok, stat);
- stat = GdipCreateCustomLineCap(NULL, path, LineCapFlat, 0.0, &custom);
+ stat = pGdipCreateCustomLineCap(NULL, path, LineCapFlat, 0.0, &custom);
expect(Ok, stat);
/* NULL args */
- stat = GdipGetCustomLineCapWidthScale(NULL, NULL);
+ stat = pGdipGetCustomLineCapWidthScale(NULL, NULL);
expect(InvalidParameter, stat);
- stat = GdipGetCustomLineCapWidthScale(NULL, &scale);
+ stat = pGdipGetCustomLineCapWidthScale(NULL, &scale);
expect(InvalidParameter, stat);
- stat = GdipGetCustomLineCapWidthScale(custom, NULL);
+ stat = pGdipGetCustomLineCapWidthScale(custom, NULL);
expect(InvalidParameter, stat);
/* valid args */
scale = (REAL)0xdeadbeef;
- stat = GdipGetCustomLineCapWidthScale(custom, &scale);
+ stat = pGdipGetCustomLineCapWidthScale(custom, &scale);
expect(Ok, stat);
expectf(1.0, scale);
- GdipDeleteCustomLineCap(custom);
- GdipDeletePath(path);
+ pGdipDeleteCustomLineCap(custom);
+ pGdipDeletePath(path);
}
START_TEST(customlinecap)
@@ -186,17 +242,22 @@ START_TEST(customlinecap)
struct GdiplusStartupInput gdiplusStartupInput;
ULONG_PTR gdiplusToken;
+ if (!InitFunctionPtrs())
+ return;
+
gdiplusStartupInput.GdiplusVersion = 1;
gdiplusStartupInput.DebugEventCallback = NULL;
gdiplusStartupInput.SuppressBackgroundThread = 0;
gdiplusStartupInput.SuppressExternalCodecs = 0;
- GdiplusStartup(&gdiplusToken, &gdiplusStartupInput, NULL);
+ pGdiplusStartup(&gdiplusToken, &gdiplusStartupInput, NULL);
test_constructor_destructor();
test_linejoin();
test_inset();
test_scale();
- GdiplusShutdown(gdiplusToken);
+ pGdiplusShutdown(gdiplusToken);
+
+ FreeLibrary(hGdiPlus);
}
diff --git a/dlls/gdiplus/tests/font.c b/dlls/gdiplus/tests/font.c
index 125535d..160a41a 100644
--- a/dlls/gdiplus/tests/font.c
+++ b/dlls/gdiplus/tests/font.c
@@ -31,6 +31,94 @@ static const WCHAR MicrosoftSansSerif[] = {'M','i','c','r','o','s','o','f','t','
static const WCHAR TimesNewRoman[] = {'T','i','m','e','s',' ','N','e','w',' ','R','o','m','a','n','\0'};
static const WCHAR CourierNew[] = {'C','o','u','r','i','e','r',' ','N','e','w','\0'};
+static GpStatus (WINGDIPAPI * pGdipCreateFont)(GDIPCONST GpFontFamily*,REAL,INT,
+ Unit,GpFont**);
+static GpStatus (WINGDIPAPI * pGdipCreateFontFromLogfontW)(HDC,
+ GDIPCONST LOGFONTW*,GpFont**);
+static GpStatus (WINGDIPAPI * pGdipDeleteFont)(GpFont*);
+static GpStatus (WINGDIPAPI * pGdipGetLogFontW)(GpFont*,GpGraphics*,LOGFONTW*);
+static GpStatus (WINGDIPAPI * pGdipGetFontUnit)(GpFont*,Unit*);
+static GpStatus (WINGDIPAPI * pGdipGetFamily)(GpFont*,GpFontFamily**);
+static GpStatus (WINGDIPAPI * pGdipGetFontSize)(GpFont*,REAL*);
+static GpStatus (WINGDIPAPI * pGdipGetFontStyle)(GpFont*,INT*);
+static GpStatus (WINGDIPAPI * pGdipCloneFontFamily)(GpFontFamily*,
+ GpFontFamily**);
+static GpStatus (WINGDIPAPI * pGdipCreateFontFamilyFromName)(GDIPCONST WCHAR*,
+ GpFontCollection*,GpFontFamily**);
+static GpStatus (WINGDIPAPI * pGdipDeleteFontFamily)(GpFontFamily*);
+static GpStatus (WINGDIPAPI * pGdipGetFamilyName)(GDIPCONST GpFontFamily*,
+ WCHAR*,LANGID);
+static GpStatus (WINGDIPAPI * pGdipGetCellAscent)(GDIPCONST GpFontFamily*,INT,
+ UINT16*);
+static GpStatus (WINGDIPAPI * pGdipGetCellDescent)(GDIPCONST GpFontFamily*,INT,
+ UINT16*);
+static GpStatus (WINGDIPAPI * pGdipGetEmHeight)(GDIPCONST GpFontFamily*,INT,
+ UINT16*);
+static GpStatus (WINGDIPAPI * pGdipGetGenericFontFamilyMonospace)(
+ GpFontFamily**);
+static GpStatus (WINGDIPAPI * pGdipGetGenericFontFamilySansSerif)(
+ GpFontFamily**);
+static GpStatus (WINGDIPAPI * pGdipGetGenericFontFamilySerif)(
+ GpFontFamily**);
+static GpStatus (WINGDIPAPI * pGdipGetLineSpacing)(GDIPCONST GpFontFamily*,INT,
+ UINT16*);
+static GpStatus (WINGDIPAPI * pGdipCreateFromHDC)(HDC,GpGraphics**);
+static GpStatus (WINGDIPAPI * pGdipDeleteGraphics)(GpGraphics*);
+static Status (WINAPI * pGdiplusStartup)(ULONG_PTR*,
+ const struct GdiplusStartupInput*,struct GdiplusStartupOutput*);
+static void (WINAPI * pGdiplusShutdown)(ULONG_PTR);
+
+
+static HMODULE hGdiPlus = 0;
+
+static BOOL InitFunctionPtrs(void)
+{
+ hGdiPlus = LoadLibraryA("gdiplus.dll");
+ if (!hGdiPlus)
+ {
+ trace("Could not load gdiplus.dll\n");
+ return FALSE;
+ }
+
+#define GDIPLUS_GET_PROC(func) \
+ p ## func = (void*)GetProcAddress(hGdiPlus, #func); \
+ if (!p ## func) \
+ { \
+ trace("GetProcAddress(%s) failed\n", #func); \
+ FreeLibrary(hGdiPlus); \
+ return FALSE; \
+ }
+
+ GDIPLUS_GET_PROC(GdipCloneFontFamily)
+ GDIPLUS_GET_PROC(GdipCreateFont)
+ GDIPLUS_GET_PROC(GdipCreateFontFamilyFromName)
+ GDIPLUS_GET_PROC(GdipCreateFontFromLogfontW)
+ GDIPLUS_GET_PROC(GdipCreateFromHDC)
+ GDIPLUS_GET_PROC(GdipDeleteFont)
+ GDIPLUS_GET_PROC(GdipDeleteFontFamily )
+ GDIPLUS_GET_PROC(GdipDeleteFontFamily)
+ GDIPLUS_GET_PROC(GdipDeleteGraphics)
+ GDIPLUS_GET_PROC(GdipGetCellAscent)
+ GDIPLUS_GET_PROC(GdipGetCellDescent)
+ GDIPLUS_GET_PROC(GdipGetEmHeight)
+ GDIPLUS_GET_PROC(GdipGetFamily)
+ GDIPLUS_GET_PROC(GdipGetFamilyName)
+ GDIPLUS_GET_PROC(GdipGetFontSize)
+ GDIPLUS_GET_PROC(GdipGetFontStyle)
+ GDIPLUS_GET_PROC(GdipGetFontUnit)
+ GDIPLUS_GET_PROC(GdipGetGenericFontFamilyMonospace)
+ GDIPLUS_GET_PROC(GdipGetGenericFontFamilySansSerif)
+ GDIPLUS_GET_PROC(GdipGetGenericFontFamilySerif)
+ GDIPLUS_GET_PROC(GdipGetLineSpacing)
+ GDIPLUS_GET_PROC(GdipGetLogFontW)
+ GDIPLUS_GET_PROC(GdiplusShutdown)
+ GDIPLUS_GET_PROC(GdiplusStartup)
+
+#undef GDIPLUS_GET_PROC
+
+ return TRUE;
+}
+
static const char *debugstr_w(LPCWSTR str)
{
static char buf[1024];
@@ -49,50 +137,50 @@ static void test_createfont(void)
REAL size;
WCHAR familyname[LF_FACESIZE];
- stat = GdipCreateFontFamilyFromName(nonexistent, NULL, &fontfamily);
+ stat = pGdipCreateFontFamilyFromName(nonexistent, NULL, &fontfamily);
expect (FontFamilyNotFound, stat);
- stat = GdipDeleteFont(font);
+ stat = pGdipDeleteFont(font);
expect (InvalidParameter, stat);
- stat = GdipCreateFontFamilyFromName(arial, NULL, &fontfamily);
+ stat = pGdipCreateFontFamilyFromName(arial, NULL, &fontfamily);
if(stat == FontFamilyNotFound)
{
skip("Arial not installed\n");
return;
}
expect (Ok, stat);
- stat = GdipCreateFont(fontfamily, 12, FontStyleRegular, UnitPoint, &font);
+ stat = pGdipCreateFont(fontfamily, 12, FontStyleRegular, UnitPoint, &font);
expect (Ok, stat);
- stat = GdipGetFontUnit (font, &unit);
+ stat = pGdipGetFontUnit(font, &unit);
expect (Ok, stat);
expect (UnitPoint, unit);
- stat = GdipGetFamily(font, &fontfamily2);
+ stat = pGdipGetFamily(font, &fontfamily2);
expect(Ok, stat);
- stat = GdipGetFamilyName(fontfamily2, familyname, 0);
+ stat = pGdipGetFamilyName(fontfamily2, familyname, 0);
expect(Ok, stat);
ok (lstrcmpiW(arial, familyname) == 0, "Expected arial, got %s\n",
debugstr_w(familyname));
- stat = GdipDeleteFontFamily(fontfamily2);
+ stat = pGdipDeleteFontFamily(fontfamily2);
expect(Ok, stat);
/* Test to see if returned size is based on unit (its not) */
- GdipGetFontSize(font, &size);
+ pGdipGetFontSize(font, &size);
ok (size == 12, "Expected 12, got %f\n", size);
- GdipDeleteFont(font);
+ pGdipDeleteFont(font);
/* Make sure everything is converted correctly for all Units */
for (i = UnitWorld; i <=UnitMillimeter; i++)
{
if (i == UnitDisplay) continue; /* Crashes WindowsXP, wtf? */
- GdipCreateFont(fontfamily, 24, FontStyleRegular, i, &font);
- GdipGetFontSize (font, &size);
+ pGdipCreateFont(fontfamily, 24, FontStyleRegular, i, &font);
+ pGdipGetFontSize(font, &size);
ok (size == 24, "Expected 24, got %f (with unit: %d)\n", size, i);
- GdipGetFontUnit (font, &unit);
+ pGdipGetFontUnit(font, &unit);
expect (i, unit);
- GdipDeleteFont(font);
+ pGdipDeleteFont(font);
}
- GdipDeleteFontFamily(fontfamily);
+ pGdipDeleteFontFamily(fontfamily);
}
static void test_logfont(void)
@@ -104,26 +192,26 @@ static void test_logfont(void)
HDC hdc = GetDC(0);
INT style;
- GdipCreateFromHDC(hdc, &graphics);
+ pGdipCreateFromHDC(hdc, &graphics);
memset(&lfw, 0, sizeof(LOGFONTW));
memset(&lfw2, 0xff, sizeof(LOGFONTW));
/* empty FaceName */
lfw.lfFaceName[0] = 0;
- stat = GdipCreateFontFromLogfontW(hdc, &lfw, &font);
+ stat = pGdipCreateFontFromLogfontW(hdc, &lfw, &font);
expect(NotTrueTypeFont, stat);
memcpy(&lfw.lfFaceName, arial, 6 * sizeof(WCHAR));
- stat = GdipCreateFontFromLogfontW(hdc, &lfw, &font);
+ stat = pGdipCreateFontFromLogfontW(hdc, &lfw, &font);
if (stat == FileNotFound)
{
skip("Arial not installed.\n");
return;
}
expect(Ok, stat);
- stat = GdipGetLogFontW(font, graphics, &lfw2);
+ stat = pGdipGetLogFontW(font, graphics, &lfw2);
expect(Ok, stat);
ok(lfw2.lfHeight < 0, "Expected negative height\n");
@@ -140,7 +228,7 @@ static void test_logfont(void)
expect(0, lfw2.lfQuality);
expect(0, lfw2.lfPitchAndFamily);
- GdipDeleteFont(font);
+ pGdipDeleteFont(font);
memset(&lfw, 0, sizeof(LOGFONTW));
lfw.lfHeight = 25;
@@ -151,9 +239,9 @@ static void test_logfont(void)
memset(&lfw2, 0xff, sizeof(LOGFONTW));
memcpy(&lfw.lfFaceName, arial, 6 * sizeof(WCHAR));
- stat = GdipCreateFontFromLogfontW(hdc, &lfw, &font);
+ stat = pGdipCreateFontFromLogfontW(hdc, &lfw, &font);
expect(Ok, stat);
- stat = GdipGetLogFontW(font, graphics, &lfw2);
+ stat = pGdipGetLogFontW(font, graphics, &lfw2);
expect(Ok, stat);
ok(lfw2.lfHeight < 0, "Expected negative height\n");
@@ -170,14 +258,14 @@ static void test_logfont(void)
expect(0, lfw2.lfQuality);
expect(0, lfw2.lfPitchAndFamily);
- stat = GdipGetFontStyle(font, &style);
+ stat = pGdipGetFontStyle(font, &style);
expect(Ok, stat);
ok (style == (FontStyleItalic | FontStyleUnderline | FontStyleStrikeout),
"Expected , got %d\n", style);
- GdipDeleteFont(font);
+ pGdipDeleteFont(font);
- GdipDeleteGraphics(graphics);
+ pGdipDeleteGraphics(graphics);
ReleaseDC(0, hdc);
}
@@ -188,23 +276,23 @@ static void test_fontfamily (void)
GpStatus stat;
/* FontFamily cannot be NULL */
- stat = GdipCreateFontFamilyFromName (arial , NULL, NULL);
+ stat = pGdipCreateFontFamilyFromName(arial , NULL, NULL);
expect (InvalidParameter, stat);
/* FontFamily must be able to actually find the family.
* If it can't, any subsequent calls should fail.
*/
- stat = GdipCreateFontFamilyFromName (nonexistent, NULL, &family);
+ stat = pGdipCreateFontFamilyFromName(nonexistent, NULL, &family);
expect (FontFamilyNotFound, stat);
/* Bitmap fonts are not found */
todo_wine
{
- stat = GdipCreateFontFamilyFromName (MSSansSerif, NULL, &family);
+ stat = pGdipCreateFontFamilyFromName(MSSansSerif, NULL, &family);
expect (FontFamilyNotFound, stat);
}
- stat = GdipCreateFontFamilyFromName (arial, NULL, &family);
+ stat = pGdipCreateFontFamilyFromName(arial, NULL, &family);
if(stat == FontFamilyNotFound)
{
skip("Arial not installed\n");
@@ -212,27 +300,27 @@ todo_wine
}
expect (Ok, stat);
- stat = GdipGetFamilyName (family, itsName, LANG_NEUTRAL);
+ stat = pGdipGetFamilyName(family, itsName, LANG_NEUTRAL);
expect (Ok, stat);
expect (0, lstrcmpiW(itsName, arial));
if (0)
{
/* Crashes on Windows XP SP2, Vista, and so Wine as well */
- stat = GdipGetFamilyName (family, NULL, LANG_NEUTRAL);
+ stat = pGdipGetFamilyName(family, NULL, LANG_NEUTRAL);
expect (Ok, stat);
}
/* Make sure we don't read old data */
ZeroMemory (itsName, sizeof(itsName));
- stat = GdipCloneFontFamily(family, &clonedFontFamily);
+ stat = pGdipCloneFontFamily(family, &clonedFontFamily);
expect (Ok, stat);
- GdipDeleteFontFamily(family);
- stat = GdipGetFamilyName(clonedFontFamily, itsName, LANG_NEUTRAL);
+ pGdipDeleteFontFamily(family);
+ stat = pGdipGetFamilyName(clonedFontFamily, itsName, LANG_NEUTRAL);
expect(Ok, stat);
expect(0, lstrcmpiW(itsName, arial));
- GdipDeleteFontFamily(clonedFontFamily);
+ pGdipDeleteFontFamily(clonedFontFamily);
}
static void test_fontfamily_properties (void)
@@ -241,49 +329,49 @@ static void test_fontfamily_properties (void)
GpStatus stat;
UINT16 result = 0;
- stat = GdipCreateFontFamilyFromName(arial, NULL, &FontFamily);
+ stat = pGdipCreateFontFamilyFromName(arial, NULL, &FontFamily);
if(stat == FontFamilyNotFound)
skip("Arial not installed\n");
else
{
- stat = GdipGetLineSpacing(FontFamily, FontStyleRegular, &result);
+ stat = pGdipGetLineSpacing(FontFamily, FontStyleRegular, &result);
expect(Ok, stat);
ok (result == 2355, "Expected 2355, got %d\n", result);
result = 0;
- stat = GdipGetEmHeight(FontFamily, FontStyleRegular, &result);
+ stat = pGdipGetEmHeight(FontFamily, FontStyleRegular, &result);
expect(Ok, stat);
ok(result == 2048, "Expected 2048, got %d\n", result);
result = 0;
- stat = GdipGetCellAscent(FontFamily, FontStyleRegular, &result);
+ stat = pGdipGetCellAscent(FontFamily, FontStyleRegular, &result);
expect(Ok, stat);
ok(result == 1854, "Expected 1854, got %d\n", result);
result = 0;
- stat = GdipGetCellDescent(FontFamily, FontStyleRegular, &result);
+ stat = pGdipGetCellDescent(FontFamily, FontStyleRegular, &result);
ok(result == 434, "Expected 434, got %d\n", result);
- GdipDeleteFontFamily(FontFamily);
+ pGdipDeleteFontFamily(FontFamily);
}
- stat = GdipCreateFontFamilyFromName(TimesNewRoman, NULL, &FontFamily);
+ stat = pGdipCreateFontFamilyFromName(TimesNewRoman, NULL, &FontFamily);
if(stat == FontFamilyNotFound)
skip("Times New Roman not installed\n");
else
{
result = 0;
- stat = GdipGetLineSpacing(FontFamily, FontStyleRegular, &result);
+ stat = pGdipGetLineSpacing(FontFamily, FontStyleRegular, &result);
expect(Ok, stat);
ok(result == 2355, "Expected 2355, got %d\n", result);
result = 0;
- stat = GdipGetEmHeight(FontFamily, FontStyleRegular, &result);
+ stat = pGdipGetEmHeight(FontFamily, FontStyleRegular, &result);
expect(Ok, stat);
ok(result == 2048, "Expected 2048, got %d\n", result);
result = 0;
- stat = GdipGetCellAscent(FontFamily, FontStyleRegular, &result);
+ stat = pGdipGetCellAscent(FontFamily, FontStyleRegular, &result);
expect(Ok, stat);
ok(result == 1825, "Expected 1825, got %d\n", result);
result = 0;
- stat = GdipGetCellDescent(FontFamily, FontStyleRegular, &result);
+ stat = pGdipGetCellDescent(FontFamily, FontStyleRegular, &result);
ok(result == 443, "Expected 443 got %d\n", result);
- GdipDeleteFontFamily(FontFamily);
+ pGdipDeleteFontFamily(FontFamily);
}
}
@@ -294,50 +382,50 @@ static void test_getgenerics (void)
WCHAR familyName[LF_FACESIZE];
ZeroMemory(familyName, sizeof(familyName)/sizeof(WCHAR));
- stat = GdipGetGenericFontFamilySansSerif (&family);
+ stat = pGdipGetGenericFontFamilySansSerif(&family);
if (stat == FontFamilyNotFound)
{
skip("Microsoft Sans Serif not installed\n");
goto serif;
}
expect (Ok, stat);
- stat = GdipGetFamilyName (family, familyName, LANG_NEUTRAL);
+ stat = pGdipGetFamilyName(family, familyName, LANG_NEUTRAL);
expect (Ok, stat);
ok ((lstrcmpiW(familyName, MicrosoftSansSerif) == 0) ||
(lstrcmpiW(familyName,MSSansSerif) == 0),
"Expected Microsoft Sans Serif or MS Sans Serif, got %s\n",
debugstr_w(familyName));
- stat = GdipDeleteFontFamily (family);
+ stat = pGdipDeleteFontFamily(family);
expect (Ok, stat);
serif:
- stat = GdipGetGenericFontFamilySerif (&family);
+ stat = pGdipGetGenericFontFamilySerif(&family);
if (stat == FontFamilyNotFound)
{
skip("Times New Roman not installed\n");
goto monospace;
}
expect (Ok, stat);
- stat = GdipGetFamilyName (family, familyName, LANG_NEUTRAL);
+ stat = pGdipGetFamilyName(family, familyName, LANG_NEUTRAL);
expect (Ok, stat);
ok (lstrcmpiW(familyName, TimesNewRoman) == 0,
"Expected Times New Roman, got %s\n", debugstr_w(familyName));
- stat = GdipDeleteFontFamily (family);
+ stat = pGdipDeleteFontFamily(family);
expect (Ok, stat);
monospace:
- stat = GdipGetGenericFontFamilyMonospace (&family);
+ stat = pGdipGetGenericFontFamilyMonospace(&family);
if (stat == FontFamilyNotFound)
{
skip("Courier New not installed\n");
return;
}
expect (Ok, stat);
- stat = GdipGetFamilyName (family, familyName, LANG_NEUTRAL);
+ stat = pGdipGetFamilyName(family, familyName, LANG_NEUTRAL);
expect (Ok, stat);
ok (lstrcmpiW(familyName, CourierNew) == 0,
"Expected Courier New, got %s\n", debugstr_w(familyName));
- stat = GdipDeleteFontFamily (family);
+ stat = pGdipDeleteFontFamily(family);
expect (Ok, stat);
}
@@ -346,12 +434,15 @@ START_TEST(font)
struct GdiplusStartupInput gdiplusStartupInput;
ULONG_PTR gdiplusToken;
+ if (!InitFunctionPtrs())
+ return;
+
gdiplusStartupInput.GdiplusVersion = 1;
gdiplusStartupInput.DebugEventCallback = NULL;
gdiplusStartupInput.SuppressBackgroundThread = 0;
gdiplusStartupInput.SuppressExternalCodecs = 0;
- GdiplusStartup(&gdiplusToken, &gdiplusStartupInput, NULL);
+ pGdiplusStartup(&gdiplusToken, &gdiplusStartupInput, NULL);
test_createfont();
test_logfont();
@@ -359,5 +450,7 @@ START_TEST(font)
test_fontfamily_properties();
test_getgenerics();
- GdiplusShutdown(gdiplusToken);
+ pGdiplusShutdown(gdiplusToken);
+
+ FreeLibrary(hGdiPlus);
}
diff --git a/dlls/gdiplus/tests/graphics.c b/dlls/gdiplus/tests/graphics.c
index 8091a9a..5b83418 100644
--- a/dlls/gdiplus/tests/graphics.c
+++ b/dlls/gdiplus/tests/graphics.c
@@ -26,33 +26,357 @@
#define expect(expected, got) ok(got == expected, "Expected %.8x, got %.8x\n", expected, got)
#define TABLE_LEN (23)
+static void* (WINGDIPAPI * pGdipAlloc)(SIZE_T);
+static GpStatus (WINGDIPAPI * pGdipDeleteBrush)(GpBrush*);
+static GpStatus (WINGDIPAPI * pGdipFlush)(GpGraphics*,GpFlushIntention);
+static GpStatus (WINGDIPAPI * pGdipCreateFromHDC)(HDC,GpGraphics**);
+static GpStatus (WINGDIPAPI * pGdipCreateFromHWND)(HWND,GpGraphics**);
+static GpStatus (WINGDIPAPI * pGdipCreateFromHWNDICM)(HWND,GpGraphics**);
+static GpStatus (WINGDIPAPI * pGdipDeleteGraphics)(GpGraphics*);
+static GpStatus (WINGDIPAPI * pGdipDrawArc)(GpGraphics*,GpPen*,REAL,REAL,REAL,
+ REAL,REAL,REAL);
+static GpStatus (WINGDIPAPI * pGdipDrawArcI)(GpGraphics*,GpPen*,INT,INT,INT,INT,
+ REAL,REAL);
+static GpStatus (WINGDIPAPI * pGdipDrawBezier)(GpGraphics*,GpPen*,REAL,REAL,
+ REAL,REAL,REAL,REAL,REAL,REAL);
+static GpStatus (WINGDIPAPI * pGdipDrawBezierI)(GpGraphics*,GpPen*,INT,INT,INT,
+ INT,INT,INT,INT,INT);
+static GpStatus (WINGDIPAPI * pGdipDrawBeziers)(GpGraphics*,GpPen*,
+ GDIPCONST GpPointF*,INT);
+static GpStatus (WINGDIPAPI * pGdipDrawBeziersI)(GpGraphics*,GpPen*,
+ GDIPCONST GpPoint*,INT);
+static GpStatus (WINGDIPAPI * pGdipDrawClosedCurve)(GpGraphics*,GpPen*,
+ GDIPCONST GpPointF*,INT);
+static GpStatus (WINGDIPAPI * pGdipDrawClosedCurveI)(GpGraphics*,GpPen*,
+ GDIPCONST GpPoint*,INT);
+static GpStatus (WINGDIPAPI * pGdipDrawClosedCurve2)(GpGraphics*,GpPen*,
+ GDIPCONST GpPointF*,INT,REAL);
+static GpStatus (WINGDIPAPI * pGdipDrawClosedCurve2I)(GpGraphics*,GpPen*,
+ GDIPCONST GpPoint*,INT,REAL);
+static GpStatus (WINGDIPAPI * pGdipDrawCurve)(GpGraphics*,GpPen*,
+ GDIPCONST GpPointF*,INT);
+static GpStatus (WINGDIPAPI * pGdipDrawCurveI)(GpGraphics*,GpPen*,
+ GDIPCONST GpPoint*,INT);
+static GpStatus (WINGDIPAPI * pGdipDrawCurve2)(GpGraphics*,GpPen*,
+ GDIPCONST GpPointF*,INT,REAL);
+static GpStatus (WINGDIPAPI * pGdipDrawCurve2I)(GpGraphics*,GpPen*,
+ GDIPCONST GpPoint*,INT,REAL);
+static GpStatus (WINGDIPAPI * pGdipDrawEllipse)(GpGraphics*,GpPen*,REAL,REAL,
+ REAL,REAL);
+static GpStatus (WINGDIPAPI * pGdipDrawEllipseI)(GpGraphics*,GpPen*,INT,INT,INT,
+ INT);
+static GpStatus (WINGDIPAPI * pGdipDrawLine)(GpGraphics*,GpPen*,REAL,REAL,REAL,
+ REAL);
+static GpStatus (WINGDIPAPI * pGdipDrawLineI)(GpGraphics*,GpPen*,INT,INT,INT,
+ INT);
+static GpStatus (WINGDIPAPI * pGdipDrawLines)(GpGraphics*,GpPen*,
+ GDIPCONST GpPointF*,INT);
+static GpStatus (WINGDIPAPI * pGdipDrawLinesI)(GpGraphics*,GpPen*,
+ GDIPCONST GpPoint*,INT);
+static GpStatus (WINGDIPAPI * pGdipDrawPath)(GpGraphics*,GpPen*,GpPath*);
+static GpStatus (WINGDIPAPI * pGdipDrawPie)(GpGraphics*,GpPen*,REAL,REAL,REAL,
+ REAL,REAL,REAL);
+static GpStatus (WINGDIPAPI * pGdipDrawPieI)(GpGraphics*,GpPen*,INT,INT,INT,INT,
+ REAL,REAL);
+static GpStatus (WINGDIPAPI * pGdipDrawPolygon)(GpGraphics*,GpPen*,
+ GDIPCONST GpPointF*,INT);
+static GpStatus (WINGDIPAPI * pGdipDrawPolygonI)(GpGraphics*,GpPen*,
+ GDIPCONST GpPoint*,INT);
+static GpStatus (WINGDIPAPI * pGdipDrawRectangle)(GpGraphics*,GpPen*,REAL,REAL,
+ REAL,REAL);
+static GpStatus (WINGDIPAPI * pGdipDrawRectangleI)(GpGraphics*,GpPen*,INT,INT,
+ INT,INT);
+static GpStatus (WINGDIPAPI * pGdipDrawRectangles)(GpGraphics*,GpPen*,
+ GDIPCONST GpRectF*,INT);
+static GpStatus (WINGDIPAPI * pGdipDrawRectanglesI)(GpGraphics*,GpPen*,
+ GDIPCONST GpRect*,INT);
+static GpStatus (WINGDIPAPI * pGdipFillClosedCurve2)(GpGraphics*,GpBrush*,
+ GDIPCONST GpPointF*,INT,REAL,GpFillMode);
+static GpStatus (WINGDIPAPI * pGdipFillClosedCurve2I)(GpGraphics*,GpBrush*,
+ GDIPCONST GpPoint*,INT,REAL,GpFillMode);
+static GpStatus (WINGDIPAPI * pGdipFillEllipse)(GpGraphics*,GpBrush*,REAL,REAL,
+ REAL,REAL);
+static GpStatus (WINGDIPAPI * pGdipFillEllipseI)(GpGraphics*,GpBrush*,INT,INT,
+ INT,INT);
+static GpStatus (WINGDIPAPI * pGdipFillPath)(GpGraphics*,GpBrush*,GpPath*);
+static GpStatus (WINGDIPAPI * pGdipFillPie)(GpGraphics*,GpBrush*,REAL,REAL,REAL,
+ REAL,REAL,REAL);
+static GpStatus (WINGDIPAPI * pGdipFillPieI)(GpGraphics*,GpBrush*,INT,INT,INT,
+ INT,REAL,REAL);
+static GpStatus (WINGDIPAPI * pGdipFillPolygon)(GpGraphics*,GpBrush*,
+ GDIPCONST GpPointF*,INT,GpFillMode);
+static GpStatus (WINGDIPAPI * pGdipFillPolygonI)(GpGraphics*,GpBrush*,
+ GDIPCONST GpPoint*,INT,GpFillMode);
+static GpStatus (WINGDIPAPI * pGdipFillPolygon2)(GpGraphics*,GpBrush*,
+ GDIPCONST GpPointF*,INT);
+static GpStatus (WINGDIPAPI * pGdipFillPolygon2I)(GpGraphics*,GpBrush*,
+ GDIPCONST GpPoint*,INT);
+static GpStatus (WINGDIPAPI * pGdipFillRectangle)(GpGraphics*,GpBrush*,REAL,
+ REAL,REAL,REAL);
+static GpStatus (WINGDIPAPI * pGdipFillRectangleI)(GpGraphics*,GpBrush*,INT,INT,
+ INT,INT);
+static GpStatus (WINGDIPAPI * pGdipFillRectangles)(GpGraphics*,GpBrush*,
+ GDIPCONST GpRectF*,INT);
+static GpStatus (WINGDIPAPI * pGdipFillRectanglesI)(GpGraphics*,GpBrush*,
+ GDIPCONST GpRect*,INT);
+static GpStatus (WINGDIPAPI * pGdipFillRegion)(GpGraphics*,GpBrush*,GpRegion*);
+static GpStatus (WINGDIPAPI * pGdipGetClip)(GpGraphics*,GpRegion*);
+static GpStatus (WINGDIPAPI * pGdipGetClipBounds)(GpGraphics*,GpRectF*);
+static GpStatus (WINGDIPAPI * pGdipGetClipBoundsI)(GpGraphics*,GpRect*);
+static GpStatus (WINGDIPAPI * pGdipGetCompositingMode)(GpGraphics*,
+ CompositingMode*);
+static GpStatus (WINGDIPAPI * pGdipGetCompositingQuality)(GpGraphics*,
+ CompositingQuality*);
+static GpStatus (WINGDIPAPI * pGdipGetDC)(GpGraphics*,HDC*);
+static GpStatus (WINGDIPAPI * pGdipGetDpiX)(GpGraphics*,REAL*);
+static GpStatus (WINGDIPAPI * pGdipGetDpiY)(GpGraphics*,REAL*);
+static GpStatus (WINGDIPAPI * pGdipGetInterpolationMode)(GpGraphics*,
+ InterpolationMode*);
+static GpStatus (WINGDIPAPI * pGdipGetNearestColor)(GpGraphics*,ARGB*);
+static GpStatus (WINGDIPAPI * pGdipGetPageScale)(GpGraphics*,REAL*);
+static GpStatus (WINGDIPAPI * pGdipGetPageUnit)(GpGraphics*,GpUnit*);
+static GpStatus (WINGDIPAPI * pGdipGetPixelOffsetMode)(GpGraphics*,
+ PixelOffsetMode*);
+static GpStatus (WINGDIPAPI * pGdipGetSmoothingMode)(GpGraphics*,
+ SmoothingMode*);
+static GpStatus (WINGDIPAPI * pGdipGetTextContrast)(GpGraphics*,UINT*);
+static GpStatus (WINGDIPAPI * pGdipGetTextRenderingHint)(GpGraphics*,
+ TextRenderingHint*);
+static GpStatus (WINGDIPAPI * pGdipGetWorldTransform)(GpGraphics*,GpMatrix*);
+static GpStatus (WINGDIPAPI * pGdipGraphicsClear)(GpGraphics*,ARGB);
+static GpStatus (WINGDIPAPI * pGdipIsClipEmpty)(GpGraphics*,BOOL*);
+static GpStatus (WINGDIPAPI * pGdipIsVisiblePoint)(GpGraphics*,REAL,REAL,BOOL*);
+static GpStatus (WINGDIPAPI * pGdipIsVisiblePointI)(GpGraphics*,INT,INT,BOOL*);
+static GpStatus (WINGDIPAPI * pGdipMultiplyWorldTransform)(GpGraphics*,
+ GDIPCONST GpMatrix*,GpMatrixOrder);
+static GpStatus (WINGDIPAPI * pGdipReleaseDC)(GpGraphics*,HDC);
+static GpStatus (WINGDIPAPI * pGdipResetClip)(GpGraphics*);
+static GpStatus (WINGDIPAPI * pGdipResetWorldTransform)(GpGraphics*);
+static GpStatus (WINGDIPAPI * pGdipRestoreGraphics)(GpGraphics*,GraphicsState);
+static GpStatus (WINGDIPAPI * pGdipRotateWorldTransform)(GpGraphics*,REAL,
+ GpMatrixOrder);
+static GpStatus (WINGDIPAPI * pGdipSaveGraphics)(GpGraphics*,GraphicsState*);
+static GpStatus (WINGDIPAPI * pGdipScaleWorldTransform)(GpGraphics*,REAL,REAL,
+ GpMatrixOrder);
+static GpStatus (WINGDIPAPI * pGdipSetClipHrgn)(GpGraphics*,HRGN,CombineMode);
+static GpStatus (WINGDIPAPI * pGdipSetClipPath)(GpGraphics*,GpPath*,
+ CombineMode);
+static GpStatus (WINGDIPAPI * pGdipSetClipRect)(GpGraphics*,REAL,REAL,REAL,REAL,
+ CombineMode);
+static GpStatus (WINGDIPAPI * pGdipSetClipRectI)(GpGraphics*,INT,INT,INT,INT,
+ CombineMode);
+static GpStatus (WINGDIPAPI * pGdipSetClipRegion)(GpGraphics*,GpRegion*,
+ CombineMode);
+static GpStatus (WINGDIPAPI * pGdipSetCompositingMode)(GpGraphics*,
+ CompositingMode);
+static GpStatus (WINGDIPAPI * pGdipSetCompositingQuality)(GpGraphics*,
+ CompositingQuality);
+static GpStatus (WINGDIPAPI * pGdipSetInterpolationMode)(GpGraphics*,
+ InterpolationMode);
+static GpStatus (WINGDIPAPI * pGdipSetPageScale)(GpGraphics*,REAL);
+static GpStatus (WINGDIPAPI * pGdipSetPageUnit)(GpGraphics*,GpUnit);
+static GpStatus (WINGDIPAPI * pGdipSetPixelOffsetMode)(GpGraphics*,
+ PixelOffsetMode);
+static GpStatus (WINGDIPAPI * pGdipSetSmoothingMode)(GpGraphics*,SmoothingMode);
+static GpStatus (WINGDIPAPI * pGdipSetTextRenderingHint)(GpGraphics*,
+ TextRenderingHint);
+static GpStatus (WINGDIPAPI * pGdipSetWorldTransform)(GpGraphics*,GpMatrix*);
+static GpStatus (WINGDIPAPI * pGdipTransformPoints)(GpGraphics*,
+ GpCoordinateSpace,GpCoordinateSpace,GpPointF*,INT);
+static GpStatus (WINGDIPAPI * pGdipTranslateClip)(GpGraphics*,REAL,REAL);
+static GpStatus (WINGDIPAPI * pGdipTranslateClipI)(GpGraphics*,INT,INT);
+static GpStatus (WINGDIPAPI * pGdipTranslateWorldTransform)(GpGraphics*,REAL,
+ REAL,GpMatrixOrder);
+static GpStatus (WINGDIPAPI * pGdipCreatePath)(GpFillMode,GpPath**);
+static GpStatus (WINGDIPAPI * pGdipDeletePath)(GpPath*);
+static GpStatus (WINGDIPAPI * pGdipCreateMatrix)(GpMatrix**);
+static GpStatus (WINGDIPAPI * pGdipDeleteMatrix)(GpMatrix*);
+static GpStatus (WINGDIPAPI * pGdipCreatePen1)(ARGB,REAL,GpUnit,GpPen**);
+static GpStatus (WINGDIPAPI * pGdipDeletePen)(GpPen*);
+static GpStatus (WINGDIPAPI * pGdipCreateRegion)(GpRegion**);
+static GpStatus (WINGDIPAPI * pGdipCreateRegionRect)(GDIPCONST GpRectF*,
+ GpRegion**);
+static GpStatus (WINGDIPAPI * pGdipDeleteRegion)(GpRegion*);
+static GpStatus (WINGDIPAPI * pGdipIsEmptyRegion)(GpRegion*,GpGraphics*,
+ BOOL*);
+static GpStatus (WINGDIPAPI * pGdipIsInfiniteRegion)(GpRegion*,GpGraphics*,
+ BOOL*);
+static GpStatus (WINGDIPAPI * pGdipSetEmpty)(GpRegion*);
+static GpStatus (WINGDIPAPI * pGdipCreateSolidFill)(ARGB,GpSolidFill**);
+static Status (WINAPI * pGdiplusStartup)(ULONG_PTR*,
+ const struct GdiplusStartupInput*,struct GdiplusStartupOutput*);
+static void (WINAPI * pGdiplusShutdown)(ULONG_PTR);
+static void (WINGDIPAPI * pGdipFree)(void*);
+
+static HMODULE hGdiPlus = 0;
+
+static BOOL InitFunctionPtrs(void)
+{
+ hGdiPlus = LoadLibraryA("gdiplus.dll");
+ if (!hGdiPlus)
+ {
+ trace("Could not load gdiplus.dll\n");
+ return FALSE;
+ }
+
+#define GDIPLUS_GET_PROC(func) \
+ p ## func = (void*)GetProcAddress(hGdiPlus, #func); \
+ if (!p ## func) \
+ { \
+ trace("GetProcAddress(%s) failed\n", #func); \
+ FreeLibrary(hGdiPlus); \
+ return FALSE; \
+ }
+
+ GDIPLUS_GET_PROC(GdipAlloc)
+ GDIPLUS_GET_PROC(GdipCreateFromHDC)
+ GDIPLUS_GET_PROC(GdipCreateFromHWND)
+ GDIPLUS_GET_PROC(GdipCreateFromHWNDICM)
+ GDIPLUS_GET_PROC(GdipCreateMatrix)
+ GDIPLUS_GET_PROC(GdipCreatePath)
+ GDIPLUS_GET_PROC(GdipCreatePen1)
+ GDIPLUS_GET_PROC(GdipCreateRegion)
+ GDIPLUS_GET_PROC(GdipCreateRegionRect)
+ GDIPLUS_GET_PROC(GdipCreateSolidFill)
+ GDIPLUS_GET_PROC(GdipDeleteBrush)
+ GDIPLUS_GET_PROC(GdipDeleteGraphics)
+ GDIPLUS_GET_PROC(GdipDeleteMatrix)
+ GDIPLUS_GET_PROC(GdipDeletePath)
+ GDIPLUS_GET_PROC(GdipDeletePen)
+ GDIPLUS_GET_PROC(GdipDeleteRegion)
+ GDIPLUS_GET_PROC(GdipDrawArc)
+ GDIPLUS_GET_PROC(GdipDrawArcI)
+ GDIPLUS_GET_PROC(GdipDrawBezier)
+ GDIPLUS_GET_PROC(GdipDrawBezierI)
+ GDIPLUS_GET_PROC(GdipDrawBeziers)
+ GDIPLUS_GET_PROC(GdipDrawBeziersI)
+ GDIPLUS_GET_PROC(GdipDrawClosedCurve)
+ GDIPLUS_GET_PROC(GdipDrawClosedCurve2)
+ GDIPLUS_GET_PROC(GdipDrawClosedCurve2I)
+ GDIPLUS_GET_PROC(GdipDrawClosedCurveI)
+ GDIPLUS_GET_PROC(GdipDrawCurve)
+ GDIPLUS_GET_PROC(GdipDrawCurve2)
+ GDIPLUS_GET_PROC(GdipDrawCurve2I)
+ GDIPLUS_GET_PROC(GdipDrawCurveI)
+ GDIPLUS_GET_PROC(GdipDrawEllipse)
+ GDIPLUS_GET_PROC(GdipDrawEllipseI)
+ GDIPLUS_GET_PROC(GdipDrawLine)
+ GDIPLUS_GET_PROC(GdipDrawLineI)
+ GDIPLUS_GET_PROC(GdipDrawLines)
+ GDIPLUS_GET_PROC(GdipDrawLinesI)
+ GDIPLUS_GET_PROC(GdipDrawPath)
+ GDIPLUS_GET_PROC(GdipDrawPie)
+ GDIPLUS_GET_PROC(GdipDrawPieI)
+ GDIPLUS_GET_PROC(GdipDrawPolygon)
+ GDIPLUS_GET_PROC(GdipDrawPolygonI)
+ GDIPLUS_GET_PROC(GdipDrawRectangle)
+ GDIPLUS_GET_PROC(GdipDrawRectangleI)
+ GDIPLUS_GET_PROC(GdipDrawRectangles)
+ GDIPLUS_GET_PROC(GdipDrawRectanglesI)
+ GDIPLUS_GET_PROC(GdipFillClosedCurve2)
+ GDIPLUS_GET_PROC(GdipFillClosedCurve2I)
+ GDIPLUS_GET_PROC(GdipFillEllipse)
+ GDIPLUS_GET_PROC(GdipFillEllipseI)
+ GDIPLUS_GET_PROC(GdipFillPath)
+ GDIPLUS_GET_PROC(GdipFillPie)
+ GDIPLUS_GET_PROC(GdipFillPieI)
+ GDIPLUS_GET_PROC(GdipFillPolygon2)
+ GDIPLUS_GET_PROC(GdipFillPolygon2I)
+ GDIPLUS_GET_PROC(GdipFillPolygon)
+ GDIPLUS_GET_PROC(GdipFillPolygonI)
+ GDIPLUS_GET_PROC(GdipFillRectangle)
+ GDIPLUS_GET_PROC(GdipFillRectangleI)
+ GDIPLUS_GET_PROC(GdipFillRectangles)
+ GDIPLUS_GET_PROC(GdipFillRectanglesI)
+ GDIPLUS_GET_PROC(GdipFillRegion)
+ GDIPLUS_GET_PROC(GdipFlush)
+ GDIPLUS_GET_PROC(GdipFree)
+ GDIPLUS_GET_PROC(GdipGetClip)
+ GDIPLUS_GET_PROC(GdipGetClipBounds)
+ GDIPLUS_GET_PROC(GdipGetClipBoundsI)
+ GDIPLUS_GET_PROC(GdipGetCompositingMode)
+ GDIPLUS_GET_PROC(GdipGetCompositingQuality)
+ GDIPLUS_GET_PROC(GdipGetDC)
+ GDIPLUS_GET_PROC(GdipGetDpiX)
+ GDIPLUS_GET_PROC(GdipGetDpiY)
+ GDIPLUS_GET_PROC(GdipGetInterpolationMode)
+ GDIPLUS_GET_PROC(GdipGetNearestColor)
+ GDIPLUS_GET_PROC(GdipGetPageScale)
+ GDIPLUS_GET_PROC(GdipGetPageUnit)
+ GDIPLUS_GET_PROC(GdipGetPixelOffsetMode)
+ GDIPLUS_GET_PROC(GdipGetSmoothingMode)
+ GDIPLUS_GET_PROC(GdipGetTextContrast)
+ GDIPLUS_GET_PROC(GdipGetTextRenderingHint)
+ GDIPLUS_GET_PROC(GdipGetWorldTransform)
+ GDIPLUS_GET_PROC(GdipGraphicsClear)
+ GDIPLUS_GET_PROC(GdipIsClipEmpty)
+ GDIPLUS_GET_PROC(GdipIsEmptyRegion)
+ GDIPLUS_GET_PROC(GdipIsInfiniteRegion)
+ GDIPLUS_GET_PROC(GdipIsVisiblePoint)
+ GDIPLUS_GET_PROC(GdipIsVisiblePointI)
+ GDIPLUS_GET_PROC(GdiplusShutdown)
+ GDIPLUS_GET_PROC(GdiplusStartup)
+ GDIPLUS_GET_PROC(GdipMultiplyWorldTransform)
+ GDIPLUS_GET_PROC(GdipReleaseDC)
+ GDIPLUS_GET_PROC(GdipReleaseDC)
+ GDIPLUS_GET_PROC(GdipResetClip)
+ GDIPLUS_GET_PROC(GdipResetWorldTransform)
+ GDIPLUS_GET_PROC(GdipRestoreGraphics)
+ GDIPLUS_GET_PROC(GdipRotateWorldTransform)
+ GDIPLUS_GET_PROC(GdipSaveGraphics)
+ GDIPLUS_GET_PROC(GdipScaleWorldTransform)
+ GDIPLUS_GET_PROC(GdipSetClipHrgn)
+ GDIPLUS_GET_PROC(GdipSetClipPath)
+ GDIPLUS_GET_PROC(GdipSetClipRect)
+ GDIPLUS_GET_PROC(GdipSetClipRectI)
+ GDIPLUS_GET_PROC(GdipSetClipRegion)
+ GDIPLUS_GET_PROC(GdipSetCompositingMode)
+ GDIPLUS_GET_PROC(GdipSetCompositingQuality)
+ GDIPLUS_GET_PROC(GdipSetEmpty)
+ GDIPLUS_GET_PROC(GdipSetInterpolationMode)
+ GDIPLUS_GET_PROC(GdipSetPageScale)
+ GDIPLUS_GET_PROC(GdipSetPageUnit)
+ GDIPLUS_GET_PROC(GdipSetPixelOffsetMode)
+ GDIPLUS_GET_PROC(GdipSetSmoothingMode)
+ GDIPLUS_GET_PROC(GdipSetTextRenderingHint)
+ GDIPLUS_GET_PROC(GdipSetWorldTransform)
+ GDIPLUS_GET_PROC(GdipTransformPoints)
+ GDIPLUS_GET_PROC(GdipTranslateClip)
+ GDIPLUS_GET_PROC(GdipTranslateClipI)
+ GDIPLUS_GET_PROC(GdipTranslateWorldTransform)
+
+#undef GDIPLUS_GET_PROC
+
+ return TRUE;
+}
+
static void test_constructor_destructor(void)
{
GpStatus stat;
GpGraphics *graphics = NULL;
HDC hdc = GetDC(0);
- stat = GdipCreateFromHDC(NULL, &graphics);
+ stat = pGdipCreateFromHDC(NULL, &graphics);
expect(OutOfMemory, stat);
- stat = GdipDeleteGraphics(graphics);
+ stat = pGdipDeleteGraphics(graphics);
expect(InvalidParameter, stat);
- stat = GdipCreateFromHDC(hdc, &graphics);
+ stat = pGdipCreateFromHDC(hdc, &graphics);
expect(Ok, stat);
- stat = GdipDeleteGraphics(graphics);
+ stat = pGdipDeleteGraphics(graphics);
expect(Ok, stat);
- stat = GdipCreateFromHWND(NULL, &graphics);
+ stat = pGdipCreateFromHWND(NULL, &graphics);
expect(Ok, stat);
- stat = GdipDeleteGraphics(graphics);
+ stat = pGdipDeleteGraphics(graphics);
expect(Ok, stat);
- stat = GdipCreateFromHWNDICM(NULL, &graphics);
+ stat = pGdipCreateFromHWNDICM(NULL, &graphics);
expect(Ok, stat);
- stat = GdipDeleteGraphics(graphics);
+ stat = pGdipDeleteGraphics(graphics);
expect(Ok, stat);
- stat = GdipDeleteGraphics(NULL);
+ stat = pGdipDeleteGraphics(NULL);
expect(InvalidParameter, stat);
ReleaseDC(0, hdc);
}
@@ -117,74 +441,74 @@ static void test_save_restore(void)
state_a = state_b = state_c = 0xdeadbeef;
/* Invalid saving. */
- GdipCreateFromHDC(hdc, &graphics1);
- stat = GdipSaveGraphics(graphics1, NULL);
+ pGdipCreateFromHDC(hdc, &graphics1);
+ stat = pGdipSaveGraphics(graphics1, NULL);
expect(InvalidParameter, stat);
- stat = GdipSaveGraphics(NULL, &state_a);
+ stat = pGdipSaveGraphics(NULL, &state_a);
expect(InvalidParameter, stat);
- GdipDeleteGraphics(graphics1);
+ pGdipDeleteGraphics(graphics1);
log_state(state_a, &state_log);
/* Basic save/restore. */
- GdipCreateFromHDC(hdc, &graphics1);
- GdipSetInterpolationMode(graphics1, InterpolationModeBilinear);
- stat = GdipSaveGraphics(graphics1, &state_a);
+ pGdipCreateFromHDC(hdc, &graphics1);
+ pGdipSetInterpolationMode(graphics1, InterpolationModeBilinear);
+ stat = pGdipSaveGraphics(graphics1, &state_a);
expect(Ok, stat);
- GdipSetInterpolationMode(graphics1, InterpolationModeBicubic);
- stat = GdipRestoreGraphics(graphics1, state_a);
+ pGdipSetInterpolationMode(graphics1, InterpolationModeBicubic);
+ stat = pGdipRestoreGraphics(graphics1, state_a);
expect(Ok, stat);
- GdipGetInterpolationMode(graphics1, &mode);
+ pGdipGetInterpolationMode(graphics1, &mode);
todo_wine
expect(InterpolationModeBilinear, mode);
- GdipDeleteGraphics(graphics1);
+ pGdipDeleteGraphics(graphics1);
log_state(state_a, &state_log);
/* Restoring garbage doesn't affect saves. */
- GdipCreateFromHDC(hdc, &graphics1);
- GdipSetInterpolationMode(graphics1, InterpolationModeBilinear);
- GdipSaveGraphics(graphics1, &state_a);
- GdipSetInterpolationMode(graphics1, InterpolationModeBicubic);
- GdipSaveGraphics(graphics1, &state_b);
- GdipSetInterpolationMode(graphics1, InterpolationModeNearestNeighbor);
- stat = GdipRestoreGraphics(graphics1, 0xdeadbeef);
+ pGdipCreateFromHDC(hdc, &graphics1);
+ pGdipSetInterpolationMode(graphics1, InterpolationModeBilinear);
+ pGdipSaveGraphics(graphics1, &state_a);
+ pGdipSetInterpolationMode(graphics1, InterpolationModeBicubic);
+ pGdipSaveGraphics(graphics1, &state_b);
+ pGdipSetInterpolationMode(graphics1, InterpolationModeNearestNeighbor);
+ stat = pGdipRestoreGraphics(graphics1, 0xdeadbeef);
expect(Ok, stat);
- GdipRestoreGraphics(graphics1, state_b);
- GdipGetInterpolationMode(graphics1, &mode);
+ pGdipRestoreGraphics(graphics1, state_b);
+ pGdipGetInterpolationMode(graphics1, &mode);
todo_wine
expect(InterpolationModeBicubic, mode);
- GdipRestoreGraphics(graphics1, state_a);
- GdipGetInterpolationMode(graphics1, &mode);
+ pGdipRestoreGraphics(graphics1, state_a);
+ pGdipGetInterpolationMode(graphics1, &mode);
todo_wine
expect(InterpolationModeBilinear, mode);
- GdipDeleteGraphics(graphics1);
+ pGdipDeleteGraphics(graphics1);
log_state(state_a, &state_log);
log_state(state_b, &state_log);
/* Restoring older state invalidates newer saves (but not older saves). */
- GdipCreateFromHDC(hdc, &graphics1);
- GdipSetInterpolationMode(graphics1, InterpolationModeBilinear);
- GdipSaveGraphics(graphics1, &state_a);
- GdipSetInterpolationMode(graphics1, InterpolationModeBicubic);
- GdipSaveGraphics(graphics1, &state_b);
- GdipSetInterpolationMode(graphics1, InterpolationModeNearestNeighbor);
- GdipSaveGraphics(graphics1, &state_c);
- GdipSetInterpolationMode(graphics1, InterpolationModeHighQualityBilinear);
- GdipRestoreGraphics(graphics1, state_b);
- GdipGetInterpolationMode(graphics1, &mode);
+ pGdipCreateFromHDC(hdc, &graphics1);
+ pGdipSetInterpolationMode(graphics1, InterpolationModeBilinear);
+ pGdipSaveGraphics(graphics1, &state_a);
+ pGdipSetInterpolationMode(graphics1, InterpolationModeBicubic);
+ pGdipSaveGraphics(graphics1, &state_b);
+ pGdipSetInterpolationMode(graphics1, InterpolationModeNearestNeighbor);
+ pGdipSaveGraphics(graphics1, &state_c);
+ pGdipSetInterpolationMode(graphics1, InterpolationModeHighQualityBilinear);
+ pGdipRestoreGraphics(graphics1, state_b);
+ pGdipGetInterpolationMode(graphics1, &mode);
todo_wine
expect(InterpolationModeBicubic, mode);
- GdipRestoreGraphics(graphics1, state_c);
- GdipGetInterpolationMode(graphics1, &mode);
+ pGdipRestoreGraphics(graphics1, state_c);
+ pGdipGetInterpolationMode(graphics1, &mode);
todo_wine
expect(InterpolationModeBicubic, mode);
- GdipRestoreGraphics(graphics1, state_a);
- GdipGetInterpolationMode(graphics1, &mode);
+ pGdipRestoreGraphics(graphics1, state_a);
+ pGdipGetInterpolationMode(graphics1, &mode);
todo_wine
expect(InterpolationModeBilinear, mode);
- GdipDeleteGraphics(graphics1);
+ pGdipDeleteGraphics(graphics1);
log_state(state_a, &state_log);
log_state(state_b, &state_log);
@@ -192,37 +516,37 @@ static void test_save_restore(void)
/* Restoring older save from one graphics object does not invalidate
* newer save from other graphics object. */
- GdipCreateFromHDC(hdc, &graphics1);
- GdipCreateFromHDC(hdc, &graphics2);
- GdipSetInterpolationMode(graphics1, InterpolationModeBilinear);
- GdipSaveGraphics(graphics1, &state_a);
- GdipSetInterpolationMode(graphics2, InterpolationModeBicubic);
- GdipSaveGraphics(graphics2, &state_b);
- GdipSetInterpolationMode(graphics1, InterpolationModeNearestNeighbor);
- GdipSetInterpolationMode(graphics2, InterpolationModeNearestNeighbor);
- GdipRestoreGraphics(graphics1, state_a);
- GdipGetInterpolationMode(graphics1, &mode);
+ pGdipCreateFromHDC(hdc, &graphics1);
+ pGdipCreateFromHDC(hdc, &graphics2);
+ pGdipSetInterpolationMode(graphics1, InterpolationModeBilinear);
+ pGdipSaveGraphics(graphics1, &state_a);
+ pGdipSetInterpolationMode(graphics2, InterpolationModeBicubic);
+ pGdipSaveGraphics(graphics2, &state_b);
+ pGdipSetInterpolationMode(graphics1, InterpolationModeNearestNeighbor);
+ pGdipSetInterpolationMode(graphics2, InterpolationModeNearestNeighbor);
+ pGdipRestoreGraphics(graphics1, state_a);
+ pGdipGetInterpolationMode(graphics1, &mode);
todo_wine
expect(InterpolationModeBilinear, mode);
- GdipRestoreGraphics(graphics2, state_b);
- GdipGetInterpolationMode(graphics2, &mode);
+ pGdipRestoreGraphics(graphics2, state_b);
+ pGdipGetInterpolationMode(graphics2, &mode);
todo_wine
expect(InterpolationModeBicubic, mode);
- GdipDeleteGraphics(graphics1);
- GdipDeleteGraphics(graphics2);
+ pGdipDeleteGraphics(graphics1);
+ pGdipDeleteGraphics(graphics2);
/* You can't restore a state to a graphics object that didn't save it. */
- GdipCreateFromHDC(hdc, &graphics1);
- GdipCreateFromHDC(hdc, &graphics2);
- GdipSetInterpolationMode(graphics1, InterpolationModeBilinear);
- GdipSaveGraphics(graphics1, &state_a);
- GdipSetInterpolationMode(graphics1, InterpolationModeNearestNeighbor);
- GdipSetInterpolationMode(graphics2, InterpolationModeNearestNeighbor);
- GdipRestoreGraphics(graphics2, state_a);
- GdipGetInterpolationMode(graphics2, &mode);
+ pGdipCreateFromHDC(hdc, &graphics1);
+ pGdipCreateFromHDC(hdc, &graphics2);
+ pGdipSetInterpolationMode(graphics1, InterpolationModeBilinear);
+ pGdipSaveGraphics(graphics1, &state_a);
+ pGdipSetInterpolationMode(graphics1, InterpolationModeNearestNeighbor);
+ pGdipSetInterpolationMode(graphics2, InterpolationModeNearestNeighbor);
+ pGdipRestoreGraphics(graphics2, state_a);
+ pGdipGetInterpolationMode(graphics2, &mode);
expect(InterpolationModeNearestNeighbor, mode);
- GdipDeleteGraphics(graphics1);
- GdipDeleteGraphics(graphics2);
+ pGdipDeleteGraphics(graphics1);
+ pGdipDeleteGraphics(graphics2);
log_state(state_a, &state_log);
@@ -241,40 +565,40 @@ static void test_GdipDrawArc(void)
HDC hdc = GetDC(0);
/* make a graphics object and pen object */
- status = GdipCreateFromHDC(hdc, &graphics);
+ status = pGdipCreateFromHDC(hdc, &graphics);
expect(Ok, status);
ok(hdc != NULL, "Expected HDC to be initialized\n");
- status = GdipCreateFromHDC(hdc, &graphics);
+ status = pGdipCreateFromHDC(hdc, &graphics);
expect(Ok, status);
ok(graphics != NULL, "Expected graphics to be initialized\n");
- status = GdipCreatePen1((ARGB)0xffff00ff, 10.0f, UnitPixel, &pen);
+ status = pGdipCreatePen1((ARGB)0xffff00ff, 10.0f, UnitPixel, &pen);
expect(Ok, status);
ok(pen != NULL, "Expected pen to be initialized\n");
/* InvalidParameter cases: null graphics, null pen, non-positive width, non-positive height */
- status = GdipDrawArc(NULL, NULL, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
+ status = pGdipDrawArc(NULL, NULL, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
expect(InvalidParameter, status);
- status = GdipDrawArc(graphics, NULL, 0.0, 0.0, 1.0, 1.0, 0.0, 0.0);
+ status = pGdipDrawArc(graphics, NULL, 0.0, 0.0, 1.0, 1.0, 0.0, 0.0);
expect(InvalidParameter, status);
- status = GdipDrawArc(NULL, pen, 0.0, 0.0, 1.0, 1.0, 0.0, 0.0);
+ status = pGdipDrawArc(NULL, pen, 0.0, 0.0, 1.0, 1.0, 0.0, 0.0);
expect(InvalidParameter, status);
- status = GdipDrawArc(graphics, pen, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0);
+ status = pGdipDrawArc(graphics, pen, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0);
expect(InvalidParameter, status);
- status = GdipDrawArc(graphics, pen, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0);
+ status = pGdipDrawArc(graphics, pen, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0);
expect(InvalidParameter, status);
/* successful case */
- status = GdipDrawArc(graphics, pen, 0.0, 0.0, 1.0, 1.0, 0.0, 0.0);
+ status = pGdipDrawArc(graphics, pen, 0.0, 0.0, 1.0, 1.0, 0.0, 0.0);
expect(Ok, status);
- GdipDeletePen(pen);
- GdipDeleteGraphics(graphics);
+ pGdipDeletePen(pen);
+ pGdipDeleteGraphics(graphics);
ReleaseDC(0, hdc);
}
@@ -287,40 +611,40 @@ static void test_GdipDrawArcI(void)
HDC hdc = GetDC(0);
/* make a graphics object and pen object */
- status = GdipCreateFromHDC(hdc, &graphics);
+ status = pGdipCreateFromHDC(hdc, &graphics);
expect(Ok, status);
ok(hdc != NULL, "Expected HDC to be initialized\n");
- status = GdipCreateFromHDC(hdc, &graphics);
+ status = pGdipCreateFromHDC(hdc, &graphics);
expect(Ok, status);
ok(graphics != NULL, "Expected graphics to be initialized\n");
- status = GdipCreatePen1((ARGB)0xffff00ff, 10.0f, UnitPixel, &pen);
+ status = pGdipCreatePen1((ARGB)0xffff00ff, 10.0f, UnitPixel, &pen);
expect(Ok, status);
ok(pen != NULL, "Expected pen to be initialized\n");
/* InvalidParameter cases: null graphics, null pen, non-positive width, non-positive height */
- status = GdipDrawArcI(NULL, NULL, 0, 0, 0, 0, 0, 0);
+ status = pGdipDrawArcI(NULL, NULL, 0, 0, 0, 0, 0, 0);
expect(InvalidParameter, status);
- status = GdipDrawArcI(graphics, NULL, 0, 0, 1, 1, 0, 0);
+ status = pGdipDrawArcI(graphics, NULL, 0, 0, 1, 1, 0, 0);
expect(InvalidParameter, status);
- status = GdipDrawArcI(NULL, pen, 0, 0, 1, 1, 0, 0);
+ status = pGdipDrawArcI(NULL, pen, 0, 0, 1, 1, 0, 0);
expect(InvalidParameter, status);
- status = GdipDrawArcI(graphics, pen, 0, 0, 1, 0, 0, 0);
+ status = pGdipDrawArcI(graphics, pen, 0, 0, 1, 0, 0, 0);
expect(InvalidParameter, status);
- status = GdipDrawArcI(graphics, pen, 0, 0, 0, 1, 0, 0);
+ status = pGdipDrawArcI(graphics, pen, 0, 0, 0, 1, 0, 0);
expect(InvalidParameter, status);
/* successful case */
- status = GdipDrawArcI(graphics, pen, 0, 0, 1, 1, 0, 0);
+ status = pGdipDrawArcI(graphics, pen, 0, 0, 1, 1, 0, 0);
expect(Ok, status);
- GdipDeletePen(pen);
- GdipDeleteGraphics(graphics);
+ pGdipDeletePen(pen);
+ pGdipDeleteGraphics(graphics);
ReleaseDC(0, hdc);
}
@@ -333,34 +657,34 @@ static void test_GdipDrawBezierI(void)
HDC hdc = GetDC(0);
/* make a graphics object and pen object */
- status = GdipCreateFromHDC(hdc, &graphics);
+ status = pGdipCreateFromHDC(hdc, &graphics);
expect(Ok, status);
ok(hdc != NULL, "Expected HDC to be initialized\n");
- status = GdipCreateFromHDC(hdc, &graphics);
+ status = pGdipCreateFromHDC(hdc, &graphics);
expect(Ok, status);
ok(graphics != NULL, "Expected graphics to be initialized\n");
- status = GdipCreatePen1((ARGB)0xffff00ff, 10.0f, UnitPixel, &pen);
+ status = pGdipCreatePen1((ARGB)0xffff00ff, 10.0f, UnitPixel, &pen);
expect(Ok, status);
ok(pen != NULL, "Expected pen to be initialized\n");
/* InvalidParameter cases: null graphics, null pen */
- status = GdipDrawBezierI(NULL, NULL, 0, 0, 0, 0, 0, 0, 0, 0);
+ status = pGdipDrawBezierI(NULL, NULL, 0, 0, 0, 0, 0, 0, 0, 0);
expect(InvalidParameter, status);
- status = GdipDrawBezierI(graphics, NULL, 0, 0, 0, 0, 0, 0, 0, 0);
+ status = pGdipDrawBezierI(graphics, NULL, 0, 0, 0, 0, 0, 0, 0, 0);
expect(InvalidParameter, status);
- status = GdipDrawBezierI(NULL, pen, 0, 0, 0, 0, 0, 0, 0, 0);
+ status = pGdipDrawBezierI(NULL, pen, 0, 0, 0, 0, 0, 0, 0, 0);
expect(InvalidParameter, status);
/* successful case */
- status = GdipDrawBezierI(graphics, pen, 0, 0, 0, 0, 0, 0, 0, 0);
+ status = pGdipDrawBezierI(graphics, pen, 0, 0, 0, 0, 0, 0, 0, 0);
expect(Ok, status);
- GdipDeletePen(pen);
- GdipDeleteGraphics(graphics);
+ pGdipDeletePen(pen);
+ pGdipDeleteGraphics(graphics);
ReleaseDC(0, hdc);
}
@@ -373,34 +697,34 @@ static void test_GdipDrawLineI(void)
HDC hdc = GetDC(0);
/* make a graphics object and pen object */
- status = GdipCreateFromHDC(hdc, &graphics);
+ status = pGdipCreateFromHDC(hdc, &graphics);
expect(Ok, status);
ok(hdc != NULL, "Expected HDC to be initialized\n");
- status = GdipCreateFromHDC(hdc, &graphics);
+ status = pGdipCreateFromHDC(hdc, &graphics);
expect(Ok, status);
ok(graphics != NULL, "Expected graphics to be initialized\n");
- status = GdipCreatePen1((ARGB)0xffff00ff, 10.0f, UnitPixel, &pen);
+ status = pGdipCreatePen1((ARGB)0xffff00ff, 10.0f, UnitPixel, &pen);
expect(Ok, status);
ok(pen != NULL, "Expected pen to be initialized\n");
/* InvalidParameter cases: null graphics, null pen */
- status = GdipDrawLineI(NULL, NULL, 0, 0, 0, 0);
+ status = pGdipDrawLineI(NULL, NULL, 0, 0, 0, 0);
expect(InvalidParameter, status);
- status = GdipDrawLineI(graphics, NULL, 0, 0, 0, 0);
+ status = pGdipDrawLineI(graphics, NULL, 0, 0, 0, 0);
expect(InvalidParameter, status);
- status = GdipDrawLineI(NULL, pen, 0, 0, 0, 0);
+ status = pGdipDrawLineI(NULL, pen, 0, 0, 0, 0);
expect(InvalidParameter, status);
/* successful case */
- status = GdipDrawLineI(graphics, pen, 0, 0, 0, 0);
+ status = pGdipDrawLineI(graphics, pen, 0, 0, 0, 0);
expect(Ok, status);
- GdipDeletePen(pen);
- GdipDeleteGraphics(graphics);
+ pGdipDeletePen(pen);
+ pGdipDeleteGraphics(graphics);
ReleaseDC(0, hdc);
}
@@ -414,20 +738,20 @@ static void test_GdipDrawLinesI(void)
HDC hdc = GetDC(0);
/* make a graphics object and pen object */
- status = GdipCreateFromHDC(hdc, &graphics);
+ status = pGdipCreateFromHDC(hdc, &graphics);
expect(Ok, status);
ok(hdc != NULL, "Expected HDC to be initialized\n");
- status = GdipCreateFromHDC(hdc, &graphics);
+ status = pGdipCreateFromHDC(hdc, &graphics);
expect(Ok, status);
ok(graphics != NULL, "Expected graphics to be initialized\n");
- status = GdipCreatePen1((ARGB)0xffff00ff, 10.0f, UnitPixel, &pen);
+ status = pGdipCreatePen1((ARGB)0xffff00ff, 10.0f, UnitPixel, &pen);
expect(Ok, status);
ok(pen != NULL, "Expected pen to be initialized\n");
/* make some arbitrary valid points*/
- ptf = GdipAlloc(2 * sizeof(GpPointF));
+ ptf = pGdipAlloc(2 * sizeof(GpPointF));
ptf[0].X = 1;
ptf[0].Y = 1;
@@ -436,25 +760,25 @@ static void test_GdipDrawLinesI(void)
ptf[1].Y = 2;
/* InvalidParameter cases: null graphics, null pen, null points, count < 2*/
- status = GdipDrawLinesI(NULL, NULL, NULL, 0);
+ status = pGdipDrawLinesI(NULL, NULL, NULL, 0);
expect(InvalidParameter, status);
- status = GdipDrawLinesI(graphics, pen, ptf, 0);
+ status = pGdipDrawLinesI(graphics, pen, ptf, 0);
expect(InvalidParameter, status);
- status = GdipDrawLinesI(graphics, NULL, ptf, 2);
+ status = pGdipDrawLinesI(graphics, NULL, ptf, 2);
expect(InvalidParameter, status);
- status = GdipDrawLinesI(NULL, pen, ptf, 2);
+ status = pGdipDrawLinesI(NULL, pen, ptf, 2);
expect(InvalidParameter, status);
/* successful case */
- status = GdipDrawLinesI(graphics, pen, ptf, 2);
+ status = pGdipDrawLinesI(graphics, pen, ptf, 2);
expect(Ok, status);
- GdipFree(ptf);
- GdipDeletePen(pen);
- GdipDeleteGraphics(graphics);
+ pGdipFree(ptf);
+ pGdipDeletePen(pen);
+ pGdipDeleteGraphics(graphics);
ReleaseDC(0, hdc);
}
@@ -520,243 +844,243 @@ static void test_Get_Release_DC(void)
rectf[i].Width = (REAL)rect[i].Width;
}
- GdipCreateMatrix(&m);
- GdipCreateRegion(®ion);
- GdipCreateSolidFill((ARGB)0xdeadbeef, &brush);
- GdipCreatePath(FillModeAlternate, &path);
- GdipCreateRegion(&clip);
+ pGdipCreateMatrix(&m);
+ pGdipCreateRegion(®ion);
+ pGdipCreateSolidFill((ARGB)0xdeadbeef, &brush);
+ pGdipCreatePath(FillModeAlternate, &path);
+ pGdipCreateRegion(&clip);
- status = GdipCreateFromHDC(hdc, &graphics);
+ status = pGdipCreateFromHDC(hdc, &graphics);
expect(Ok, status);
ok(graphics != NULL, "Expected graphics to be initialized\n");
- status = GdipCreatePen1((ARGB)0xffff00ff, 10.0f, UnitPixel, &pen);
+ status = pGdipCreatePen1((ARGB)0xffff00ff, 10.0f, UnitPixel, &pen);
expect(Ok, status);
/* NULL arguments */
- status = GdipGetDC(NULL, NULL);
+ status = pGdipGetDC(NULL, NULL);
expect(InvalidParameter, status);
- status = GdipGetDC(graphics, NULL);
+ status = pGdipGetDC(graphics, NULL);
expect(InvalidParameter, status);
- status = GdipGetDC(NULL, &retdc);
+ status = pGdipGetDC(NULL, &retdc);
expect(InvalidParameter, status);
- status = GdipReleaseDC(NULL, NULL);
+ status = pGdipReleaseDC(NULL, NULL);
expect(InvalidParameter, status);
- status = GdipReleaseDC(graphics, NULL);
+ status = pGdipReleaseDC(graphics, NULL);
expect(InvalidParameter, status);
- status = GdipReleaseDC(NULL, (HDC)0xdeadbeef);
+ status = pGdipReleaseDC(NULL, (HDC)0xdeadbeef);
expect(InvalidParameter, status);
/* Release without Get */
- status = GdipReleaseDC(graphics, hdc);
+ status = pGdipReleaseDC(graphics, hdc);
expect(InvalidParameter, status);
retdc = NULL;
- status = GdipGetDC(graphics, &retdc);
+ status = pGdipGetDC(graphics, &retdc);
expect(Ok, status);
ok(retdc == hdc, "Invalid HDC returned\n");
/* call it once more */
- status = GdipGetDC(graphics, &retdc);
+ status = pGdipGetDC(graphics, &retdc);
expect(ObjectBusy, status);
/* try all Graphics calls here */
status = Ok;
- status = GdipDrawArc(graphics, pen, 0.0, 0.0, 1.0, 1.0, 0.0, 0.0);
+ status = pGdipDrawArc(graphics, pen, 0.0, 0.0, 1.0, 1.0, 0.0, 0.0);
expect(ObjectBusy, status); status = Ok;
- status = GdipDrawArcI(graphics, pen, 0, 0, 1, 1, 0.0, 0.0);
+ status = pGdipDrawArcI(graphics, pen, 0, 0, 1, 1, 0.0, 0.0);
expect(ObjectBusy, status); status = Ok;
- status = GdipDrawBezier(graphics, pen, 0.0, 10.0, 20.0, 15.0, 35.0, -10.0, 10.0, 10.0);
+ status = pGdipDrawBezier(graphics, pen, 0.0, 10.0, 20.0, 15.0, 35.0, -10.0, 10.0, 10.0);
expect(ObjectBusy, status); status = Ok;
- status = GdipDrawBezierI(graphics, pen, 0, 0, 0, 0, 0, 0, 0, 0);
+ status = pGdipDrawBezierI(graphics, pen, 0, 0, 0, 0, 0, 0, 0, 0);
expect(ObjectBusy, status); status = Ok;
- status = GdipDrawBeziers(graphics, pen, ptf, 5);
+ status = pGdipDrawBeziers(graphics, pen, ptf, 5);
expect(ObjectBusy, status); status = Ok;
- status = GdipDrawBeziersI(graphics, pen, pt, 5);
+ status = pGdipDrawBeziersI(graphics, pen, pt, 5);
expect(ObjectBusy, status); status = Ok;
- status = GdipDrawClosedCurve(graphics, pen, ptf, 5);
+ status = pGdipDrawClosedCurve(graphics, pen, ptf, 5);
expect(ObjectBusy, status); status = Ok;
- status = GdipDrawClosedCurveI(graphics, pen, pt, 5);
+ status = pGdipDrawClosedCurveI(graphics, pen, pt, 5);
expect(ObjectBusy, status); status = Ok;
- status = GdipDrawClosedCurve2(graphics, pen, ptf, 5, 1.0);
+ status = pGdipDrawClosedCurve2(graphics, pen, ptf, 5, 1.0);
expect(ObjectBusy, status); status = Ok;
- status = GdipDrawClosedCurve2I(graphics, pen, pt, 5, 1.0);
+ status = pGdipDrawClosedCurve2I(graphics, pen, pt, 5, 1.0);
expect(ObjectBusy, status); status = Ok;
- status = GdipDrawCurve(graphics, pen, ptf, 5);
+ status = pGdipDrawCurve(graphics, pen, ptf, 5);
expect(ObjectBusy, status); status = Ok;
- status = GdipDrawCurveI(graphics, pen, pt, 5);
+ status = pGdipDrawCurveI(graphics, pen, pt, 5);
expect(ObjectBusy, status); status = Ok;
- status = GdipDrawCurve2(graphics, pen, ptf, 5, 1.0);
+ status = pGdipDrawCurve2(graphics, pen, ptf, 5, 1.0);
expect(ObjectBusy, status); status = Ok;
- status = GdipDrawCurve2I(graphics, pen, pt, 5, 1.0);
+ status = pGdipDrawCurve2I(graphics, pen, pt, 5, 1.0);
expect(ObjectBusy, status); status = Ok;
- status = GdipDrawEllipse(graphics, pen, 0.0, 0.0, 100.0, 50.0);
+ status = pGdipDrawEllipse(graphics, pen, 0.0, 0.0, 100.0, 50.0);
expect(ObjectBusy, status); status = Ok;
- status = GdipDrawEllipseI(graphics, pen, 0, 0, 100, 50);
+ status = pGdipDrawEllipseI(graphics, pen, 0, 0, 100, 50);
expect(ObjectBusy, status); status = Ok;
/* GdipDrawImage/GdipDrawImageI */
/* GdipDrawImagePointsRect/GdipDrawImagePointsRectI */
/* GdipDrawImageRectRect/GdipDrawImageRectRectI */
/* GdipDrawImageRect/GdipDrawImageRectI */
- status = GdipDrawLine(graphics, pen, 0.0, 0.0, 100.0, 200.0);
+ status = pGdipDrawLine(graphics, pen, 0.0, 0.0, 100.0, 200.0);
expect(ObjectBusy, status); status = Ok;
- status = GdipDrawLineI(graphics, pen, 0, 0, 100, 200);
+ status = pGdipDrawLineI(graphics, pen, 0, 0, 100, 200);
expect(ObjectBusy, status); status = Ok;
- status = GdipDrawLines(graphics, pen, ptf, 5);
+ status = pGdipDrawLines(graphics, pen, ptf, 5);
expect(ObjectBusy, status); status = Ok;
- status = GdipDrawLinesI(graphics, pen, pt, 5);
+ status = pGdipDrawLinesI(graphics, pen, pt, 5);
expect(ObjectBusy, status); status = Ok;
- status = GdipDrawPath(graphics, pen, path);
+ status = pGdipDrawPath(graphics, pen, path);
expect(ObjectBusy, status); status = Ok;
- status = GdipDrawPie(graphics, pen, 0.0, 0.0, 100.0, 100.0, 0.0, 90.0);
+ status = pGdipDrawPie(graphics, pen, 0.0, 0.0, 100.0, 100.0, 0.0, 90.0);
expect(ObjectBusy, status); status = Ok;
- status = GdipDrawPieI(graphics, pen, 0, 0, 100, 100, 0.0, 90.0);
+ status = pGdipDrawPieI(graphics, pen, 0, 0, 100, 100, 0.0, 90.0);
expect(ObjectBusy, status); status = Ok;
- status = GdipDrawRectangle(graphics, pen, 0.0, 0.0, 100.0, 300.0);
+ status = pGdipDrawRectangle(graphics, pen, 0.0, 0.0, 100.0, 300.0);
expect(ObjectBusy, status); status = Ok;
- status = GdipDrawRectangleI(graphics, pen, 0, 0, 100, 300);
+ status = pGdipDrawRectangleI(graphics, pen, 0, 0, 100, 300);
expect(ObjectBusy, status); status = Ok;
- status = GdipDrawRectangles(graphics, pen, rectf, 2);
+ status = pGdipDrawRectangles(graphics, pen, rectf, 2);
expect(ObjectBusy, status); status = Ok;
- status = GdipDrawRectanglesI(graphics, pen, rect, 2);
+ status = pGdipDrawRectanglesI(graphics, pen, rect, 2);
expect(ObjectBusy, status); status = Ok;
/* GdipDrawString */
- status = GdipFillClosedCurve2(graphics, (GpBrush*)brush, ptf, 5, 1.0, FillModeAlternate);
+ status = pGdipFillClosedCurve2(graphics, (GpBrush*)brush, ptf, 5, 1.0, FillModeAlternate);
expect(ObjectBusy, status); status = Ok;
- status = GdipFillClosedCurve2I(graphics, (GpBrush*)brush, pt, 5, 1.0, FillModeAlternate);
+ status = pGdipFillClosedCurve2I(graphics, (GpBrush*)brush, pt, 5, 1.0, FillModeAlternate);
expect(ObjectBusy, status); status = Ok;
- status = GdipFillEllipse(graphics, (GpBrush*)brush, 0.0, 0.0, 100.0, 100.0);
+ status = pGdipFillEllipse(graphics, (GpBrush*)brush, 0.0, 0.0, 100.0, 100.0);
expect(ObjectBusy, status); status = Ok;
- status = GdipFillEllipseI(graphics, (GpBrush*)brush, 0, 0, 100, 100);
+ status = pGdipFillEllipseI(graphics, (GpBrush*)brush, 0, 0, 100, 100);
expect(ObjectBusy, status); status = Ok;
- status = GdipFillPath(graphics, (GpBrush*)brush, path);
+ status = pGdipFillPath(graphics, (GpBrush*)brush, path);
expect(ObjectBusy, status); status = Ok;
- status = GdipFillPie(graphics, (GpBrush*)brush, 0.0, 0.0, 100.0, 100.0, 0.0, 15.0);
+ status = pGdipFillPie(graphics, (GpBrush*)brush, 0.0, 0.0, 100.0, 100.0, 0.0, 15.0);
expect(ObjectBusy, status); status = Ok;
- status = GdipFillPieI(graphics, (GpBrush*)brush, 0, 0, 100, 100, 0.0, 15.0);
+ status = pGdipFillPieI(graphics, (GpBrush*)brush, 0, 0, 100, 100, 0.0, 15.0);
expect(ObjectBusy, status); status = Ok;
- status = GdipFillPolygon(graphics, (GpBrush*)brush, ptf, 5, FillModeAlternate);
+ status = pGdipFillPolygon(graphics, (GpBrush*)brush, ptf, 5, FillModeAlternate);
expect(ObjectBusy, status); status = Ok;
- status = GdipFillPolygonI(graphics, (GpBrush*)brush, pt, 5, FillModeAlternate);
+ status = pGdipFillPolygonI(graphics, (GpBrush*)brush, pt, 5, FillModeAlternate);
expect(ObjectBusy, status); status = Ok;
- status = GdipFillPolygon2(graphics, (GpBrush*)brush, ptf, 5);
+ status = pGdipFillPolygon2(graphics, (GpBrush*)brush, ptf, 5);
expect(ObjectBusy, status); status = Ok;
- status = GdipFillPolygon2I(graphics, (GpBrush*)brush, pt, 5);
+ status = pGdipFillPolygon2I(graphics, (GpBrush*)brush, pt, 5);
expect(ObjectBusy, status); status = Ok;
- status = GdipFillRectangle(graphics, (GpBrush*)brush, 0.0, 0.0, 100.0, 100.0);
+ status = pGdipFillRectangle(graphics, (GpBrush*)brush, 0.0, 0.0, 100.0, 100.0);
expect(ObjectBusy, status); status = Ok;
- status = GdipFillRectangleI(graphics, (GpBrush*)brush, 0, 0, 100, 100);
+ status = pGdipFillRectangleI(graphics, (GpBrush*)brush, 0, 0, 100, 100);
expect(ObjectBusy, status); status = Ok;
- status = GdipFillRectangles(graphics, (GpBrush*)brush, rectf, 2);
+ status = pGdipFillRectangles(graphics, (GpBrush*)brush, rectf, 2);
expect(ObjectBusy, status); status = Ok;
- status = GdipFillRectanglesI(graphics, (GpBrush*)brush, rect, 2);
+ status = pGdipFillRectanglesI(graphics, (GpBrush*)brush, rect, 2);
expect(ObjectBusy, status); status = Ok;
- status = GdipFillRegion(graphics, (GpBrush*)brush, region);
+ status = pGdipFillRegion(graphics, (GpBrush*)brush, region);
expect(ObjectBusy, status); status = Ok;
- status = GdipFlush(graphics, FlushIntentionFlush);
+ status = pGdipFlush(graphics, FlushIntentionFlush);
expect(ObjectBusy, status); status = Ok;
- status = GdipGetClipBounds(graphics, rectf);
+ status = pGdipGetClipBounds(graphics, rectf);
expect(ObjectBusy, status); status = Ok;
- status = GdipGetClipBoundsI(graphics, rect);
+ status = pGdipGetClipBoundsI(graphics, rect);
expect(ObjectBusy, status); status = Ok;
- status = GdipGetCompositingMode(graphics, &compmode);
+ status = pGdipGetCompositingMode(graphics, &compmode);
expect(ObjectBusy, status); status = Ok;
- status = GdipGetCompositingQuality(graphics, &quality);
+ status = pGdipGetCompositingQuality(graphics, &quality);
expect(ObjectBusy, status); status = Ok;
- status = GdipGetInterpolationMode(graphics, &intmode);
+ status = pGdipGetInterpolationMode(graphics, &intmode);
expect(ObjectBusy, status); status = Ok;
- status = GdipGetNearestColor(graphics, &color);
+ status = pGdipGetNearestColor(graphics, &color);
expect(ObjectBusy, status); status = Ok;
- status = GdipGetPageScale(graphics, &r);
+ status = pGdipGetPageScale(graphics, &r);
expect(ObjectBusy, status); status = Ok;
- status = GdipGetPageUnit(graphics, &unit);
+ status = pGdipGetPageUnit(graphics, &unit);
expect(ObjectBusy, status); status = Ok;
- status = GdipGetPixelOffsetMode(graphics, &offsetmode);
+ status = pGdipGetPixelOffsetMode(graphics, &offsetmode);
expect(ObjectBusy, status); status = Ok;
- status = GdipGetSmoothingMode(graphics, &smoothmode);
+ status = pGdipGetSmoothingMode(graphics, &smoothmode);
expect(ObjectBusy, status); status = Ok;
- status = GdipGetTextRenderingHint(graphics, &texthint);
+ status = pGdipGetTextRenderingHint(graphics, &texthint);
expect(ObjectBusy, status); status = Ok;
- status = GdipGetWorldTransform(graphics, m);
+ status = pGdipGetWorldTransform(graphics, m);
expect(ObjectBusy, status); status = Ok;
- status = GdipGraphicsClear(graphics, 0xdeadbeef);
+ status = pGdipGraphicsClear(graphics, 0xdeadbeef);
expect(ObjectBusy, status); status = Ok;
- status = GdipIsVisiblePoint(graphics, 0.0, 0.0, &res);
+ status = pGdipIsVisiblePoint(graphics, 0.0, 0.0, &res);
expect(ObjectBusy, status); status = Ok;
- status = GdipIsVisiblePointI(graphics, 0, 0, &res);
+ status = pGdipIsVisiblePointI(graphics, 0, 0, &res);
expect(ObjectBusy, status); status = Ok;
/* GdipMeasureCharacterRanges */
/* GdipMeasureString */
- status = GdipResetClip(graphics);
+ status = pGdipResetClip(graphics);
expect(ObjectBusy, status); status = Ok;
- status = GdipResetWorldTransform(graphics);
+ status = pGdipResetWorldTransform(graphics);
expect(ObjectBusy, status); status = Ok;
/* GdipRestoreGraphics */
- status = GdipRotateWorldTransform(graphics, 15.0, MatrixOrderPrepend);
+ status = pGdipRotateWorldTransform(graphics, 15.0, MatrixOrderPrepend);
expect(ObjectBusy, status); status = Ok;
/* GdipSaveGraphics */
- status = GdipScaleWorldTransform(graphics, 1.0, 1.0, MatrixOrderPrepend);
+ status = pGdipScaleWorldTransform(graphics, 1.0, 1.0, MatrixOrderPrepend);
expect(ObjectBusy, status); status = Ok;
- status = GdipSetCompositingMode(graphics, CompositingModeSourceOver);
+ status = pGdipSetCompositingMode(graphics, CompositingModeSourceOver);
expect(ObjectBusy, status); status = Ok;
- status = GdipSetCompositingQuality(graphics, CompositingQualityDefault);
+ status = pGdipSetCompositingQuality(graphics, CompositingQualityDefault);
expect(ObjectBusy, status); status = Ok;
- status = GdipSetInterpolationMode(graphics, InterpolationModeDefault);
+ status = pGdipSetInterpolationMode(graphics, InterpolationModeDefault);
expect(ObjectBusy, status); status = Ok;
- status = GdipSetPageScale(graphics, 1.0);
+ status = pGdipSetPageScale(graphics, 1.0);
expect(ObjectBusy, status); status = Ok;
- status = GdipSetPageUnit(graphics, UnitWorld);
+ status = pGdipSetPageUnit(graphics, UnitWorld);
expect(ObjectBusy, status); status = Ok;
- status = GdipSetPixelOffsetMode(graphics, PixelOffsetModeDefault);
+ status = pGdipSetPixelOffsetMode(graphics, PixelOffsetModeDefault);
expect(ObjectBusy, status); status = Ok;
- status = GdipSetSmoothingMode(graphics, SmoothingModeDefault);
+ status = pGdipSetSmoothingMode(graphics, SmoothingModeDefault);
expect(ObjectBusy, status); status = Ok;
- status = GdipSetTextRenderingHint(graphics, TextRenderingHintSystemDefault);
+ status = pGdipSetTextRenderingHint(graphics, TextRenderingHintSystemDefault);
expect(ObjectBusy, status); status = Ok;
- status = GdipSetWorldTransform(graphics, m);
+ status = pGdipSetWorldTransform(graphics, m);
expect(ObjectBusy, status); status = Ok;
- status = GdipTranslateWorldTransform(graphics, 0.0, 0.0, MatrixOrderPrepend);
+ status = pGdipTranslateWorldTransform(graphics, 0.0, 0.0, MatrixOrderPrepend);
expect(ObjectBusy, status); status = Ok;
- status = GdipSetClipHrgn(graphics, hrgn, CombineModeReplace);
+ status = pGdipSetClipHrgn(graphics, hrgn, CombineModeReplace);
expect(ObjectBusy, status); status = Ok;
- status = GdipSetClipPath(graphics, path, CombineModeReplace);
+ status = pGdipSetClipPath(graphics, path, CombineModeReplace);
expect(ObjectBusy, status); status = Ok;
- status = GdipSetClipRect(graphics, 0.0, 0.0, 10.0, 10.0, CombineModeReplace);
+ status = pGdipSetClipRect(graphics, 0.0, 0.0, 10.0, 10.0, CombineModeReplace);
expect(ObjectBusy, status); status = Ok;
- status = GdipSetClipRectI(graphics, 0, 0, 10, 10, CombineModeReplace);
+ status = pGdipSetClipRectI(graphics, 0, 0, 10, 10, CombineModeReplace);
expect(ObjectBusy, status); status = Ok;
- status = GdipSetClipRegion(graphics, clip, CombineModeReplace);
+ status = pGdipSetClipRegion(graphics, clip, CombineModeReplace);
expect(ObjectBusy, status); status = Ok;
- status = GdipTranslateClip(graphics, 0.0, 0.0);
+ status = pGdipTranslateClip(graphics, 0.0, 0.0);
expect(ObjectBusy, status); status = Ok;
- status = GdipTranslateClipI(graphics, 0, 0);
+ status = pGdipTranslateClipI(graphics, 0, 0);
expect(ObjectBusy, status); status = Ok;
- status = GdipDrawPolygon(graphics, pen, ptf, 5);
+ status = pGdipDrawPolygon(graphics, pen, ptf, 5);
expect(ObjectBusy, status); status = Ok;
- status = GdipDrawPolygonI(graphics, pen, pt, 5);
+ status = pGdipDrawPolygonI(graphics, pen, pt, 5);
expect(ObjectBusy, status); status = Ok;
- status = GdipGetDpiX(graphics, &r);
+ status = pGdipGetDpiX(graphics, &r);
expect(ObjectBusy, status); status = Ok;
- status = GdipGetDpiY(graphics, &r);
+ status = pGdipGetDpiY(graphics, &r);
expect(ObjectBusy, status); status = Ok;
- status = GdipMultiplyWorldTransform(graphics, m, MatrixOrderPrepend);
- status = GdipGetClip(graphics, region);
+ status = pGdipMultiplyWorldTransform(graphics, m, MatrixOrderPrepend);
+ status = pGdipGetClip(graphics, region);
expect(ObjectBusy, status); status = Ok;
- status = GdipTransformPoints(graphics, CoordinateSpacePage, CoordinateSpaceWorld, ptf, 5);
+ status = pGdipTransformPoints(graphics, CoordinateSpacePage, CoordinateSpaceWorld, ptf, 5);
expect(ObjectBusy, status); status = Ok;
/* try to delete before release */
- status = GdipDeleteGraphics(graphics);
+ status = pGdipDeleteGraphics(graphics);
expect(ObjectBusy, status);
- status = GdipReleaseDC(graphics, retdc);
+ status = pGdipReleaseDC(graphics, retdc);
expect(Ok, status);
- GdipDeletePen(pen);
- GdipDeleteGraphics(graphics);
+ pGdipDeletePen(pen);
+ pGdipDeleteGraphics(graphics);
- GdipDeletePath(path);
- GdipDeleteBrush((GpBrush*)brush);
- GdipDeleteRegion(region);
- GdipDeleteMatrix(m);
+ pGdipDeletePath(path);
+ pGdipDeleteBrush((GpBrush*)brush);
+ pGdipDeleteRegion(region);
+ pGdipDeleteMatrix(m);
DeleteObject(hrgn);
ReleaseDC(0, hdc);
@@ -770,7 +1094,7 @@ static void test_transformpoints(void)
GpPointF ptf[5];
INT i;
- status = GdipCreateFromHDC(hdc, &graphics);
+ status = pGdipCreateFromHDC(hdc, &graphics);
expect(Ok, status);
for(i = 0; i < 5; i++){
@@ -779,16 +1103,16 @@ static void test_transformpoints(void)
}
/* NULL arguments */
- status = GdipTransformPoints(NULL, CoordinateSpacePage, CoordinateSpaceWorld, NULL, 0);
+ status = pGdipTransformPoints(NULL, CoordinateSpacePage, CoordinateSpaceWorld, NULL, 0);
expect(InvalidParameter, status);
- status = GdipTransformPoints(graphics, CoordinateSpacePage, CoordinateSpaceWorld, NULL, 0);
+ status = pGdipTransformPoints(graphics, CoordinateSpacePage, CoordinateSpaceWorld, NULL, 0);
expect(InvalidParameter, status);
- status = GdipTransformPoints(graphics, CoordinateSpacePage, CoordinateSpaceWorld, ptf, 0);
+ status = pGdipTransformPoints(graphics, CoordinateSpacePage, CoordinateSpaceWorld, ptf, 0);
expect(InvalidParameter, status);
- status = GdipTransformPoints(graphics, CoordinateSpacePage, CoordinateSpaceWorld, ptf, -1);
+ status = pGdipTransformPoints(graphics, CoordinateSpacePage, CoordinateSpaceWorld, ptf, -1);
expect(InvalidParameter, status);
- GdipDeleteGraphics(graphics);
+ pGdipDeleteGraphics(graphics);
ReleaseDC(0, hdc);
}
@@ -801,73 +1125,73 @@ static void test_get_set_clip(void)
GpRectF rect;
BOOL res;
- status = GdipCreateFromHDC(hdc, &graphics);
+ status = pGdipCreateFromHDC(hdc, &graphics);
expect(Ok, status);
rect.X = rect.Y = 0.0;
rect.Height = rect.Width = 100.0;
- status = GdipCreateRegionRect(&rect, &clip);
+ status = pGdipCreateRegionRect(&rect, &clip);
/* NULL arguments */
- status = GdipGetClip(NULL, NULL);
+ status = pGdipGetClip(NULL, NULL);
expect(InvalidParameter, status);
- status = GdipGetClip(graphics, NULL);
+ status = pGdipGetClip(graphics, NULL);
expect(InvalidParameter, status);
- status = GdipGetClip(NULL, clip);
+ status = pGdipGetClip(NULL, clip);
expect(InvalidParameter, status);
- status = GdipSetClipRegion(NULL, NULL, CombineModeReplace);
+ status = pGdipSetClipRegion(NULL, NULL, CombineModeReplace);
expect(InvalidParameter, status);
- status = GdipSetClipRegion(graphics, NULL, CombineModeReplace);
+ status = pGdipSetClipRegion(graphics, NULL, CombineModeReplace);
expect(InvalidParameter, status);
- status = GdipSetClipPath(NULL, NULL, CombineModeReplace);
+ status = pGdipSetClipPath(NULL, NULL, CombineModeReplace);
expect(InvalidParameter, status);
- status = GdipSetClipPath(graphics, NULL, CombineModeReplace);
+ status = pGdipSetClipPath(graphics, NULL, CombineModeReplace);
expect(InvalidParameter, status);
res = FALSE;
- status = GdipGetClip(graphics, clip);
+ status = pGdipGetClip(graphics, clip);
expect(Ok, status);
- status = GdipIsInfiniteRegion(clip, graphics, &res);
+ status = pGdipIsInfiniteRegion(clip, graphics, &res);
expect(Ok, status);
expect(TRUE, res);
/* remains infinite after reset */
res = FALSE;
- status = GdipResetClip(graphics);
+ status = pGdipResetClip(graphics);
expect(Ok, status);
- status = GdipGetClip(graphics, clip);
+ status = pGdipGetClip(graphics, clip);
expect(Ok, status);
- status = GdipIsInfiniteRegion(clip, graphics, &res);
+ status = pGdipIsInfiniteRegion(clip, graphics, &res);
expect(Ok, status);
expect(TRUE, res);
/* set to empty and then reset to infinite */
- status = GdipSetEmpty(clip);
+ status = pGdipSetEmpty(clip);
expect(Ok, status);
- status = GdipSetClipRegion(graphics, clip, CombineModeReplace);
+ status = pGdipSetClipRegion(graphics, clip, CombineModeReplace);
expect(Ok, status);
- status = GdipGetClip(graphics, clip);
+ status = pGdipGetClip(graphics, clip);
expect(Ok, status);
res = FALSE;
- status = GdipIsEmptyRegion(clip, graphics, &res);
+ status = pGdipIsEmptyRegion(clip, graphics, &res);
expect(Ok, status);
expect(TRUE, res);
- status = GdipResetClip(graphics);
+ status = pGdipResetClip(graphics);
expect(Ok, status);
- status = GdipGetClip(graphics, clip);
+ status = pGdipGetClip(graphics, clip);
expect(Ok, status);
res = FALSE;
- status = GdipIsInfiniteRegion(clip, graphics, &res);
+ status = pGdipIsInfiniteRegion(clip, graphics, &res);
expect(Ok, status);
expect(TRUE, res);
- GdipDeleteRegion(clip);
+ pGdipDeleteRegion(clip);
- GdipDeleteGraphics(graphics);
+ pGdipDeleteGraphics(graphics);
ReleaseDC(0, hdc);
}
@@ -879,29 +1203,29 @@ static void test_isempty(void)
GpRegion *clip;
BOOL res;
- status = GdipCreateFromHDC(hdc, &graphics);
+ status = pGdipCreateFromHDC(hdc, &graphics);
expect(Ok, status);
- status = GdipCreateRegion(&clip);
+ status = pGdipCreateRegion(&clip);
expect(Ok, status);
/* NULL */
- status = GdipIsClipEmpty(NULL, NULL);
+ status = pGdipIsClipEmpty(NULL, NULL);
expect(InvalidParameter, status);
- status = GdipIsClipEmpty(graphics, NULL);
+ status = pGdipIsClipEmpty(graphics, NULL);
expect(InvalidParameter, status);
- status = GdipIsClipEmpty(NULL, &res);
+ status = pGdipIsClipEmpty(NULL, &res);
expect(InvalidParameter, status);
/* default is infinite */
res = TRUE;
- status = GdipIsClipEmpty(graphics, &res);
+ status = pGdipIsClipEmpty(graphics, &res);
expect(Ok, status);
expect(FALSE, res);
- GdipDeleteRegion(clip);
+ pGdipDeleteRegion(clip);
- GdipDeleteGraphics(graphics);
+ pGdipDeleteGraphics(graphics);
ReleaseDC(0, hdc);
}
@@ -909,7 +1233,7 @@ static void test_clear(void)
{
GpStatus status;
- status = GdipGraphicsClear(NULL, 0xdeadbeef);
+ status = pGdipGraphicsClear(NULL, 0xdeadbeef);
expect(InvalidParameter, status);
}
@@ -920,18 +1244,18 @@ static void test_textcontrast(void)
GpGraphics *graphics;
UINT contrast;
- status = GdipGetTextContrast(NULL, NULL);
+ status = pGdipGetTextContrast(NULL, NULL);
expect(InvalidParameter, status);
- status = GdipCreateFromHDC(hdc, &graphics);
+ status = pGdipCreateFromHDC(hdc, &graphics);
expect(Ok, status);
- status = GdipGetTextContrast(graphics, NULL);
+ status = pGdipGetTextContrast(graphics, NULL);
expect(InvalidParameter, status);
- status = GdipGetTextContrast(graphics, &contrast);
+ status = pGdipGetTextContrast(graphics, &contrast);
expect(4, contrast);
- GdipDeleteGraphics(graphics);
+ pGdipDeleteGraphics(graphics);
ReleaseDC(0, hdc);
}
@@ -940,12 +1264,15 @@ START_TEST(graphics)
struct GdiplusStartupInput gdiplusStartupInput;
ULONG_PTR gdiplusToken;
+ if (!InitFunctionPtrs())
+ return;
+
gdiplusStartupInput.GdiplusVersion = 1;
gdiplusStartupInput.DebugEventCallback = NULL;
gdiplusStartupInput.SuppressBackgroundThread = 0;
gdiplusStartupInput.SuppressExternalCodecs = 0;
- GdiplusStartup(&gdiplusToken, &gdiplusStartupInput, NULL);
+ pGdiplusStartup(&gdiplusToken, &gdiplusStartupInput, NULL);
test_constructor_destructor();
test_save_restore();
@@ -961,5 +1288,7 @@ START_TEST(graphics)
test_clear();
test_textcontrast();
- GdiplusShutdown(gdiplusToken);
+ pGdiplusShutdown(gdiplusToken);
+
+ FreeLibrary(hGdiPlus);
}
diff --git a/dlls/gdiplus/tests/graphicspath.c b/dlls/gdiplus/tests/graphicspath.c
index 6e257eb..709830a 100644
--- a/dlls/gdiplus/tests/graphicspath.c
+++ b/dlls/gdiplus/tests/graphicspath.c
@@ -27,6 +27,123 @@
#define expectf(expected, got) ok(fabs(expected - got) < 2.0, "Expected %.2f, got %.2f\n", expected, got)
#define POINT_TYPE_MAX_LEN (75)
+static void* (WINGDIPAPI * pGdipAlloc)(SIZE_T);
+static GpStatus (WINGDIPAPI * pGdipCreateFromHDC)(HDC,GpGraphics**);
+static GpStatus (WINGDIPAPI * pGdipDeleteGraphics)(GpGraphics*);
+static GpStatus (WINGDIPAPI * pGdipSetClipRect)(GpGraphics*,REAL,REAL,REAL,REAL,
+ CombineMode);
+static GpStatus (WINGDIPAPI * pGdipAddPathArc)(GpPath*,REAL,REAL,REAL,REAL,REAL,
+ REAL);
+static GpStatus (WINGDIPAPI * pGdipAddPathClosedCurve2)(GpPath*,
+ GDIPCONST GpPointF*,INT,REAL);
+static GpStatus (WINGDIPAPI * pGdipAddPathCurve2)(GpPath*,GDIPCONST GpPointF*,
+ INT,REAL);
+static GpStatus (WINGDIPAPI * pGdipAddPathCurve3)(GpPath*,GDIPCONST GpPointF*,
+ INT,INT,INT,REAL);
+static GpStatus (WINGDIPAPI * pGdipAddPathEllipse)(GpPath*,REAL,REAL,REAL,REAL);
+static GpStatus (WINGDIPAPI * pGdipAddPathLine)(GpPath*,REAL,REAL,REAL,REAL);
+static GpStatus (WINGDIPAPI * pGdipAddPathLineI)(GpPath*,INT,INT,INT,INT);
+static GpStatus (WINGDIPAPI * pGdipAddPathLine2)(GpPath*,GDIPCONST GpPointF*,
+ INT);
+static GpStatus (WINGDIPAPI * pGdipAddPathPath)(GpPath*,GDIPCONST GpPath*,BOOL);
+static GpStatus (WINGDIPAPI * pGdipAddPathPie)(GpPath*,REAL,REAL,REAL,REAL,REAL,
+ REAL);
+static GpStatus (WINGDIPAPI * pGdipAddPathPolygon)(GpPath*,GDIPCONST GpPointF*,
+ INT);
+static GpStatus (WINGDIPAPI * pGdipAddPathRectangle)(GpPath*,REAL,REAL,REAL,
+ REAL);
+static GpStatus (WINGDIPAPI * pGdipAddPathRectangles)(GpPath*,
+ GDIPCONST GpRectF*,INT);
+static GpStatus (WINGDIPAPI * pGdipClosePathFigure)(GpPath*);
+static GpStatus (WINGDIPAPI * pGdipCreatePath)(GpFillMode,GpPath**);
+static GpStatus (WINGDIPAPI * pGdipDeletePath)(GpPath*);
+static GpStatus (WINGDIPAPI * pGdipFlattenPath)(GpPath*,GpMatrix*,REAL);
+static GpStatus (WINGDIPAPI * pGdipIsVisiblePathPoint)(GpPath*,REAL,REAL,
+ GpGraphics*,BOOL*);
+static GpStatus (WINGDIPAPI * pGdipGetPathData)(GpPath*,GpPathData*);
+static GpStatus (WINGDIPAPI * pGdipGetPathLastPoint)(GpPath*,GpPointF*);
+static GpStatus (WINGDIPAPI * pGdipGetPathPoints)(GpPath*,GpPointF*,INT);
+static GpStatus (WINGDIPAPI * pGdipGetPathTypes)(GpPath*,BYTE*,INT);
+static GpStatus (WINGDIPAPI * pGdipGetPathWorldBounds)(GpPath*,GpRectF*,
+ GDIPCONST GpMatrix*,GDIPCONST GpPen*);
+static GpStatus (WINGDIPAPI * pGdipGetPointCount)(GpPath*,INT*);
+static GpStatus (WINGDIPAPI * pGdipResetPath)(GpPath*);
+static GpStatus (WINGDIPAPI * pGdipReversePath)(GpPath*);
+static GpStatus (WINGDIPAPI * pGdipCreateMatrix)(GpMatrix**);
+static GpStatus (WINGDIPAPI * pGdipCreateMatrix2)(REAL,REAL,REAL,REAL,REAL,REAL,
+ GpMatrix**);
+static GpStatus (WINGDIPAPI * pGdipDeleteMatrix)(GpMatrix*);
+static GpStatus (WINGDIPAPI * pGdipCreatePen1)(ARGB,REAL,GpUnit,GpPen**);
+static GpStatus (WINGDIPAPI * pGdipSetPenEndCap)(GpPen*,GpLineCap);
+static Status (WINAPI * pGdiplusStartup)(ULONG_PTR*,
+ const struct GdiplusStartupInput*,struct GdiplusStartupOutput*);
+static void (WINAPI * pGdiplusShutdown)(ULONG_PTR);
+static void (WINGDIPAPI * pGdipFree)(void*);
+
+static HMODULE hGdiPlus = 0;
+
+static BOOL InitFunctionPtrs(void)
+{
+ hGdiPlus = LoadLibraryA("gdiplus.dll");
+ if (!hGdiPlus)
+ {
+ trace("Could not load gdiplus.dll\n");
+ return FALSE;
+ }
+
+#define GDIPLUS_GET_PROC(func) \
+ p ## func = (void*)GetProcAddress(hGdiPlus, #func); \
+ if (!p ## func) \
+ { \
+ trace("GetProcAddress(%s) failed\n", #func); \
+ FreeLibrary(hGdiPlus); \
+ return FALSE; \
+ }
+
+ GDIPLUS_GET_PROC(GdipAddPathArc)
+ GDIPLUS_GET_PROC(GdipAddPathClosedCurve2)
+ GDIPLUS_GET_PROC(GdipAddPathCurve2)
+ GDIPLUS_GET_PROC(GdipAddPathCurve3)
+ GDIPLUS_GET_PROC(GdipAddPathEllipse)
+ GDIPLUS_GET_PROC(GdipAddPathLine)
+ GDIPLUS_GET_PROC(GdipAddPathLine2)
+ GDIPLUS_GET_PROC(GdipAddPathLineI)
+ GDIPLUS_GET_PROC(GdipAddPathPath)
+ GDIPLUS_GET_PROC(GdipAddPathPie)
+ GDIPLUS_GET_PROC(GdipAddPathPolygon)
+ GDIPLUS_GET_PROC(GdipAddPathRectangle)
+ GDIPLUS_GET_PROC(GdipAddPathRectangles)
+ GDIPLUS_GET_PROC(GdipAlloc)
+ GDIPLUS_GET_PROC(GdipClosePathFigure)
+ GDIPLUS_GET_PROC(GdipCreateFromHDC)
+ GDIPLUS_GET_PROC(GdipCreateMatrix)
+ GDIPLUS_GET_PROC(GdipCreateMatrix2)
+ GDIPLUS_GET_PROC(GdipCreatePath)
+ GDIPLUS_GET_PROC(GdipCreatePen1)
+ GDIPLUS_GET_PROC(GdipDeleteGraphics)
+ GDIPLUS_GET_PROC(GdipDeleteMatrix)
+ GDIPLUS_GET_PROC(GdipDeletePath)
+ GDIPLUS_GET_PROC(GdipFlattenPath)
+ GDIPLUS_GET_PROC(GdipFree)
+ GDIPLUS_GET_PROC(GdipGetPathData)
+ GDIPLUS_GET_PROC(GdipGetPathLastPoint)
+ GDIPLUS_GET_PROC(GdipGetPathPoints)
+ GDIPLUS_GET_PROC(GdipGetPathTypes)
+ GDIPLUS_GET_PROC(GdipGetPathWorldBounds)
+ GDIPLUS_GET_PROC(GdipGetPointCount)
+ GDIPLUS_GET_PROC(GdipIsVisiblePathPoint)
+ GDIPLUS_GET_PROC(GdiplusShutdown)
+ GDIPLUS_GET_PROC(GdiplusStartup)
+ GDIPLUS_GET_PROC(GdipResetPath)
+ GDIPLUS_GET_PROC(GdipReversePath)
+ GDIPLUS_GET_PROC(GdipSetClipRect)
+ GDIPLUS_GET_PROC(GdipSetPenEndCap)
+
+#undef GDIPLUS_GET_PROC
+
+ return TRUE;
+}
+
static void stringify_point_type(PathPointType type, char * name)
{
*name = '\0';
@@ -82,7 +199,7 @@ static void ok_path(GpPath* path, const path_test_t *expected, INT expected_size
GpPointF * points;
char ename[POINT_TYPE_MAX_LEN], name[POINT_TYPE_MAX_LEN];
- if(GdipGetPointCount(path, &size) != Ok){
+ if(pGdipGetPointCount(path, &size) != Ok){
skip("Cannot perform path comparisons due to failure to retrieve path.\n");
return;
}
@@ -97,7 +214,7 @@ static void ok_path(GpPath* path, const path_test_t *expected, INT expected_size
points = HeapAlloc(GetProcessHeap(), 0, size * sizeof(GpPointF));
types = HeapAlloc(GetProcessHeap(), 0, size);
- if(GdipGetPathPoints(path, points, size) != Ok || GdipGetPathTypes(path, types, size) != Ok){
+ if(pGdipGetPathPoints(path, points, size) != Ok || pGdipGetPathTypes(path, types, size) != Ok){
skip("Cannot perform path comparisons due to failure to retrieve path.\n");
goto end;
}
@@ -138,14 +255,14 @@ static void test_constructor_destructor(void)
GpStatus status;
GpPath* path = NULL;
- status = GdipCreatePath(FillModeAlternate, &path);
+ status = pGdipCreatePath(FillModeAlternate, &path);
expect(Ok, status);
ok(path != NULL, "Expected path to be initialized\n");
- status = GdipDeletePath(NULL);
+ status = pGdipDeletePath(NULL);
expect(InvalidParameter, status);
- status = GdipDeletePath(path);
+ status = pGdipDeletePath(path);
expect(Ok, status);
}
@@ -156,27 +273,27 @@ static void test_getpathdata(void)
GpStatus status;
INT count;
- GdipCreatePath(FillModeAlternate, &path);
- status = GdipAddPathLine(path, 5.0, 5.0, 100.0, 50.0);
+ pGdipCreatePath(FillModeAlternate, &path);
+ status = pGdipAddPathLine(path, 5.0, 5.0, 100.0, 50.0);
expect(Ok, status);
/* Prepare storage. Made by wrapper class. */
- status = GdipGetPointCount(path, &count);
+ status = pGdipGetPointCount(path, &count);
expect(Ok, status);
data.Count = 2;
- data.Types = GdipAlloc(sizeof(BYTE) * count);
- data.Points = GdipAlloc(sizeof(PointF) * count);
+ data.Types = pGdipAlloc(sizeof(BYTE) * count);
+ data.Points = pGdipAlloc(sizeof(PointF) * count);
- status = GdipGetPathData(path, &data);
+ status = pGdipGetPathData(path, &data);
expect(Ok, status);
expect((data.Points[0].X == 5.0) && (data.Points[0].Y == 5.0) &&
(data.Points[1].X == 100.0) && (data.Points[1].Y == 50.0), TRUE);
expect((data.Types[0] == PathPointTypeStart) && (data.Types[1] == PathPointTypeLine), TRUE);
- GdipFree(data.Points);
- GdipFree(data.Types);
- GdipDeletePath(path);
+ pGdipFree(data.Points);
+ pGdipFree(data.Types);
+ pGdipDeletePath(path);
}
static path_test_t line2_path[] = {
@@ -203,19 +320,19 @@ static void test_line2(void)
line2_points[i].Y = 50.0 - i * 5.0;
}
- GdipCreatePath(FillModeAlternate, &path);
- status = GdipAddPathLine2(path, line2_points, 3);
+ pGdipCreatePath(FillModeAlternate, &path);
+ status = pGdipAddPathLine2(path, line2_points, 3);
expect(Ok, status);
- status = GdipAddPathLine2(path, &(line2_points[3]), 3);
+ status = pGdipAddPathLine2(path, &(line2_points[3]), 3);
expect(Ok, status);
- status = GdipClosePathFigure(path);
+ status = pGdipClosePathFigure(path);
expect(Ok, status);
- status = GdipAddPathLine2(path, &(line2_points[6]), 3);
+ status = pGdipAddPathLine2(path, &(line2_points[6]), 3);
expect(Ok, status);
ok_path(path, line2_path, sizeof(line2_path)/sizeof(path_test_t), FALSE);
- GdipDeletePath(path);
+ pGdipDeletePath(path);
}
static path_test_t arc_path[] = {
@@ -264,29 +381,29 @@ static void test_arc(void)
GpStatus status;
GpPath* path;
- GdipCreatePath(FillModeAlternate, &path);
+ pGdipCreatePath(FillModeAlternate, &path);
/* Exactly 90 degrees */
- status = GdipAddPathArc(path, 100.0, 100.0, 500.0, 700.0, 0.0, 90.0);
+ status = pGdipAddPathArc(path, 100.0, 100.0, 500.0, 700.0, 0.0, 90.0);
expect(Ok, status);
/* Over 90 degrees */
- status = GdipAddPathArc(path, 100.0, 100.0, 500.0, 700.0, 0.0, 100.0);
+ status = pGdipAddPathArc(path, 100.0, 100.0, 500.0, 700.0, 0.0, 100.0);
expect(Ok, status);
/* Negative start angle */
- status = GdipAddPathArc(path, 100.0, 100.0, 500.0, 700.0, -80.0, 100.0);
+ status = pGdipAddPathArc(path, 100.0, 100.0, 500.0, 700.0, -80.0, 100.0);
expect(Ok, status);
/* Negative sweep angle */
- status = GdipAddPathArc(path, 100.0, 100.0, 500.0, 700.0, 80.0, -100.0);
+ status = pGdipAddPathArc(path, 100.0, 100.0, 500.0, 700.0, 80.0, -100.0);
expect(Ok, status);
/* More than a full revolution */
- status = GdipAddPathArc(path, 100.0, 100.0, 500.0, 700.0, 50.0, -400.0);
+ status = pGdipAddPathArc(path, 100.0, 100.0, 500.0, 700.0, 50.0, -400.0);
expect(Ok, status);
/* 0 sweep angle */
- status = GdipAddPathArc(path, 100.0, 100.0, 500.0, 700.0, 50.0, 0.0);
+ status = pGdipAddPathArc(path, 100.0, 100.0, 500.0, 700.0, 50.0, 0.0);
expect(Ok, status);
ok_path(path, arc_path, sizeof(arc_path)/sizeof(path_test_t), FALSE);
- GdipDeletePath(path);
+ pGdipDeletePath(path);
}
static void test_worldbounds(void)
@@ -303,51 +420,51 @@ static void test_worldbounds(void)
line2_points[i].X = 200.0 + i * 50.0 * (i % 2);
line2_points[i].Y = 200.0 + i * 50.0 * !(i % 2);
}
- GdipCreatePen1((ARGB)0xdeadbeef, 20.0, UnitWorld, &pen);
- GdipSetPenEndCap(pen, LineCapSquareAnchor);
- GdipCreateMatrix2(1.5, 0.0, 1.0, 1.2, 10.4, 10.2, &matrix);
+ pGdipCreatePen1((ARGB)0xdeadbeef, 20.0, UnitWorld, &pen);
+ pGdipSetPenEndCap(pen, LineCapSquareAnchor);
+ pGdipCreateMatrix2(1.5, 0.0, 1.0, 1.2, 10.4, 10.2, &matrix);
- GdipCreatePath(FillModeAlternate, &path);
- GdipAddPathArc(path, 100.0, 100.0, 500.0, 700.0, 0.0, 100.0);
- GdipAddPathLine2(path, &(line2_points[0]), 10);
- status = GdipGetPathWorldBounds(path, &bounds, NULL, NULL);
+ pGdipCreatePath(FillModeAlternate, &path);
+ pGdipAddPathArc(path, 100.0, 100.0, 500.0, 700.0, 0.0, 100.0);
+ pGdipAddPathLine2(path, &(line2_points[0]), 10);
+ status = pGdipGetPathWorldBounds(path, &bounds, NULL, NULL);
expect(Ok, status);
- GdipDeletePath(path);
+ pGdipDeletePath(path);
expectf(200.0, bounds.X);
expectf(200.0, bounds.Y);
expectf(450.0, bounds.Width);
expectf(600.0, bounds.Height);
- GdipCreatePath(FillModeAlternate, &path);
- GdipAddPathArc(path, 100.0, 100.0, 500.0, 700.0, 0.0, 100.0);
- GdipAddPathLine2(path, &(line2_points[0]), 10);
- status = GdipGetPathWorldBounds(path, &bounds, matrix, NULL);
+ pGdipCreatePath(FillModeAlternate, &path);
+ pGdipAddPathArc(path, 100.0, 100.0, 500.0, 700.0, 0.0, 100.0);
+ pGdipAddPathLine2(path, &(line2_points[0]), 10);
+ status = pGdipGetPathWorldBounds(path, &bounds, matrix, NULL);
expect(Ok, status);
- GdipDeletePath(path);
+ pGdipDeletePath(path);
expectf(510.4, bounds.X);
expectf(250.2, bounds.Y);
expectf(1275.0, bounds.Width);
expectf(720.0, bounds.Height);
- GdipCreatePath(FillModeAlternate, &path);
- GdipAddPathArc(path, 100.0, 100.0, 500.0, 700.0, 0.0, 100.0);
- GdipAddPathLine2(path, &(line2_points[0]), 10);
- status = GdipGetPathWorldBounds(path, &bounds, NULL, pen);
+ pGdipCreatePath(FillModeAlternate, &path);
+ pGdipAddPathArc(path, 100.0, 100.0, 500.0, 700.0, 0.0, 100.0);
+ pGdipAddPathLine2(path, &(line2_points[0]), 10);
+ status = pGdipGetPathWorldBounds(path, &bounds, NULL, pen);
expect(Ok, status);
- GdipDeletePath(path);
+ pGdipDeletePath(path);
expectf(100.0, bounds.X);
expectf(100.0, bounds.Y);
expectf(650.0, bounds.Width);
expectf(800.0, bounds.Height);
- GdipCreatePath(FillModeAlternate, &path);
- GdipAddPathLine2(path, &(line2_points[0]), 2);
- status = GdipGetPathWorldBounds(path, &bounds, NULL, pen);
+ pGdipCreatePath(FillModeAlternate, &path);
+ pGdipAddPathLine2(path, &(line2_points[0]), 2);
+ status = pGdipGetPathWorldBounds(path, &bounds, NULL, pen);
expect(Ok, status);
- GdipDeletePath(path);
+ pGdipDeletePath(path);
expectf(156.0, bounds.X);
expectf(156.0, bounds.Y);
@@ -357,43 +474,43 @@ static void test_worldbounds(void)
line2_points[2].X = 2 * line2_points[1].X - line2_points[0].X;
line2_points[2].Y = 2 * line2_points[1].Y - line2_points[0].Y;
- GdipCreatePath(FillModeAlternate, &path);
- GdipAddPathLine2(path, &(line2_points[0]), 3);
- status = GdipGetPathWorldBounds(path, &bounds, NULL, pen);
+ pGdipCreatePath(FillModeAlternate, &path);
+ pGdipAddPathLine2(path, &(line2_points[0]), 3);
+ status = pGdipGetPathWorldBounds(path, &bounds, NULL, pen);
expect(Ok, status);
- GdipDeletePath(path);
+ pGdipDeletePath(path);
expectf(100.0, bounds.X);
expectf(100.0, bounds.Y);
expectf(300.0, bounds.Width);
expectf(200.0, bounds.Height);
- GdipCreatePath(FillModeAlternate, &path);
- GdipAddPathArc(path, 100.0, 100.0, 500.0, 700.0, 45.0, 20.0);
- status = GdipGetPathWorldBounds(path, &bounds, NULL, pen);
+ pGdipCreatePath(FillModeAlternate, &path);
+ pGdipAddPathArc(path, 100.0, 100.0, 500.0, 700.0, 45.0, 20.0);
+ status = pGdipGetPathWorldBounds(path, &bounds, NULL, pen);
expect(Ok, status);
- GdipDeletePath(path);
+ pGdipDeletePath(path);
expectf(386.7, bounds.X);
expectf(553.4, bounds.Y);
expectf(266.8, bounds.Width);
expectf(289.6, bounds.Height);
- GdipCreatePath(FillModeAlternate, &path);
- status = GdipGetPathWorldBounds(path, &bounds, matrix, pen);
+ pGdipCreatePath(FillModeAlternate, &path);
+ status = pGdipGetPathWorldBounds(path, &bounds, matrix, pen);
expect(Ok, status);
- GdipDeletePath(path);
+ pGdipDeletePath(path);
expectf(0.0, bounds.X);
expectf(0.0, bounds.Y);
expectf(0.0, bounds.Width);
expectf(0.0, bounds.Height);
- GdipCreatePath(FillModeAlternate, &path);
- GdipAddPathLine2(path, &(line2_points[0]), 2);
- status = GdipGetPathWorldBounds(path, &bounds, matrix, pen);
+ pGdipCreatePath(FillModeAlternate, &path);
+ pGdipAddPathLine2(path, &(line2_points[0]), 2);
+ status = pGdipGetPathWorldBounds(path, &bounds, matrix, pen);
expect(Ok, status);
- GdipDeletePath(path);
+ pGdipDeletePath(path);
todo_wine{
expectf(427.9, bounds.X);
@@ -402,14 +519,14 @@ static void test_worldbounds(void)
expectf(164.9, bounds.Height);
}
- GdipDeleteMatrix(matrix);
- GdipCreateMatrix2(0.9, -0.5, -0.5, -1.2, 10.4, 10.2, &matrix);
- GdipCreatePath(FillModeAlternate, &path);
- GdipAddPathArc(path, 100.0, 100.0, 500.0, 700.0, 0.0, 100.0);
- GdipAddPathLine2(path, &(line2_points[0]), 10);
- status = GdipGetPathWorldBounds(path, &bounds, matrix, NULL);
+ pGdipDeleteMatrix(matrix);
+ pGdipCreateMatrix2(0.9, -0.5, -0.5, -1.2, 10.4, 10.2, &matrix);
+ pGdipCreatePath(FillModeAlternate, &path);
+ pGdipAddPathArc(path, 100.0, 100.0, 500.0, 700.0, 0.0, 100.0);
+ pGdipAddPathLine2(path, &(line2_points[0]), 10);
+ status = pGdipGetPathWorldBounds(path, &bounds, matrix, NULL);
expect(Ok, status);
- GdipDeletePath(path);
+ pGdipDeletePath(path);
expectf(-209.6, bounds.X);
expectf(-1274.8, bounds.Y);
@@ -450,21 +567,21 @@ static void test_pathpath(void)
GpStatus status;
GpPath* path1, *path2;
- GdipCreatePath(FillModeAlternate, &path2);
- GdipAddPathArc(path2, 100.0, 100.0, 500.0, 700.0, 95.0, 100.0);
+ pGdipCreatePath(FillModeAlternate, &path2);
+ pGdipAddPathArc(path2, 100.0, 100.0, 500.0, 700.0, 95.0, 100.0);
- GdipCreatePath(FillModeAlternate, &path1);
- GdipAddPathArc(path1, 100.0, 100.0, 500.0, 700.0, 0.0, 90.0);
- status = GdipAddPathPath(path1, path2, FALSE);
+ pGdipCreatePath(FillModeAlternate, &path1);
+ pGdipAddPathArc(path1, 100.0, 100.0, 500.0, 700.0, 0.0, 90.0);
+ status = pGdipAddPathPath(path1, path2, FALSE);
expect(Ok, status);
- GdipAddPathArc(path1, 100.0, 100.0, 500.0, 700.0, -80.0, 100.0);
- status = GdipAddPathPath(path1, path2, TRUE);
+ pGdipAddPathArc(path1, 100.0, 100.0, 500.0, 700.0, -80.0, 100.0);
+ status = pGdipAddPathPath(path1, path2, TRUE);
expect(Ok, status);
ok_path(path1, pathpath_path, sizeof(pathpath_path)/sizeof(path_test_t), FALSE);
- GdipDeletePath(path1);
- GdipDeletePath(path2);
+ pGdipDeletePath(path1);
+ pGdipDeletePath(path2);
}
static path_test_t ellipse_path[] = {
@@ -522,19 +639,19 @@ static void test_ellipse(void)
points[1].X = 13.0;
points[1].Y = 17.0;
- GdipCreatePath(FillModeAlternate, &path);
- status = GdipAddPathEllipse(path, 10.0, 100.0, 20.0, 50.5);
+ pGdipCreatePath(FillModeAlternate, &path);
+ status = pGdipAddPathEllipse(path, 10.0, 100.0, 20.0, 50.5);
expect(Ok, status);
- GdipAddPathLine2(path, points, 2);
- status = GdipAddPathEllipse(path, 10.0, 200.0, -5.0, -10.0);
+ pGdipAddPathLine2(path, points, 2);
+ status = pGdipAddPathEllipse(path, 10.0, 200.0, -5.0, -10.0);
expect(Ok, status);
- GdipClosePathFigure(path);
- status = GdipAddPathEllipse(path, 10.0, 300.0, 0.0, 1.0);
+ pGdipClosePathFigure(path);
+ status = pGdipAddPathEllipse(path, 10.0, 300.0, 0.0, 1.0);
expect(Ok, status);
ok_path(path, ellipse_path, sizeof(ellipse_path)/sizeof(path_test_t), FALSE);
- GdipDeletePath(path);
+ pGdipDeletePath(path);
}
static path_test_t linei_path[] = {
@@ -564,19 +681,19 @@ static void test_linei(void)
points[1].X = 13.0;
points[1].Y = 17.0;
- GdipCreatePath(FillModeAlternate, &path);
- status = GdipAddPathLineI(path, 5.0, 5.0, 6.0, 8.0);
+ pGdipCreatePath(FillModeAlternate, &path);
+ status = pGdipAddPathLineI(path, 5.0, 5.0, 6.0, 8.0);
expect(Ok, status);
- GdipAddPathArc(path, 100.0, 100.0, 500.0, 700.0, -80.0, 100.0);
- status = GdipAddPathLineI(path, 15.0, 15.0, 26.0, 28.0);
+ pGdipAddPathArc(path, 100.0, 100.0, 500.0, 700.0, -80.0, 100.0);
+ status = pGdipAddPathLineI(path, 15.0, 15.0, 26.0, 28.0);
expect(Ok, status);
- GdipClosePathFigure(path);
- status = GdipAddPathLineI(path, 35.0, 35.0, 36.0, 38.0);
+ pGdipClosePathFigure(path);
+ status = pGdipAddPathLineI(path, 35.0, 35.0, 36.0, 38.0);
expect(Ok, status);
ok_path(path, linei_path, sizeof(linei_path)/sizeof(path_test_t), FALSE);
- GdipDeletePath(path);
+ pGdipDeletePath(path);
}
static path_test_t poly_path[] = {
@@ -606,26 +723,26 @@ static void test_polygon(void)
points[4].X = 20.0;
points[4].Y = 0.0;
- GdipCreatePath(FillModeAlternate, &path);
+ pGdipCreatePath(FillModeAlternate, &path);
/* NULL args */
- status = GdipAddPathPolygon(NULL, points, 5);
+ status = pGdipAddPathPolygon(NULL, points, 5);
expect(InvalidParameter, status);
- status = GdipAddPathPolygon(path, NULL, 5);
+ status = pGdipAddPathPolygon(path, NULL, 5);
expect(InvalidParameter, status);
/* Polygon should have 3 points at least */
- status = GdipAddPathPolygon(path, points, 2);
+ status = pGdipAddPathPolygon(path, points, 2);
expect(InvalidParameter, status);
/* to test how it prolongs not empty path */
- status = GdipAddPathLine(path, 5.0, 5.0, 6.0, 8.0);
+ status = pGdipAddPathLine(path, 5.0, 5.0, 6.0, 8.0);
expect(Ok, status);
- status = GdipAddPathPolygon(path, points, 5);
+ status = pGdipAddPathPolygon(path, points, 5);
expect(Ok, status);
/* check resulting path */
ok_path(path, poly_path, sizeof(poly_path)/sizeof(path_test_t), FALSE);
- GdipDeletePath(path);
+ pGdipDeletePath(path);
}
static path_test_t rect_path[] = {
@@ -646,17 +763,17 @@ static void test_rect(void)
GpPath *path;
GpRectF rects[2];
- GdipCreatePath(FillModeAlternate, &path);
- status = GdipAddPathRectangle(path, 5.0, 5.0, 100.0, 50.0);
+ pGdipCreatePath(FillModeAlternate, &path);
+ status = pGdipAddPathRectangle(path, 5.0, 5.0, 100.0, 50.0);
expect(Ok, status);
- status = GdipAddPathRectangle(path, 100.0, 50.0, 120.0, 30.0);
+ status = pGdipAddPathRectangle(path, 100.0, 50.0, 120.0, 30.0);
expect(Ok, status);
ok_path(path, rect_path, sizeof(rect_path)/sizeof(path_test_t), FALSE);
- GdipDeletePath(path);
+ pGdipDeletePath(path);
- GdipCreatePath(FillModeAlternate, &path);
+ pGdipCreatePath(FillModeAlternate, &path);
rects[0].X = 5.0;
rects[0].Y = 5.0;
@@ -667,12 +784,12 @@ static void test_rect(void)
rects[1].Width = 120.0;
rects[1].Height = 30.0;
- status = GdipAddPathRectangles(path, (GDIPCONST GpRectF*)&rects, 2);
+ status = pGdipAddPathRectangles(path, (GDIPCONST GpRectF*)&rects, 2);
expect(Ok, status);
ok_path(path, rect_path, sizeof(rect_path)/sizeof(path_test_t), FALSE);
- GdipDeletePath(path);
+ pGdipDeletePath(path);
}
static void test_lastpoint(void)
@@ -681,23 +798,23 @@ static void test_lastpoint(void)
GpPath *path;
GpPointF ptf;
- GdipCreatePath(FillModeAlternate, &path);
- status = GdipAddPathRectangle(path, 5.0, 5.0, 100.0, 50.0);
+ pGdipCreatePath(FillModeAlternate, &path);
+ status = pGdipAddPathRectangle(path, 5.0, 5.0, 100.0, 50.0);
expect(Ok, status);
/* invalid args */
- status = GdipGetPathLastPoint(NULL, &ptf);
+ status = pGdipGetPathLastPoint(NULL, &ptf);
expect(InvalidParameter, status);
- status = GdipGetPathLastPoint(path, NULL);
+ status = pGdipGetPathLastPoint(path, NULL);
expect(InvalidParameter, status);
- status = GdipGetPathLastPoint(NULL, NULL);
+ status = pGdipGetPathLastPoint(NULL, NULL);
expect(InvalidParameter, status);
- status = GdipGetPathLastPoint(path, &ptf);
+ status = pGdipGetPathLastPoint(path, &ptf);
expect(Ok, status);
expect(TRUE, (ptf.X == 5.0) && (ptf.Y == 55.0));
- GdipDeletePath(path);
+ pGdipDeletePath(path);
}
static path_test_t addcurve_path[] = {
@@ -750,62 +867,62 @@ static void test_addcurve(void)
points[3].X = 30.0;
points[3].Y = 10.0;
- GdipCreatePath(FillModeAlternate, &path);
+ pGdipCreatePath(FillModeAlternate, &path);
/* NULL args */
- status = GdipAddPathCurve2(NULL, NULL, 0, 0.0);
+ status = pGdipAddPathCurve2(NULL, NULL, 0, 0.0);
expect(InvalidParameter, status);
- status = GdipAddPathCurve2(path, NULL, 0, 0.0);
+ status = pGdipAddPathCurve2(path, NULL, 0, 0.0);
expect(InvalidParameter, status);
- status = GdipAddPathCurve2(path, points, -1, 0.0);
+ status = pGdipAddPathCurve2(path, points, -1, 0.0);
expect(InvalidParameter, status);
- status = GdipAddPathCurve2(path, points, 1, 1.0);
+ status = pGdipAddPathCurve2(path, points, 1, 1.0);
expect(InvalidParameter, status);
/* add to empty path */
- status = GdipAddPathCurve2(path, points, 4, 1.0);
+ status = pGdipAddPathCurve2(path, points, 4, 1.0);
expect(Ok, status);
ok_path(path, addcurve_path, sizeof(addcurve_path)/sizeof(path_test_t), FALSE);
- GdipDeletePath(path);
+ pGdipDeletePath(path);
/* add to notempty path and opened figure */
- GdipCreatePath(FillModeAlternate, &path);
- GdipAddPathLine(path, 100.0, 120.0, 123.0, 10.0);
- status = GdipAddPathCurve2(path, points, 4, 1.0);
+ pGdipCreatePath(FillModeAlternate, &path);
+ pGdipAddPathLine(path, 100.0, 120.0, 123.0, 10.0);
+ status = pGdipAddPathCurve2(path, points, 4, 1.0);
expect(Ok, status);
ok_path(path, addcurve_path2, sizeof(addcurve_path2)/sizeof(path_test_t), FALSE);
/* NULL args */
- GdipResetPath(path);
- status = GdipAddPathCurve3(NULL, NULL, 0, 0, 0, 0.0);
+ pGdipResetPath(path);
+ status = pGdipAddPathCurve3(NULL, NULL, 0, 0, 0, 0.0);
expect(InvalidParameter, status);
- status = GdipAddPathCurve3(path, NULL, 0, 0, 0, 0.0);
+ status = pGdipAddPathCurve3(path, NULL, 0, 0, 0, 0.0);
expect(InvalidParameter, status);
/* wrong count, offset.. */
- status = GdipAddPathCurve3(path, points, 0, 0, 0, 0.0);
+ status = pGdipAddPathCurve3(path, points, 0, 0, 0, 0.0);
expect(InvalidParameter, status);
- status = GdipAddPathCurve3(path, points, 4, 0, 0, 0.0);
+ status = pGdipAddPathCurve3(path, points, 4, 0, 0, 0.0);
expect(InvalidParameter, status);
- status = GdipAddPathCurve3(path, points, 4, 0, 4, 0.0);
+ status = pGdipAddPathCurve3(path, points, 4, 0, 4, 0.0);
expect(InvalidParameter, status);
- status = GdipAddPathCurve3(path, points, 4, 1, 3, 0.0);
+ status = pGdipAddPathCurve3(path, points, 4, 1, 3, 0.0);
expect(InvalidParameter, status);
- status = GdipAddPathCurve3(path, points, 4, 1, 0, 0.0);
+ status = pGdipAddPathCurve3(path, points, 4, 1, 0, 0.0);
expect(InvalidParameter, status);
- status = GdipAddPathCurve3(path, points, 4, 3, 1, 0.0);
+ status = pGdipAddPathCurve3(path, points, 4, 3, 1, 0.0);
expect(InvalidParameter, status);
/* use all points */
- status = GdipAddPathCurve3(path, points, 4, 0, 3, 1.0);
+ status = pGdipAddPathCurve3(path, points, 4, 0, 3, 1.0);
expect(Ok, status);
ok_path(path, addcurve_path, sizeof(addcurve_path)/sizeof(path_test_t), FALSE);
- GdipResetPath(path);
+ pGdipResetPath(path);
- status = GdipAddPathCurve3(path, points, 4, 1, 2, 1.0);
+ status = pGdipAddPathCurve3(path, points, 4, 1, 2, 1.0);
expect(Ok, status);
ok_path(path, addcurve_path3, sizeof(addcurve_path3)/sizeof(path_test_t), FALSE);
- GdipDeletePath(path);
+ pGdipDeletePath(path);
}
static path_test_t addclosedcurve_path[] = {
@@ -838,23 +955,23 @@ static void test_addclosedcurve(void)
points[3].X = 30.0;
points[3].Y = 10.0;
- GdipCreatePath(FillModeAlternate, &path);
+ pGdipCreatePath(FillModeAlternate, &path);
/* NULL args */
- status = GdipAddPathClosedCurve2(NULL, NULL, 0, 0.0);
+ status = pGdipAddPathClosedCurve2(NULL, NULL, 0, 0.0);
expect(InvalidParameter, status);
- status = GdipAddPathClosedCurve2(path, NULL, 0, 0.0);
+ status = pGdipAddPathClosedCurve2(path, NULL, 0, 0.0);
expect(InvalidParameter, status);
- status = GdipAddPathClosedCurve2(path, points, -1, 0.0);
+ status = pGdipAddPathClosedCurve2(path, points, -1, 0.0);
expect(InvalidParameter, status);
- status = GdipAddPathClosedCurve2(path, points, 1, 1.0);
+ status = pGdipAddPathClosedCurve2(path, points, 1, 1.0);
expect(InvalidParameter, status);
/* add to empty path */
- status = GdipAddPathClosedCurve2(path, points, 4, 1.0);
+ status = pGdipAddPathClosedCurve2(path, points, 4, 1.0);
expect(Ok, status);
ok_path(path, addclosedcurve_path, sizeof(addclosedcurve_path)/sizeof(path_test_t), FALSE);
- GdipDeletePath(path);
+ pGdipDeletePath(path);
}
static path_test_t reverse_path[] = {
@@ -879,25 +996,25 @@ static void test_reverse(void)
pts[i].Y = 50.0 - i * 5.0;
}
- GdipCreatePath(FillModeAlternate, &path);
+ pGdipCreatePath(FillModeAlternate, &path);
/* NULL argument */
- status = GdipReversePath(NULL);
+ status = pGdipReversePath(NULL);
expect(InvalidParameter, status);
/* empty path */
- status = GdipReversePath(path);
+ status = pGdipReversePath(path);
expect(Ok, status);
- GdipAddPathLine2(path, pts, 4);
- GdipClosePathFigure(path);
- GdipAddPathLine2(path, &(pts[4]), 3);
+ pGdipAddPathLine2(path, pts, 4);
+ pGdipClosePathFigure(path);
+ pGdipAddPathLine2(path, &(pts[4]), 3);
- status = GdipReversePath(path);
+ status = pGdipReversePath(path);
expect(Ok, status);
ok_path(path, reverse_path, sizeof(reverse_path)/sizeof(path_test_t), FALSE);
- GdipDeletePath(path);
+ pGdipDeletePath(path);
}
static path_test_t addpie_path[] = {
@@ -918,31 +1035,31 @@ static void test_addpie(void)
GpStatus status;
GpPath *path;
- GdipCreatePath(FillModeAlternate, &path);
+ pGdipCreatePath(FillModeAlternate, &path);
/* NULL argument */
- status = GdipAddPathPie(NULL, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
+ status = pGdipAddPathPie(NULL, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
expect(InvalidParameter, status);
- status = GdipAddPathPie(path, 0.0, 0.0, 100.0, 50.0, 10.0, 50.0);
+ status = pGdipAddPathPie(path, 0.0, 0.0, 100.0, 50.0, 10.0, 50.0);
expect(Ok, status);
ok_path(path, addpie_path, sizeof(addpie_path)/sizeof(path_test_t), FALSE);
- status = GdipResetPath(path);
+ status = pGdipResetPath(path);
expect(Ok, status);
/* zero width base ellipse */
- status = GdipAddPathPie(path, 0.0, 0.0, 0.0, 60.0, -90.0, 24.0);
+ status = pGdipAddPathPie(path, 0.0, 0.0, 0.0, 60.0, -90.0, 24.0);
expect(InvalidParameter, status);
ok_path(path, addpie_path2, sizeof(addpie_path2)/sizeof(path_test_t), FALSE);
- status = GdipResetPath(path);
+ status = pGdipResetPath(path);
expect(Ok, status);
/* zero height base ellipse */
- status = GdipAddPathPie(path, 0.0, 0.0, 60.0, 0.0 , -90.0, 24.0);
+ status = pGdipAddPathPie(path, 0.0, 0.0, 60.0, 0.0 , -90.0, 24.0);
expect(InvalidParameter, status);
ok_path(path, addpie_path3, sizeof(addpie_path3)/sizeof(path_test_t), FALSE);
- GdipDeletePath(path);
+ pGdipDeletePath(path);
}
static path_test_t flattenellipse_path[] = {
@@ -1006,55 +1123,55 @@ static void test_flatten(void)
GpPath *path;
GpMatrix *m;
- status = GdipCreatePath(FillModeAlternate, &path);
+ status = pGdipCreatePath(FillModeAlternate, &path);
expect(Ok, status);
- status = GdipCreateMatrix(&m);
+ status = pGdipCreateMatrix(&m);
expect(Ok, status);
/* NULL arguments */
- status = GdipFlattenPath(NULL, NULL, 0.0);
+ status = pGdipFlattenPath(NULL, NULL, 0.0);
expect(InvalidParameter, status);
- status = GdipFlattenPath(NULL, m, 0.0);
+ status = pGdipFlattenPath(NULL, m, 0.0);
expect(InvalidParameter, status);
/* flatten empty path */
- status = GdipFlattenPath(path, NULL, 1.0);
+ status = pGdipFlattenPath(path, NULL, 1.0);
expect(Ok, status);
- status = GdipAddPathEllipse(path, 0.0, 0.0, 100.0, 50.0);
+ status = pGdipAddPathEllipse(path, 0.0, 0.0, 100.0, 50.0);
expect(Ok, status);
- status = GdipFlattenPath(path, NULL, 1.0);
+ status = pGdipFlattenPath(path, NULL, 1.0);
expect(Ok, status);
ok_path(path, flattenellipse_path, sizeof(flattenellipse_path)/sizeof(path_test_t), TRUE);
- status = GdipResetPath(path);
+ status = pGdipResetPath(path);
expect(Ok, status);
- status = GdipAddPathLine(path, 5.0, 10.0, 50.0, 100.0);
+ status = pGdipAddPathLine(path, 5.0, 10.0, 50.0, 100.0);
expect(Ok, status);
- status = GdipFlattenPath(path, NULL, 1.0);
+ status = pGdipFlattenPath(path, NULL, 1.0);
expect(Ok, status);
ok_path(path, flattenline_path, sizeof(flattenline_path)/sizeof(path_test_t), FALSE);
- status = GdipResetPath(path);
+ status = pGdipResetPath(path);
expect(Ok, status);
- status = GdipAddPathArc(path, 0.0, 0.0, 100.0, 50.0, 0.0, 90.0);
+ status = pGdipAddPathArc(path, 0.0, 0.0, 100.0, 50.0, 0.0, 90.0);
expect(Ok, status);
- status = GdipFlattenPath(path, NULL, 1.0);
+ status = pGdipFlattenPath(path, NULL, 1.0);
expect(Ok, status);
ok_path(path, flattenarc_path, sizeof(flattenarc_path)/sizeof(path_test_t), TRUE);
/* easy case - quater of a full circle */
- status = GdipResetPath(path);
+ status = pGdipResetPath(path);
expect(Ok, status);
- status = GdipAddPathArc(path, 0.0, 0.0, 100.0, 100.0, 0.0, 90.0);
+ status = pGdipAddPathArc(path, 0.0, 0.0, 100.0, 100.0, 0.0, 90.0);
expect(Ok, status);
- status = GdipFlattenPath(path, NULL, 1.0);
+ status = pGdipFlattenPath(path, NULL, 1.0);
expect(Ok, status);
ok_path(path, flattenquater_path, sizeof(flattenquater_path)/sizeof(path_test_t), FALSE);
- GdipDeleteMatrix(m);
- GdipDeletePath(path);
+ pGdipDeleteMatrix(m);
+ pGdipDeletePath(path);
}
static void test_isvisible(void)
@@ -1065,47 +1182,47 @@ static void test_isvisible(void)
BOOL result;
GpStatus status;
- status = GdipCreateFromHDC(hdc, &graphics);
+ status = pGdipCreateFromHDC(hdc, &graphics);
expect(Ok, status);
- status = GdipCreatePath(FillModeAlternate, &path);
+ status = pGdipCreatePath(FillModeAlternate, &path);
expect(Ok, status);
/* NULL */
- status = GdipIsVisiblePathPoint(NULL, 0.0, 0.0, NULL, NULL);
+ status = pGdipIsVisiblePathPoint(NULL, 0.0, 0.0, NULL, NULL);
expect(InvalidParameter, status);
- status = GdipIsVisiblePathPoint(path, 0.0, 0.0, NULL, NULL);
+ status = pGdipIsVisiblePathPoint(path, 0.0, 0.0, NULL, NULL);
expect(InvalidParameter, status);
- status = GdipIsVisiblePathPoint(path, 0.0, 0.0, NULL, NULL);
+ status = pGdipIsVisiblePathPoint(path, 0.0, 0.0, NULL, NULL);
expect(InvalidParameter, status);
- status = GdipIsVisiblePathPoint(path, 0.0, 0.0, graphics, NULL);
+ status = pGdipIsVisiblePathPoint(path, 0.0, 0.0, graphics, NULL);
expect(InvalidParameter, status);
/* empty path */
result = TRUE;
- status = GdipIsVisiblePathPoint(path, 0.0, 0.0, NULL, &result);
+ status = pGdipIsVisiblePathPoint(path, 0.0, 0.0, NULL, &result);
expect(Ok, status);
expect(FALSE, result);
/* rect */
- status = GdipAddPathRectangle(path, 0.0, 0.0, 10.0, 10.0);
+ status = pGdipAddPathRectangle(path, 0.0, 0.0, 10.0, 10.0);
expect(Ok, status);
result = FALSE;
- status = GdipIsVisiblePathPoint(path, 0.0, 0.0, NULL, &result);
+ status = pGdipIsVisiblePathPoint(path, 0.0, 0.0, NULL, &result);
expect(Ok, status);
expect(TRUE, result);
result = TRUE;
- status = GdipIsVisiblePathPoint(path, 11.0, 11.0, NULL, &result);
+ status = pGdipIsVisiblePathPoint(path, 11.0, 11.0, NULL, &result);
expect(Ok, status);
expect(FALSE, result);
/* not affected by clipping */
- status = GdipSetClipRect(graphics, 5.0, 5.0, 5.0, 5.0, CombineModeReplace);
+ status = pGdipSetClipRect(graphics, 5.0, 5.0, 5.0, 5.0, CombineModeReplace);
expect(Ok, status);
result = FALSE;
- status = GdipIsVisiblePathPoint(path, 0.0, 0.0, graphics, &result);
+ status = pGdipIsVisiblePathPoint(path, 0.0, 0.0, graphics, &result);
expect(Ok, status);
expect(TRUE, result);
- GdipDeletePath(path);
- GdipDeleteGraphics(graphics);
+ pGdipDeletePath(path);
+ pGdipDeleteGraphics(graphics);
ReleaseDC(0, hdc);
}
@@ -1114,12 +1231,15 @@ START_TEST(graphicspath)
struct GdiplusStartupInput gdiplusStartupInput;
ULONG_PTR gdiplusToken;
+ if (!InitFunctionPtrs())
+ return;
+
gdiplusStartupInput.GdiplusVersion = 1;
gdiplusStartupInput.DebugEventCallback = NULL;
gdiplusStartupInput.SuppressBackgroundThread = 0;
gdiplusStartupInput.SuppressExternalCodecs = 0;
- GdiplusStartup(&gdiplusToken, &gdiplusStartupInput, NULL);
+ pGdiplusStartup(&gdiplusToken, &gdiplusStartupInput, NULL);
test_constructor_destructor();
test_getpathdata();
@@ -1139,5 +1259,7 @@ START_TEST(graphicspath)
test_flatten();
test_isvisible();
- GdiplusShutdown(gdiplusToken);
+ pGdiplusShutdown(gdiplusToken);
+
+ FreeLibrary(hGdiPlus);
}
diff --git a/dlls/gdiplus/tests/image.c b/dlls/gdiplus/tests/image.c
index 12fab7c..142cded 100644
--- a/dlls/gdiplus/tests/image.c
+++ b/dlls/gdiplus/tests/image.c
@@ -30,6 +30,98 @@
#define expect(expected, got) ok(((UINT)got) == ((UINT)expected), "Expected %.8x, got %.8x\n", (UINT)expected, (UINT)got)
#define expectf(expected, got) ok(fabs(expected - got) < 0.0001, "Expected %.2f, got %.2f\n", expected, got)
+static GpStatus (WINGDIPAPI * pGdipBitmapLockBits)(GpBitmap*,GDIPCONST GpRect*,
+ UINT,PixelFormat,BitmapData*);
+static GpStatus (WINGDIPAPI * pGdipBitmapUnlockBits)(GpBitmap*,BitmapData*);
+static GpStatus (WINGDIPAPI * pGdipCreateBitmapFromFile)(GDIPCONST WCHAR*,
+ GpBitmap**);
+static GpStatus (WINGDIPAPI * pGdipCreateBitmapFromHBITMAP)(HBITMAP,HPALETTE,
+ GpBitmap**);
+static GpStatus (WINGDIPAPI * pGdipCreateBitmapFromHICON)(HICON,GpBitmap**);
+static GpStatus (WINGDIPAPI * pGdipCreateBitmapFromScan0)(INT,INT,INT,
+ PixelFormat,BYTE*,GpBitmap**);
+static GpStatus (WINGDIPAPI * pGdipCreateBitmapFromStream)(IStream*,GpBitmap**);
+static GpStatus (WINGDIPAPI * pGdipCloneImage)(GpImage*,GpImage**);
+static GpStatus (WINGDIPAPI * pGdipDisposeImage)(GpImage*);
+static GpStatus (WINGDIPAPI * pGdipGetImageBounds)(GpImage*,GpRectF*,GpUnit*);
+static GpStatus (WINGDIPAPI * pGdipGetImageDimension)(GpImage*,REAL*,REAL*);
+static GpStatus (WINGDIPAPI * pGdipGetImageFlags)(GpImage*,UINT*);
+static GpStatus (WINGDIPAPI * pGdipGetImageHeight)(GpImage*,UINT*);
+static GpStatus (WINGDIPAPI * pGdipGetImagePixelFormat)(GpImage*,PixelFormat*);
+static GpStatus (WINGDIPAPI * pGdipGetImageRawFormat)(GpImage*,GUID*);
+static GpStatus (WINGDIPAPI * pGdipGetImageType)(GpImage*,ImageType*);
+static GpStatus (WINGDIPAPI * pGdipGetImageWidth)(GpImage*,UINT*);
+static GpStatus (WINGDIPAPI * pGdipImageGetFrameDimensionsCount)(GpImage*,
+ UINT*);
+static GpStatus (WINGDIPAPI * pGdipLoadImageFromFile)(GDIPCONST WCHAR*,
+ GpImage**);
+static GpStatus (WINGDIPAPI * pGdipLoadImageFromFileICM)(GDIPCONST WCHAR*,
+ GpImage**);
+static GpStatus (WINGDIPAPI * pGdipSaveImageToFile)(GpImage*,GDIPCONST WCHAR*,
+ GDIPCONST CLSID*,GDIPCONST EncoderParameters*);
+static GpStatus (WINGDIPAPI * pGdipGetImageEncodersSize)(UINT*,UINT*);
+static GpStatus (WINGDIPAPI * pGdipGetImageEncoders)(UINT,UINT,ImageCodecInfo*);
+static GpStatus (WINGDIPAPI * pGdipTestControl)(GpTestControlEnum,void*);
+static Status (WINAPI * pGdiplusStartup)(ULONG_PTR*,
+ const struct GdiplusStartupInput*,struct GdiplusStartupOutput*);
+static void (WINAPI * pGdiplusShutdown)(ULONG_PTR);
+static void* (WINGDIPAPI * pGdipAlloc)(SIZE_T);
+static void (WINGDIPAPI * pGdipFree)(void*);
+
+static HMODULE hGdiPlus = 0;
+
+static BOOL InitFunctionPtrs(void)
+{
+ hGdiPlus = LoadLibraryA("gdiplus.dll");
+ if (!hGdiPlus)
+ {
+ trace("Could not load gdiplus.dll\n");
+ return FALSE;
+ }
+
+#define GDIPLUS_GET_PROC(func) \
+ p ## func = (void*)GetProcAddress(hGdiPlus, #func); \
+ if (!p ## func) \
+ { \
+ trace("GetProcAddress(%s) failed\n", #func); \
+ FreeLibrary(hGdiPlus); \
+ return FALSE; \
+ }
+
+ GDIPLUS_GET_PROC(GdipAlloc)
+ GDIPLUS_GET_PROC(GdipBitmapLockBits)
+ GDIPLUS_GET_PROC(GdipBitmapUnlockBits)
+ GDIPLUS_GET_PROC(GdipCloneImage)
+ GDIPLUS_GET_PROC(GdipCreateBitmapFromFile)
+ GDIPLUS_GET_PROC(GdipCreateBitmapFromHBITMAP)
+ GDIPLUS_GET_PROC(GdipCreateBitmapFromHICON)
+ GDIPLUS_GET_PROC(GdipCreateBitmapFromScan0)
+ GDIPLUS_GET_PROC(GdipCreateBitmapFromStream)
+ GDIPLUS_GET_PROC(GdipDisposeImage)
+ GDIPLUS_GET_PROC(GdipFree)
+ GDIPLUS_GET_PROC(GdipGetImageBounds)
+ GDIPLUS_GET_PROC(GdipGetImageDimension)
+ GDIPLUS_GET_PROC(GdipGetImageEncoders)
+ GDIPLUS_GET_PROC(GdipGetImageEncodersSize)
+ GDIPLUS_GET_PROC(GdipGetImageFlags)
+ GDIPLUS_GET_PROC(GdipGetImageHeight)
+ GDIPLUS_GET_PROC(GdipGetImagePixelFormat)
+ GDIPLUS_GET_PROC(GdipGetImageRawFormat)
+ GDIPLUS_GET_PROC(GdipGetImageType)
+ GDIPLUS_GET_PROC(GdipGetImageWidth)
+ GDIPLUS_GET_PROC(GdipImageGetFrameDimensionsCount)
+ GDIPLUS_GET_PROC(GdipLoadImageFromFile)
+ GDIPLUS_GET_PROC(GdipLoadImageFromFileICM)
+ GDIPLUS_GET_PROC(GdiplusShutdown)
+ GDIPLUS_GET_PROC(GdiplusStartup)
+ GDIPLUS_GET_PROC(GdipSaveImageToFile)
+ GDIPLUS_GET_PROC(GdipTestControl)
+
+#undef GDIPLUS_GET_PROC
+
+ return TRUE;
+}
+
static void expect_rawformat(REFGUID expected, GpImage *img, int line, BOOL todo)
{
GUID raw;
@@ -38,7 +130,7 @@ static void expect_rawformat(REFGUID expected, GpImage *img, int line, BOOL todo
char buffer2[39];
GpStatus stat;
- stat = GdipGetImageRawFormat(img, &raw);
+ stat = pGdipGetImageRawFormat(img, &raw);
ok_(__FILE__, line)(stat == Ok, "GdipGetImageRawFormat failed with %d\n", stat);
if(stat != Ok) return;
StringFromGUID2(&raw, bufferW, sizeof(bufferW)/sizeof(bufferW[0]));
@@ -69,7 +161,7 @@ static void test_bufferrawformat(void* buff, int size, REFGUID expected, int lin
ok_(__FILE__, line)(hres == S_OK, "Failed to create a stream\n");
if(hres != S_OK) return;
- stat = GdipCreateBitmapFromStream(stream, &bmp);
+ stat = pGdipCreateBitmapFromStream(stream, &bmp);
ok_(__FILE__, line)(stat == Ok, "Failed to create a Bitmap\n");
if(stat != Ok){
IStream_Release(stream);
@@ -78,7 +170,7 @@ static void test_bufferrawformat(void* buff, int size, REFGUID expected, int lin
expect_rawformat(expected, (GpImage*)bmp, line, todo);
- GdipDisposeImage((GpImage*)bmp);
+ pGdipDisposeImage((GpImage*)bmp);
IStream_Release(stream);
}
@@ -89,53 +181,53 @@ static void test_Scan0(void)
BYTE buff[360];
bm = NULL;
- stat = GdipCreateBitmapFromScan0(10, 10, 10, PixelFormat24bppRGB, NULL, &bm);
+ stat = pGdipCreateBitmapFromScan0(10, 10, 10, PixelFormat24bppRGB, NULL, &bm);
expect(Ok, stat);
ok(NULL != bm, "Expected bitmap to be initialized\n");
if (stat == Ok)
- GdipDisposeImage((GpImage*)bm);
+ pGdipDisposeImage((GpImage*)bm);
bm = (GpBitmap*)0xdeadbeef;
- stat = GdipCreateBitmapFromScan0(10, -10, 10, PixelFormat24bppRGB, NULL, &bm);
+ stat = pGdipCreateBitmapFromScan0(10, -10, 10, PixelFormat24bppRGB, NULL, &bm);
expect(InvalidParameter, stat);
ok( !bm, "expected null bitmap\n" );
bm = (GpBitmap*)0xdeadbeef;
- stat = GdipCreateBitmapFromScan0(-10, 10, 10, PixelFormat24bppRGB, NULL, &bm);
+ stat = pGdipCreateBitmapFromScan0(-10, 10, 10, PixelFormat24bppRGB, NULL, &bm);
expect(InvalidParameter, stat);
ok( !bm, "expected null bitmap\n" );
bm = (GpBitmap*)0xdeadbeef;
- stat = GdipCreateBitmapFromScan0(10, 0, 10, PixelFormat24bppRGB, NULL, &bm);
+ stat = pGdipCreateBitmapFromScan0(10, 0, 10, PixelFormat24bppRGB, NULL, &bm);
expect(InvalidParameter, stat);
ok( !bm, "expected null bitmap\n" );
bm = NULL;
- stat = GdipCreateBitmapFromScan0(10, 10, 12, PixelFormat24bppRGB, buff, &bm);
+ stat = pGdipCreateBitmapFromScan0(10, 10, 12, PixelFormat24bppRGB, buff, &bm);
expect(Ok, stat);
ok(NULL != bm, "Expected bitmap to be initialized\n");
if (stat == Ok)
- GdipDisposeImage((GpImage*)bm);
+ pGdipDisposeImage((GpImage*)bm);
bm = (GpBitmap*) 0xdeadbeef;
- stat = GdipCreateBitmapFromScan0(10, 10, 10, PixelFormat24bppRGB, buff, &bm);
+ stat = pGdipCreateBitmapFromScan0(10, 10, 10, PixelFormat24bppRGB, buff, &bm);
expect(InvalidParameter, stat);
ok( !bm, "expected null bitmap\n" );
bm = (GpBitmap*)0xdeadbeef;
- stat = GdipCreateBitmapFromScan0(10, 10, 0, PixelFormat24bppRGB, buff, &bm);
+ stat = pGdipCreateBitmapFromScan0(10, 10, 0, PixelFormat24bppRGB, buff, &bm);
expect(InvalidParameter, stat);
ok( bm == (GpBitmap*)0xdeadbeef, "expected deadbeef bitmap\n" );
bm = NULL;
- stat = GdipCreateBitmapFromScan0(10, 10, -8, PixelFormat24bppRGB, buff, &bm);
+ stat = pGdipCreateBitmapFromScan0(10, 10, -8, PixelFormat24bppRGB, buff, &bm);
expect(Ok, stat);
ok(NULL != bm, "Expected bitmap to be initialized\n");
if (stat == Ok)
- GdipDisposeImage((GpImage*)bm);
+ pGdipDisposeImage((GpImage*)bm);
bm = (GpBitmap*)0xdeadbeef;
- stat = GdipCreateBitmapFromScan0(10, 10, -10, PixelFormat24bppRGB, buff, &bm);
+ stat = pGdipCreateBitmapFromScan0(10, 10, -10, PixelFormat24bppRGB, buff, &bm);
expect(InvalidParameter, stat);
ok( !bm, "expected null bitmap\n" );
}
@@ -148,27 +240,27 @@ static void test_GetImageDimension(void)
REAL w,h;
bm = (GpBitmap*)0xdeadbeef;
- stat = GdipCreateBitmapFromScan0(WIDTH, HEIGHT, 0, PixelFormat24bppRGB,NULL, &bm);
+ stat = pGdipCreateBitmapFromScan0(WIDTH, HEIGHT, 0, PixelFormat24bppRGB,NULL, &bm);
expect(Ok,stat);
ok((GpBitmap*)0xdeadbeef != bm, "Expected bitmap to not be 0xdeadbeef\n");
ok(NULL != bm, "Expected bitmap to not be NULL\n");
- stat = GdipGetImageDimension(NULL,&w,&h);
+ stat = pGdipGetImageDimension(NULL,&w,&h);
expect(InvalidParameter, stat);
- stat = GdipGetImageDimension((GpImage*)bm,NULL,&h);
+ stat = pGdipGetImageDimension((GpImage*)bm,NULL,&h);
expect(InvalidParameter, stat);
- stat = GdipGetImageDimension((GpImage*)bm,&w,NULL);
+ stat = pGdipGetImageDimension((GpImage*)bm,&w,NULL);
expect(InvalidParameter, stat);
w = -1;
h = -1;
- stat = GdipGetImageDimension((GpImage*)bm,&w,&h);
+ stat = pGdipGetImageDimension((GpImage*)bm,&w,&h);
expect(Ok, stat);
expectf(WIDTH, w);
expectf(HEIGHT, h);
- GdipDisposeImage((GpImage*)bm);
+ pGdipDisposeImage((GpImage*)bm);
}
static void test_GdipImageGetFrameDimensionsCount(void)
@@ -179,44 +271,44 @@ static void test_GdipImageGetFrameDimensionsCount(void)
UINT w;
bm = (GpBitmap*)0xdeadbeef;
- stat = GdipCreateBitmapFromScan0(WIDTH, HEIGHT, 0, PixelFormat24bppRGB,NULL, &bm);
+ stat = pGdipCreateBitmapFromScan0(WIDTH, HEIGHT, 0, PixelFormat24bppRGB,NULL, &bm);
expect(Ok,stat);
ok((GpBitmap*)0xdeadbeef != bm, "Expected bitmap to not be 0xdeadbeef\n");
ok(NULL != bm, "Expected bitmap to not be NULL\n");
- stat = GdipImageGetFrameDimensionsCount(NULL,&w);
+ stat = pGdipImageGetFrameDimensionsCount(NULL,&w);
expect(InvalidParameter, stat);
- stat = GdipImageGetFrameDimensionsCount((GpImage*)bm,NULL);
+ stat = pGdipImageGetFrameDimensionsCount((GpImage*)bm,NULL);
expect(InvalidParameter, stat);
w = -1;
- stat = GdipImageGetFrameDimensionsCount((GpImage*)bm,&w);
+ stat = pGdipImageGetFrameDimensionsCount((GpImage*)bm,&w);
expect(Ok, stat);
expect(1, w);
- GdipDisposeImage((GpImage*)bm);
+ pGdipDisposeImage((GpImage*)bm);
}
static void test_LoadingImages(void)
{
GpStatus stat;
- stat = GdipCreateBitmapFromFile(0, 0);
+ stat = pGdipCreateBitmapFromFile(0, 0);
expect(InvalidParameter, stat);
- stat = GdipCreateBitmapFromFile(0, (GpBitmap**)0xdeadbeef);
+ stat = pGdipCreateBitmapFromFile(0, (GpBitmap**)0xdeadbeef);
expect(InvalidParameter, stat);
- stat = GdipLoadImageFromFile(0, 0);
+ stat = pGdipLoadImageFromFile(0, 0);
expect(InvalidParameter, stat);
- stat = GdipLoadImageFromFile(0, (GpImage**)0xdeadbeef);
+ stat = pGdipLoadImageFromFile(0, (GpImage**)0xdeadbeef);
expect(InvalidParameter, stat);
- stat = GdipLoadImageFromFileICM(0, 0);
+ stat = pGdipLoadImageFromFileICM(0, 0);
expect(InvalidParameter, stat);
- stat = GdipLoadImageFromFileICM(0, (GpImage**)0xdeadbeef);
+ stat = pGdipLoadImageFromFileICM(0, (GpImage**)0xdeadbeef);
expect(InvalidParameter, stat);
}
@@ -233,53 +325,53 @@ static void test_SavingImages(void)
codecs = NULL;
- stat = GdipSaveImageToFile(0, 0, 0, 0);
+ stat = pGdipSaveImageToFile(0, 0, 0, 0);
expect(InvalidParameter, stat);
bm = NULL;
- stat = GdipCreateBitmapFromScan0(WIDTH, HEIGHT, 0, PixelFormat24bppRGB, NULL, &bm);
+ stat = pGdipCreateBitmapFromScan0(WIDTH, HEIGHT, 0, PixelFormat24bppRGB, NULL, &bm);
expect(Ok, stat);
if (!bm)
return;
/* invalid params */
- stat = GdipSaveImageToFile((GpImage*)bm, 0, 0, 0);
+ stat = pGdipSaveImageToFile((GpImage*)bm, 0, 0, 0);
expect(InvalidParameter, stat);
- stat = GdipSaveImageToFile((GpImage*)bm, filename, 0, 0);
+ stat = pGdipSaveImageToFile((GpImage*)bm, filename, 0, 0);
expect(InvalidParameter, stat);
/* encoder tests should succeed -- already tested */
- stat = GdipGetImageEncodersSize(&n, &s);
+ stat = pGdipGetImageEncodersSize(&n, &s);
if (stat != Ok || n == 0) goto cleanup;
- codecs = GdipAlloc(s);
+ codecs = pGdipAlloc(s);
if (!codecs) goto cleanup;
- stat = GdipGetImageEncoders(n, s, codecs);
+ stat = pGdipGetImageEncoders(n, s, codecs);
if (stat != Ok) goto cleanup;
- stat = GdipSaveImageToFile((GpImage*)bm, filename, &codecs[0].Clsid, 0);
+ stat = pGdipSaveImageToFile((GpImage*)bm, filename, &codecs[0].Clsid, 0);
expect(stat, Ok);
- GdipDisposeImage((GpImage*)bm);
+ pGdipDisposeImage((GpImage*)bm);
bm = 0;
/* re-load and check image stats */
- stat = GdipLoadImageFromFile(filename, (GpImage**)&bm);
+ stat = pGdipLoadImageFromFile(filename, (GpImage**)&bm);
expect(stat, Ok);
if (stat != Ok) goto cleanup;
- stat = GdipGetImageDimension((GpImage*)bm, &w, &h);
+ stat = pGdipGetImageDimension((GpImage*)bm, &w, &h);
if (stat != Ok) goto cleanup;
expectf(WIDTH, w);
expectf(HEIGHT, h);
cleanup:
- GdipFree(codecs);
+ pGdipFree(codecs);
if (bm)
- GdipDisposeImage((GpImage*)bm);
+ pGdipDisposeImage((GpImage*)bm);
ok(DeleteFileW(filename), "Delete failed.\n");
}
@@ -294,26 +386,26 @@ static void test_encoders(void)
static const WCHAR bmp_format[] = {'B', 'M', 'P', 0};
- stat = GdipGetImageEncodersSize(&n, &s);
+ stat = pGdipGetImageEncodersSize(&n, &s);
expect(stat, Ok);
- codecs = GdipAlloc(s);
+ codecs = pGdipAlloc(s);
if (!codecs)
return;
- stat = GdipGetImageEncoders(n, s, NULL);
+ stat = pGdipGetImageEncoders(n, s, NULL);
expect(GenericError, stat);
- stat = GdipGetImageEncoders(0, s, codecs);
+ stat = pGdipGetImageEncoders(0, s, codecs);
expect(GenericError, stat);
- stat = GdipGetImageEncoders(n, s-1, codecs);
+ stat = pGdipGetImageEncoders(n, s-1, codecs);
expect(GenericError, stat);
- stat = GdipGetImageEncoders(n, s+1, codecs);
+ stat = pGdipGetImageEncoders(n, s+1, codecs);
expect(GenericError, stat);
- stat = GdipGetImageEncoders(n, s, codecs);
+ stat = pGdipGetImageEncoders(n, s, codecs);
expect(stat, Ok);
bmp_found = FALSE;
@@ -329,7 +421,7 @@ static void test_encoders(void)
if (!bmp_found)
ok(FALSE, "No BMP codec found.\n");
- GdipFree(codecs);
+ pGdipFree(codecs);
}
static void test_LockBits(void)
@@ -341,7 +433,7 @@ static void test_LockBits(void)
const INT WIDTH = 10, HEIGHT = 20;
bm = NULL;
- stat = GdipCreateBitmapFromScan0(WIDTH, HEIGHT, 0, PixelFormat24bppRGB, NULL, &bm);
+ stat = pGdipCreateBitmapFromScan0(WIDTH, HEIGHT, 0, PixelFormat24bppRGB, NULL, &bm);
expect(Ok, stat);
rect.X = 2;
@@ -350,97 +442,97 @@ static void test_LockBits(void)
rect.Height = 5;
/* read-only */
- stat = GdipBitmapLockBits(bm, &rect, ImageLockModeRead, PixelFormat24bppRGB, &bd);
+ stat = pGdipBitmapLockBits(bm, &rect, ImageLockModeRead, PixelFormat24bppRGB, &bd);
expect(Ok, stat);
if (stat == Ok) {
- stat = GdipBitmapUnlockBits(bm, &bd);
+ stat = pGdipBitmapUnlockBits(bm, &bd);
expect(Ok, stat);
}
/* read-only, with NULL rect -> whole bitmap lock */
- stat = GdipBitmapLockBits(bm, NULL, ImageLockModeRead, PixelFormat24bppRGB, &bd);
+ stat = pGdipBitmapLockBits(bm, NULL, ImageLockModeRead, PixelFormat24bppRGB, &bd);
expect(Ok, stat);
expect(bd.Width, WIDTH);
expect(bd.Height, HEIGHT);
if (stat == Ok) {
- stat = GdipBitmapUnlockBits(bm, &bd);
+ stat = pGdipBitmapUnlockBits(bm, &bd);
expect(Ok, stat);
}
/* read-only, consecutive */
- stat = GdipBitmapLockBits(bm, &rect, ImageLockModeRead, PixelFormat24bppRGB, &bd);
+ stat = pGdipBitmapLockBits(bm, &rect, ImageLockModeRead, PixelFormat24bppRGB, &bd);
expect(Ok, stat);
if (stat == Ok) {
- stat = GdipBitmapUnlockBits(bm, &bd);
+ stat = pGdipBitmapUnlockBits(bm, &bd);
expect(Ok, stat);
}
- stat = GdipDisposeImage((GpImage*)bm);
+ stat = pGdipDisposeImage((GpImage*)bm);
expect(Ok, stat);
- stat = GdipCreateBitmapFromScan0(WIDTH, HEIGHT, 0, PixelFormat24bppRGB, NULL, &bm);
+ stat = pGdipCreateBitmapFromScan0(WIDTH, HEIGHT, 0, PixelFormat24bppRGB, NULL, &bm);
expect(Ok, stat);
/* read x2 */
- stat = GdipBitmapLockBits(bm, &rect, ImageLockModeRead, PixelFormat24bppRGB, &bd);
+ stat = pGdipBitmapLockBits(bm, &rect, ImageLockModeRead, PixelFormat24bppRGB, &bd);
expect(Ok, stat);
- stat = GdipBitmapLockBits(bm, &rect, ImageLockModeRead, PixelFormat24bppRGB, &bd);
+ stat = pGdipBitmapLockBits(bm, &rect, ImageLockModeRead, PixelFormat24bppRGB, &bd);
expect(WrongState, stat);
- stat = GdipBitmapUnlockBits(bm, &bd);
+ stat = pGdipBitmapUnlockBits(bm, &bd);
expect(Ok, stat);
- stat = GdipDisposeImage((GpImage*)bm);
+ stat = pGdipDisposeImage((GpImage*)bm);
expect(Ok, stat);
- stat = GdipCreateBitmapFromScan0(WIDTH, HEIGHT, 0, PixelFormat24bppRGB, NULL, &bm);
+ stat = pGdipCreateBitmapFromScan0(WIDTH, HEIGHT, 0, PixelFormat24bppRGB, NULL, &bm);
expect(Ok, stat);
/* write, no modification */
- stat = GdipBitmapLockBits(bm, &rect, ImageLockModeWrite, PixelFormat24bppRGB, &bd);
+ stat = pGdipBitmapLockBits(bm, &rect, ImageLockModeWrite, PixelFormat24bppRGB, &bd);
expect(Ok, stat);
if (stat == Ok) {
- stat = GdipBitmapUnlockBits(bm, &bd);
+ stat = pGdipBitmapUnlockBits(bm, &bd);
expect(Ok, stat);
}
/* write, consecutive */
- stat = GdipBitmapLockBits(bm, &rect, ImageLockModeWrite, PixelFormat24bppRGB, &bd);
+ stat = pGdipBitmapLockBits(bm, &rect, ImageLockModeWrite, PixelFormat24bppRGB, &bd);
expect(Ok, stat);
if (stat == Ok) {
- stat = GdipBitmapUnlockBits(bm, &bd);
+ stat = pGdipBitmapUnlockBits(bm, &bd);
expect(Ok, stat);
}
- stat = GdipDisposeImage((GpImage*)bm);
+ stat = pGdipDisposeImage((GpImage*)bm);
expect(Ok, stat);
- stat = GdipCreateBitmapFromScan0(WIDTH, HEIGHT, 0, PixelFormat24bppRGB, NULL, &bm);
+ stat = pGdipCreateBitmapFromScan0(WIDTH, HEIGHT, 0, PixelFormat24bppRGB, NULL, &bm);
expect(Ok, stat);
/* write, modify */
- stat = GdipBitmapLockBits(bm, &rect, ImageLockModeWrite, PixelFormat24bppRGB, &bd);
+ stat = pGdipBitmapLockBits(bm, &rect, ImageLockModeWrite, PixelFormat24bppRGB, &bd);
expect(Ok, stat);
if (stat == Ok) {
if (bd.Scan0)
((char*)bd.Scan0)[2] = 0xff;
- stat = GdipBitmapUnlockBits(bm, &bd);
+ stat = pGdipBitmapUnlockBits(bm, &bd);
expect(Ok, stat);
}
- stat = GdipDisposeImage((GpImage*)bm);
+ stat = pGdipDisposeImage((GpImage*)bm);
expect(Ok, stat);
/* dispose locked */
- stat = GdipCreateBitmapFromScan0(WIDTH, HEIGHT, 0, PixelFormat24bppRGB, NULL, &bm);
+ stat = pGdipCreateBitmapFromScan0(WIDTH, HEIGHT, 0, PixelFormat24bppRGB, NULL, &bm);
expect(Ok, stat);
- stat = GdipBitmapLockBits(bm, &rect, ImageLockModeRead, PixelFormat24bppRGB, &bd);
+ stat = pGdipBitmapLockBits(bm, &rect, ImageLockModeRead, PixelFormat24bppRGB, &bd);
expect(Ok, stat);
- stat = GdipDisposeImage((GpImage*)bm);
+ stat = pGdipDisposeImage((GpImage*)bm);
expect(Ok, stat);
}
@@ -460,33 +552,33 @@ static void test_GdipCreateBitmapFromHBITMAP(void)
HDC hdc;
BITMAPINFO bmi;
- stat = GdipCreateBitmapFromHBITMAP(NULL, NULL, NULL);
+ stat = pGdipCreateBitmapFromHBITMAP(NULL, NULL, NULL);
expect(InvalidParameter, stat);
hbm = CreateBitmap(WIDTH1, HEIGHT1, 1, 1, NULL);
- stat = GdipCreateBitmapFromHBITMAP(hbm, NULL, NULL);
+ stat = pGdipCreateBitmapFromHBITMAP(hbm, NULL, NULL);
expect(InvalidParameter, stat);
- stat = GdipCreateBitmapFromHBITMAP(hbm, NULL, &gpbm);
+ stat = pGdipCreateBitmapFromHBITMAP(hbm, NULL, &gpbm);
expect(Ok, stat);
- expect(Ok, GdipGetImageDimension((GpImage*) gpbm, &width, &height));
+ expect(Ok, pGdipGetImageDimension((GpImage*) gpbm, &width, &height));
expectf(WIDTH1, width);
expectf(HEIGHT1, height);
if (stat == Ok)
- GdipDisposeImage((GpImage*)gpbm);
+ pGdipDisposeImage((GpImage*)gpbm);
GlobalFree(hbm);
hbm = CreateBitmap(WIDTH2, HEIGHT2, 1, 1, &buff);
- stat = GdipCreateBitmapFromHBITMAP(hbm, NULL, &gpbm);
+ stat = pGdipCreateBitmapFromHBITMAP(hbm, NULL, &gpbm);
expect(Ok, stat);
/* raw format */
expect_rawformat(&ImageFormatMemoryBMP, (GpImage*)gpbm, __LINE__, TRUE);
- expect(Ok, GdipGetImageDimension((GpImage*) gpbm, &width, &height));
+ expect(Ok, pGdipGetImageDimension((GpImage*) gpbm, &width, &height));
expectf(WIDTH2, width);
expectf(HEIGHT2, height);
if (stat == Ok)
- GdipDisposeImage((GpImage*)gpbm);
+ pGdipDisposeImage((GpImage*)gpbm);
GlobalFree(hbm);
hdc = CreateCompatibleDC(0);
@@ -501,28 +593,28 @@ static void test_GdipCreateBitmapFromHBITMAP(void)
hbm = CreateDIBSection(hdc, &bmi, DIB_RGB_COLORS, NULL, NULL, 0);
ok(hbm != NULL, "CreateDIBSection failed\n");
- stat = GdipCreateBitmapFromHBITMAP(hbm, NULL, &gpbm);
+ stat = pGdipCreateBitmapFromHBITMAP(hbm, NULL, &gpbm);
expect(Ok, stat);
- expect(Ok, GdipGetImageDimension((GpImage*) gpbm, &width, &height));
+ expect(Ok, pGdipGetImageDimension((GpImage*) gpbm, &width, &height));
expectf(WIDTH1, width);
expectf(HEIGHT1, height);
if (stat == Ok)
- GdipDisposeImage((GpImage*)gpbm);
+ pGdipDisposeImage((GpImage*)gpbm);
- LogPal = GdipAlloc(sizeof(LOGPALETTE));
+ LogPal = pGdipAlloc(sizeof(LOGPALETTE));
ok(LogPal != NULL, "unable to allocate LOGPALETTE\n");
LogPal->palVersion = 0x300;
hpal = CreatePalette(LogPal);
ok(hpal != NULL, "CreatePalette failed\n");
- GdipFree(LogPal);
+ pGdipFree(LogPal);
- stat = GdipCreateBitmapFromHBITMAP(hbm, hpal, &gpbm);
+ stat = pGdipCreateBitmapFromHBITMAP(hbm, hpal, &gpbm);
todo_wine
{
expect(Ok, stat);
}
if (stat == Ok)
- GdipDisposeImage((GpImage*)gpbm);
+ pGdipDisposeImage((GpImage*)gpbm);
GlobalFree(hpal);
GlobalFree(hbm);
@@ -536,13 +628,13 @@ static void test_GdipGetImageFlags(void)
img = (GpImage*)0xdeadbeef;
- stat = GdipGetImageFlags(NULL, NULL);
+ stat = pGdipGetImageFlags(NULL, NULL);
expect(InvalidParameter, stat);
- stat = GdipGetImageFlags(NULL, &flags);
+ stat = pGdipGetImageFlags(NULL, &flags);
expect(InvalidParameter, stat);
- stat = GdipGetImageFlags(img, NULL);
+ stat = pGdipGetImageFlags(img, NULL);
expect(InvalidParameter, stat);
}
@@ -556,25 +648,25 @@ static void test_GdipCloneImage(void)
const INT WIDTH = 10, HEIGHT = 20;
/* Create an image, clone it, delete the original, make sure the copy works */
- stat = GdipCreateBitmapFromScan0(WIDTH, HEIGHT, 0, PixelFormat24bppRGB, NULL, &bm);
+ stat = pGdipCreateBitmapFromScan0(WIDTH, HEIGHT, 0, PixelFormat24bppRGB, NULL, &bm);
expect(Ok, stat);
expect_rawformat(&ImageFormatMemoryBMP, (GpImage*)bm, __LINE__, TRUE);
image_src = ((GpImage*)bm);
- stat = GdipCloneImage(image_src, &image_dest);
+ stat = pGdipCloneImage(image_src, &image_dest);
expect(Ok, stat);
expect_rawformat(&ImageFormatMemoryBMP, image_dest, __LINE__, TRUE);
- stat = GdipDisposeImage((GpImage*)bm);
+ stat = pGdipDisposeImage((GpImage*)bm);
expect(Ok, stat);
- stat = GdipGetImageBounds(image_dest, &rectF, &unit);
+ stat = pGdipGetImageBounds(image_dest, &rectF, &unit);
expect(Ok, stat);
/* Treat FP values carefully */
expectf((REAL)WIDTH, rectF.Width);
expectf((REAL)HEIGHT, rectF.Height);
- stat = GdipDisposeImage(image_dest);
+ stat = pGdipDisposeImage(image_dest);
expect(Ok, stat);
}
@@ -584,7 +676,7 @@ static void test_testcontrol(void)
DWORD param;
param = 0;
- stat = GdipTestControl(TestControlGetBuildNumber, ¶m);
+ stat = pGdipTestControl(TestControlGetBuildNumber, ¶m);
expect(Ok, stat);
ok(param != 0, "Build number expected, got %u\n", param);
}
@@ -602,9 +694,9 @@ static void test_fromhicon(void)
PixelFormat format;
/* NULL */
- stat = GdipCreateBitmapFromHICON(NULL, NULL);
+ stat = pGdipCreateBitmapFromHICON(NULL, NULL);
expect(InvalidParameter, stat);
- stat = GdipCreateBitmapFromHICON(NULL, &bitmap);
+ stat = pGdipCreateBitmapFromHICON(NULL, &bitmap);
expect(InvalidParameter, stat);
/* color icon 1 bit */
@@ -622,24 +714,24 @@ static void test_fromhicon(void)
DeleteObject(hbmMask);
DeleteObject(hbmColor);
- stat = GdipCreateBitmapFromHICON(hIcon, &bitmap);
+ stat = pGdipCreateBitmapFromHICON(hIcon, &bitmap);
expect(Ok, stat);
if(stat == Ok){
/* check attributes */
- stat = GdipGetImageHeight((GpImage*)bitmap, &dim);
+ stat = pGdipGetImageHeight((GpImage*)bitmap, &dim);
expect(Ok, stat);
expect(16, dim);
- stat = GdipGetImageWidth((GpImage*)bitmap, &dim);
+ stat = pGdipGetImageWidth((GpImage*)bitmap, &dim);
expect(Ok, stat);
expect(16, dim);
- stat = GdipGetImageType((GpImage*)bitmap, &type);
+ stat = pGdipGetImageType((GpImage*)bitmap, &type);
expect(Ok, stat);
expect(ImageTypeBitmap, type);
- stat = GdipGetImagePixelFormat((GpImage*)bitmap, &format);
+ stat = pGdipGetImagePixelFormat((GpImage*)bitmap, &format);
expect(PixelFormat32bppARGB, format);
/* raw format */
expect_rawformat(&ImageFormatMemoryBMP, (GpImage*)bitmap, __LINE__, TRUE);
- GdipDisposeImage((GpImage*)bitmap);
+ pGdipDisposeImage((GpImage*)bitmap);
}
DestroyIcon(hIcon);
@@ -658,24 +750,24 @@ static void test_fromhicon(void)
DeleteObject(hbmMask);
DeleteObject(hbmColor);
- stat = GdipCreateBitmapFromHICON(hIcon, &bitmap);
+ stat = pGdipCreateBitmapFromHICON(hIcon, &bitmap);
expect(Ok, stat);
if(stat == Ok){
/* check attributes */
- stat = GdipGetImageHeight((GpImage*)bitmap, &dim);
+ stat = pGdipGetImageHeight((GpImage*)bitmap, &dim);
expect(Ok, stat);
expect(16, dim);
- stat = GdipGetImageWidth((GpImage*)bitmap, &dim);
+ stat = pGdipGetImageWidth((GpImage*)bitmap, &dim);
expect(Ok, stat);
expect(16, dim);
- stat = GdipGetImageType((GpImage*)bitmap, &type);
+ stat = pGdipGetImageType((GpImage*)bitmap, &type);
expect(Ok, stat);
expect(ImageTypeBitmap, type);
- stat = GdipGetImagePixelFormat((GpImage*)bitmap, &format);
+ stat = pGdipGetImagePixelFormat((GpImage*)bitmap, &format);
expect(PixelFormat32bppARGB, format);
/* raw format */
expect_rawformat(&ImageFormatMemoryBMP, (GpImage*)bitmap, __LINE__, TRUE);
- GdipDisposeImage((GpImage*)bitmap);
+ pGdipDisposeImage((GpImage*)bitmap);
}
DestroyIcon(hIcon);
}
@@ -738,12 +830,15 @@ START_TEST(image)
struct GdiplusStartupInput gdiplusStartupInput;
ULONG_PTR gdiplusToken;
+ if (!InitFunctionPtrs())
+ return;
+
gdiplusStartupInput.GdiplusVersion = 1;
gdiplusStartupInput.DebugEventCallback = NULL;
gdiplusStartupInput.SuppressBackgroundThread = 0;
gdiplusStartupInput.SuppressExternalCodecs = 0;
- GdiplusStartup(&gdiplusToken, &gdiplusStartupInput, NULL);
+ pGdiplusStartup(&gdiplusToken, &gdiplusStartupInput, NULL);
test_Scan0();
test_GetImageDimension();
@@ -759,5 +854,7 @@ START_TEST(image)
test_fromhicon();
test_getrawformat();
- GdiplusShutdown(gdiplusToken);
+ pGdiplusShutdown(gdiplusToken);
+
+ FreeLibrary(hGdiPlus);
}
diff --git a/dlls/gdiplus/tests/matrix.c b/dlls/gdiplus/tests/matrix.c
index 16ce85a..7a390e4 100644
--- a/dlls/gdiplus/tests/matrix.c
+++ b/dlls/gdiplus/tests/matrix.c
@@ -27,19 +27,70 @@
#define expect(expected, got) ok(got == expected, "Expected %.8x, got %.8x\n", expected, got)
+static GpStatus (WINGDIPAPI * pGdipCreateMatrix2)(REAL,REAL,REAL,REAL,REAL,REAL,
+ GpMatrix**);
+static GpStatus (WINGDIPAPI * pGdipDeleteMatrix)(GpMatrix*);
+static GpStatus (WINGDIPAPI * pGdipInvertMatrix)(GpMatrix*);
+static GpStatus (WINGDIPAPI * pGdipIsMatrixEqual)(GDIPCONST GpMatrix*,
+ GDIPCONST GpMatrix*,BOOL*);
+static GpStatus (WINGDIPAPI * pGdipIsMatrixInvertible)(GDIPCONST GpMatrix*,
+ BOOL*);
+static GpStatus (WINGDIPAPI * pGdipShearMatrix)(GpMatrix*,REAL,REAL,
+ GpMatrixOrder);
+static GpStatus (WINGDIPAPI * pGdipTransformMatrixPoints)(GpMatrix*,GpPointF*,
+ INT);
+static Status (WINAPI * pGdiplusStartup)(ULONG_PTR*,
+ const struct GdiplusStartupInput*,struct GdiplusStartupOutput*);
+static void (WINAPI * pGdiplusShutdown)(ULONG_PTR);
+
+static HMODULE hGdiPlus = 0;
+
+static BOOL InitFunctionPtrs(void)
+{
+ hGdiPlus = LoadLibraryA("gdiplus.dll");
+ if (!hGdiPlus)
+ {
+ trace("Could not load gdiplus.dll\n");
+ return FALSE;
+ }
+
+#define GDIPLUS_GET_PROC(func) \
+ p ## func = (void*)GetProcAddress(hGdiPlus, #func); \
+ if (!p ## func) \
+ { \
+ trace("GetProcAddress(%s) failed\n", #func); \
+ FreeLibrary(hGdiPlus); \
+ return FALSE; \
+ }
+
+ GDIPLUS_GET_PROC(GdipCreateMatrix2)
+ GDIPLUS_GET_PROC(GdipDeleteMatrix)
+ GDIPLUS_GET_PROC(GdipInvertMatrix)
+ GDIPLUS_GET_PROC(GdipIsMatrixEqual)
+ GDIPLUS_GET_PROC(GdipIsMatrixInvertible)
+ GDIPLUS_GET_PROC(GdiplusShutdown)
+ GDIPLUS_GET_PROC(GdiplusStartup)
+ GDIPLUS_GET_PROC(GdipShearMatrix)
+ GDIPLUS_GET_PROC(GdipTransformMatrixPoints)
+
+#undef GDIPLUS_GET_PROC
+
+ return TRUE;
+}
+
static void test_constructor_destructor(void)
{
GpStatus status;
GpMatrix *matrix = NULL;
- status = GdipCreateMatrix2(0.0, 0.0, 0.0, 0.0, 0.0, 0.0, &matrix);
+ status = pGdipCreateMatrix2(0.0, 0.0, 0.0, 0.0, 0.0, 0.0, &matrix);
expect(Ok, status);
ok(matrix != NULL, "Expected matrix to be initialized\n");
- status = GdipDeleteMatrix(NULL);
+ status = pGdipDeleteMatrix(NULL);
expect(InvalidParameter, status);
- status = GdipDeleteMatrix(matrix);
+ status = pGdipDeleteMatrix(matrix);
expect(Ok, status);
}
@@ -74,9 +125,9 @@ static void test_transform(void)
pts[i].Y = 50.0 - i * 5.0;
}
- GdipCreateMatrix2(1.0, -2.0, 30.0, 40.0, -500.0, 600.0, &matrix);
+ pGdipCreateMatrix2(1.0, -2.0, 30.0, 40.0, -500.0, 600.0, &matrix);
- status = GdipTransformMatrixPoints(matrix, pts, 10);
+ status = pGdipTransformMatrixPoints(matrix, pts, 10);
expect(Ok, status);
for(i = 0; i < 10; i ++){
@@ -87,7 +138,7 @@ static void test_transform(void)
transform_points[i].X, transform_points[i].Y, pts[i].X, pts[i].Y);
}
- GdipDeleteMatrix(matrix);
+ pGdipDeleteMatrix(matrix);
}
static void test_isinvertible(void)
@@ -97,26 +148,26 @@ static void test_isinvertible(void)
BOOL result;
/* NULL arguments */
- status = GdipIsMatrixInvertible(NULL, &result);
+ status = pGdipIsMatrixInvertible(NULL, &result);
expect(InvalidParameter, status);
- status = GdipIsMatrixInvertible((GpMatrix*)0xdeadbeef, NULL);
+ status = pGdipIsMatrixInvertible((GpMatrix*)0xdeadbeef, NULL);
expect(InvalidParameter, status);
- status = GdipIsMatrixInvertible(NULL, NULL);
+ status = pGdipIsMatrixInvertible(NULL, NULL);
expect(InvalidParameter, status);
/* invertible */
- GdipCreateMatrix2(1.0, 1.2, 2.3, -1.0, 2.0, 3.0, &matrix);
- status = GdipIsMatrixInvertible(matrix, &result);
+ pGdipCreateMatrix2(1.0, 1.2, 2.3, -1.0, 2.0, 3.0, &matrix);
+ status = pGdipIsMatrixInvertible(matrix, &result);
expect(Ok, status);
expect(TRUE, result);
- GdipDeleteMatrix(matrix);
+ pGdipDeleteMatrix(matrix);
/* noninvertible */
- GdipCreateMatrix2(2.0, -1.0, 6.0, -3.0, 2.2, 3.0, &matrix);
- status = GdipIsMatrixInvertible(matrix, &result);
+ pGdipCreateMatrix2(2.0, -1.0, 6.0, -3.0, 2.2, 3.0, &matrix);
+ status = pGdipIsMatrixInvertible(matrix, &result);
expect(Ok, status);
expect(FALSE, result);
- GdipDeleteMatrix(matrix);
+ pGdipDeleteMatrix(matrix);
}
static void test_invert(void)
@@ -127,25 +178,25 @@ static void test_invert(void)
BOOL equal = FALSE;
/* NULL */
- status = GdipInvertMatrix(NULL);
+ status = pGdipInvertMatrix(NULL);
expect(InvalidParameter, status);
/* noninvertible */
- GdipCreateMatrix2(2.0, -1.0, 6.0, -3.0, 2.2, 3.0, &matrix);
- status = GdipInvertMatrix(matrix);
+ pGdipCreateMatrix2(2.0, -1.0, 6.0, -3.0, 2.2, 3.0, &matrix);
+ status = pGdipInvertMatrix(matrix);
expect(InvalidParameter, status);
- GdipDeleteMatrix(matrix);
+ pGdipDeleteMatrix(matrix);
/* invertible */
- GdipCreateMatrix2(3.0, -2.0, 5.0, 2.0, 6.0, 3.0, &matrix);
- status = GdipInvertMatrix(matrix);
+ pGdipCreateMatrix2(3.0, -2.0, 5.0, 2.0, 6.0, 3.0, &matrix);
+ status = pGdipInvertMatrix(matrix);
expect(Ok, status);
- GdipCreateMatrix2(2.0/16.0, 2.0/16.0, -5.0/16.0, 3.0/16.0, 3.0/16.0, -21.0/16.0, &inverted);
- GdipIsMatrixEqual(matrix, inverted, &equal);
+ pGdipCreateMatrix2(2.0/16.0, 2.0/16.0, -5.0/16.0, 3.0/16.0, 3.0/16.0, -21.0/16.0, &inverted);
+ pGdipIsMatrixEqual(matrix, inverted, &equal);
expect(TRUE, equal);
- GdipDeleteMatrix(inverted);
- GdipDeleteMatrix(matrix);
+ pGdipDeleteMatrix(inverted);
+ pGdipDeleteMatrix(matrix);
}
static void test_shear(void)
@@ -156,68 +207,68 @@ static void test_shear(void)
BOOL equal;
/* NULL */
- status = GdipShearMatrix(NULL, 0.0, 0.0, MatrixOrderPrepend);
+ status = pGdipShearMatrix(NULL, 0.0, 0.0, MatrixOrderPrepend);
expect(InvalidParameter, status);
/* X only shearing, MatrixOrderPrepend */
- GdipCreateMatrix2(1.0, 2.0, 4.0, -1.0, 6.0, 3.0, &matrix);
- status = GdipShearMatrix(matrix, 1.5, 0.0, MatrixOrderPrepend);
+ pGdipCreateMatrix2(1.0, 2.0, 4.0, -1.0, 6.0, 3.0, &matrix);
+ status = pGdipShearMatrix(matrix, 1.5, 0.0, MatrixOrderPrepend);
expect(Ok, status);
- GdipCreateMatrix2(1.0, 2.0, 5.5, 2.0, 6.0, 3.0, &sheared);
- GdipIsMatrixEqual(matrix, sheared, &equal);
+ pGdipCreateMatrix2(1.0, 2.0, 5.5, 2.0, 6.0, 3.0, &sheared);
+ pGdipIsMatrixEqual(matrix, sheared, &equal);
expect(TRUE, equal);
- GdipDeleteMatrix(sheared);
- GdipDeleteMatrix(matrix);
+ pGdipDeleteMatrix(sheared);
+ pGdipDeleteMatrix(matrix);
/* X only shearing, MatrixOrderAppend */
- GdipCreateMatrix2(1.0, 2.0, 4.0, -1.0, 6.0, 3.0, &matrix);
- status = GdipShearMatrix(matrix, 1.5, 0.0, MatrixOrderAppend);
+ pGdipCreateMatrix2(1.0, 2.0, 4.0, -1.0, 6.0, 3.0, &matrix);
+ status = pGdipShearMatrix(matrix, 1.5, 0.0, MatrixOrderAppend);
expect(Ok, status);
- GdipCreateMatrix2(4.0, 2.0, 2.5, -1.0, 10.5, 3.0, &sheared);
- GdipIsMatrixEqual(matrix, sheared, &equal);
+ pGdipCreateMatrix2(4.0, 2.0, 2.5, -1.0, 10.5, 3.0, &sheared);
+ pGdipIsMatrixEqual(matrix, sheared, &equal);
expect(TRUE, equal);
- GdipDeleteMatrix(sheared);
- GdipDeleteMatrix(matrix);
+ pGdipDeleteMatrix(sheared);
+ pGdipDeleteMatrix(matrix);
/* Y only shearing, MatrixOrderPrepend */
- GdipCreateMatrix2(1.0, 2.0, 4.0, -1.0, 6.0, 3.0, &matrix);
- status = GdipShearMatrix(matrix, 0.0, 1.5, MatrixOrderPrepend);
+ pGdipCreateMatrix2(1.0, 2.0, 4.0, -1.0, 6.0, 3.0, &matrix);
+ status = pGdipShearMatrix(matrix, 0.0, 1.5, MatrixOrderPrepend);
expect(Ok, status);
- GdipCreateMatrix2(7.0, 0.5, 4.0, -1.0, 6.0, 3.0, &sheared);
- GdipIsMatrixEqual(matrix, sheared, &equal);
+ pGdipCreateMatrix2(7.0, 0.5, 4.0, -1.0, 6.0, 3.0, &sheared);
+ pGdipIsMatrixEqual(matrix, sheared, &equal);
expect(TRUE, equal);
- GdipDeleteMatrix(sheared);
- GdipDeleteMatrix(matrix);
+ pGdipDeleteMatrix(sheared);
+ pGdipDeleteMatrix(matrix);
/* Y only shearing, MatrixOrderAppend */
- GdipCreateMatrix2(1.0, 2.0, 4.0, -1.0, 6.0, 3.0, &matrix);
- status = GdipShearMatrix(matrix, 0.0, 1.5, MatrixOrderAppend);
+ pGdipCreateMatrix2(1.0, 2.0, 4.0, -1.0, 6.0, 3.0, &matrix);
+ status = pGdipShearMatrix(matrix, 0.0, 1.5, MatrixOrderAppend);
expect(Ok, status);
- GdipCreateMatrix2(1.0, 3.5, 4.0, 5.0, 6.0, 12.0, &sheared);
- GdipIsMatrixEqual(matrix, sheared, &equal);
+ pGdipCreateMatrix2(1.0, 3.5, 4.0, 5.0, 6.0, 12.0, &sheared);
+ pGdipIsMatrixEqual(matrix, sheared, &equal);
expect(TRUE, equal);
- GdipDeleteMatrix(sheared);
- GdipDeleteMatrix(matrix);
+ pGdipDeleteMatrix(sheared);
+ pGdipDeleteMatrix(matrix);
/* X,Y shearing, MatrixOrderPrepend */
- GdipCreateMatrix2(1.0, 2.0, 4.0, -1.0, 6.0, 3.0, &matrix);
- status = GdipShearMatrix(matrix, 4.0, 1.5, MatrixOrderPrepend);
+ pGdipCreateMatrix2(1.0, 2.0, 4.0, -1.0, 6.0, 3.0, &matrix);
+ status = pGdipShearMatrix(matrix, 4.0, 1.5, MatrixOrderPrepend);
expect(Ok, status);
- GdipCreateMatrix2(7.0, 0.5, 8.0, 7.0, 6.0, 3.0, &sheared);
- GdipIsMatrixEqual(matrix, sheared, &equal);
+ pGdipCreateMatrix2(7.0, 0.5, 8.0, 7.0, 6.0, 3.0, &sheared);
+ pGdipIsMatrixEqual(matrix, sheared, &equal);
expect(TRUE, equal);
- GdipDeleteMatrix(sheared);
- GdipDeleteMatrix(matrix);
+ pGdipDeleteMatrix(sheared);
+ pGdipDeleteMatrix(matrix);
/* X,Y shearing, MatrixOrderAppend */
- GdipCreateMatrix2(1.0, 2.0, 4.0, -1.0, 6.0, 3.0, &matrix);
- status = GdipShearMatrix(matrix, 4.0, 1.5, MatrixOrderAppend);
+ pGdipCreateMatrix2(1.0, 2.0, 4.0, -1.0, 6.0, 3.0, &matrix);
+ status = pGdipShearMatrix(matrix, 4.0, 1.5, MatrixOrderAppend);
expect(Ok, status);
- GdipCreateMatrix2(9.0, 3.5, 0.0, 5.0, 18.0, 12.0, &sheared);
- GdipIsMatrixEqual(matrix, sheared, &equal);
+ pGdipCreateMatrix2(9.0, 3.5, 0.0, 5.0, 18.0, 12.0, &sheared);
+ pGdipIsMatrixEqual(matrix, sheared, &equal);
expect(TRUE, equal);
- GdipDeleteMatrix(sheared);
- GdipDeleteMatrix(matrix);
+ pGdipDeleteMatrix(sheared);
+ pGdipDeleteMatrix(matrix);
}
START_TEST(matrix)
@@ -225,12 +276,15 @@ START_TEST(matrix)
struct GdiplusStartupInput gdiplusStartupInput;
ULONG_PTR gdiplusToken;
+ if (!InitFunctionPtrs())
+ return;
+
gdiplusStartupInput.GdiplusVersion = 1;
gdiplusStartupInput.DebugEventCallback = NULL;
gdiplusStartupInput.SuppressBackgroundThread = 0;
gdiplusStartupInput.SuppressExternalCodecs = 0;
- GdiplusStartup(&gdiplusToken, &gdiplusStartupInput, NULL);
+ pGdiplusStartup(&gdiplusToken, &gdiplusStartupInput, NULL);
test_constructor_destructor();
test_transform();
@@ -238,5 +292,7 @@ START_TEST(matrix)
test_invert();
test_shear();
- GdiplusShutdown(gdiplusToken);
+ pGdiplusShutdown(gdiplusToken);
+
+ FreeLibrary(hGdiPlus);
}
diff --git a/dlls/gdiplus/tests/pathiterator.c b/dlls/gdiplus/tests/pathiterator.c
index eddb24e..d052fdf 100644
--- a/dlls/gdiplus/tests/pathiterator.c
+++ b/dlls/gdiplus/tests/pathiterator.c
@@ -24,31 +24,108 @@
#define expect(expected, got) ok(got == expected, "Expected %.8x, got %.8x\n", expected, got)
+static GpStatus (WINGDIPAPI * pGdipAddPathEllipse)(GpPath*,REAL,REAL,REAL,REAL);
+static GpStatus (WINGDIPAPI * pGdipAddPathLine)(GpPath*,REAL,REAL,REAL,REAL);
+static GpStatus (WINGDIPAPI * pGdipAddPathRectangle)(GpPath*,REAL,REAL,REAL,
+ REAL);
+static GpStatus (WINGDIPAPI * pGdipClosePathFigure)(GpPath*);
+static GpStatus (WINGDIPAPI * pGdipCreatePath)(GpFillMode,GpPath**);
+static GpStatus (WINGDIPAPI * pGdipDeletePath)(GpPath*);
+static GpStatus (WINGDIPAPI * pGdipGetPointCount)(GpPath*,INT*);
+static GpStatus (WINGDIPAPI * pGdipSetPathMarker)(GpPath*);
+static GpStatus (WINGDIPAPI * pGdipStartPathFigure)(GpPath*);
+static GpStatus (WINGDIPAPI * pGdipCreatePathIter)(GpPathIterator**,GpPath*);
+static GpStatus (WINGDIPAPI * pGdipDeletePathIter)(GpPathIterator*);
+static GpStatus (WINGDIPAPI * pGdipPathIterGetSubpathCount)(GpPathIterator*,
+ INT*);
+static GpStatus (WINGDIPAPI * pGdipPathIterHasCurve)(GpPathIterator*,BOOL*);
+static GpStatus (WINGDIPAPI * pGdipPathIterIsValid)(GpPathIterator*,BOOL*);
+static GpStatus (WINGDIPAPI * pGdipPathIterNextMarker)(GpPathIterator*,INT*,
+ INT*,INT*);
+static GpStatus (WINGDIPAPI * pGdipPathIterNextMarkerPath)(GpPathIterator*,INT*,
+ GpPath*);
+static GpStatus (WINGDIPAPI * pGdipPathIterNextPathType)(GpPathIterator*,INT*,
+ BYTE*,INT*,INT*);
+static GpStatus (WINGDIPAPI * pGdipPathIterNextSubpath)(GpPathIterator*,INT*,
+ INT*,INT*,BOOL*);
+static GpStatus (WINGDIPAPI * pGdipPathIterNextSubpathPath)(GpPathIterator*,
+ INT*,GpPath*,BOOL*);
+static Status (WINAPI * pGdiplusStartup)(ULONG_PTR*,
+ const struct GdiplusStartupInput*,struct GdiplusStartupOutput*);
+static void (WINAPI * pGdiplusShutdown)(ULONG_PTR);
+
+static HMODULE hGdiPlus = 0;
+
+static BOOL InitFunctionPtrs(void)
+{
+ hGdiPlus = LoadLibraryA("gdiplus.dll");
+ if (!hGdiPlus)
+ {
+ trace("Could not load gdiplus.dll\n");
+ return FALSE;
+ }
+
+#define GDIPLUS_GET_PROC(func) \
+ p ## func = (void*)GetProcAddress(hGdiPlus, #func); \
+ if (!p ## func) \
+ { \
+ trace("GetProcAddress(%s) failed\n", #func); \
+ FreeLibrary(hGdiPlus); \
+ return FALSE; \
+ }
+
+ GDIPLUS_GET_PROC(GdipAddPathEllipse)
+ GDIPLUS_GET_PROC(GdipAddPathLine)
+ GDIPLUS_GET_PROC(GdipAddPathRectangle)
+ GDIPLUS_GET_PROC(GdipClosePathFigure)
+ GDIPLUS_GET_PROC(GdipCreatePath)
+ GDIPLUS_GET_PROC(GdipCreatePathIter)
+ GDIPLUS_GET_PROC(GdipDeletePath)
+ GDIPLUS_GET_PROC(GdipDeletePathIter)
+ GDIPLUS_GET_PROC(GdipGetPointCount)
+ GDIPLUS_GET_PROC(GdiplusShutdown)
+ GDIPLUS_GET_PROC(GdiplusStartup)
+ GDIPLUS_GET_PROC(GdipPathIterGetSubpathCount)
+ GDIPLUS_GET_PROC(GdipPathIterHasCurve)
+ GDIPLUS_GET_PROC(GdipPathIterIsValid)
+ GDIPLUS_GET_PROC(GdipPathIterNextMarker)
+ GDIPLUS_GET_PROC(GdipPathIterNextMarkerPath)
+ GDIPLUS_GET_PROC(GdipPathIterNextPathType)
+ GDIPLUS_GET_PROC(GdipPathIterNextSubpath)
+ GDIPLUS_GET_PROC(GdipPathIterNextSubpathPath)
+ GDIPLUS_GET_PROC(GdipSetPathMarker)
+ GDIPLUS_GET_PROC(GdipStartPathFigure)
+
+#undef GDIPLUS_GET_PROC
+
+ return TRUE;
+}
+
static void test_constructor_destructor(void)
{
GpPath *path;
GpPathIterator *iter;
GpStatus stat;
- GdipCreatePath(FillModeAlternate, &path);
- GdipAddPathRectangle(path, 5.0, 5.0, 100.0, 50.0);
+ pGdipCreatePath(FillModeAlternate, &path);
+ pGdipAddPathRectangle(path, 5.0, 5.0, 100.0, 50.0);
/* NULL args */
- stat = GdipCreatePathIter(NULL, NULL);
+ stat = pGdipCreatePathIter(NULL, NULL);
expect(InvalidParameter, stat);
- stat = GdipCreatePathIter(&iter, NULL);
+ stat = pGdipCreatePathIter(&iter, NULL);
expect(Ok, stat);
- stat = GdipCreatePathIter(NULL, path);
+ stat = pGdipCreatePathIter(NULL, path);
expect(InvalidParameter, stat);
- stat = GdipDeletePathIter(NULL);
+ stat = pGdipDeletePathIter(NULL);
expect(InvalidParameter, stat);
/* valid args */
- stat = GdipCreatePathIter(&iter, path);
+ stat = pGdipCreatePathIter(&iter, path);
expect(Ok, stat);
- GdipDeletePathIter(iter);
- GdipDeletePath(path);
+ pGdipDeletePathIter(iter);
+ pGdipDeletePath(path);
}
static void test_hascurve(void)
@@ -58,36 +135,36 @@ static void test_hascurve(void)
GpStatus stat;
BOOL hasCurve;
- GdipCreatePath(FillModeAlternate, &path);
- GdipAddPathRectangle(path, 5.0, 5.0, 100.0, 50.0);
+ pGdipCreatePath(FillModeAlternate, &path);
+ pGdipAddPathRectangle(path, 5.0, 5.0, 100.0, 50.0);
- stat = GdipCreatePathIter(&iter, path);
+ stat = pGdipCreatePathIter(&iter, path);
expect(Ok, stat);
/* NULL args
BOOL out argument is local in wrapper class method,
so it always has not-NULL address */
- stat = GdipPathIterHasCurve(NULL, &hasCurve);
+ stat = pGdipPathIterHasCurve(NULL, &hasCurve);
expect(InvalidParameter, stat);
/* valid args */
- stat = GdipPathIterHasCurve(iter, &hasCurve);
+ stat = pGdipPathIterHasCurve(iter, &hasCurve);
expect(Ok, stat);
expect(FALSE, hasCurve);
- GdipDeletePathIter(iter);
+ pGdipDeletePathIter(iter);
- GdipAddPathEllipse(path, 0.0, 0.0, 35.0, 70.0);
+ pGdipAddPathEllipse(path, 0.0, 0.0, 35.0, 70.0);
- stat = GdipCreatePathIter(&iter, path);
+ stat = pGdipCreatePathIter(&iter, path);
expect(Ok, stat);
- stat = GdipPathIterHasCurve(iter, &hasCurve);
+ stat = pGdipPathIterHasCurve(iter, &hasCurve);
expect(Ok, stat);
expect(TRUE, hasCurve);
- GdipDeletePathIter(iter);
- GdipDeletePath(path);
+ pGdipDeletePathIter(iter);
+ pGdipDeletePath(path);
}
static void test_nextmarker(void)
@@ -101,74 +178,74 @@ static void test_nextmarker(void)
/* NULL args
BOOL out argument is local in wrapper class method,
so it always has not-NULL address */
- stat = GdipPathIterNextMarker(NULL, &result, NULL, NULL);
+ stat = pGdipPathIterNextMarker(NULL, &result, NULL, NULL);
expect(InvalidParameter, stat);
- stat = GdipPathIterNextMarker(NULL, &result, &start, NULL);
+ stat = pGdipPathIterNextMarker(NULL, &result, &start, NULL);
expect(InvalidParameter, stat);
- stat = GdipPathIterNextMarker(NULL, &result, NULL, &end);
+ stat = pGdipPathIterNextMarker(NULL, &result, NULL, &end);
expect(InvalidParameter, stat);
- GdipCreatePath(FillModeAlternate, &path);
- GdipAddPathRectangle(path, 5.0, 5.0, 100.0, 50.0);
+ pGdipCreatePath(FillModeAlternate, &path);
+ pGdipAddPathRectangle(path, 5.0, 5.0, 100.0, 50.0);
/* no markers */
- GdipCreatePathIter(&iter, path);
+ pGdipCreatePathIter(&iter, path);
start = end = result = (INT)0xdeadbeef;
- stat = GdipPathIterNextMarker(iter, &result, &start, &end);
+ stat = pGdipPathIterNextMarker(iter, &result, &start, &end);
expect(Ok, stat);
expect(0, start);
expect(3, end);
expect(4, result);
start = end = result = (INT)0xdeadbeef;
- stat = GdipPathIterNextMarker(iter, &result, &start, &end);
+ stat = pGdipPathIterNextMarker(iter, &result, &start, &end);
/* start/end remain unchanged */
expect((INT)0xdeadbeef, start);
expect((INT)0xdeadbeef, end);
expect(0, result);
- GdipDeletePathIter(iter);
+ pGdipDeletePathIter(iter);
/* one marker */
- GdipSetPathMarker(path);
- GdipCreatePathIter(&iter, path);
+ pGdipSetPathMarker(path);
+ pGdipCreatePathIter(&iter, path);
start = end = result = (INT)0xdeadbeef;
- stat = GdipPathIterNextMarker(iter, &result, &start, &end);
+ stat = pGdipPathIterNextMarker(iter, &result, &start, &end);
expect(Ok, stat);
expect(0, start);
expect(3, end);
expect(4, result);
start = end = result = (INT)0xdeadbeef;
- stat = GdipPathIterNextMarker(iter, &result, &start, &end);
+ stat = pGdipPathIterNextMarker(iter, &result, &start, &end);
expect(Ok, stat);
expect((INT)0xdeadbeef, start);
expect((INT)0xdeadbeef, end);
expect(0, result);
- GdipDeletePathIter(iter);
+ pGdipDeletePathIter(iter);
/* two markers */
- GdipAddPathLine(path, 0.0, 0.0, 10.0, 30.0);
- GdipSetPathMarker(path);
- GdipCreatePathIter(&iter, path);
+ pGdipAddPathLine(path, 0.0, 0.0, 10.0, 30.0);
+ pGdipSetPathMarker(path);
+ pGdipCreatePathIter(&iter, path);
start = end = result = (INT)0xdeadbeef;
- stat = GdipPathIterNextMarker(iter, &result, &start, &end);
+ stat = pGdipPathIterNextMarker(iter, &result, &start, &end);
expect(Ok, stat);
expect(0, start);
expect(3, end);
expect(4, result);
start = end = result = (INT)0xdeadbeef;
- stat = GdipPathIterNextMarker(iter, &result, &start, &end);
+ stat = pGdipPathIterNextMarker(iter, &result, &start, &end);
expect(Ok, stat);
expect(4, start);
expect(5, end);
expect(2, result);
start = end = result = (INT)0xdeadbeef;
- stat = GdipPathIterNextMarker(iter, &result, &start, &end);
+ stat = pGdipPathIterNextMarker(iter, &result, &start, &end);
expect(Ok, stat);
expect((INT)0xdeadbeef, start);
expect((INT)0xdeadbeef, end);
expect(0, result);
- GdipDeletePathIter(iter);
+ pGdipDeletePathIter(iter);
- GdipDeletePath(path);
+ pGdipDeletePath(path);
}
static void test_nextmarkerpath(void)
@@ -178,80 +255,80 @@ static void test_nextmarkerpath(void)
GpStatus stat;
INT result, count;
- GdipCreatePath(FillModeAlternate, &path);
+ pGdipCreatePath(FillModeAlternate, &path);
/* NULL */
- stat = GdipPathIterNextMarkerPath(NULL, NULL, NULL);
+ stat = pGdipPathIterNextMarkerPath(NULL, NULL, NULL);
expect(InvalidParameter, stat);
- stat = GdipPathIterNextMarkerPath(NULL, &result, NULL);
+ stat = pGdipPathIterNextMarkerPath(NULL, &result, NULL);
expect(InvalidParameter, stat);
- stat = GdipPathIterNextMarkerPath(NULL, &result, path);
+ stat = pGdipPathIterNextMarkerPath(NULL, &result, path);
expect(InvalidParameter, stat);
- GdipAddPathRectangle(path, 5.0, 5.0, 100.0, 50.0);
+ pGdipAddPathRectangle(path, 5.0, 5.0, 100.0, 50.0);
/* no markers */
- GdipCreatePath(FillModeAlternate, &retpath);
- GdipCreatePathIter(&iter, path);
+ pGdipCreatePath(FillModeAlternate, &retpath);
+ pGdipCreatePathIter(&iter, path);
result = -1;
- stat = GdipPathIterNextMarkerPath(iter, &result, retpath);
+ stat = pGdipPathIterNextMarkerPath(iter, &result, retpath);
expect(Ok, stat);
expect(4, result);
count = -1;
- GdipGetPointCount(retpath, &count);
+ pGdipGetPointCount(retpath, &count);
expect(4, count);
result = -1;
- stat = GdipPathIterNextMarkerPath(iter, &result, retpath);
+ stat = pGdipPathIterNextMarkerPath(iter, &result, retpath);
expect(Ok, stat);
expect(0, result);
count = -1;
- GdipGetPointCount(retpath, &count);
+ pGdipGetPointCount(retpath, &count);
expect(4, count);
- GdipDeletePathIter(iter);
- GdipDeletePath(retpath);
+ pGdipDeletePathIter(iter);
+ pGdipDeletePath(retpath);
/* one marker */
- GdipSetPathMarker(path);
- GdipCreatePath(FillModeAlternate, &retpath);
- GdipCreatePathIter(&iter, path);
+ pGdipSetPathMarker(path);
+ pGdipCreatePath(FillModeAlternate, &retpath);
+ pGdipCreatePathIter(&iter, path);
result = -1;
- stat = GdipPathIterNextMarkerPath(iter, &result, retpath);
+ stat = pGdipPathIterNextMarkerPath(iter, &result, retpath);
expect(Ok, stat);
expect(4, result);
count = -1;
- GdipGetPointCount(retpath, &count);
+ pGdipGetPointCount(retpath, &count);
expect(4, count);
result = -1;
- stat = GdipPathIterNextMarkerPath(iter, &result, retpath);
+ stat = pGdipPathIterNextMarkerPath(iter, &result, retpath);
expect(Ok, stat);
expect(0, result);
count = -1;
- GdipGetPointCount(retpath, &count);
+ pGdipGetPointCount(retpath, &count);
expect(4, count);
- GdipDeletePathIter(iter);
- GdipDeletePath(retpath);
+ pGdipDeletePathIter(iter);
+ pGdipDeletePath(retpath);
/* two markers */
- GdipAddPathLine(path, 0.0, 0.0, 10.0, 30.0);
- GdipSetPathMarker(path);
- GdipCreatePath(FillModeAlternate, &retpath);
- GdipCreatePathIter(&iter, path);
+ pGdipAddPathLine(path, 0.0, 0.0, 10.0, 30.0);
+ pGdipSetPathMarker(path);
+ pGdipCreatePath(FillModeAlternate, &retpath);
+ pGdipCreatePathIter(&iter, path);
result = -1;
- stat = GdipPathIterNextMarkerPath(iter, &result, retpath);
+ stat = pGdipPathIterNextMarkerPath(iter, &result, retpath);
expect(Ok, stat);
expect(4, result);
result = -1;
- stat = GdipPathIterNextMarkerPath(iter, &result, retpath);
+ stat = pGdipPathIterNextMarkerPath(iter, &result, retpath);
expect(Ok, stat);
expect(2, result);
result = -1;
- stat = GdipPathIterNextMarkerPath(iter, &result, retpath);
+ stat = pGdipPathIterNextMarkerPath(iter, &result, retpath);
expect(Ok, stat);
expect(0, result);
- GdipDeletePathIter(iter);
- GdipDeletePath(retpath);
+ pGdipDeletePathIter(iter);
+ pGdipDeletePath(retpath);
- GdipDeletePath(path);
+ pGdipDeletePath(path);
}
static void test_getsubpathcount(void)
@@ -262,39 +339,39 @@ static void test_getsubpathcount(void)
INT count;
/* NULL args */
- stat = GdipPathIterGetSubpathCount(NULL, NULL);
+ stat = pGdipPathIterGetSubpathCount(NULL, NULL);
expect(InvalidParameter, stat);
- stat = GdipPathIterGetSubpathCount(NULL, &count);
+ stat = pGdipPathIterGetSubpathCount(NULL, &count);
expect(InvalidParameter, stat);
- GdipCreatePath(FillModeAlternate, &path);
+ pGdipCreatePath(FillModeAlternate, &path);
/* empty path */
- GdipCreatePathIter(&iter, path);
- stat = GdipPathIterGetSubpathCount(iter, &count);
+ pGdipCreatePathIter(&iter, path);
+ stat = pGdipPathIterGetSubpathCount(iter, &count);
expect(Ok, stat);
expect(0, count);
- GdipDeletePathIter(iter);
+ pGdipDeletePathIter(iter);
- GdipAddPathLine(path, 5.0, 5.0, 100.0, 50.0);
+ pGdipAddPathLine(path, 5.0, 5.0, 100.0, 50.0);
/* open figure */
- GdipCreatePathIter(&iter, path);
- stat = GdipPathIterGetSubpathCount(iter, &count);
+ pGdipCreatePathIter(&iter, path);
+ stat = pGdipPathIterGetSubpathCount(iter, &count);
expect(Ok, stat);
expect(1, count);
- GdipDeletePathIter(iter);
+ pGdipDeletePathIter(iter);
/* manually start new figure */
- GdipStartPathFigure(path);
- GdipAddPathLine(path, 50.0, 50.0, 110.0, 40.0);
- GdipCreatePathIter(&iter, path);
- stat = GdipPathIterGetSubpathCount(iter, &count);
+ pGdipStartPathFigure(path);
+ pGdipAddPathLine(path, 50.0, 50.0, 110.0, 40.0);
+ pGdipCreatePathIter(&iter, path);
+ stat = pGdipPathIterGetSubpathCount(iter, &count);
expect(Ok, stat);
expect(2, count);
- GdipDeletePathIter(iter);
+ pGdipDeletePathIter(iter);
- GdipDeletePath(path);
+ pGdipDeletePath(path);
}
static void test_isvalid(void)
@@ -305,37 +382,37 @@ static void test_isvalid(void)
BOOL isvalid;
INT start, end, result;
- GdipCreatePath(FillModeAlternate, &path);
+ pGdipCreatePath(FillModeAlternate, &path);
/* NULL args */
- GdipCreatePathIter(&iter, path);
- stat = GdipPathIterIsValid(NULL, NULL);
+ pGdipCreatePathIter(&iter, path);
+ stat = pGdipPathIterIsValid(NULL, NULL);
expect(InvalidParameter, stat);
- stat = GdipPathIterIsValid(iter, NULL);
+ stat = pGdipPathIterIsValid(iter, NULL);
expect(InvalidParameter, stat);
- stat = GdipPathIterIsValid(NULL, &isvalid);
+ stat = pGdipPathIterIsValid(NULL, &isvalid);
expect(InvalidParameter, stat);
- GdipDeletePathIter(iter);
+ pGdipDeletePathIter(iter);
/* on empty path */
- GdipCreatePathIter(&iter, path);
+ pGdipCreatePathIter(&iter, path);
isvalid = FALSE;
- stat = GdipPathIterIsValid(iter, &isvalid);
+ stat = pGdipPathIterIsValid(iter, &isvalid);
expect(Ok, stat);
expect(TRUE, isvalid);
- GdipDeletePathIter(iter);
+ pGdipDeletePathIter(iter);
/* no markers */
- GdipAddPathLine(path, 50.0, 50.0, 110.0, 40.0);
- GdipCreatePathIter(&iter, path);
- GdipPathIterNextMarker(iter, &result, &start, &end);
+ pGdipAddPathLine(path, 50.0, 50.0, 110.0, 40.0);
+ pGdipCreatePathIter(&iter, path);
+ pGdipPathIterNextMarker(iter, &result, &start, &end);
isvalid = FALSE;
- stat = GdipPathIterIsValid(iter, &isvalid);
+ stat = pGdipPathIterIsValid(iter, &isvalid);
expect(Ok, stat);
expect(TRUE, isvalid);
- GdipDeletePathIter(iter);
+ pGdipDeletePathIter(iter);
- GdipDeletePath(path);
+ pGdipDeletePath(path);
}
static void test_nextsubpathpath(void)
@@ -346,109 +423,109 @@ static void test_nextsubpathpath(void)
BOOL closed;
INT count, result;
- GdipCreatePath(FillModeAlternate, &path);
+ pGdipCreatePath(FillModeAlternate, &path);
/* NULL args */
- GdipCreatePath(FillModeAlternate, &retpath);
- GdipCreatePathIter(&iter, path);
- stat = GdipPathIterNextSubpathPath(NULL, NULL, NULL, NULL);
+ pGdipCreatePath(FillModeAlternate, &retpath);
+ pGdipCreatePathIter(&iter, path);
+ stat = pGdipPathIterNextSubpathPath(NULL, NULL, NULL, NULL);
expect(InvalidParameter, stat);
- stat = GdipPathIterNextSubpathPath(iter, NULL, NULL, NULL);
+ stat = pGdipPathIterNextSubpathPath(iter, NULL, NULL, NULL);
expect(InvalidParameter, stat);
- stat = GdipPathIterNextSubpathPath(NULL, &result, NULL, NULL);
+ stat = pGdipPathIterNextSubpathPath(NULL, &result, NULL, NULL);
expect(InvalidParameter, stat);
- stat = GdipPathIterNextSubpathPath(iter, &result, NULL, &closed);
+ stat = pGdipPathIterNextSubpathPath(iter, &result, NULL, &closed);
expect(Ok, stat);
- stat = GdipPathIterNextSubpathPath(iter, NULL, NULL, &closed);
+ stat = pGdipPathIterNextSubpathPath(iter, NULL, NULL, &closed);
expect(InvalidParameter, stat);
- stat = GdipPathIterNextSubpathPath(iter, NULL, retpath, NULL);
+ stat = pGdipPathIterNextSubpathPath(iter, NULL, retpath, NULL);
expect(InvalidParameter, stat);
- stat = GdipPathIterNextSubpathPath(iter, &result, retpath, NULL);
+ stat = pGdipPathIterNextSubpathPath(iter, &result, retpath, NULL);
expect(InvalidParameter, stat);
- GdipDeletePathIter(iter);
- GdipDeletePath(retpath);
+ pGdipDeletePathIter(iter);
+ pGdipDeletePath(retpath);
/* empty path */
- GdipCreatePath(FillModeAlternate, &retpath);
- GdipCreatePathIter(&iter, path);
+ pGdipCreatePath(FillModeAlternate, &retpath);
+ pGdipCreatePathIter(&iter, path);
result = -2;
closed = TRUE;
- stat = GdipPathIterNextSubpathPath(iter, &result, retpath, &closed);
+ stat = pGdipPathIterNextSubpathPath(iter, &result, retpath, &closed);
expect(Ok, stat);
expect(0, result);
expect(TRUE, closed);
count = -1;
- GdipGetPointCount(retpath, &count);
+ pGdipGetPointCount(retpath, &count);
expect(0, count);
- GdipDeletePathIter(iter);
- GdipDeletePath(retpath);
+ pGdipDeletePathIter(iter);
+ pGdipDeletePath(retpath);
/* open figure */
- GdipAddPathLine(path, 5.0, 5.0, 100.0, 50.0);
+ pGdipAddPathLine(path, 5.0, 5.0, 100.0, 50.0);
- GdipCreatePath(FillModeAlternate, &retpath);
- GdipCreatePathIter(&iter, path);
+ pGdipCreatePath(FillModeAlternate, &retpath);
+ pGdipCreatePathIter(&iter, path);
result = -2;
closed = TRUE;
- stat = GdipPathIterNextSubpathPath(iter, &result, retpath, &closed);
+ stat = pGdipPathIterNextSubpathPath(iter, &result, retpath, &closed);
expect(Ok, stat);
expect(2, result);
expect(FALSE, closed);
count = -1;
- GdipGetPointCount(retpath, &count);
+ pGdipGetPointCount(retpath, &count);
expect(2, count);
/* subsequent call */
result = -2;
closed = TRUE;
- stat = GdipPathIterNextSubpathPath(iter, &result, retpath, &closed);
+ stat = pGdipPathIterNextSubpathPath(iter, &result, retpath, &closed);
expect(Ok, stat);
expect(0, result);
expect(TRUE, closed);
count = -1;
- GdipGetPointCount(retpath, &count);
+ pGdipGetPointCount(retpath, &count);
expect(2, count);
- GdipDeletePathIter(iter);
+ pGdipDeletePathIter(iter);
/* closed figure, check does it extend retpath or reset it */
- GdipAddPathLine(retpath, 50.0, 55.0, 200.0, 150.0);
+ pGdipAddPathLine(retpath, 50.0, 55.0, 200.0, 150.0);
- GdipClosePathFigure(path);
- GdipAddPathLine(path, 50.0, 55.0, 200.0, 150.0);
- GdipClosePathFigure(path);
+ pGdipClosePathFigure(path);
+ pGdipAddPathLine(path, 50.0, 55.0, 200.0, 150.0);
+ pGdipClosePathFigure(path);
- GdipCreatePathIter(&iter, path);
+ pGdipCreatePathIter(&iter, path);
result = -2;
closed = FALSE;
- stat = GdipPathIterNextSubpathPath(iter, &result, retpath, &closed);
+ stat = pGdipPathIterNextSubpathPath(iter, &result, retpath, &closed);
expect(Ok, stat);
expect(2, result);
expect(TRUE, closed);
count = -1;
- GdipGetPointCount(retpath, &count);
+ pGdipGetPointCount(retpath, &count);
expect(2, count);
/* subsequent call */
result = -2;
closed = FALSE;
- stat = GdipPathIterNextSubpathPath(iter, &result, retpath, &closed);
+ stat = pGdipPathIterNextSubpathPath(iter, &result, retpath, &closed);
expect(Ok, stat);
expect(2, result);
expect(TRUE, closed);
count = -1;
- GdipGetPointCount(retpath, &count);
+ pGdipGetPointCount(retpath, &count);
expect(2, count);
result = -2;
closed = FALSE;
- stat = GdipPathIterNextSubpathPath(iter, &result, retpath, &closed);
+ stat = pGdipPathIterNextSubpathPath(iter, &result, retpath, &closed);
expect(Ok, stat);
expect(0, result);
expect(TRUE, closed);
count = -1;
- GdipGetPointCount(retpath, &count);
+ pGdipGetPointCount(retpath, &count);
expect(2, count);
- GdipDeletePathIter(iter);
+ pGdipDeletePathIter(iter);
- GdipDeletePath(retpath);
- GdipDeletePath(path);
+ pGdipDeletePath(retpath);
+ pGdipDeletePath(path);
}
static void test_nextsubpath(void)
@@ -460,18 +537,18 @@ static void test_nextsubpath(void)
BOOL closed;
/* empty path */
- GdipCreatePath(FillModeAlternate, &path);
- GdipCreatePathIter(&iter, path);
+ pGdipCreatePath(FillModeAlternate, &path);
+ pGdipCreatePathIter(&iter, path);
result = -2;
closed = TRUE;
- stat = GdipPathIterNextSubpath(iter, &result, &start, &end, &closed);
+ stat = pGdipPathIterNextSubpath(iter, &result, &start, &end, &closed);
expect(Ok, stat);
expect(0, result);
expect(TRUE, closed);
- GdipDeletePathIter(iter);
- GdipDeletePath(path);
+ pGdipDeletePathIter(iter);
+ pGdipDeletePath(path);
}
static void test_nextpathtype(void)
@@ -482,73 +559,73 @@ static void test_nextpathtype(void)
INT start, end, result;
BYTE type;
- GdipCreatePath(FillModeAlternate, &path);
- GdipCreatePathIter(&iter, path);
+ pGdipCreatePath(FillModeAlternate, &path);
+ pGdipCreatePathIter(&iter, path);
/* NULL arguments */
- stat = GdipPathIterNextPathType(NULL, NULL, NULL, NULL, NULL);
+ stat = pGdipPathIterNextPathType(NULL, NULL, NULL, NULL, NULL);
expect(InvalidParameter, stat);
- stat = GdipPathIterNextPathType(iter, NULL, NULL, NULL, NULL);
+ stat = pGdipPathIterNextPathType(iter, NULL, NULL, NULL, NULL);
expect(InvalidParameter, stat);
- stat = GdipPathIterNextPathType(iter, &result, NULL, NULL, NULL);
+ stat = pGdipPathIterNextPathType(iter, &result, NULL, NULL, NULL);
expect(InvalidParameter, stat);
- stat = GdipPathIterNextPathType(iter, NULL, &type, NULL, NULL);
+ stat = pGdipPathIterNextPathType(iter, NULL, &type, NULL, NULL);
expect(InvalidParameter, stat);
- stat = GdipPathIterNextPathType(iter, NULL, NULL, &start, &end);
+ stat = pGdipPathIterNextPathType(iter, NULL, NULL, &start, &end);
expect(InvalidParameter, stat);
- stat = GdipPathIterNextPathType(iter, NULL, &type, &start, &end);
+ stat = pGdipPathIterNextPathType(iter, NULL, &type, &start, &end);
expect(InvalidParameter, stat);
- stat = GdipPathIterNextPathType(iter, &result, &type, NULL, NULL);
+ stat = pGdipPathIterNextPathType(iter, &result, &type, NULL, NULL);
expect(InvalidParameter, stat);
/* empty path */
start = end = result = (INT)0xdeadbeef;
- stat = GdipPathIterNextPathType(iter, &result, &type, &start, &end);
+ stat = pGdipPathIterNextPathType(iter, &result, &type, &start, &end);
todo_wine expect(Ok, stat);
expect((INT)0xdeadbeef, start);
expect((INT)0xdeadbeef, end);
todo_wine expect(0, result);
- GdipDeletePathIter(iter);
+ pGdipDeletePathIter(iter);
/* single figure */
- GdipAddPathLine(path, 0.0, 0.0, 10.0, 30.0);
- GdipCreatePathIter(&iter, path);
+ pGdipAddPathLine(path, 0.0, 0.0, 10.0, 30.0);
+ pGdipCreatePathIter(&iter, path);
start = end = result = (INT)0xdeadbeef;
type = 255; /* out of range */
- stat = GdipPathIterNextPathType(iter, &result, &type, &start, &end);
+ stat = pGdipPathIterNextPathType(iter, &result, &type, &start, &end);
todo_wine expect(Ok, stat);
expect((INT)0xdeadbeef, start);
expect((INT)0xdeadbeef, end);
expect(255, type);
todo_wine expect(0, result);
- GdipDeletePathIter(iter);
+ pGdipDeletePathIter(iter);
- GdipAddPathEllipse(path, 0.0, 0.0, 35.0, 70.0);
- GdipCreatePathIter(&iter, path);
+ pGdipAddPathEllipse(path, 0.0, 0.0, 35.0, 70.0);
+ pGdipCreatePathIter(&iter, path);
start = end = result = (INT)0xdeadbeef;
type = 255; /* out of range */
- stat = GdipPathIterNextPathType(iter, &result, &type, &start, &end);
+ stat = pGdipPathIterNextPathType(iter, &result, &type, &start, &end);
todo_wine expect(Ok, stat);
expect((INT)0xdeadbeef, start);
expect((INT)0xdeadbeef, end);
expect(255, type);
todo_wine expect(0, result);
- GdipDeletePathIter(iter);
+ pGdipDeletePathIter(iter);
/* closed */
- GdipClosePathFigure(path);
- GdipCreatePathIter(&iter, path);
+ pGdipClosePathFigure(path);
+ pGdipCreatePathIter(&iter, path);
start = end = result = (INT)0xdeadbeef;
type = 255; /* out of range */
- stat = GdipPathIterNextPathType(iter, &result, &type, &start, &end);
+ stat = pGdipPathIterNextPathType(iter, &result, &type, &start, &end);
todo_wine expect(Ok, stat);
expect((INT)0xdeadbeef, start);
expect((INT)0xdeadbeef, end);
expect(255, type);
todo_wine expect(0, result);
- GdipDeletePathIter(iter);
+ pGdipDeletePathIter(iter);
- GdipDeletePath(path);
+ pGdipDeletePath(path);
}
START_TEST(pathiterator)
@@ -556,12 +633,15 @@ START_TEST(pathiterator)
struct GdiplusStartupInput gdiplusStartupInput;
ULONG_PTR gdiplusToken;
+ if (!InitFunctionPtrs())
+ return;
+
gdiplusStartupInput.GdiplusVersion = 1;
gdiplusStartupInput.DebugEventCallback = NULL;
gdiplusStartupInput.SuppressBackgroundThread = 0;
gdiplusStartupInput.SuppressExternalCodecs = 0;
- GdiplusStartup(&gdiplusToken, &gdiplusStartupInput, NULL);
+ pGdiplusStartup(&gdiplusToken, &gdiplusStartupInput, NULL);
test_constructor_destructor();
test_hascurve();
@@ -573,5 +653,7 @@ START_TEST(pathiterator)
test_nextsubpath();
test_nextpathtype();
- GdiplusShutdown(gdiplusToken);
+ pGdiplusShutdown(gdiplusToken);
+
+ FreeLibrary(hGdiPlus);
}
diff --git a/dlls/gdiplus/tests/pen.c b/dlls/gdiplus/tests/pen.c
index d2f33f0..7963735 100644
--- a/dlls/gdiplus/tests/pen.c
+++ b/dlls/gdiplus/tests/pen.c
@@ -27,6 +27,87 @@
#define expect(expected, got) ok(got == expected, "Expected %.8x, got %.8x\n", expected, got)
#define expectf(expected, got) ok(fabs(got - expected) < 0.1, "Expected %.2f, got %.2f\n", expected, got)
+static GpStatus (WINGDIPAPI * pGdipDeleteBrush)(GpBrush*);
+static GpStatus (WINGDIPAPI * pGdipGetBrushType)(GpBrush*,GpBrushType*);
+static GpStatus (WINGDIPAPI * pGdipCreateLineBrush)(GDIPCONST GpPointF*,
+ GDIPCONST GpPointF*,ARGB,ARGB,GpWrapMode,GpLineGradient**);
+static GpStatus (WINGDIPAPI * pGdipCreatePen1)(ARGB,REAL,GpUnit,GpPen**);
+static GpStatus (WINGDIPAPI * pGdipCreatePen2)(GpBrush*,REAL,GpUnit,GpPen**);
+static GpStatus (WINGDIPAPI * pGdipDeletePen)(GpPen*);
+static GpStatus (WINGDIPAPI * pGdipGetPenBrushFill)(GpPen*,GpBrush**);
+static GpStatus (WINGDIPAPI * pGdipGetPenColor)(GpPen*,ARGB*);
+static GpStatus (WINGDIPAPI * pGdipGetPenCustomStartCap)(GpPen*,
+ GpCustomLineCap**);
+static GpStatus (WINGDIPAPI * pGdipGetPenCustomEndCap)(GpPen*,
+ GpCustomLineCap**);
+static GpStatus (WINGDIPAPI * pGdipGetPenDashArray)(GpPen*,REAL*,INT);
+static GpStatus (WINGDIPAPI * pGdipGetPenDashStyle)(GpPen*,GpDashStyle*);
+static GpStatus (WINGDIPAPI * pGdipSetPenBrushFill)(GpPen*,GpBrush*);
+static GpStatus (WINGDIPAPI * pGdipSetPenCompoundArray)(GpPen*,GDIPCONST REAL*,
+ INT);
+static GpStatus (WINGDIPAPI * pGdipSetPenCustomEndCap)(GpPen*,GpCustomLineCap*);
+static GpStatus (WINGDIPAPI * pGdipSetPenCustomStartCap)(GpPen*,
+ GpCustomLineCap*);
+static GpStatus (WINGDIPAPI * pGdipSetPenDashArray)(GpPen*,GDIPCONST REAL*,INT);
+static GpStatus (WINGDIPAPI * pGdipSetPenDashStyle)(GpPen*,GpDashStyle);
+static GpStatus (WINGDIPAPI * pGdipGetPenFillType)(GpPen*,GpPenType*);
+static GpStatus (WINGDIPAPI * pGdipCreateSolidFill)(ARGB,GpSolidFill**);
+static GpStatus (WINGDIPAPI * pGdipGetSolidFillColor)(GpSolidFill*,ARGB*);
+static GpStatus (WINGDIPAPI * pGdipSetSolidFillColor)(GpSolidFill*,ARGB);
+static Status (WINAPI * pGdiplusStartup)(ULONG_PTR*,
+ const struct GdiplusStartupInput*,struct GdiplusStartupOutput*);
+static void (WINAPI * pGdiplusShutdown)(ULONG_PTR);
+
+static HMODULE hGdiPlus = 0;
+
+static BOOL InitFunctionPtrs(void)
+{
+ hGdiPlus = LoadLibraryA("gdiplus.dll");
+ if (!hGdiPlus)
+ {
+ trace("Could not load gdiplus.dll\n");
+ return FALSE;
+ }
+
+#define GDIPLUS_GET_PROC(func) \
+ p ## func = (void*)GetProcAddress(hGdiPlus, #func); \
+ if (!p ## func) \
+ { \
+ trace("GetProcAddress(%s) failed\n", #func); \
+ FreeLibrary(hGdiPlus); \
+ return FALSE; \
+ }
+
+ GDIPLUS_GET_PROC(GdipCreateLineBrush)
+ GDIPLUS_GET_PROC(GdipCreatePen1)
+ GDIPLUS_GET_PROC(GdipCreatePen2)
+ GDIPLUS_GET_PROC(GdipCreateSolidFill)
+ GDIPLUS_GET_PROC(GdipDeleteBrush)
+ GDIPLUS_GET_PROC(GdipDeletePen)
+ GDIPLUS_GET_PROC(GdipGetBrushType)
+ GDIPLUS_GET_PROC(GdipGetPenBrushFill)
+ GDIPLUS_GET_PROC(GdipGetPenColor)
+ GDIPLUS_GET_PROC(GdipGetPenCustomEndCap)
+ GDIPLUS_GET_PROC(GdipGetPenCustomStartCap)
+ GDIPLUS_GET_PROC(GdipGetPenDashArray)
+ GDIPLUS_GET_PROC(GdipGetPenDashStyle)
+ GDIPLUS_GET_PROC(GdipGetPenFillType)
+ GDIPLUS_GET_PROC(GdipGetSolidFillColor)
+ GDIPLUS_GET_PROC(GdiplusShutdown)
+ GDIPLUS_GET_PROC(GdiplusStartup)
+ GDIPLUS_GET_PROC(GdipSetPenBrushFill)
+ GDIPLUS_GET_PROC(GdipSetPenCompoundArray)
+ GDIPLUS_GET_PROC(GdipSetPenCustomEndCap)
+ GDIPLUS_GET_PROC(GdipSetPenCustomStartCap)
+ GDIPLUS_GET_PROC(GdipSetPenDashArray)
+ GDIPLUS_GET_PROC(GdipSetPenDashStyle)
+ GDIPLUS_GET_PROC(GdipSetSolidFillColor)
+
+#undef GDIPLUS_GET_PROC
+
+ return TRUE;
+}
+
static void test_startup(void)
{
GpPen *pen = NULL;
@@ -39,22 +120,22 @@ static void test_startup(void)
gdiplusStartupInput.SuppressBackgroundThread = 0;
gdiplusStartupInput.SuppressExternalCodecs = 0;
- status = GdiplusStartup(&gdiplusToken, &gdiplusStartupInput, NULL);
+ status = pGdiplusStartup(&gdiplusToken, &gdiplusStartupInput, NULL);
expect(Ok, status);
- GdiplusShutdown(gdiplusToken);
+ pGdiplusShutdown(gdiplusToken);
gdiplusStartupInput.GdiplusVersion = 2;
- status = GdiplusStartup(&gdiplusToken, &gdiplusStartupInput, NULL);
+ status = pGdiplusStartup(&gdiplusToken, &gdiplusStartupInput, NULL);
expect(UnsupportedGdiplusVersion, status);
- GdiplusShutdown(gdiplusToken);
+ pGdiplusShutdown(gdiplusToken);
- status = GdipCreatePen1((ARGB)0xffff00ff, 10.0f, UnitPixel, &pen);
+ status = pGdipCreatePen1((ARGB)0xffff00ff, 10.0f, UnitPixel, &pen);
todo_wine
expect(GdiplusNotInitialized, status);
- GdipDeletePen(pen);
+ pGdipDeletePen(pen);
}
static void test_constructor_destructor(void)
@@ -62,18 +143,18 @@ static void test_constructor_destructor(void)
GpStatus status;
GpPen *pen = NULL;
- status = GdipCreatePen1((ARGB)0xffff00ff, 10.0f, UnitPixel, NULL);
+ status = pGdipCreatePen1((ARGB)0xffff00ff, 10.0f, UnitPixel, NULL);
expect(InvalidParameter, status);
ok(pen == NULL, "Expected pen to be NULL\n");
- status = GdipCreatePen1((ARGB)0xffff00ff, 10.0f, UnitPixel, &pen);
+ status = pGdipCreatePen1((ARGB)0xffff00ff, 10.0f, UnitPixel, &pen);
expect(Ok, status);
ok(pen != NULL, "Expected pen to be initialized\n");
- status = GdipDeletePen(NULL);
+ status = pGdipDeletePen(NULL);
expect(InvalidParameter, status);
- status = GdipDeletePen(pen);
+ status = pGdipDeletePen(pen);
expect(Ok, status);
}
@@ -84,7 +165,7 @@ static void test_constructor_destructor2(void)
GpBrush *brush = NULL;
GpPointF points[2];
- status = GdipCreatePen2(NULL, 10.0f, UnitPixel, &pen);
+ status = pGdipCreatePen2(NULL, 10.0f, UnitPixel, &pen);
expect(InvalidParameter, status);
ok(pen == NULL, "Expected pen to be NULL\n");
@@ -93,19 +174,19 @@ static void test_constructor_destructor2(void)
points[1].X = 13.0;
points[1].Y = 17.0;
- status = GdipCreateLineBrush(&points[0], &points[1], (ARGB)0xffff00ff,
+ status = pGdipCreateLineBrush(&points[0], &points[1], (ARGB)0xffff00ff,
(ARGB)0xff0000ff, WrapModeTile, (GpLineGradient **)&brush);
expect(Ok, status);
ok(brush != NULL, "Expected brush to be initialized\n");
- status = GdipCreatePen2(brush, 10.0f, UnitPixel, &pen);
+ status = pGdipCreatePen2(brush, 10.0f, UnitPixel, &pen);
expect(Ok, status);
ok(pen != NULL, "Expected pen to be initialized\n");
- status = GdipDeletePen(pen);
+ status = pGdipDeletePen(pen);
expect(Ok, status);
- status = GdipDeleteBrush(brush);
+ status = pGdipDeleteBrush(brush);
expect(Ok, status);
}
@@ -118,39 +199,39 @@ static void test_brushfill(void)
ARGB color = 0;
/* default solid */
- GdipCreatePen1(0xdeadbeef, 4.5, UnitWorld, &pen);
- status = GdipGetPenBrushFill(pen, &brush);
+ pGdipCreatePen1(0xdeadbeef, 4.5, UnitWorld, &pen);
+ status = pGdipGetPenBrushFill(pen, &brush);
expect(Ok, status);
- GdipGetBrushType(brush, &type);
+ pGdipGetBrushType(brush, &type);
expect(BrushTypeSolidColor, type);
- GdipGetPenColor(pen, &color);
+ pGdipGetPenColor(pen, &color);
expect(0xdeadbeef, color);
- GdipDeleteBrush(brush);
+ pGdipDeleteBrush(brush);
/* color controlled by brush */
- GdipCreateSolidFill(0xabaddeed, (GpSolidFill**)&brush);
- status = GdipSetPenBrushFill(pen, brush);
+ pGdipCreateSolidFill(0xabaddeed, (GpSolidFill**)&brush);
+ status = pGdipSetPenBrushFill(pen, brush);
expect(Ok, status);
- GdipGetPenColor(pen, &color);
+ pGdipGetPenColor(pen, &color);
expect(0xabaddeed, color);
- GdipDeleteBrush(brush);
+ pGdipDeleteBrush(brush);
color = 0;
/* get returns a clone, not a reference */
- GdipGetPenBrushFill(pen, &brush);
- GdipSetSolidFillColor((GpSolidFill*)brush, 0xbeadfeed);
- GdipGetPenBrushFill(pen, &brush2);
+ pGdipGetPenBrushFill(pen, &brush);
+ pGdipSetSolidFillColor((GpSolidFill*)brush, 0xbeadfeed);
+ pGdipGetPenBrushFill(pen, &brush2);
ok(brush != brush2, "Expected to get a clone, not a copy of the reference\n");
- GdipGetSolidFillColor((GpSolidFill*)brush2, &color);
+ pGdipGetSolidFillColor((GpSolidFill*)brush2, &color);
expect(0xabaddeed, color);
- GdipDeleteBrush(brush);
- GdipDeleteBrush(brush2);
+ pGdipDeleteBrush(brush);
+ pGdipDeleteBrush(brush2);
/* brush cannot be NULL */
- status = GdipSetPenBrushFill(pen, NULL);
+ status = pGdipSetPenBrushFill(pen, NULL);
expect(InvalidParameter, status);
- GdipDeletePen(pen);
+ pGdipDeletePen(pen);
}
static void test_dasharray(void)
@@ -160,7 +241,7 @@ static void test_dasharray(void)
GpStatus status;
REAL dashes[12];
- GdipCreatePen1(0xdeadbeef, 10.0, UnitWorld, &pen);
+ pGdipCreatePen1(0xdeadbeef, 10.0, UnitWorld, &pen);
dashes[0] = 10.0;
dashes[1] = 11.0;
dashes[2] = 12.0;
@@ -171,59 +252,59 @@ static void test_dasharray(void)
dashes[7] = dashes[8] = dashes[9] = dashes[10] = dashes[11] = 0.0;
/* setting the array sets the type to custom */
- GdipGetPenDashStyle(pen, &style);
+ pGdipGetPenDashStyle(pen, &style);
expect(DashStyleSolid, style);
- status = GdipSetPenDashArray(pen, dashes, 2);
+ status = pGdipSetPenDashArray(pen, dashes, 2);
expect(Ok, status);
- GdipGetPenDashStyle(pen, &style);
+ pGdipGetPenDashStyle(pen, &style);
expect(DashStyleCustom, style);
/* Getting the array on a non-custom pen returns invalid parameter (unless
* you are getting 0 elements).*/
- GdipSetPenDashStyle(pen, DashStyleSolid);
- status = GdipGetPenDashArray(pen, &dashes[5], 2);
+ pGdipSetPenDashStyle(pen, DashStyleSolid);
+ status = pGdipGetPenDashArray(pen, &dashes[5], 2);
expect(InvalidParameter, status);
- status = GdipGetPenDashArray(pen, &dashes[5], 0);
+ status = pGdipGetPenDashArray(pen, &dashes[5], 0);
expect(Ok, status);
/* What does setting DashStyleCustom do to the array length? */
- GdipSetPenDashArray(pen, dashes, 2);
- GdipSetPenDashStyle(pen, DashStyleCustom);
- status = GdipGetPenDashArray(pen, &dashes[5], 2);
+ pGdipSetPenDashArray(pen, dashes, 2);
+ pGdipSetPenDashStyle(pen, DashStyleCustom);
+ status = pGdipGetPenDashArray(pen, &dashes[5], 2);
expect(Ok, status);
expectf(10.0, dashes[5]);
expectf(11.0, dashes[6]);
/* Set the array, then get with different sized buffers. */
- status = GdipSetPenDashArray(pen, dashes, 5);
+ status = pGdipSetPenDashArray(pen, dashes, 5);
expect(Ok, status);
dashes[5] = -100.0;
dashes[6] = -100.0;
- status = GdipGetPenDashArray(pen, &dashes[5], 1);
+ status = pGdipGetPenDashArray(pen, &dashes[5], 1);
expect(Ok, status); /* not InsufficientBuffer! */
expectf(10.0, dashes[5]);
expectf(-100.0, dashes[6]);
dashes[5] = -100.0;
- status = GdipGetPenDashArray(pen, &dashes[5], 6);
+ status = pGdipGetPenDashArray(pen, &dashes[5], 6);
expect(InvalidParameter, status); /* not Ok! */
expectf(-100.0, dashes[5]);
expectf(-100.0, dashes[6]);
/* Some invalid array values. */
- status = GdipSetPenDashArray(pen, &dashes[7], 5);
+ status = pGdipSetPenDashArray(pen, &dashes[7], 5);
expect(InvalidParameter, status);
dashes[9] = -1.0;
- status = GdipSetPenDashArray(pen, &dashes[7], 5);
+ status = pGdipSetPenDashArray(pen, &dashes[7], 5);
expect(InvalidParameter, status);
/* Try to set with count = 0. */
- GdipSetPenDashStyle(pen, DashStyleDot);
- status = GdipSetPenDashArray(pen, dashes, 0);
+ pGdipSetPenDashStyle(pen, DashStyleDot);
+ status = pGdipSetPenDashArray(pen, dashes, 0);
expect(OutOfMemory, status);
- GdipGetPenDashStyle(pen, &style);
+ pGdipGetPenDashStyle(pen, &style);
expect(DashStyleDot, style);
- GdipDeletePen(pen);
+ pGdipDeletePen(pen);
}
static void test_customcap(void)
@@ -232,47 +313,47 @@ static void test_customcap(void)
GpStatus status;
GpCustomLineCap *custom;
- status = GdipCreatePen1((ARGB)0xffff00ff, 10.0f, UnitPixel, &pen);
+ status = pGdipCreatePen1((ARGB)0xffff00ff, 10.0f, UnitPixel, &pen);
expect(Ok, status);
/* NULL args */
- status = GdipGetPenCustomStartCap(NULL, NULL);
+ status = pGdipGetPenCustomStartCap(NULL, NULL);
expect(InvalidParameter, status);
- status = GdipGetPenCustomStartCap(pen, NULL);
+ status = pGdipGetPenCustomStartCap(pen, NULL);
expect(InvalidParameter, status);
- status = GdipGetPenCustomStartCap(NULL, &custom);
+ status = pGdipGetPenCustomStartCap(NULL, &custom);
expect(InvalidParameter, status);
- status = GdipGetPenCustomEndCap(NULL, NULL);
+ status = pGdipGetPenCustomEndCap(NULL, NULL);
expect(InvalidParameter, status);
- status = GdipGetPenCustomEndCap(pen, NULL);
+ status = pGdipGetPenCustomEndCap(pen, NULL);
expect(InvalidParameter, status);
- status = GdipGetPenCustomEndCap(NULL, &custom);
+ status = pGdipGetPenCustomEndCap(NULL, &custom);
expect(InvalidParameter, status);
/* native crashes on pen == NULL, custom != NULL */
- status = GdipSetPenCustomStartCap(NULL, NULL);
+ status = pGdipSetPenCustomStartCap(NULL, NULL);
expect(InvalidParameter, status);
- status = GdipSetPenCustomStartCap(pen, NULL);
+ status = pGdipSetPenCustomStartCap(pen, NULL);
expect(InvalidParameter, status);
- status = GdipSetPenCustomEndCap(NULL, NULL);
+ status = pGdipSetPenCustomEndCap(NULL, NULL);
expect(InvalidParameter, status);
- status = GdipSetPenCustomEndCap(pen, NULL);
+ status = pGdipSetPenCustomEndCap(pen, NULL);
expect(InvalidParameter, status);
/* get without setting previously */
custom = (GpCustomLineCap*)0xdeadbeef;
- status = GdipGetPenCustomEndCap(pen, &custom);
+ status = pGdipGetPenCustomEndCap(pen, &custom);
expect(Ok, status);
ok(custom == NULL,"Expect CustomCap == NULL\n");
custom = (GpCustomLineCap*)0xdeadbeef;
- status = GdipGetPenCustomStartCap(pen, &custom);
+ status = pGdipGetPenCustomStartCap(pen, &custom);
expect(Ok, status);
ok(custom == NULL,"Expect CustomCap == NULL\n");
- GdipDeletePen(pen);
+ pGdipDeletePen(pen);
}
static void test_penfilltype(void)
@@ -285,44 +366,44 @@ static void test_penfilltype(void)
GpPenType type;
/* NULL */
- status = GdipGetPenFillType(NULL, NULL);
+ status = pGdipGetPenFillType(NULL, NULL);
expect(InvalidParameter, status);
- status = GdipCreatePen1((ARGB)0xffff00ff, 10.0f, UnitPixel, &pen);
+ status = pGdipCreatePen1((ARGB)0xffff00ff, 10.0f, UnitPixel, &pen);
expect(Ok, status);
- status = GdipGetPenFillType(pen, NULL);
+ status = pGdipGetPenFillType(pen, NULL);
expect(InvalidParameter, status);
- /* created with GdipCreatePen1() */
- status = GdipGetPenFillType(pen, &type);
+ /* created with pGdipCreatePen1() */
+ status = pGdipGetPenFillType(pen, &type);
expect(Ok, status);
expect(PenTypeSolidColor, type);
- GdipDeletePen(pen);
+ pGdipDeletePen(pen);
/* based on SolidBrush */
- status = GdipCreateSolidFill((ARGB)0xffff00ff, &solid);
+ status = pGdipCreateSolidFill((ARGB)0xffff00ff, &solid);
expect(Ok, status);
- status = GdipCreatePen2((GpBrush*)solid, 10.0f, UnitPixel, &pen);
+ status = pGdipCreatePen2((GpBrush*)solid, 10.0f, UnitPixel, &pen);
expect(Ok, status);
- status = GdipGetPenFillType(pen, &type);
+ status = pGdipGetPenFillType(pen, &type);
expect(Ok, status);
expect(PenTypeSolidColor, type);
- GdipDeletePen(pen);
- GdipDeleteBrush((GpBrush*)solid);
+ pGdipDeletePen(pen);
+ pGdipDeleteBrush((GpBrush*)solid);
/* based on LinearGradientBrush */
a.X = a.Y = 0.0;
b.X = b.Y = 10.0;
- status = GdipCreateLineBrush(&a, &b, (ARGB)0xffff00ff, (ARGB)0xffff0000,
+ status = pGdipCreateLineBrush(&a, &b, (ARGB)0xffff00ff, (ARGB)0xffff0000,
WrapModeTile, &line);
expect(Ok, status);
- status = GdipCreatePen2((GpBrush*)line, 10.0f, UnitPixel, &pen);
+ status = pGdipCreatePen2((GpBrush*)line, 10.0f, UnitPixel, &pen);
expect(Ok, status);
- status = GdipGetPenFillType(pen, &type);
+ status = pGdipGetPenFillType(pen, &type);
expect(Ok, status);
expect(PenTypeLinearGradient, type);
- GdipDeletePen(pen);
- GdipDeleteBrush((GpBrush*)line);
+ pGdipDeletePen(pen);
+ pGdipDeleteBrush((GpBrush*)line);
}
static void test_compoundarray(void)
@@ -331,25 +412,25 @@ static void test_compoundarray(void)
GpPen *pen;
static const REAL testvalues[] = {0.2, 0.4, 0.6, 0.8};
- status = GdipSetPenCompoundArray(NULL, testvalues, 4);
+ status = pGdipSetPenCompoundArray(NULL, testvalues, 4);
expect(InvalidParameter, status);
- status = GdipCreatePen1((ARGB)0xffff00ff, 10.0f, UnitPixel, &pen);
+ status = pGdipCreatePen1((ARGB)0xffff00ff, 10.0f, UnitPixel, &pen);
expect(Ok, status);
- status = GdipSetPenCompoundArray(pen, NULL, 4);
+ status = pGdipSetPenCompoundArray(pen, NULL, 4);
expect(InvalidParameter, status);
- status = GdipSetPenCompoundArray(pen, testvalues, 3);
+ status = pGdipSetPenCompoundArray(pen, testvalues, 3);
expect(InvalidParameter, status);
- status = GdipSetPenCompoundArray(pen, testvalues, 0);
+ status = pGdipSetPenCompoundArray(pen, testvalues, 0);
expect(InvalidParameter, status);
- status = GdipSetPenCompoundArray(pen, testvalues, -2);
+ status = pGdipSetPenCompoundArray(pen, testvalues, -2);
expect(InvalidParameter, status);
- status = GdipSetPenCompoundArray(pen, testvalues, 4);
+ status = pGdipSetPenCompoundArray(pen, testvalues, 4);
todo_wine expect(Ok, status);
- GdipDeletePen(pen);
+ pGdipDeletePen(pen);
}
START_TEST(pen)
@@ -357,6 +438,9 @@ START_TEST(pen)
struct GdiplusStartupInput gdiplusStartupInput;
ULONG_PTR gdiplusToken;
+ if (!InitFunctionPtrs())
+ return;
+
test_startup();
gdiplusStartupInput.GdiplusVersion = 1;
@@ -364,7 +448,7 @@ START_TEST(pen)
gdiplusStartupInput.SuppressBackgroundThread = 0;
gdiplusStartupInput.SuppressExternalCodecs = 0;
- GdiplusStartup(&gdiplusToken, &gdiplusStartupInput, NULL);
+ pGdiplusStartup(&gdiplusToken, &gdiplusStartupInput, NULL);
test_constructor_destructor();
test_constructor_destructor2();
@@ -374,5 +458,7 @@ START_TEST(pen)
test_penfilltype();
test_compoundarray();
- GdiplusShutdown(gdiplusToken);
+ pGdiplusShutdown(gdiplusToken);
+
+ FreeLibrary(hGdiPlus);
}
diff --git a/dlls/gdiplus/tests/region.c b/dlls/gdiplus/tests/region.c
index 689811c..a76af5f 100644
--- a/dlls/gdiplus/tests/region.c
+++ b/dlls/gdiplus/tests/region.c
@@ -100,6 +100,116 @@ static void verify_region(HRGN hrgn, const RECT *rc)
ok(EqualRect(&rgn.data.rdh.rcBound, rc), "rects don't match\n");
}
+static GpStatus (WINGDIPAPI * pGdipCreateFromHDC)(HDC,GpGraphics**);
+static GpStatus (WINGDIPAPI * pGdipDeleteGraphics)(GpGraphics*);
+static GpStatus (WINGDIPAPI * pGdipScaleWorldTransform)(GpGraphics*,REAL,REAL,
+ GpMatrixOrder);
+static GpStatus (WINGDIPAPI * pGdipSetWorldTransform)(GpGraphics*,GpMatrix*);
+static GpStatus (WINGDIPAPI * pGdipAddPathEllipse)(GpPath*,REAL,REAL,REAL,REAL);
+static GpStatus (WINGDIPAPI * pGdipAddPathLine)(GpPath*,REAL,REAL,REAL,REAL);
+static GpStatus (WINGDIPAPI * pGdipAddPathRectangle)(GpPath*,REAL,REAL,REAL,
+ REAL);
+static GpStatus (WINGDIPAPI * pGdipClosePathFigure)(GpPath*);
+static GpStatus (WINGDIPAPI * pGdipCreatePath)(GpFillMode,GpPath**);
+static GpStatus (WINGDIPAPI * pGdipDeletePath)(GpPath*);
+static GpStatus (WINGDIPAPI * pGdipResetPath)(GpPath*);
+static GpStatus (WINGDIPAPI * pGdipCreateMatrix2)(REAL,REAL,REAL,REAL,REAL,REAL,
+ GpMatrix**);
+static GpStatus (WINGDIPAPI * pGdipDeleteMatrix)(GpMatrix*);
+static GpStatus (WINGDIPAPI * pGdipCombineRegionPath)(GpRegion*,GpPath*,
+ CombineMode);
+static GpStatus (WINGDIPAPI * pGdipCombineRegionRect)(GpRegion*,
+ GDIPCONST GpRectF*,CombineMode);
+static GpStatus (WINGDIPAPI * pGdipCombineRegionRectI)(GpRegion*,
+ GDIPCONST GpRect*,CombineMode);
+static GpStatus (WINGDIPAPI * pGdipCombineRegionRegion)(GpRegion*,GpRegion*,
+ CombineMode);
+static GpStatus (WINGDIPAPI * pGdipCreateRegion)(GpRegion**);
+static GpStatus (WINGDIPAPI * pGdipCreateRegionPath)(GpPath*,GpRegion**);
+static GpStatus (WINGDIPAPI * pGdipCreateRegionRect)(GDIPCONST GpRectF*,
+ GpRegion**);
+static GpStatus (WINGDIPAPI * pGdipCreateRegionRectI)(GDIPCONST GpRect*,
+ GpRegion**);
+static GpStatus (WINGDIPAPI * pGdipCreateRegionHrgn)(HRGN,GpRegion**);
+static GpStatus (WINGDIPAPI * pGdipDeleteRegion)(GpRegion*);
+static GpStatus (WINGDIPAPI * pGdipGetRegionBounds)(GpRegion*,GpGraphics*,
+ GpRectF*);
+static GpStatus (WINGDIPAPI * pGdipGetRegionData)(GpRegion*,BYTE*,UINT,UINT*);
+static GpStatus (WINGDIPAPI * pGdipGetRegionDataSize)(GpRegion*,UINT*);
+static GpStatus (WINGDIPAPI * pGdipGetRegionHRgn)(GpRegion*,GpGraphics*,HRGN*);
+static GpStatus (WINGDIPAPI * pGdipIsEmptyRegion)(GpRegion*,GpGraphics*,BOOL*);
+static GpStatus (WINGDIPAPI * pGdipIsEqualRegion)(GpRegion*,GpRegion*,
+ GpGraphics*,BOOL*);
+static GpStatus (WINGDIPAPI * pGdipIsInfiniteRegion)(GpRegion*,GpGraphics*,
+ BOOL*);
+static GpStatus (WINGDIPAPI * pGdipSetEmpty)(GpRegion*);
+static GpStatus (WINGDIPAPI * pGdipSetInfinite)(GpRegion*);
+static GpStatus (WINGDIPAPI * pGdipTranslateRegion)(GpRegion*,REAL,REAL);
+static Status (WINAPI * pGdiplusStartup)(ULONG_PTR*,
+ const struct GdiplusStartupInput*,struct GdiplusStartupOutput*);
+static void (WINAPI * pGdiplusShutdown)(ULONG_PTR);
+
+static HMODULE hGdiPlus = 0;
+
+static BOOL InitFunctionPtrs(void)
+{
+ hGdiPlus = LoadLibraryA("gdiplus.dll");
+ if (!hGdiPlus)
+ {
+ trace("Could not load gdiplus.dll\n");
+ return FALSE;
+ }
+
+#define GDIPLUS_GET_PROC(func) \
+ p ## func = (void*)GetProcAddress(hGdiPlus, #func); \
+ if (!p ## func) \
+ { \
+ trace("GetProcAddress(%s) failed\n", #func); \
+ FreeLibrary(hGdiPlus); \
+ return FALSE; \
+ }
+
+ GDIPLUS_GET_PROC(GdipAddPathEllipse)
+ GDIPLUS_GET_PROC(GdipAddPathLine)
+ GDIPLUS_GET_PROC(GdipAddPathRectangle)
+ GDIPLUS_GET_PROC(GdipClosePathFigure)
+ GDIPLUS_GET_PROC(GdipCombineRegionPath)
+ GDIPLUS_GET_PROC(GdipCombineRegionRect)
+ GDIPLUS_GET_PROC(GdipCombineRegionRectI)
+ GDIPLUS_GET_PROC(GdipCombineRegionRegion)
+ GDIPLUS_GET_PROC(GdipCreateFromHDC)
+ GDIPLUS_GET_PROC(GdipCreateMatrix2)
+ GDIPLUS_GET_PROC(GdipCreatePath)
+ GDIPLUS_GET_PROC(GdipCreateRegion)
+ GDIPLUS_GET_PROC(GdipCreateRegionHrgn)
+ GDIPLUS_GET_PROC(GdipCreateRegionPath)
+ GDIPLUS_GET_PROC(GdipCreateRegionRect)
+ GDIPLUS_GET_PROC(GdipCreateRegionRectI)
+ GDIPLUS_GET_PROC(GdipDeleteGraphics)
+ GDIPLUS_GET_PROC(GdipDeleteMatrix)
+ GDIPLUS_GET_PROC(GdipDeletePath)
+ GDIPLUS_GET_PROC(GdipDeleteRegion)
+ GDIPLUS_GET_PROC(GdipGetRegionBounds)
+ GDIPLUS_GET_PROC(GdipGetRegionData)
+ GDIPLUS_GET_PROC(GdipGetRegionDataSize)
+ GDIPLUS_GET_PROC(GdipGetRegionHRgn)
+ GDIPLUS_GET_PROC(GdipIsEmptyRegion)
+ GDIPLUS_GET_PROC(GdipIsEqualRegion)
+ GDIPLUS_GET_PROC(GdipIsInfiniteRegion)
+ GDIPLUS_GET_PROC(GdiplusShutdown)
+ GDIPLUS_GET_PROC(GdiplusStartup)
+ GDIPLUS_GET_PROC(GdipResetPath)
+ GDIPLUS_GET_PROC(GdipScaleWorldTransform)
+ GDIPLUS_GET_PROC(GdipSetEmpty)
+ GDIPLUS_GET_PROC(GdipSetInfinite)
+ GDIPLUS_GET_PROC(GdipSetWorldTransform)
+ GDIPLUS_GET_PROC(GdipTranslateRegion)
+
+#undef GDIPLUS_GET_PROC
+
+ return TRUE;
+}
+
static void test_getregiondata(void)
{
GpStatus status;
@@ -112,13 +222,13 @@ static void test_getregiondata(void)
memset(buf, 0xee, sizeof(buf));
- status = GdipCreateRegion(®ion);
+ status = pGdipCreateRegion(®ion);
ok(status == Ok, "status %08x\n", status);
- status = GdipGetRegionDataSize(region, &needed);
+ status = pGdipGetRegionDataSize(region, &needed);
ok(status == Ok, "status %08x\n", status);
expect(20, needed);
- status = GdipGetRegionData(region, (BYTE*)buf, sizeof(buf), &needed);
+ status = pGdipGetRegionData(region, (BYTE*)buf, sizeof(buf), &needed);
ok(status == Ok, "status %08x\n", status);
expect(20, needed);
expect_dword(buf, 12);
@@ -127,12 +237,12 @@ static void test_getregiondata(void)
expect_dword(buf + 3, 0);
expect_dword(buf + 4, RGNDATA_INFINITE_RECT);
- status = GdipSetEmpty(region);
+ status = pGdipSetEmpty(region);
ok(status == Ok, "status %08x\n", status);
- status = GdipGetRegionDataSize(region, &needed);
+ status = pGdipGetRegionDataSize(region, &needed);
ok(status == Ok, "status %08x\n", status);
expect(20, needed);
- status = GdipGetRegionData(region, (BYTE*)buf, sizeof(buf), &needed);
+ status = pGdipGetRegionData(region, (BYTE*)buf, sizeof(buf), &needed);
ok(status == Ok, "status %08x\n", status);
expect(20, needed);
expect_dword(buf, 12);
@@ -141,12 +251,12 @@ static void test_getregiondata(void)
expect_dword(buf + 3, 0);
expect_dword(buf + 4, RGNDATA_EMPTY_RECT);
- status = GdipSetInfinite(region);
+ status = pGdipSetInfinite(region);
ok(status == Ok, "status %08x\n", status);
- status = GdipGetRegionDataSize(region, &needed);
+ status = pGdipGetRegionDataSize(region, &needed);
ok(status == Ok, "status %08x\n", status);
expect(20, needed);
- status = GdipGetRegionData(region, (BYTE*)buf, sizeof(buf), &needed);
+ status = pGdipGetRegionData(region, (BYTE*)buf, sizeof(buf), &needed);
ok(status == Ok, "status %08x\n", status);
expect(20, needed);
expect_dword(buf, 12);
@@ -155,19 +265,19 @@ static void test_getregiondata(void)
expect_dword(buf + 3, 0);
expect_dword(buf + 4, RGNDATA_INFINITE_RECT);
- status = GdipDeleteRegion(region);
+ status = pGdipDeleteRegion(region);
ok(status == Ok, "status %08x\n", status);
rect.X = 10;
rect.Y = 20;
rect.Width = 100;
rect.Height = 200;
- status = GdipCreateRegionRectI(&rect, ®ion);
+ status = pGdipCreateRegionRectI(&rect, ®ion);
ok(status == Ok, "status %08x\n", status);
- status = GdipGetRegionDataSize(region, &needed);
+ status = pGdipGetRegionDataSize(region, &needed);
ok(status == Ok, "status %08x\n", status);
expect(36, needed);
- status = GdipGetRegionData(region, (BYTE*)buf, sizeof(buf), &needed);
+ status = pGdipGetRegionData(region, (BYTE*)buf, sizeof(buf), &needed);
ok(status == Ok, "status %08x\n", status);
expect(36, needed);
expect_dword(buf, 28);
@@ -184,42 +294,42 @@ static void test_getregiondata(void)
rect.Y = 30;
rect.Width = 10;
rect.Height = 20;
- status = GdipCombineRegionRectI(region, &rect, CombineModeIntersect);
+ status = pGdipCombineRegionRectI(region, &rect, CombineModeIntersect);
ok(status == Ok, "status %08x\n", status);
rect.X = 100;
rect.Y = 300;
rect.Width = 30;
rect.Height = 50;
- status = GdipCombineRegionRectI(region, &rect, CombineModeXor);
+ status = pGdipCombineRegionRectI(region, &rect, CombineModeXor);
ok(status == Ok, "status %08x\n", status);
rect.X = 200;
rect.Y = 100;
rect.Width = 133;
rect.Height = 266;
- status = GdipCreateRegionRectI(&rect, ®ion2);
+ status = pGdipCreateRegionRectI(&rect, ®ion2);
ok(status == Ok, "status %08x\n", status);
rect.X = 20;
rect.Y = 10;
rect.Width = 40;
rect.Height = 66;
- status = GdipCombineRegionRectI(region2, &rect, CombineModeUnion);
+ status = pGdipCombineRegionRectI(region2, &rect, CombineModeUnion);
ok(status == Ok, "status %08x\n", status);
- status = GdipCombineRegionRegion(region, region2, CombineModeComplement);
+ status = pGdipCombineRegionRegion(region, region2, CombineModeComplement);
ok(status == Ok, "status %08x\n", status);
rect.X = 400;
rect.Y = 500;
rect.Width = 22;
rect.Height = 55;
- status = GdipCombineRegionRectI(region, &rect, CombineModeExclude);
+ status = pGdipCombineRegionRectI(region, &rect, CombineModeExclude);
ok(status == Ok, "status %08x\n", status);
- status = GdipGetRegionDataSize(region, &needed);
+ status = pGdipGetRegionDataSize(region, &needed);
ok(status == Ok, "status %08x\n", status);
expect(156, needed);
- status = GdipGetRegionData(region, (BYTE*)buf, sizeof(buf), &needed);
+ status = pGdipGetRegionData(region, (BYTE*)buf, sizeof(buf), &needed);
ok(status == Ok, "status %08x\n", status);
expect(156, needed);
expect_dword(buf, 148);
@@ -262,23 +372,23 @@ static void test_getregiondata(void)
expect_float(buf + 37, 22.0);
expect_float(buf + 38, 55.0);
- status = GdipDeleteRegion(region2);
+ status = pGdipDeleteRegion(region2);
ok(status == Ok, "status %08x\n", status);
- status = GdipDeleteRegion(region);
+ status = pGdipDeleteRegion(region);
ok(status == Ok, "status %08x\n", status);
/* Try some paths */
- status = GdipCreatePath(FillModeAlternate, &path);
+ status = pGdipCreatePath(FillModeAlternate, &path);
ok(status == Ok, "status %08x\n", status);
- GdipAddPathRectangle(path, 12.5, 13.0, 14.0, 15.0);
+ pGdipAddPathRectangle(path, 12.5, 13.0, 14.0, 15.0);
- status = GdipCreateRegionPath(path, ®ion);
+ status = pGdipCreateRegionPath(path, ®ion);
ok(status == Ok, "status %08x\n", status);
- status = GdipGetRegionDataSize(region, &needed);
+ status = pGdipGetRegionDataSize(region, &needed);
ok(status == Ok, "status %08x\n", status);
expect(72, needed);
- status = GdipGetRegionData(region, (BYTE*)buf, sizeof(buf), &needed);
+ status = pGdipGetRegionData(region, (BYTE*)buf, sizeof(buf), &needed);
ok(status == Ok, "status %08x\n", status);
expect(72, needed);
expect_dword(buf, 64);
@@ -305,12 +415,12 @@ static void test_getregiondata(void)
rect.Y = 30;
rect.Width = 10;
rect.Height = 20;
- status = GdipCombineRegionRectI(region, &rect, CombineModeIntersect);
+ status = pGdipCombineRegionRectI(region, &rect, CombineModeIntersect);
ok(status == Ok, "status %08x\n", status);
- status = GdipGetRegionDataSize(region, &needed);
+ status = pGdipGetRegionDataSize(region, &needed);
ok(status == Ok, "status %08x\n", status);
expect(96, needed);
- status = GdipGetRegionData(region, (BYTE*)buf, sizeof(buf), &needed);
+ status = pGdipGetRegionData(region, (BYTE*)buf, sizeof(buf), &needed);
ok(status == Ok, "status %08x\n", status);
expect(96, needed);
expect_dword(buf, 88);
@@ -338,20 +448,20 @@ static void test_getregiondata(void)
expect_float(buf + 22, 10.0);
expect_float(buf + 23, 20.0);
- status = GdipDeleteRegion(region);
+ status = pGdipDeleteRegion(region);
ok(status == Ok, "status %08x\n", status);
- status = GdipDeletePath(path);
+ status = pGdipDeletePath(path);
ok(status == Ok, "status %08x\n", status);
/* Test an empty path */
- status = GdipCreatePath(FillModeAlternate, &path);
+ status = pGdipCreatePath(FillModeAlternate, &path);
expect(Ok, status);
- status = GdipCreateRegionPath(path, ®ion);
+ status = pGdipCreateRegionPath(path, ®ion);
expect(Ok, status);
- status = GdipGetRegionDataSize(region, &needed);
+ status = pGdipGetRegionDataSize(region, &needed);
expect(Ok, status);
expect(36, needed);
- status = GdipGetRegionData(region, (BYTE*)buf, sizeof(buf), &needed);
+ status = pGdipGetRegionData(region, (BYTE*)buf, sizeof(buf), &needed);
expect(Ok, status);
expect(36, needed);
expect_dword(buf, 28);
@@ -366,22 +476,22 @@ static void test_getregiondata(void)
expect_dword(buf + 7, 0);
expect_dword(buf + 8, 0x00004000);
- status = GdipDeleteRegion(region);
+ status = pGdipDeleteRegion(region);
expect(Ok, status);
/* Test a simple triangle of INTs */
- status = GdipAddPathLine(path, 5, 6, 7, 8);
+ status = pGdipAddPathLine(path, 5, 6, 7, 8);
expect(Ok, status);
- status = GdipAddPathLine(path, 8, 1, 5, 6);
+ status = pGdipAddPathLine(path, 8, 1, 5, 6);
expect(Ok, status);
- status = GdipClosePathFigure(path);
+ status = pGdipClosePathFigure(path);
expect(Ok, status);
- status = GdipCreateRegionPath(path, ®ion);
+ status = pGdipCreateRegionPath(path, ®ion);
expect(Ok, status);
- status = GdipGetRegionDataSize(region, &needed);
+ status = pGdipGetRegionDataSize(region, &needed);
expect(Ok, status);
expect(56, needed);
- status = GdipGetRegionData(region, (BYTE*)buf, sizeof(buf), &needed);
+ status = pGdipGetRegionData(region, (BYTE*)buf, sizeof(buf), &needed);
expect(Ok, status);
expect(56, needed);
expect_dword(buf, 48);
@@ -406,24 +516,24 @@ static void test_getregiondata(void)
expect(6, point[3].Y);
expect_dword(buf + 13, 0x81010100); /* 0x01010100 if we don't close the path */
- status = GdipDeletePath(path);
+ status = pGdipDeletePath(path);
expect(Ok, status);
- status = GdipDeleteRegion(region);
+ status = pGdipDeleteRegion(region);
expect(Ok, status);
/* Test a floating-point triangle */
- status = GdipCreatePath(FillModeAlternate, &path);
+ status = pGdipCreatePath(FillModeAlternate, &path);
expect(Ok, status);
- status = GdipAddPathLine(path, 5.6, 6.2, 7.2, 8.9);
+ status = pGdipAddPathLine(path, 5.6, 6.2, 7.2, 8.9);
expect(Ok, status);
- status = GdipAddPathLine(path, 8.1, 1.6, 5.6, 6.2);
+ status = pGdipAddPathLine(path, 8.1, 1.6, 5.6, 6.2);
expect(Ok, status);
- status = GdipCreateRegionPath(path, ®ion);
+ status = pGdipCreateRegionPath(path, ®ion);
expect(Ok, status);
- status = GdipGetRegionDataSize(region, &needed);
+ status = pGdipGetRegionDataSize(region, &needed);
expect(Ok, status);
expect(72, needed);
- status = GdipGetRegionData(region, (BYTE*)buf, sizeof(buf), &needed);
+ status = pGdipGetRegionData(region, (BYTE*)buf, sizeof(buf), &needed);
expect(Ok, status);
expect(72, needed);
expect_dword(buf, 64);
@@ -445,32 +555,32 @@ static void test_getregiondata(void)
expect_float(buf + 15, 5.6);
expect_float(buf + 16, 6.2);
- status = GdipDeletePath(path);
+ status = pGdipDeletePath(path);
expect(Ok, status);
- status = GdipDeleteRegion(region);
+ status = pGdipDeleteRegion(region);
expect(Ok, status);
/* Test for a path with > 4 points, and CombineRegionPath */
- GdipCreatePath(FillModeAlternate, &path);
- status = GdipAddPathLine(path, 50, 70.2, 60, 102.8);
+ pGdipCreatePath(FillModeAlternate, &path);
+ status = pGdipAddPathLine(path, 50, 70.2, 60, 102.8);
expect(Ok, status);
- status = GdipAddPathLine(path, 55.4, 122.4, 40.4, 60.2);
+ status = pGdipAddPathLine(path, 55.4, 122.4, 40.4, 60.2);
expect(Ok, status);
- status = GdipAddPathLine(path, 45.6, 20.2, 50, 70.2);
+ status = pGdipAddPathLine(path, 45.6, 20.2, 50, 70.2);
expect(Ok, status);
rect.X = 20;
rect.Y = 25;
rect.Width = 60;
rect.Height = 120;
- status = GdipCreateRegionRectI(&rect, ®ion);
+ status = pGdipCreateRegionRectI(&rect, ®ion);
expect(Ok, status);
- status = GdipCombineRegionPath(region, path, CombineModeUnion);
+ status = pGdipCombineRegionPath(region, path, CombineModeUnion);
expect(Ok, status);
- status = GdipGetRegionDataSize(region, &needed);
+ status = pGdipGetRegionDataSize(region, &needed);
expect(Ok, status);
expect(116, needed);
- status = GdipGetRegionData(region, (BYTE*)buf, sizeof(buf), &needed);
+ status = pGdipGetRegionData(region, (BYTE*)buf, sizeof(buf), &needed);
expect(Ok, status);
expect(116, needed);
expect_dword(buf, 108);
@@ -505,9 +615,9 @@ static void test_getregiondata(void)
expect_dword(buf + 27, 0x01010100);
expect_dword(buf + 28, 0x00000101);
- status = GdipDeletePath(path);
+ status = pGdipDeletePath(path);
expect(Ok, status);
- status = GdipDeleteRegion(region);
+ status = pGdipDeleteRegion(region);
expect(Ok, status);
}
@@ -520,41 +630,41 @@ static void test_isinfinite(void)
HDC hdc = GetDC(0);
BOOL res;
- status = GdipCreateFromHDC(hdc, &graphics);
+ status = pGdipCreateFromHDC(hdc, &graphics);
expect(Ok, status);
- GdipCreateRegion(®ion);
+ pGdipCreateRegion(®ion);
- GdipCreateMatrix2(3.0, 0.0, 0.0, 1.0, 20.0, 30.0, &m);
+ pGdipCreateMatrix2(3.0, 0.0, 0.0, 1.0, 20.0, 30.0, &m);
/* NULL arguments */
- status = GdipIsInfiniteRegion(NULL, NULL, NULL);
+ status = pGdipIsInfiniteRegion(NULL, NULL, NULL);
expect(InvalidParameter, status);
- status = GdipIsInfiniteRegion(region, NULL, NULL);
+ status = pGdipIsInfiniteRegion(region, NULL, NULL);
expect(InvalidParameter, status);
- status = GdipIsInfiniteRegion(NULL, graphics, NULL);
+ status = pGdipIsInfiniteRegion(NULL, graphics, NULL);
expect(InvalidParameter, status);
- status = GdipIsInfiniteRegion(NULL, NULL, &res);
+ status = pGdipIsInfiniteRegion(NULL, NULL, &res);
expect(InvalidParameter, status);
- status = GdipIsInfiniteRegion(region, NULL, &res);
+ status = pGdipIsInfiniteRegion(region, NULL, &res);
expect(InvalidParameter, status);
res = FALSE;
- status = GdipIsInfiniteRegion(region, graphics, &res);
+ status = pGdipIsInfiniteRegion(region, graphics, &res);
expect(Ok, status);
expect(TRUE, res);
/* after world transform */
- status = GdipSetWorldTransform(graphics, m);
+ status = pGdipSetWorldTransform(graphics, m);
expect(Ok, status);
res = FALSE;
- status = GdipIsInfiniteRegion(region, graphics, &res);
+ status = pGdipIsInfiniteRegion(region, graphics, &res);
expect(Ok, status);
expect(TRUE, res);
- GdipDeleteMatrix(m);
- GdipDeleteRegion(region);
- GdipDeleteGraphics(graphics);
+ pGdipDeleteMatrix(m);
+ pGdipDeleteRegion(region);
+ pGdipDeleteGraphics(graphics);
ReleaseDC(0, hdc);
}
@@ -566,38 +676,38 @@ static void test_isempty(void)
HDC hdc = GetDC(0);
BOOL res;
- status = GdipCreateFromHDC(hdc, &graphics);
+ status = pGdipCreateFromHDC(hdc, &graphics);
expect(Ok, status);
- GdipCreateRegion(®ion);
+ pGdipCreateRegion(®ion);
/* NULL arguments */
- status = GdipIsEmptyRegion(NULL, NULL, NULL);
+ status = pGdipIsEmptyRegion(NULL, NULL, NULL);
expect(InvalidParameter, status);
- status = GdipIsEmptyRegion(region, NULL, NULL);
+ status = pGdipIsEmptyRegion(region, NULL, NULL);
expect(InvalidParameter, status);
- status = GdipIsEmptyRegion(NULL, graphics, NULL);
+ status = pGdipIsEmptyRegion(NULL, graphics, NULL);
expect(InvalidParameter, status);
- status = GdipIsEmptyRegion(NULL, NULL, &res);
+ status = pGdipIsEmptyRegion(NULL, NULL, &res);
expect(InvalidParameter, status);
- status = GdipIsEmptyRegion(region, NULL, &res);
+ status = pGdipIsEmptyRegion(region, NULL, &res);
expect(InvalidParameter, status);
/* default is infinite */
res = TRUE;
- status = GdipIsEmptyRegion(region, graphics, &res);
+ status = pGdipIsEmptyRegion(region, graphics, &res);
expect(Ok, status);
expect(FALSE, res);
- status = GdipSetEmpty(region);
+ status = pGdipSetEmpty(region);
expect(Ok, status);
res = FALSE;
- status = GdipIsEmptyRegion(region, graphics, &res);
+ status = pGdipIsEmptyRegion(region, graphics, &res);
expect(Ok, status);
expect(TRUE, res);
- GdipDeleteRegion(region);
- GdipDeleteGraphics(graphics);
+ pGdipDeleteRegion(region);
+ pGdipDeleteGraphics(graphics);
ReleaseDC(0, hdc);
}
@@ -613,17 +723,17 @@ static void test_combinereplace(void)
rectf.X = rectf.Y = 0.0;
rectf.Width = rectf.Height = 100.0;
- status = GdipCreateRegionRect(&rectf, ®ion);
+ status = pGdipCreateRegionRect(&rectf, ®ion);
expect(Ok, status);
/* replace with the same rectangle */
- status = GdipCombineRegionRect(region, &rectf,CombineModeReplace);
+ status = pGdipCombineRegionRect(region, &rectf,CombineModeReplace);
expect(Ok, status);
- status = GdipGetRegionDataSize(region, &needed);
+ status = pGdipGetRegionDataSize(region, &needed);
expect(Ok, status);
expect(36, needed);
- status = GdipGetRegionData(region, (BYTE*)buf, sizeof(buf), &needed);
+ status = pGdipGetRegionData(region, (BYTE*)buf, sizeof(buf), &needed);
expect(Ok, status);
expect(36, needed);
expect_dword(buf, 28);
@@ -633,17 +743,17 @@ static void test_combinereplace(void)
expect_dword(buf + 4, RGNDATA_RECT);
/* replace with path */
- status = GdipCreatePath(FillModeAlternate, &path);
+ status = pGdipCreatePath(FillModeAlternate, &path);
expect(Ok, status);
- status = GdipAddPathEllipse(path, 0.0, 0.0, 100.0, 250.0);
+ status = pGdipAddPathEllipse(path, 0.0, 0.0, 100.0, 250.0);
expect(Ok, status);
- status = GdipCombineRegionPath(region, path, CombineModeReplace);
+ status = pGdipCombineRegionPath(region, path, CombineModeReplace);
expect(Ok, status);
- status = GdipGetRegionDataSize(region, &needed);
+ status = pGdipGetRegionDataSize(region, &needed);
expect(Ok, status);
expect(156, needed);
- status = GdipGetRegionData(region, (BYTE*)buf, sizeof(buf), &needed);
+ status = pGdipGetRegionData(region, (BYTE*)buf, sizeof(buf), &needed);
expect(Ok, status);
expect(156, needed);
expect_dword(buf, 148);
@@ -651,18 +761,18 @@ static void test_combinereplace(void)
expect_magic((DWORD*)(buf + 2));
expect_dword(buf + 3, 0);
expect_dword(buf + 4, RGNDATA_PATH);
- GdipDeletePath(path);
+ pGdipDeletePath(path);
/* replace with infinite rect */
- status = GdipCreateRegion(®ion2);
+ status = pGdipCreateRegion(®ion2);
expect(Ok, status);
- status = GdipCombineRegionRegion(region, region2, CombineModeReplace);
+ status = pGdipCombineRegionRegion(region, region2, CombineModeReplace);
expect(Ok, status);
- status = GdipGetRegionDataSize(region, &needed);
+ status = pGdipGetRegionDataSize(region, &needed);
expect(Ok, status);
expect(20, needed);
- status = GdipGetRegionData(region, (BYTE*)buf, sizeof(buf), &needed);
+ status = pGdipGetRegionData(region, (BYTE*)buf, sizeof(buf), &needed);
expect(Ok, status);
expect(20, needed);
expect_dword(buf, 12);
@@ -670,26 +780,26 @@ static void test_combinereplace(void)
expect_magic((DWORD*)(buf + 2));
expect_dword(buf + 3, 0);
expect_dword(buf + 4, RGNDATA_INFINITE_RECT);
- GdipDeleteRegion(region2);
+ pGdipDeleteRegion(region2);
/* more complex case : replace with a combined region */
- status = GdipCreateRegionRect(&rectf, ®ion2);
+ status = pGdipCreateRegionRect(&rectf, ®ion2);
expect(Ok, status);
- status = GdipCreatePath(FillModeAlternate, &path);
+ status = pGdipCreatePath(FillModeAlternate, &path);
expect(Ok, status);
- status = GdipAddPathEllipse(path, 0.0, 0.0, 100.0, 250.0);
+ status = pGdipAddPathEllipse(path, 0.0, 0.0, 100.0, 250.0);
expect(Ok, status);
- status = GdipCombineRegionPath(region2, path, CombineModeUnion);
+ status = pGdipCombineRegionPath(region2, path, CombineModeUnion);
expect(Ok, status);
- GdipDeletePath(path);
- status = GdipCombineRegionRegion(region, region2, CombineModeReplace);
+ pGdipDeletePath(path);
+ status = pGdipCombineRegionRegion(region, region2, CombineModeReplace);
expect(Ok, status);
- GdipDeleteRegion(region2);
+ pGdipDeleteRegion(region2);
- status = GdipGetRegionDataSize(region, &needed);
+ status = pGdipGetRegionDataSize(region, &needed);
expect(Ok, status);
expect(180, needed);
- status = GdipGetRegionData(region, (BYTE*)buf, sizeof(buf), &needed);
+ status = pGdipGetRegionData(region, (BYTE*)buf, sizeof(buf), &needed);
expect(Ok, status);
expect(180, needed);
expect_dword(buf, 172);
@@ -698,7 +808,7 @@ static void test_combinereplace(void)
expect_dword(buf + 3, 2);
expect_dword(buf + 4, CombineModeUnion);
- GdipDeleteRegion(region);
+ pGdipDeleteRegion(region);
}
static void test_fromhrgn(void)
@@ -714,43 +824,43 @@ static void test_fromhrgn(void)
BOOL res;
/* NULL */
- status = GdipCreateRegionHrgn(NULL, NULL);
+ status = pGdipCreateRegionHrgn(NULL, NULL);
expect(InvalidParameter, status);
- status = GdipCreateRegionHrgn(NULL, ®ion);
+ status = pGdipCreateRegionHrgn(NULL, ®ion);
expect(InvalidParameter, status);
- status = GdipCreateRegionHrgn((HRGN)0xdeadbeef, ®ion);
+ status = pGdipCreateRegionHrgn((HRGN)0xdeadbeef, ®ion);
expect(InvalidParameter, status);
/* empty rectangle */
hrgn = CreateRectRgn(0, 0, 0, 0);
- status = GdipCreateRegionHrgn(hrgn, ®ion);
+ status = pGdipCreateRegionHrgn(hrgn, ®ion);
expect(Ok, status);
if(status == Ok) {
hdc = GetDC(0);
- status = GdipCreateFromHDC(hdc, &graphics);
+ status = pGdipCreateFromHDC(hdc, &graphics);
expect(Ok, status);
res = FALSE;
- status = GdipIsEmptyRegion(region, graphics, &res);
+ status = pGdipIsEmptyRegion(region, graphics, &res);
expect(Ok, status);
expect(TRUE, res);
- GdipDeleteGraphics(graphics);
+ pGdipDeleteGraphics(graphics);
ReleaseDC(0, hdc);
- GdipDeleteRegion(region);
+ pGdipDeleteRegion(region);
}
DeleteObject(hrgn);
/* rectangle */
hrgn = CreateRectRgn(0, 0, 100, 10);
- status = GdipCreateRegionHrgn(hrgn, ®ion);
+ status = pGdipCreateRegionHrgn(hrgn, ®ion);
expect(Ok, status);
- status = GdipGetRegionDataSize(region, &needed);
+ status = pGdipGetRegionDataSize(region, &needed);
expect(Ok, status);
expect(56, needed);
- status = GdipGetRegionData(region, (BYTE*)buf, sizeof(buf), &needed);
+ status = pGdipGetRegionData(region, (BYTE*)buf, sizeof(buf), &needed);
expect(Ok, status);
if(status == Ok){
@@ -782,20 +892,20 @@ static void test_fromhrgn(void)
}
- GdipDeleteRegion(region);
+ pGdipDeleteRegion(region);
DeleteObject(hrgn);
/* ellipse */
hrgn = CreateEllipticRgn(0, 0, 100, 10);
- status = GdipCreateRegionHrgn(hrgn, ®ion);
+ status = pGdipCreateRegionHrgn(hrgn, ®ion);
todo_wine expect(Ok, status);
- status = GdipGetRegionDataSize(region, &needed);
+ status = pGdipGetRegionDataSize(region, &needed);
todo_wine{
expect(Ok, status);
expect(216, needed);
}
- status = GdipGetRegionData(region, (BYTE*)buf, sizeof(buf), &needed);
+ status = pGdipGetRegionData(region, (BYTE*)buf, sizeof(buf), &needed);
todo_wine expect(Ok, status);
if(status == Ok)
@@ -814,7 +924,7 @@ todo_wine{
}
}
- GdipDeleteRegion(region);
+ pGdipDeleteRegion(region);
DeleteObject(hrgn);
}
@@ -835,118 +945,118 @@ static void test_gethrgn(void)
static const RECT test_rect3 = {10, 11, 20, 31};
static const GpRectF test_rect3F = {10.0, 11.0, 10.0, 20.0};
- status = GdipCreateFromHDC(hdc, &graphics);
+ status = pGdipCreateFromHDC(hdc, &graphics);
ok(status == Ok, "status %08x\n", status);
- status = GdipCreateRegion(®ion);
+ status = pGdipCreateRegion(®ion);
ok(status == Ok, "status %08x\n", status);
- status = GdipGetRegionHRgn(NULL, graphics, &hrgn);
+ status = pGdipGetRegionHRgn(NULL, graphics, &hrgn);
ok(status == InvalidParameter, "status %08x\n", status);
- status = GdipGetRegionHRgn(region, graphics, NULL);
+ status = pGdipGetRegionHRgn(region, graphics, NULL);
ok(status == InvalidParameter, "status %08x\n", status);
- status = GdipGetRegionHRgn(region, NULL, &hrgn);
+ status = pGdipGetRegionHRgn(region, NULL, &hrgn);
ok(status == Ok, "status %08x\n", status);
ok(hrgn == NULL, "hrgn=%p\n", hrgn);
DeleteObject(hrgn);
- status = GdipGetRegionHRgn(region, graphics, &hrgn);
+ status = pGdipGetRegionHRgn(region, graphics, &hrgn);
ok(status == Ok, "status %08x\n", status);
ok(hrgn == NULL, "hrgn=%p\n", hrgn);
DeleteObject(hrgn);
- status = GdipSetEmpty(region);
+ status = pGdipSetEmpty(region);
ok(status == Ok, "status %08x\n", status);
- status = GdipGetRegionHRgn(region, NULL, &hrgn);
+ status = pGdipGetRegionHRgn(region, NULL, &hrgn);
ok(status == Ok, "status %08x\n", status);
verify_region(hrgn, &empty_rect);
DeleteObject(hrgn);
- status = GdipCreatePath(FillModeAlternate, &path);
+ status = pGdipCreatePath(FillModeAlternate, &path);
ok(status == Ok, "status %08x\n", status);
- status = GdipAddPathRectangle(path, 10.0, 11.0, 10.0, 10.0);
+ status = pGdipAddPathRectangle(path, 10.0, 11.0, 10.0, 10.0);
ok(status == Ok, "status %08x\n", status);
- status = GdipCreateRegionPath(path, ®ion2);
+ status = pGdipCreateRegionPath(path, ®ion2);
ok(status == Ok, "status %08x\n", status);
- status = GdipGetRegionHRgn(region2, NULL, &hrgn);
+ status = pGdipGetRegionHRgn(region2, NULL, &hrgn);
ok(status == Ok, "status %08x\n", status);
verify_region(hrgn, &test_rect);
DeleteObject(hrgn);
/* resulting HRGN is in device coordinates */
- status = GdipScaleWorldTransform(graphics, 2.0, 2.0, MatrixOrderPrepend);
+ status = pGdipScaleWorldTransform(graphics, 2.0, 2.0, MatrixOrderPrepend);
ok(status == Ok, "status %08x\n", status);
- status = GdipGetRegionHRgn(region2, graphics, &hrgn);
+ status = pGdipGetRegionHRgn(region2, graphics, &hrgn);
ok(status == Ok, "status %08x\n", status);
verify_region(hrgn, &scaled_rect);
DeleteObject(hrgn);
- status = GdipCombineRegionRect(region2, &test_rectF, CombineModeReplace);
+ status = pGdipCombineRegionRect(region2, &test_rectF, CombineModeReplace);
ok(status == Ok, "status %08x\n", status);
- status = GdipGetRegionHRgn(region2, NULL, &hrgn);
+ status = pGdipGetRegionHRgn(region2, NULL, &hrgn);
ok(status == Ok, "status %08x\n", status);
verify_region(hrgn, &test_rect);
DeleteObject(hrgn);
- status = GdipGetRegionHRgn(region2, graphics, &hrgn);
+ status = pGdipGetRegionHRgn(region2, graphics, &hrgn);
ok(status == Ok, "status %08x\n", status);
verify_region(hrgn, &scaled_rect);
DeleteObject(hrgn);
- status = GdipSetInfinite(region);
+ status = pGdipSetInfinite(region);
ok(status == Ok, "status %08x\n", status);
- status = GdipCombineRegionRect(region, &test_rectF, CombineModeIntersect);
+ status = pGdipCombineRegionRect(region, &test_rectF, CombineModeIntersect);
ok(status == Ok, "status %08x\n", status);
- status = GdipGetRegionHRgn(region, NULL, &hrgn);
+ status = pGdipGetRegionHRgn(region, NULL, &hrgn);
ok(status == Ok, "status %08x\n", status);
verify_region(hrgn, &test_rect);
DeleteObject(hrgn);
- status = GdipCombineRegionRect(region, &test_rectF, CombineModeReplace);
+ status = pGdipCombineRegionRect(region, &test_rectF, CombineModeReplace);
ok(status == Ok, "status %08x\n", status);
- status = GdipCombineRegionRect(region, &test_rect2F, CombineModeUnion);
+ status = pGdipCombineRegionRect(region, &test_rect2F, CombineModeUnion);
ok(status == Ok, "status %08x\n", status);
- status = GdipGetRegionHRgn(region, NULL, &hrgn);
+ status = pGdipGetRegionHRgn(region, NULL, &hrgn);
ok(status == Ok, "status %08x\n", status);
verify_region(hrgn, &test_rect3);
DeleteObject(hrgn);
- status = GdipCombineRegionRect(region, &test_rect3F, CombineModeReplace);
+ status = pGdipCombineRegionRect(region, &test_rect3F, CombineModeReplace);
ok(status == Ok, "status %08x\n", status);
- status = GdipCombineRegionRect(region, &test_rect2F, CombineModeXor);
+ status = pGdipCombineRegionRect(region, &test_rect2F, CombineModeXor);
ok(status == Ok, "status %08x\n", status);
- status = GdipGetRegionHRgn(region, NULL, &hrgn);
+ status = pGdipGetRegionHRgn(region, NULL, &hrgn);
ok(status == Ok, "status %08x\n", status);
verify_region(hrgn, &test_rect);
DeleteObject(hrgn);
- status = GdipCombineRegionRect(region, &test_rect3F, CombineModeReplace);
+ status = pGdipCombineRegionRect(region, &test_rect3F, CombineModeReplace);
ok(status == Ok, "status %08x\n", status);
- status = GdipCombineRegionRect(region, &test_rectF, CombineModeExclude);
+ status = pGdipCombineRegionRect(region, &test_rectF, CombineModeExclude);
ok(status == Ok, "status %08x\n", status);
- status = GdipGetRegionHRgn(region, NULL, &hrgn);
+ status = pGdipGetRegionHRgn(region, NULL, &hrgn);
ok(status == Ok, "status %08x\n", status);
verify_region(hrgn, &test_rect2);
DeleteObject(hrgn);
- status = GdipCombineRegionRect(region, &test_rectF, CombineModeReplace);
+ status = pGdipCombineRegionRect(region, &test_rectF, CombineModeReplace);
ok(status == Ok, "status %08x\n", status);
- status = GdipCombineRegionRect(region, &test_rect3F, CombineModeComplement);
+ status = pGdipCombineRegionRect(region, &test_rect3F, CombineModeComplement);
ok(status == Ok, "status %08x\n", status);
- status = GdipGetRegionHRgn(region, NULL, &hrgn);
+ status = pGdipGetRegionHRgn(region, NULL, &hrgn);
ok(status == Ok, "status %08x\n", status);
verify_region(hrgn, &test_rect2);
DeleteObject(hrgn);
- status = GdipDeletePath(path);
+ status = pGdipDeletePath(path);
ok(status == Ok, "status %08x\n", status);
- status = GdipDeleteRegion(region);
+ status = pGdipDeleteRegion(region);
ok(status == Ok, "status %08x\n", status);
- status = GdipDeleteRegion(region2);
+ status = pGdipDeleteRegion(region2);
ok(status == Ok, "status %08x\n", status);
- status = GdipDeleteGraphics(graphics);
+ status = pGdipDeleteGraphics(graphics);
ok(status == Ok, "status %08x\n", status);
ReleaseDC(0, hdc);
}
@@ -960,85 +1070,85 @@ static void test_isequal(void)
HDC hdc = GetDC(0);
BOOL res;
- status = GdipCreateFromHDC(hdc, &graphics);
+ status = pGdipCreateFromHDC(hdc, &graphics);
ok(status == Ok, "status %08x\n", status);
- status = GdipCreateRegion(®ion1);
+ status = pGdipCreateRegion(®ion1);
ok(status == Ok, "status %08x\n", status);
- status = GdipCreateRegion(®ion2);
+ status = pGdipCreateRegion(®ion2);
ok(status == Ok, "status %08x\n", status);
/* NULL */
- status = GdipIsEqualRegion(NULL, NULL, NULL, NULL);
+ status = pGdipIsEqualRegion(NULL, NULL, NULL, NULL);
ok(status == InvalidParameter, "status %08x\n", status);
- status = GdipIsEqualRegion(region1, region2, NULL, NULL);
+ status = pGdipIsEqualRegion(region1, region2, NULL, NULL);
ok(status == InvalidParameter, "status %08x\n", status);
- status = GdipIsEqualRegion(region1, region2, graphics, NULL);
+ status = pGdipIsEqualRegion(region1, region2, graphics, NULL);
ok(status == InvalidParameter, "status %08x\n", status);
- status = GdipIsEqualRegion(region1, region2, NULL, &res);
+ status = pGdipIsEqualRegion(region1, region2, NULL, &res);
ok(status == InvalidParameter, "status %08x\n", status);
/* infinite regions */
res = FALSE;
- status = GdipIsEqualRegion(region1, region2, graphics, &res);
+ status = pGdipIsEqualRegion(region1, region2, graphics, &res);
ok(status == Ok, "status %08x\n", status);
ok(res, "Expected to be equal.\n");
/* empty regions */
- status = GdipSetEmpty(region1);
+ status = pGdipSetEmpty(region1);
ok(status == Ok, "status %08x\n", status);
- status = GdipSetEmpty(region2);
+ status = pGdipSetEmpty(region2);
ok(status == Ok, "status %08x\n", status);
res = FALSE;
- status = GdipIsEqualRegion(region1, region2, graphics, &res);
+ status = pGdipIsEqualRegion(region1, region2, graphics, &res);
ok(status == Ok, "status %08x\n", status);
ok(res, "Expected to be equal.\n");
/* empty & infinite */
- status = GdipSetInfinite(region1);
+ status = pGdipSetInfinite(region1);
ok(status == Ok, "status %08x\n", status);
res = TRUE;
- status = GdipIsEqualRegion(region1, region2, graphics, &res);
+ status = pGdipIsEqualRegion(region1, region2, graphics, &res);
ok(status == Ok, "status %08x\n", status);
ok(!res, "Expected to be unequal.\n");
/* rect & (inf/empty) */
rectf.X = rectf.Y = 0.0;
rectf.Width = rectf.Height = 100.0;
- status = GdipCombineRegionRect(region1, &rectf, CombineModeReplace);
+ status = pGdipCombineRegionRect(region1, &rectf, CombineModeReplace);
ok(status == Ok, "status %08x\n", status);
res = TRUE;
- status = GdipIsEqualRegion(region1, region2, graphics, &res);
+ status = pGdipIsEqualRegion(region1, region2, graphics, &res);
ok(status == Ok, "status %08x\n", status);
ok(!res, "Expected to be unequal.\n");
- status = GdipSetInfinite(region2);
+ status = pGdipSetInfinite(region2);
ok(status == Ok, "status %08x\n", status);
res = TRUE;
- status = GdipIsEqualRegion(region1, region2, graphics, &res);
+ status = pGdipIsEqualRegion(region1, region2, graphics, &res);
ok(status == Ok, "status %08x\n", status);
ok(!res, "Expected to be unequal.\n");
/* roughly equal rectangles */
rectf.X = rectf.Y = 0.0;
rectf.Width = rectf.Height = 100.001;
- status = GdipCombineRegionRect(region2, &rectf, CombineModeReplace);
+ status = pGdipCombineRegionRect(region2, &rectf, CombineModeReplace);
ok(status == Ok, "status %08x\n", status);
res = FALSE;
- status = GdipIsEqualRegion(region1, region2, graphics, &res);
+ status = pGdipIsEqualRegion(region1, region2, graphics, &res);
ok(status == Ok, "status %08x\n", status);
ok(res, "Expected to be equal.\n");
/* equal rectangles */
rectf.X = rectf.Y = 0.0;
rectf.Width = rectf.Height = 100.0;
- status = GdipCombineRegionRect(region2, &rectf, CombineModeReplace);
+ status = pGdipCombineRegionRect(region2, &rectf, CombineModeReplace);
ok(status == Ok, "status %08x\n", status);
res = FALSE;
- status = GdipIsEqualRegion(region1, region2, graphics, &res);
+ status = pGdipIsEqualRegion(region1, region2, graphics, &res);
ok(status == Ok, "status %08x\n", status);
ok(res, "Expected to be equal.\n");
/* cleanup */
- status = GdipDeleteRegion(region1);
+ status = pGdipDeleteRegion(region1);
ok(status == Ok, "status %08x\n", status);
- status = GdipDeleteRegion(region2);
+ status = pGdipDeleteRegion(region2);
ok(status == Ok, "status %08x\n", status);
- status = GdipDeleteGraphics(graphics);
+ status = pGdipDeleteGraphics(graphics);
ok(status == Ok, "status %08x\n", status);
ReleaseDC(0, hdc);
}
@@ -1053,69 +1163,69 @@ static void test_translate(void)
HDC hdc = GetDC(0);
BOOL res;
- status = GdipCreateFromHDC(hdc, &graphics);
+ status = pGdipCreateFromHDC(hdc, &graphics);
ok(status == Ok, "status %08x\n", status);
- status = GdipCreatePath(FillModeAlternate, &path);
+ status = pGdipCreatePath(FillModeAlternate, &path);
ok(status == Ok, "status %08x\n", status);
- status = GdipCreateRegion(®ion);
+ status = pGdipCreateRegion(®ion);
ok(status == Ok, "status %08x\n", status);
- status = GdipCreateRegion(®ion2);
+ status = pGdipCreateRegion(®ion2);
ok(status == Ok, "status %08x\n", status);
/* NULL */
- status = GdipTranslateRegion(NULL, 0.0, 0.0);
+ status = pGdipTranslateRegion(NULL, 0.0, 0.0);
ok(status == InvalidParameter, "status %08x\n", status);
/* infinite */
- status = GdipTranslateRegion(region, 10.0, 10.0);
+ status = pGdipTranslateRegion(region, 10.0, 10.0);
ok(status == Ok, "status %08x\n", status);
/* empty */
- status = GdipSetEmpty(region);
+ status = pGdipSetEmpty(region);
ok(status == Ok, "status %08x\n", status);
- status = GdipTranslateRegion(region, 10.0, 10.0);
+ status = pGdipTranslateRegion(region, 10.0, 10.0);
ok(status == Ok, "status %08x\n", status);
/* rect */
rectf.X = 10.0; rectf.Y = 0.0;
rectf.Width = rectf.Height = 100.0;
- status = GdipCombineRegionRect(region, &rectf, CombineModeReplace);
+ status = pGdipCombineRegionRect(region, &rectf, CombineModeReplace);
ok(status == Ok, "status %08x\n", status);
rectf.X = 15.0; rectf.Y = -2.0;
rectf.Width = rectf.Height = 100.0;
- status = GdipCombineRegionRect(region2, &rectf, CombineModeReplace);
+ status = pGdipCombineRegionRect(region2, &rectf, CombineModeReplace);
ok(status == Ok, "status %08x\n", status);
- status = GdipTranslateRegion(region, 5.0, -2.0);
+ status = pGdipTranslateRegion(region, 5.0, -2.0);
ok(status == Ok, "status %08x\n", status);
res = FALSE;
- status = GdipIsEqualRegion(region, region2, graphics, &res);
+ status = pGdipIsEqualRegion(region, region2, graphics, &res);
ok(status == Ok, "status %08x\n", status);
ok(res, "Expected to be equal.\n");
/* path */
- status = GdipAddPathEllipse(path, 0.0, 10.0, 100.0, 150.0);
+ status = pGdipAddPathEllipse(path, 0.0, 10.0, 100.0, 150.0);
ok(status == Ok, "status %08x\n", status);
- status = GdipCombineRegionPath(region, path, CombineModeReplace);
+ status = pGdipCombineRegionPath(region, path, CombineModeReplace);
ok(status == Ok, "status %08x\n", status);
- status = GdipResetPath(path);
+ status = pGdipResetPath(path);
ok(status == Ok, "status %08x\n", status);
- status = GdipAddPathEllipse(path, 10.0, 21.0, 100.0, 150.0);
+ status = pGdipAddPathEllipse(path, 10.0, 21.0, 100.0, 150.0);
ok(status == Ok, "status %08x\n", status);
- status = GdipCombineRegionPath(region2, path, CombineModeReplace);
+ status = pGdipCombineRegionPath(region2, path, CombineModeReplace);
ok(status == Ok, "status %08x\n", status);
- status = GdipTranslateRegion(region, 10.0, 11.0);
+ status = pGdipTranslateRegion(region, 10.0, 11.0);
ok(status == Ok, "status %08x\n", status);
res = FALSE;
- status = GdipIsEqualRegion(region, region2, graphics, &res);
+ status = pGdipIsEqualRegion(region, region2, graphics, &res);
ok(status == Ok, "status %08x\n", status);
ok(res, "Expected to be equal.\n");
- status = GdipDeleteRegion(region);
+ status = pGdipDeleteRegion(region);
ok(status == Ok, "status %08x\n", status);
- status = GdipDeleteRegion(region2);
+ status = pGdipDeleteRegion(region2);
ok(status == Ok, "status %08x\n", status);
- status = GdipDeleteGraphics(graphics);
+ status = pGdipDeleteGraphics(graphics);
ok(status == Ok, "status %08x\n", status);
- status = GdipDeletePath(path);
+ status = pGdipDeletePath(path);
ok(status == Ok, "status %08x\n", status);
ReleaseDC(0, hdc);
}
@@ -1128,22 +1238,22 @@ static void test_getbounds(void)
GpRectF rectf;
HDC hdc = GetDC(0);
- status = GdipCreateFromHDC(hdc, &graphics);
+ status = pGdipCreateFromHDC(hdc, &graphics);
ok(status == Ok, "status %08x\n", status);
- status = GdipCreateRegion(®ion);
+ status = pGdipCreateRegion(®ion);
ok(status == Ok, "status %08x\n", status);
/* NULL */
- status = GdipGetRegionBounds(NULL, NULL, NULL);
+ status = pGdipGetRegionBounds(NULL, NULL, NULL);
ok(status == InvalidParameter, "status %08x\n", status);
- status = GdipGetRegionBounds(region, NULL, NULL);
+ status = pGdipGetRegionBounds(region, NULL, NULL);
ok(status == InvalidParameter, "status %08x\n", status);
- status = GdipGetRegionBounds(region, graphics, NULL);
+ status = pGdipGetRegionBounds(region, graphics, NULL);
ok(status == InvalidParameter, "status %08x\n", status);
/* infinite */
rectf.X = rectf.Y = 0.0;
rectf.Height = rectf.Width = 100.0;
- status = GdipGetRegionBounds(region, graphics, &rectf);
+ status = pGdipGetRegionBounds(region, graphics, &rectf);
ok(status == Ok, "status %08x\n", status);
ok(rectf.X == -(REAL)(1 << 22), "Expected X = %.2f, got %.2f\n", -(REAL)(1 << 22), rectf.X);
ok(rectf.Y == -(REAL)(1 << 22), "Expected Y = %.2f, got %.2f\n", -(REAL)(1 << 22), rectf.Y);
@@ -1152,9 +1262,9 @@ static void test_getbounds(void)
/* empty */
rectf.X = rectf.Y = 0.0;
rectf.Height = rectf.Width = 100.0;
- status = GdipSetEmpty(region);
+ status = pGdipSetEmpty(region);
ok(status == Ok, "status %08x\n", status);
- status = GdipGetRegionBounds(region, graphics, &rectf);
+ status = pGdipGetRegionBounds(region, graphics, &rectf);
ok(status == Ok, "status %08x\n", status);
ok(rectf.X == 0.0, "Expected X = 0.0, got %.2f\n", rectf.X);
ok(rectf.Y == 0.0, "Expected Y = 0.0, got %.2f\n", rectf.Y);
@@ -1163,20 +1273,20 @@ static void test_getbounds(void)
/* rect */
rectf.X = 10.0; rectf.Y = 0.0;
rectf.Width = rectf.Height = 100.0;
- status = GdipCombineRegionRect(region, &rectf, CombineModeReplace);
+ status = pGdipCombineRegionRect(region, &rectf, CombineModeReplace);
ok(status == Ok, "status %08x\n", status);
rectf.X = rectf.Y = 0.0;
rectf.Height = rectf.Width = 0.0;
- status = GdipGetRegionBounds(region, graphics, &rectf);
+ status = pGdipGetRegionBounds(region, graphics, &rectf);
ok(status == Ok, "status %08x\n", status);
ok(rectf.X == 10.0, "Expected X = 0.0, got %.2f\n", rectf.X);
ok(rectf.Y == 0.0, "Expected Y = 0.0, got %.2f\n", rectf.Y);
ok(rectf.Width == 100.0, "Expected width = 0.0, got %.2f\n", rectf.Width);
ok(rectf.Height == 100.0, "Expected height = 0.0, got %.2f\n", rectf.Height);
- status = GdipDeleteRegion(region);
+ status = pGdipDeleteRegion(region);
ok(status == Ok, "status %08x\n", status);
- status = GdipDeleteGraphics(graphics);
+ status = pGdipDeleteGraphics(graphics);
ok(status == Ok, "status %08x\n", status);
ReleaseDC(0, hdc);
}
@@ -1186,12 +1296,15 @@ START_TEST(region)
struct GdiplusStartupInput gdiplusStartupInput;
ULONG_PTR gdiplusToken;
+ if (!InitFunctionPtrs())
+ return;
+
gdiplusStartupInput.GdiplusVersion = 1;
gdiplusStartupInput.DebugEventCallback = NULL;
gdiplusStartupInput.SuppressBackgroundThread = 0;
gdiplusStartupInput.SuppressExternalCodecs = 0;
- GdiplusStartup(&gdiplusToken, &gdiplusStartupInput, NULL);
+ pGdiplusStartup(&gdiplusToken, &gdiplusStartupInput, NULL);
test_getregiondata();
test_isinfinite();
@@ -1203,5 +1316,7 @@ START_TEST(region)
test_translate();
test_getbounds();
- GdiplusShutdown(gdiplusToken);
+ pGdiplusShutdown(gdiplusToken);
+
+ FreeLibrary(hGdiPlus);
}
diff --git a/dlls/gdiplus/tests/stringformat.c b/dlls/gdiplus/tests/stringformat.c
index b28dbc6..e355d42 100644
--- a/dlls/gdiplus/tests/stringformat.c
+++ b/dlls/gdiplus/tests/stringformat.c
@@ -25,6 +25,87 @@
#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 GpStatus (WINGDIPAPI * pGdipCreateStringFormat)(INT,LANGID,
+ GpStringFormat**);
+static GpStatus (WINGDIPAPI * pGdipDeleteStringFormat)(GpStringFormat*);
+static GpStatus (WINGDIPAPI * pGdipGetStringFormatAlign)(GpStringFormat*,
+ StringAlignment*);
+static GpStatus (WINGDIPAPI * pGdipGetStringFormatDigitSubstitution)(
+ GDIPCONST GpStringFormat*,LANGID*,StringDigitSubstitute*);
+static GpStatus (WINGDIPAPI * pGdipGetStringFormatFlags)(
+ GDIPCONST GpStringFormat*,INT*);
+static GpStatus (WINGDIPAPI * pGdipGetStringFormatHotkeyPrefix)(
+ GDIPCONST GpStringFormat*,INT*);
+static GpStatus (WINGDIPAPI * pGdipGetStringFormatLineAlign)(GpStringFormat*,
+ StringAlignment*);
+static GpStatus (WINGDIPAPI * pGdipGetStringFormatMeasurableCharacterRangeCount)(
+ GDIPCONST GpStringFormat*,INT*);
+static GpStatus (WINGDIPAPI * pGdipGetStringFormatTabStopCount)(
+ GDIPCONST GpStringFormat*,INT*);
+static GpStatus (WINGDIPAPI * pGdipGetStringFormatTabStops)(
+ GDIPCONST GpStringFormat*,INT,REAL*,REAL*);
+static GpStatus (WINGDIPAPI * pGdipGetStringFormatTrimming)(GpStringFormat*,
+ StringTrimming*);
+static GpStatus (WINGDIPAPI * pGdipSetStringFormatDigitSubstitution)(
+ GpStringFormat*,LANGID,StringDigitSubstitute);
+static GpStatus (WINGDIPAPI * pGdipSetStringFormatMeasurableCharacterRanges)(
+ GpStringFormat*,INT,GDIPCONST CharacterRange*);
+static GpStatus (WINGDIPAPI * pGdipSetStringFormatTabStops)(GpStringFormat*,
+ REAL,INT,GDIPCONST REAL*);
+static GpStatus (WINGDIPAPI * pGdipSetStringFormatFlags)(GpStringFormat*,INT);
+static GpStatus (WINGDIPAPI * pGdipStringFormatGetGenericDefault)(
+ GpStringFormat**);
+static GpStatus (WINGDIPAPI * pGdipStringFormatGetGenericTypographic)(
+ GpStringFormat**);
+static Status (WINAPI * pGdiplusStartup)(ULONG_PTR*,
+ const struct GdiplusStartupInput*,struct GdiplusStartupOutput*);
+static void (WINAPI * pGdiplusShutdown)(ULONG_PTR);
+
+static HMODULE hGdiPlus = 0;
+
+static BOOL InitFunctionPtrs(void)
+{
+ hGdiPlus = LoadLibraryA("gdiplus.dll");
+ if (!hGdiPlus)
+ {
+ trace("Could not load gdiplus.dll\n");
+ return FALSE;
+ }
+
+#define GDIPLUS_GET_PROC(func) \
+ p ## func = (void*)GetProcAddress(hGdiPlus, #func); \
+ if (!p ## func) \
+ { \
+ trace("GetProcAddress(%s) failed\n", #func); \
+ FreeLibrary(hGdiPlus); \
+ return FALSE; \
+ }
+
+ GDIPLUS_GET_PROC(GdipCreateStringFormat)
+ GDIPLUS_GET_PROC(GdipDeleteStringFormat)
+ GDIPLUS_GET_PROC(GdipGetStringFormatAlign)
+ GDIPLUS_GET_PROC(GdipGetStringFormatDigitSubstitution)
+ GDIPLUS_GET_PROC(GdipGetStringFormatFlags)
+ GDIPLUS_GET_PROC(GdipGetStringFormatHotkeyPrefix)
+ GDIPLUS_GET_PROC(GdipGetStringFormatLineAlign)
+ GDIPLUS_GET_PROC(GdipGetStringFormatMeasurableCharacterRangeCount)
+ GDIPLUS_GET_PROC(GdipGetStringFormatTabStopCount)
+ GDIPLUS_GET_PROC(GdipGetStringFormatTabStops)
+ GDIPLUS_GET_PROC(GdipGetStringFormatTrimming)
+ GDIPLUS_GET_PROC(GdiplusShutdown)
+ GDIPLUS_GET_PROC(GdiplusStartup)
+ GDIPLUS_GET_PROC(GdipSetStringFormatDigitSubstitution)
+ GDIPLUS_GET_PROC(GdipSetStringFormatFlags)
+ GDIPLUS_GET_PROC(GdipSetStringFormatMeasurableCharacterRanges)
+ GDIPLUS_GET_PROC(GdipSetStringFormatTabStops)
+ GDIPLUS_GET_PROC(GdipStringFormatGetGenericDefault)
+ GDIPLUS_GET_PROC(GdipStringFormatGetGenericTypographic)
+
+#undef GDIPLUS_GET_PROC
+
+ return TRUE;
+}
+
static void test_constructor(void)
{
GpStringFormat *format;
@@ -35,14 +116,14 @@ static void test_constructor(void)
StringDigitSubstitute digitsub;
LANGID digitlang;
- stat = GdipCreateStringFormat(0, LANG_NEUTRAL, &format);
+ stat = pGdipCreateStringFormat(0, LANG_NEUTRAL, &format);
expect(Ok, stat);
- GdipGetStringFormatAlign(format, &align);
- GdipGetStringFormatLineAlign(format, &valign);
- GdipGetStringFormatHotkeyPrefix(format, &n);
- GdipGetStringFormatTrimming(format, &trimming);
- GdipGetStringFormatDigitSubstitution(format, &digitlang, &digitsub);
+ pGdipGetStringFormatAlign(format, &align);
+ pGdipGetStringFormatLineAlign(format, &valign);
+ pGdipGetStringFormatHotkeyPrefix(format, &n);
+ pGdipGetStringFormatTrimming(format, &trimming);
+ pGdipGetStringFormatDigitSubstitution(format, &digitlang, &digitsub);
expect(HotkeyPrefixNone, n);
expect(StringAlignmentNear, align);
@@ -51,7 +132,7 @@ static void test_constructor(void)
expect(StringDigitSubstituteUser, digitsub);
expect(LANG_NEUTRAL, digitlang);
- stat = GdipDeleteStringFormat(format);
+ stat = pGdipDeleteStringFormat(format);
expect(Ok, stat);
}
@@ -62,17 +143,17 @@ static void test_characterrange(void)
GpStringFormat* format;
GpStatus stat;
- stat = GdipCreateStringFormat(0, LANG_NEUTRAL, &format);
+ stat = pGdipCreateStringFormat(0, LANG_NEUTRAL, &format);
expect(Ok, stat);
todo_wine
{
- stat = GdipSetStringFormatMeasurableCharacterRanges(format, 3, ranges);
+ stat = pGdipSetStringFormatMeasurableCharacterRanges(format, 3, ranges);
expect(Ok, stat);
- stat = GdipGetStringFormatMeasurableCharacterRangeCount(format, &count);
+ stat = pGdipGetStringFormatMeasurableCharacterRangeCount(format, &count);
expect(Ok, stat);
if (stat == Ok) expect(3, count);
}
- stat= GdipDeleteStringFormat(format);
+ stat= pGdipDeleteStringFormat(format);
expect(Ok, stat);
}
@@ -83,51 +164,51 @@ static void test_digitsubstitution(void)
StringDigitSubstitute digitsub;
LANGID digitlang;
- stat = GdipCreateStringFormat(0, LANG_RUSSIAN, &format);
+ stat = pGdipCreateStringFormat(0, LANG_RUSSIAN, &format);
expect(Ok, stat);
/* NULL arguments */
- stat = GdipGetStringFormatDigitSubstitution(NULL, NULL, NULL);
+ stat = pGdipGetStringFormatDigitSubstitution(NULL, NULL, NULL);
expect(InvalidParameter, stat);
- stat = GdipGetStringFormatDigitSubstitution(format, NULL, NULL);
+ stat = pGdipGetStringFormatDigitSubstitution(format, NULL, NULL);
expect(Ok, stat);
- stat = GdipGetStringFormatDigitSubstitution(NULL, &digitlang, NULL);
+ stat = pGdipGetStringFormatDigitSubstitution(NULL, &digitlang, NULL);
expect(InvalidParameter, stat);
- stat = GdipGetStringFormatDigitSubstitution(NULL, NULL, &digitsub);
+ stat = pGdipGetStringFormatDigitSubstitution(NULL, NULL, &digitsub);
expect(InvalidParameter, stat);
- stat = GdipGetStringFormatDigitSubstitution(NULL, &digitlang, &digitsub);
+ stat = pGdipGetStringFormatDigitSubstitution(NULL, &digitlang, &digitsub);
expect(InvalidParameter, stat);
- stat = GdipSetStringFormatDigitSubstitution(NULL, LANG_NEUTRAL, StringDigitSubstituteNone);
+ stat = pGdipSetStringFormatDigitSubstitution(NULL, LANG_NEUTRAL, StringDigitSubstituteNone);
expect(InvalidParameter, stat);
/* try to get both and one by one */
- stat = GdipGetStringFormatDigitSubstitution(format, &digitlang, &digitsub);
+ stat = pGdipGetStringFormatDigitSubstitution(format, &digitlang, &digitsub);
expect(Ok, stat);
expect(StringDigitSubstituteUser, digitsub);
expect(LANG_NEUTRAL, digitlang);
digitsub = StringDigitSubstituteNone;
- stat = GdipGetStringFormatDigitSubstitution(format, NULL, &digitsub);
+ stat = pGdipGetStringFormatDigitSubstitution(format, NULL, &digitsub);
expect(Ok, stat);
expect(StringDigitSubstituteUser, digitsub);
digitlang = LANG_RUSSIAN;
- stat = GdipGetStringFormatDigitSubstitution(format, &digitlang, NULL);
+ stat = pGdipGetStringFormatDigitSubstitution(format, &digitlang, NULL);
expect(Ok, stat);
expect(LANG_NEUTRAL, digitlang);
/* set/get */
- stat = GdipSetStringFormatDigitSubstitution(format, MAKELANGID(LANG_CHINESE, SUBLANG_CHINESE_TRADITIONAL),
+ stat = pGdipSetStringFormatDigitSubstitution(format, MAKELANGID(LANG_CHINESE, SUBLANG_CHINESE_TRADITIONAL),
StringDigitSubstituteUser);
expect(Ok, stat);
digitsub = StringDigitSubstituteNone;
digitlang = LANG_RUSSIAN;
- stat = GdipGetStringFormatDigitSubstitution(format, &digitlang, &digitsub);
+ stat = pGdipGetStringFormatDigitSubstitution(format, &digitlang, &digitsub);
expect(Ok, stat);
expect(StringDigitSubstituteUser, digitsub);
expect(MAKELANGID(LANG_CHINESE, SUBLANG_CHINESE_TRADITIONAL), digitlang);
- stat = GdipDeleteStringFormat(format);
+ stat = pGdipDeleteStringFormat(format);
expect(Ok, stat);
}
@@ -144,19 +225,19 @@ static void test_getgenerictypographic(void)
INT tabcount;
/* NULL arg */
- stat = GdipStringFormatGetGenericTypographic(NULL);
+ stat = pGdipStringFormatGetGenericTypographic(NULL);
expect(InvalidParameter, stat);
- stat = GdipStringFormatGetGenericTypographic(&format);
+ stat = pGdipStringFormatGetGenericTypographic(&format);
expect(Ok, stat);
- GdipGetStringFormatFlags(format, &flags);
- GdipGetStringFormatAlign(format, &align);
- GdipGetStringFormatLineAlign(format, &valign);
- GdipGetStringFormatHotkeyPrefix(format, &n);
- GdipGetStringFormatTrimming(format, &trimming);
- GdipGetStringFormatDigitSubstitution(format, &digitlang, &digitsub);
- GdipGetStringFormatTabStopCount(format, &tabcount);
+ pGdipGetStringFormatFlags(format, &flags);
+ pGdipGetStringFormatAlign(format, &align);
+ pGdipGetStringFormatLineAlign(format, &valign);
+ pGdipGetStringFormatHotkeyPrefix(format, &n);
+ pGdipGetStringFormatTrimming(format, &trimming);
+ pGdipGetStringFormatDigitSubstitution(format, &digitlang, &digitsub);
+ pGdipGetStringFormatTabStopCount(format, &tabcount);
expect((StringFormatFlagsNoFitBlackBox |StringFormatFlagsLineLimit | StringFormatFlagsNoClip),
flags);
@@ -168,7 +249,7 @@ static void test_getgenerictypographic(void)
expect(LANG_NEUTRAL, digitlang);
expect(0, tabcount);
- stat = GdipDeleteStringFormat(format);
+ stat = pGdipDeleteStringFormat(format);
expect(Ok, stat);
}
@@ -181,84 +262,84 @@ static void test_tabstops(void)
REAL tabs[3];
REAL firsttab;
- stat = GdipCreateStringFormat(0, LANG_NEUTRAL, &format);
+ stat = pGdipCreateStringFormat(0, LANG_NEUTRAL, &format);
expect(Ok, stat);
/* NULL */
- stat = GdipGetStringFormatTabStopCount(NULL, NULL);
+ stat = pGdipGetStringFormatTabStopCount(NULL, NULL);
expect(InvalidParameter, stat);
- stat = GdipGetStringFormatTabStopCount(NULL, &count);
+ stat = pGdipGetStringFormatTabStopCount(NULL, &count);
expect(InvalidParameter, stat);
- stat = GdipGetStringFormatTabStopCount(format, NULL);
+ stat = pGdipGetStringFormatTabStopCount(format, NULL);
expect(InvalidParameter, stat);
- stat = GdipSetStringFormatTabStops(NULL, 0.0, 0, NULL);
+ stat = pGdipSetStringFormatTabStops(NULL, 0.0, 0, NULL);
expect(InvalidParameter, stat);
- stat = GdipSetStringFormatTabStops(format, 0.0, 0, NULL);
+ stat = pGdipSetStringFormatTabStops(format, 0.0, 0, NULL);
expect(InvalidParameter, stat);
- stat = GdipSetStringFormatTabStops(NULL, 0.0, 0, tabstops);
+ stat = pGdipSetStringFormatTabStops(NULL, 0.0, 0, tabstops);
expect(InvalidParameter, stat);
- stat = GdipGetStringFormatTabStops(NULL, 0, NULL, NULL);
+ stat = pGdipGetStringFormatTabStops(NULL, 0, NULL, NULL);
expect(InvalidParameter, stat);
- stat = GdipGetStringFormatTabStops(format, 0, NULL, NULL);
+ stat = pGdipGetStringFormatTabStops(format, 0, NULL, NULL);
expect(InvalidParameter, stat);
- stat = GdipGetStringFormatTabStops(NULL, 0, &firsttab, NULL);
+ stat = pGdipGetStringFormatTabStops(NULL, 0, &firsttab, NULL);
expect(InvalidParameter, stat);
- stat = GdipGetStringFormatTabStops(NULL, 0, NULL, tabs);
+ stat = pGdipGetStringFormatTabStops(NULL, 0, NULL, tabs);
expect(InvalidParameter, stat);
- stat = GdipGetStringFormatTabStops(format, 0, &firsttab, NULL);
+ stat = pGdipGetStringFormatTabStops(format, 0, &firsttab, NULL);
expect(InvalidParameter, stat);
- stat = GdipGetStringFormatTabStops(format, 0, NULL, tabs);
+ stat = pGdipGetStringFormatTabStops(format, 0, NULL, tabs);
expect(InvalidParameter, stat);
/* not NULL */
- stat = GdipGetStringFormatTabStopCount(format, &count);
+ stat = pGdipGetStringFormatTabStopCount(format, &count);
expect(Ok, stat);
expect(0, count);
/* negative tabcount */
- stat = GdipSetStringFormatTabStops(format, 0.0, -1, tabstops);
+ stat = pGdipSetStringFormatTabStops(format, 0.0, -1, tabstops);
expect(Ok, stat);
count = -1;
- stat = GdipGetStringFormatTabStopCount(format, &count);
+ stat = pGdipGetStringFormatTabStopCount(format, &count);
expect(Ok, stat);
expect(0, count);
- stat = GdipSetStringFormatTabStops(format, -10.0, 0, tabstops);
+ stat = pGdipSetStringFormatTabStops(format, -10.0, 0, tabstops);
expect(Ok, stat);
- stat = GdipSetStringFormatTabStops(format, -10.0, 1, tabstops);
+ stat = pGdipSetStringFormatTabStops(format, -10.0, 1, tabstops);
expect(NotImplemented, stat);
firsttab = -1.0;
tabs[0] = tabs[1] = tabs[2] = -1.0;
- stat = GdipGetStringFormatTabStops(format, 0, &firsttab, tabs);
+ stat = pGdipGetStringFormatTabStops(format, 0, &firsttab, tabs);
expect(Ok, stat);
expectf(-1.0, tabs[0]);
expectf(-1.0, tabs[1]);
expectf(-1.0, tabs[2]);
expectf(0.0, firsttab);
- stat = GdipSetStringFormatTabStops(format, +0.0, 3, tabstops);
+ stat = pGdipSetStringFormatTabStops(format, +0.0, 3, tabstops);
expect(Ok, stat);
count = 0;
- stat = GdipGetStringFormatTabStopCount(format, &count);
+ stat = pGdipGetStringFormatTabStopCount(format, &count);
expect(Ok, stat);
expect(3, count);
firsttab = -1.0;
tabs[0] = tabs[1] = tabs[2] = -1.0;
- stat = GdipGetStringFormatTabStops(format, 3, &firsttab, tabs);
+ stat = pGdipGetStringFormatTabStops(format, 3, &firsttab, tabs);
expect(Ok, stat);
expectf(0.0, tabs[0]);
expectf(10.0, tabs[1]);
expectf(2.0, tabs[2]);
expectf(0.0, firsttab);
- stat = GdipSetStringFormatTabStops(format, 10.0, 3, tabstops);
+ stat = pGdipSetStringFormatTabStops(format, 10.0, 3, tabstops);
expect(Ok, stat);
firsttab = -1.0;
tabs[0] = tabs[1] = tabs[2] = -1.0;
- stat = GdipGetStringFormatTabStops(format, 0, &firsttab, tabs);
+ stat = pGdipGetStringFormatTabStops(format, 0, &firsttab, tabs);
expect(Ok, stat);
expectf(-1.0, tabs[0]);
expectf(-1.0, tabs[1]);
@@ -266,14 +347,14 @@ static void test_tabstops(void)
expectf(10.0, firsttab);
/* zero tabcount, after valid setting to 3 */
- stat = GdipSetStringFormatTabStops(format, 0.0, 0, tabstops);
+ stat = pGdipSetStringFormatTabStops(format, 0.0, 0, tabstops);
expect(Ok, stat);
count = 0;
- stat = GdipGetStringFormatTabStopCount(format, &count);
+ stat = pGdipGetStringFormatTabStopCount(format, &count);
expect(Ok, stat);
expect(3, count);
- stat = GdipDeleteStringFormat(format);
+ stat = pGdipDeleteStringFormat(format);
expect(Ok, stat);
}
@@ -291,19 +372,19 @@ static void test_getgenericdefault(void)
INT tabcount;
/* NULL arg */
- stat = GdipStringFormatGetGenericDefault(NULL);
+ stat = pGdipStringFormatGetGenericDefault(NULL);
expect(InvalidParameter, stat);
- stat = GdipStringFormatGetGenericDefault(&format);
+ stat = pGdipStringFormatGetGenericDefault(&format);
expect(Ok, stat);
- GdipGetStringFormatFlags(format, &flags);
- GdipGetStringFormatAlign(format, &align);
- GdipGetStringFormatLineAlign(format, &valign);
- GdipGetStringFormatHotkeyPrefix(format, &n);
- GdipGetStringFormatTrimming(format, &trimming);
- GdipGetStringFormatDigitSubstitution(format, &digitlang, &digitsub);
- GdipGetStringFormatTabStopCount(format, &tabcount);
+ pGdipGetStringFormatFlags(format, &flags);
+ pGdipGetStringFormatAlign(format, &align);
+ pGdipGetStringFormatLineAlign(format, &valign);
+ pGdipGetStringFormatHotkeyPrefix(format, &n);
+ pGdipGetStringFormatTrimming(format, &trimming);
+ pGdipGetStringFormatDigitSubstitution(format, &digitlang, &digitsub);
+ pGdipGetStringFormatTabStopCount(format, &tabcount);
expect(0, flags);
expect(HotkeyPrefixNone, n);
@@ -314,7 +395,7 @@ static void test_getgenericdefault(void)
expect(LANG_NEUTRAL, digitlang);
expect(0, tabcount);
- stat = GdipDeleteStringFormat(format);
+ stat = pGdipDeleteStringFormat(format);
expect(Ok, stat);
}
@@ -325,57 +406,57 @@ static void test_stringformatflags(void)
INT flags;
- stat = GdipCreateStringFormat(0, LANG_NEUTRAL, &format);
+ stat = pGdipCreateStringFormat(0, LANG_NEUTRAL, &format);
expect(Ok, stat);
/* NULL args */
- stat = GdipSetStringFormatFlags(NULL, 0);
+ stat = pGdipSetStringFormatFlags(NULL, 0);
expect(InvalidParameter, stat);
- stat = GdipSetStringFormatFlags(format, 0);
+ stat = pGdipSetStringFormatFlags(format, 0);
expect(Ok, stat);
- stat = GdipGetStringFormatFlags(format, &flags);
+ stat = pGdipGetStringFormatFlags(format, &flags);
expect(Ok, stat);
expect(0, flags);
/* Check some valid flags */
- stat = GdipSetStringFormatFlags(format, StringFormatFlagsDirectionRightToLeft);
+ stat = pGdipSetStringFormatFlags(format, StringFormatFlagsDirectionRightToLeft);
expect(Ok, stat);
- stat = GdipGetStringFormatFlags(format, &flags);
+ stat = pGdipGetStringFormatFlags(format, &flags);
expect(Ok, stat);
expect(StringFormatFlagsDirectionRightToLeft, flags);
- stat = GdipSetStringFormatFlags(format, StringFormatFlagsNoFontFallback);
+ stat = pGdipSetStringFormatFlags(format, StringFormatFlagsNoFontFallback);
expect(Ok, stat);
- stat = GdipGetStringFormatFlags(format, &flags);
+ stat = pGdipGetStringFormatFlags(format, &flags);
expect(Ok, stat);
expect(StringFormatFlagsNoFontFallback, flags);
/* Check some flag combinations */
- stat = GdipSetStringFormatFlags(format, StringFormatFlagsDirectionVertical
+ stat = pGdipSetStringFormatFlags(format, StringFormatFlagsDirectionVertical
| StringFormatFlagsNoFitBlackBox);
expect(Ok, stat);
- stat = GdipGetStringFormatFlags(format, &flags);
+ stat = pGdipGetStringFormatFlags(format, &flags);
expect(Ok, stat);
expect((StringFormatFlagsDirectionVertical
| StringFormatFlagsNoFitBlackBox), flags);
- stat = GdipSetStringFormatFlags(format, StringFormatFlagsDisplayFormatControl
+ stat = pGdipSetStringFormatFlags(format, StringFormatFlagsDisplayFormatControl
| StringFormatFlagsMeasureTrailingSpaces);
expect(Ok, stat);
- stat = GdipGetStringFormatFlags(format, &flags);
+ stat = pGdipGetStringFormatFlags(format, &flags);
expect(Ok, stat);
expect((StringFormatFlagsDisplayFormatControl
| StringFormatFlagsMeasureTrailingSpaces), flags);
/* Check invalid flags */
- stat = GdipSetStringFormatFlags(format, 0xdeadbeef);
+ stat = pGdipSetStringFormatFlags(format, 0xdeadbeef);
expect(Ok, stat);
- stat = GdipGetStringFormatFlags(format, &flags);
+ stat = pGdipGetStringFormatFlags(format, &flags);
expect(Ok, stat);
expect(0xdeadbeef, flags);
- stat = GdipDeleteStringFormat(format);
+ stat = pGdipDeleteStringFormat(format);
expect(Ok, stat);
}
@@ -384,12 +465,15 @@ START_TEST(stringformat)
struct GdiplusStartupInput gdiplusStartupInput;
ULONG_PTR gdiplusToken;
+ if (!InitFunctionPtrs())
+ return;
+
gdiplusStartupInput.GdiplusVersion = 1;
gdiplusStartupInput.DebugEventCallback = NULL;
gdiplusStartupInput.SuppressBackgroundThread = 0;
gdiplusStartupInput.SuppressExternalCodecs = 0;
- GdiplusStartup(&gdiplusToken, &gdiplusStartupInput, NULL);
+ pGdiplusStartup(&gdiplusToken, &gdiplusStartupInput, NULL);
test_constructor();
test_characterrange();
@@ -399,5 +483,7 @@ START_TEST(stringformat)
test_getgenericdefault();
test_stringformatflags();
- GdiplusShutdown(gdiplusToken);
+ pGdiplusShutdown(gdiplusToken);
+
+ FreeLibrary(hGdiPlus);
}
--
1.5.6.3
--=-+MEuQHOShHMid/sIdtbC--
More information about the wine-patches
mailing list