Vincent Povirk : gdiplus: Add tests for GdipDrawString.
Alexandre Julliard
julliard at winehq.org
Wed Mar 31 10:04:50 CDT 2010
Module: wine
Branch: master
Commit: 0f919e365b7cc135e60be74af287a1909c7991ad
URL: http://source.winehq.org/git/wine.git/?a=commit;h=0f919e365b7cc135e60be74af287a1909c7991ad
Author: Vincent Povirk <vincent at codeweavers.com>
Date: Tue Mar 30 10:24:06 2010 -0500
gdiplus: Add tests for GdipDrawString.
---
dlls/gdiplus/tests/graphics.c | 68 +++++++++++++++++++++++++++++++++++++++++
1 files changed, 68 insertions(+), 0 deletions(-)
diff --git a/dlls/gdiplus/tests/graphics.c b/dlls/gdiplus/tests/graphics.c
index e33ff5f..0585321 100644
--- a/dlls/gdiplus/tests/graphics.c
+++ b/dlls/gdiplus/tests/graphics.c
@@ -2400,6 +2400,73 @@ static void test_GdipGetNearestColor(void)
ReleaseDC(hwnd, hdc);
}
+static void test_string_functions(void)
+{
+ GpStatus status;
+ GpGraphics *graphics;
+ GpFontFamily *family;
+ GpFont *font;
+ RectF rc;
+ GpBrush *brush;
+ ARGB color = 0xff000000;
+ HDC hdc = GetDC( hwnd );
+ const WCHAR fontname[] = {'C','o','u','r','i','e','r',' ','N','e','w',0};
+ const WCHAR fontname2[] = {'C','o','u','r','i','e','r',0};
+ const WCHAR teststring[] = {'o','o',' ','o','\n','o',0};
+
+ ok(hdc != NULL, "Expected HDC to be initialized\n");
+ status = GdipCreateFromHDC(hdc, &graphics);
+ expect(Ok, status);
+ ok(graphics != NULL, "Expected graphics to be initialized\n");
+
+ status = GdipCreateFontFamilyFromName(fontname, NULL, &family);
+
+ if (status != Ok)
+ {
+ /* Wine doesn't have Courier New? */
+ todo_wine expect(Ok, status);
+ status = GdipCreateFontFamilyFromName(fontname2, NULL, &family);
+ }
+
+ expect(Ok, status);
+
+ status = GdipCreateFont(family, 10.0, FontStyleRegular, UnitPixel, &font);
+ expect(Ok, status);
+
+ status = GdipCreateSolidFill(color, (GpSolidFill**)&brush);
+ expect(Ok, status);
+
+ rc.X = 0;
+ rc.Y = 0;
+ rc.Width = 100.0;
+ rc.Height = 100.0;
+
+ status = GdipDrawString(NULL, teststring, 6, font, &rc, NULL, brush);
+ expect(InvalidParameter, status);
+
+ status = GdipDrawString(graphics, NULL, 6, font, &rc, NULL, brush);
+ expect(InvalidParameter, status);
+
+ status = GdipDrawString(graphics, teststring, 6, NULL, &rc, NULL, brush);
+ expect(InvalidParameter, status);
+
+ status = GdipDrawString(graphics, teststring, 6, font, NULL, NULL, brush);
+ expect(InvalidParameter, status);
+
+ status = GdipDrawString(graphics, teststring, 6, font, &rc, NULL, NULL);
+ expect(InvalidParameter, status);
+
+ status = GdipDrawString(graphics, teststring, 6, font, &rc, NULL, brush);
+ expect(Ok, status);
+
+ GdipDeleteBrush(brush);
+ GdipDeleteFont(font);
+ GdipDeleteFontFamily(family);
+ GdipDeleteGraphics(graphics);
+
+ ReleaseDC(hwnd, hdc);
+}
+
START_TEST(graphics)
{
struct GdiplusStartupInput gdiplusStartupInput;
@@ -2452,6 +2519,7 @@ START_TEST(graphics)
test_clear();
test_textcontrast();
test_fromMemoryBitmap();
+ test_string_functions();
GdiplusShutdown(gdiplusToken);
DestroyWindow( hwnd );
More information about the wine-cvs
mailing list