https://git.reactos.org/?p=reactos.git;a=commitdiff;h=3e9224d013a9ff5102ba9d...
commit 3e9224d013a9ff5102ba9d99c383445b6ede9663 Author: Amine Khaldi amine.khaldi@reactos.org AuthorDate: Mon Oct 1 12:50:59 2018 +0100 Commit: Amine Khaldi amine.khaldi@reactos.org CommitDate: Mon Oct 1 12:50:59 2018 +0100
[GDIPLUS_WINETEST] Sync with Wine Staging 3.17. CORE-15127 --- modules/rostests/winetests/gdiplus/graphics.c | 58 +++++++++++++++++++++-- modules/rostests/winetests/gdiplus/graphicspath.c | 58 +++++++++++------------ modules/rostests/winetests/gdiplus/image.c | 40 ++++++++-------- 3 files changed, 102 insertions(+), 54 deletions(-)
diff --git a/modules/rostests/winetests/gdiplus/graphics.c b/modules/rostests/winetests/gdiplus/graphics.c index 6acc656c8f..b0e3d8232b 100644 --- a/modules/rostests/winetests/gdiplus/graphics.c +++ b/modules/rostests/winetests/gdiplus/graphics.c @@ -1539,6 +1539,52 @@ static void test_GdipFillClosedCurveI(void) ReleaseDC(hwnd, hdc); }
+static void test_GdipFillPath(void) +{ + GpStatus status; + GpGraphics *graphics; + GpSolidFill *brush; + GpPath *path; + HDC hdc = GetDC(hwnd); + + 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 = GdipCreateSolidFill((ARGB)0xffffffff, &brush); + expect(Ok, status); + ok(brush != NULL, "Expected brush to be initialized\n"); + status = GdipCreatePath(FillModeAlternate, &path); + expect(Ok, status); + ok(path != NULL, "Expected path to be initialized\n"); + + /* Empty path */ + GdipResetPath(path); + status = GdipFillPath(graphics, (GpBrush *)brush, path); + expect(Ok, status); + + /* Not closed path */ + GdipResetPath(path); + status = GdipAddPathLineI(path, 0, 0, 2, 2); + expect(Ok, status); + status = GdipAddPathLineI(path, 2, 2, 4, 0); + expect(Ok, status); + status = GdipFillPath(graphics, (GpBrush *)brush, path); + expect(Ok, status); + + /* Closed path */ + GdipResetPath(path); + status = GdipAddPathRectangle(path, 0, 0, 4, 4); + expect(Ok, status); + status = GdipFillPath(graphics, (GpBrush *)brush, path); + expect(Ok, status); + + GdipDeletePath(path); + GdipDeleteBrush((GpBrush *)brush); + GdipDeleteGraphics(graphics); + ReleaseDC(hwnd, hdc); +} + static void test_Get_Release_DC(void) { GpStatus status; @@ -2148,6 +2194,7 @@ static void test_clip_xform(void) expect(0xff, color);
GdipDeleteGraphics(graphics); + GdipDeleteRegion(clip); ReleaseDC(hwnd, hdc); }
@@ -3721,7 +3768,7 @@ static void test_GdipMeasureString(void) expect(Ok, status); expect(UnitPixel, font_unit);
- for (i = 0; i < sizeof(td)/sizeof(td[0]); i++) + for (i = 0; i < ARRAY_SIZE(td); i++) { GpImage *image;
@@ -3799,7 +3846,7 @@ todo_wine expect(Ok, status); expect(unit, font_unit);
- for (i = 0; i < sizeof(td)/sizeof(td[0]); i++) + for (i = 0; i < ARRAY_SIZE(td); i++) { REAL unit_scale; GpImage *image; @@ -3883,7 +3930,7 @@ todo_wine }
/* Font with units = UnitWorld */ - for (i = 0; i < sizeof(td)/sizeof(td[0]); i++) + for (i = 0; i < ARRAY_SIZE(td); i++) { GpPointF pt = {0.0, 100.0}; GpImage* image; @@ -3972,7 +4019,7 @@ static void test_transform(void) GpPointF ptf[2]; UINT i;
- for (i = 0; i < sizeof(td)/sizeof(td[0]); i++) + for (i = 0; i < ARRAY_SIZE(td); i++) { graphics = create_graphics(td[i].res_x, td[i].res_y, td[i].unit, td[i].scale, &image); ptf[0].X = td[i].in[0].X; @@ -4032,7 +4079,7 @@ static void test_pen_thickness(void) BitmapData bd; INT min, max, size;
- for (i = 0; i < sizeof(td)/sizeof(td[0]); i++) + for (i = 0; i < ARRAY_SIZE(td); i++) { status = GdipCreateBitmapFromScan0(100, 100, 0, PixelFormat24bppRGB, NULL, &u.bitmap); expect(Ok, status); @@ -6795,6 +6842,7 @@ START_TEST(graphics) test_GdipDrawImagePointsRect(); test_GdipFillClosedCurve(); test_GdipFillClosedCurveI(); + test_GdipFillPath(); test_GdipDrawString(); test_GdipGetNearestColor(); test_GdipGetVisibleClipBounds(); diff --git a/modules/rostests/winetests/gdiplus/graphicspath.c b/modules/rostests/winetests/gdiplus/graphicspath.c index c5403cbe0e..096fbc600a 100644 --- a/modules/rostests/winetests/gdiplus/graphicspath.c +++ b/modules/rostests/winetests/gdiplus/graphicspath.c @@ -207,7 +207,7 @@ static void test_line2(void) status = GdipAddPathLine2(path, &(line2_points[6]), 3); expect(Ok, status);
- ok_path(path, line2_path, sizeof(line2_path)/sizeof(path_test_t), FALSE); + ok_path(path, line2_path, ARRAY_SIZE(line2_path), FALSE);
GdipDeletePath(path); } @@ -278,7 +278,7 @@ static void test_arc(void) status = GdipAddPathArc(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); + ok_path(path, arc_path, ARRAY_SIZE(arc_path), FALSE);
GdipDeletePath(path); } @@ -458,7 +458,7 @@ static void test_pathpath(void) status = GdipAddPathPath(path1, path2, TRUE); expect(Ok, status);
- ok_path(path1, pathpath_path, sizeof(pathpath_path)/sizeof(path_test_t), FALSE); + ok_path(path1, pathpath_path, ARRAY_SIZE(pathpath_path), FALSE);
GdipDeletePath(path1); GdipDeletePath(path2); @@ -529,7 +529,7 @@ static void test_ellipse(void) status = GdipAddPathEllipse(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); + ok_path(path, ellipse_path, ARRAY_SIZE(ellipse_path), FALSE);
GdipDeletePath(path); } @@ -565,7 +565,7 @@ static void test_linei(void) status = GdipAddPathLineI(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); + ok_path(path, linei_path, ARRAY_SIZE(linei_path), FALSE);
GdipDeletePath(path); } @@ -614,7 +614,7 @@ static void test_polygon(void) status = GdipAddPathPolygon(path, points, 5); expect(Ok, status); /* check resulting path */ - ok_path(path, poly_path, sizeof(poly_path)/sizeof(path_test_t), FALSE); + ok_path(path, poly_path, ARRAY_SIZE(poly_path), FALSE);
GdipDeletePath(path); } @@ -643,7 +643,7 @@ static void test_rect(void) status = GdipAddPathRectangle(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); + ok_path(path, rect_path, ARRAY_SIZE(rect_path), FALSE);
GdipDeletePath(path);
@@ -661,7 +661,7 @@ static void test_rect(void) status = GdipAddPathRectangles(path, (GDIPCONST GpRectF*)&rects, 2); expect(Ok, status);
- ok_path(path, rect_path, sizeof(rect_path)/sizeof(path_test_t), FALSE); + ok_path(path, rect_path, ARRAY_SIZE(rect_path), FALSE);
GdipDeletePath(path); } @@ -756,7 +756,7 @@ static void test_addcurve(void) /* add to empty path */ status = GdipAddPathCurve2(path, points, 4, 1.0); expect(Ok, status); - ok_path(path, addcurve_path, sizeof(addcurve_path)/sizeof(path_test_t), FALSE); + ok_path(path, addcurve_path, ARRAY_SIZE(addcurve_path), FALSE); GdipDeletePath(path);
/* add to notempty path and opened figure */ @@ -764,7 +764,7 @@ static void test_addcurve(void) GdipAddPathLine(path, 100.0, 120.0, 123.0, 10.0); status = GdipAddPathCurve2(path, points, 4, 1.0); expect(Ok, status); - ok_path(path, addcurve_path2, sizeof(addcurve_path2)/sizeof(path_test_t), FALSE); + ok_path(path, addcurve_path2, ARRAY_SIZE(addcurve_path2), FALSE);
/* NULL args */ GdipResetPath(path); @@ -789,12 +789,12 @@ static void test_addcurve(void) /* use all points */ status = GdipAddPathCurve3(path, points, 4, 0, 3, 1.0); expect(Ok, status); - ok_path(path, addcurve_path, sizeof(addcurve_path)/sizeof(path_test_t), FALSE); + ok_path(path, addcurve_path, ARRAY_SIZE(addcurve_path), FALSE); GdipResetPath(path);
status = GdipAddPathCurve3(path, points, 4, 1, 2, 1.0); expect(Ok, status); - ok_path(path, addcurve_path3, sizeof(addcurve_path3)/sizeof(path_test_t), FALSE); + ok_path(path, addcurve_path3, ARRAY_SIZE(addcurve_path3), FALSE);
GdipDeletePath(path); } @@ -844,7 +844,7 @@ static void test_addclosedcurve(void) /* add to empty path */ status = GdipAddPathClosedCurve2(path, points, 4, 1.0); expect(Ok, status); - ok_path(path, addclosedcurve_path, sizeof(addclosedcurve_path)/sizeof(path_test_t), FALSE); + ok_path(path, addclosedcurve_path, ARRAY_SIZE(addclosedcurve_path), FALSE); GdipDeletePath(path); }
@@ -886,7 +886,7 @@ static void test_reverse(void)
status = GdipReversePath(path); expect(Ok, status); - ok_path(path, reverse_path, sizeof(reverse_path)/sizeof(path_test_t), FALSE); + ok_path(path, reverse_path, ARRAY_SIZE(reverse_path), FALSE);
GdipDeletePath(path); } @@ -917,21 +917,21 @@ static void test_addpie(void)
status = GdipAddPathPie(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); + ok_path(path, addpie_path, ARRAY_SIZE(addpie_path), FALSE); status = GdipResetPath(path); expect(Ok, status);
/* zero width base ellipse */ status = GdipAddPathPie(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); + ok_path(path, addpie_path2, ARRAY_SIZE(addpie_path2), FALSE); status = GdipResetPath(path); expect(Ok, status);
/* zero height base ellipse */ status = GdipAddPathPie(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); + ok_path(path, addpie_path3, ARRAY_SIZE(addpie_path3), FALSE);
GdipDeletePath(path); } @@ -1020,7 +1020,7 @@ static void test_flatten(void)
status = GdipFlattenPath(path, NULL, 1.0); expect(Ok, status); - ok_path(path, flattenellipse_path, sizeof(flattenellipse_path)/sizeof(path_test_t), TRUE); + ok_path(path, flattenellipse_path, ARRAY_SIZE(flattenellipse_path), TRUE);
status = GdipResetPath(path); expect(Ok, status); @@ -1028,7 +1028,7 @@ static void test_flatten(void) expect(Ok, status); status = GdipFlattenPath(path, NULL, 1.0); expect(Ok, status); - ok_path(path, flattenline_path, sizeof(flattenline_path)/sizeof(path_test_t), FALSE); + ok_path(path, flattenline_path, ARRAY_SIZE(flattenline_path), FALSE);
status = GdipResetPath(path); expect(Ok, status); @@ -1036,7 +1036,7 @@ static void test_flatten(void) expect(Ok, status); status = GdipFlattenPath(path, NULL, 1.0); expect(Ok, status); - ok_path(path, flattenarc_path, sizeof(flattenarc_path)/sizeof(path_test_t), TRUE); + ok_path(path, flattenarc_path, ARRAY_SIZE(flattenarc_path), TRUE);
/* easy case - quater of a full circle */ status = GdipResetPath(path); @@ -1045,7 +1045,7 @@ static void test_flatten(void) expect(Ok, status); status = GdipFlattenPath(path, NULL, 1.0); expect(Ok, status); - ok_path(path, flattenquater_path, sizeof(flattenquater_path)/sizeof(path_test_t), FALSE); + ok_path(path, flattenquater_path, ARRAY_SIZE(flattenquater_path), FALSE);
GdipDeleteMatrix(m); GdipDeletePath(path); @@ -1119,7 +1119,7 @@ static void test_widen(void)
status = GdipWidenPath(path, pen, m, 1.0); expect(Ok, status); - ok_path(path, widenline_path, sizeof(widenline_path)/sizeof(path_test_t), FALSE); + ok_path(path, widenline_path, ARRAY_SIZE(widenline_path), FALSE);
/* horizontal 2x stretch */ status = GdipResetPath(path); @@ -1132,7 +1132,7 @@ static void test_widen(void)
status = GdipWidenPath(path, pen, m, 1.0); expect(Ok, status); - ok_path(path, widenline_path, sizeof(widenline_path)/sizeof(path_test_t), FALSE); + ok_path(path, widenline_path, ARRAY_SIZE(widenline_path), FALSE);
/* vertical 2x stretch */ status = GdipResetPath(path); @@ -1145,7 +1145,7 @@ static void test_widen(void)
status = GdipWidenPath(path, pen, m, 1.0); expect(Ok, status); - ok_path(path, widenline_path, sizeof(widenline_path)/sizeof(path_test_t), FALSE); + ok_path(path, widenline_path, ARRAY_SIZE(widenline_path), FALSE);
status = GdipScaleMatrix(m, 1.0, 0.5, MatrixOrderAppend); expect(Ok, status); @@ -1161,7 +1161,7 @@ static void test_widen(void)
status = GdipWidenPath(path, pen, m, 1.0); expect(Ok, status); - ok_path(path, widenline_dash_path, sizeof(widenline_dash_path)/sizeof(path_test_t), FALSE); + ok_path(path, widenline_dash_path, ARRAY_SIZE(widenline_dash_path), FALSE);
status = GdipSetPenDashStyle(pen, DashStyleSolid); expect(Ok, status); @@ -1178,7 +1178,7 @@ static void test_widen(void)
status = GdipWidenPath(path, pen, m, 1.0); expect(Ok, status); - ok_path(path, widenline_path, sizeof(widenline_path)/sizeof(path_test_t), FALSE); + ok_path(path, widenline_path, ARRAY_SIZE(widenline_path), FALSE);
/* horizontal 2x stretch */ status = GdipResetPath(path); @@ -1191,7 +1191,7 @@ static void test_widen(void)
status = GdipWidenPath(path, pen, m, 1.0); expect(Ok, status); - ok_path(path, widenline_path, sizeof(widenline_path)/sizeof(path_test_t), FALSE); + ok_path(path, widenline_path, ARRAY_SIZE(widenline_path), FALSE);
/* vertical 2x stretch */ status = GdipResetPath(path); @@ -1204,7 +1204,7 @@ static void test_widen(void)
status = GdipWidenPath(path, pen, m, 1.0); expect(Ok, status); - ok_path(path, widenline_wide_path, sizeof(widenline_wide_path)/sizeof(path_test_t), FALSE); + ok_path(path, widenline_wide_path, ARRAY_SIZE(widenline_wide_path), FALSE);
status = GdipScaleMatrix(m, 1.0, 0.5, MatrixOrderAppend); expect(Ok, status); @@ -1221,7 +1221,7 @@ static void test_widen(void)
status = GdipWidenPath(path, pen, m, 1.0); expect(Ok, status); - ok_path(path, widenline_path, sizeof(widenline_path)/sizeof(path_test_t), FALSE); + ok_path(path, widenline_path, ARRAY_SIZE(widenline_path), FALSE);
/* pen width = 0 pixels - native fails to widen but can draw with this pen */ GdipDeletePen(pen); diff --git a/modules/rostests/winetests/gdiplus/image.c b/modules/rostests/winetests/gdiplus/image.c index bb27dd6af2..516e7129a6 100644 --- a/modules/rostests/winetests/gdiplus/image.c +++ b/modules/rostests/winetests/gdiplus/image.c @@ -74,10 +74,10 @@ static void expect_guid(REFGUID expected, REFGUID got, int line, BOOL todo) char buffer[39]; char buffer2[39];
- StringFromGUID2(got, bufferW, sizeof(bufferW)/sizeof(bufferW[0])); - WideCharToMultiByte(CP_ACP, 0, bufferW, sizeof(bufferW)/sizeof(bufferW[0]), buffer, sizeof(buffer), NULL, NULL); - StringFromGUID2(expected, bufferW, sizeof(bufferW)/sizeof(bufferW[0])); - WideCharToMultiByte(CP_ACP, 0, bufferW, sizeof(bufferW)/sizeof(bufferW[0]), buffer2, sizeof(buffer2), NULL, NULL); + StringFromGUID2(got, bufferW, ARRAY_SIZE(bufferW)); + WideCharToMultiByte(CP_ACP, 0, bufferW, ARRAY_SIZE(bufferW), buffer, sizeof(buffer), NULL, NULL); + StringFromGUID2(expected, bufferW, ARRAY_SIZE(bufferW)); + WideCharToMultiByte(CP_ACP, 0, bufferW, ARRAY_SIZE(bufferW), buffer2, sizeof(buffer2), NULL, NULL); todo_wine_if (todo) ok_(__FILE__, line)(IsEqualGUID(expected, got), "Expected %s, got %s\n", buffer2, buffer); } @@ -3328,7 +3328,7 @@ static void test_image_properties(void) char buf[256]; } item;
- for (i = 0; i < sizeof(td)/sizeof(td[0]); i++) + for (i = 0; i < ARRAY_SIZE(td); i++) { image = load_image(td[i].image_data, td[i].image_size); if (!image) @@ -3646,9 +3646,9 @@ static void test_tiff_properties(void) prop_count = 0xdeadbeef; status = GdipGetPropertyCount(image, &prop_count); expect(Ok, status); - ok(prop_count == sizeof(td)/sizeof(td[0]) || - broken(prop_count == sizeof(td)/sizeof(td[0]) - 1) /* Win7 SP0 */, - "expected property count %u, got %u\n", (UINT)(sizeof(td)/sizeof(td[0])), prop_count); + ok(prop_count == ARRAY_SIZE(td) || + broken(prop_count == ARRAY_SIZE(td) - 1) /* Win7 SP0 */, + "expected property count %u, got %u\n", (UINT) ARRAY_SIZE(td), prop_count);
prop_id = HeapAlloc(GetProcessHeap(), 0, prop_count * sizeof(*prop_id));
@@ -3756,8 +3756,8 @@ static void test_GdipGetAllPropertyItems(void) prop_count = 0xdeadbeef; status = GdipGetPropertyCount(image, &prop_count); expect(Ok, status); - ok(prop_count == sizeof(td)/sizeof(td[0]), - "expected property count %u, got %u\n", (UINT)(sizeof(td)/sizeof(td[0])), prop_count); + ok(prop_count == ARRAY_SIZE(td), + "expected property count %u, got %u\n", (UINT) ARRAY_SIZE(td), prop_count);
prop_id = HeapAlloc(GetProcessHeap(), 0, prop_count * sizeof(*prop_id));
@@ -4031,7 +4031,7 @@ static void test_bitmapbits(void) } palette; ARGB *entries = palette.pal.Entries;
- for (i = 0; i < sizeof(td)/sizeof(td[0]); i++) + for (i = 0; i < ARRAY_SIZE(td); i++) { BYTE pixels[sizeof(pixels_24)]; memcpy(pixels, pixels_24, sizeof(pixels_24)); @@ -4300,7 +4300,7 @@ static void test_image_format(void) BitmapData data; UINT i, ret;
- for (i = 0; i < sizeof(fmt)/sizeof(fmt[0]); i++) + for (i = 0; i < ARRAY_SIZE(fmt); i++) { status = GdipCreateBitmapFromScan0(1, 1, 0, fmt[i], NULL, &bitmap); ok(status == Ok || broken(status == InvalidParameter) /* before win7 */, @@ -4452,7 +4452,7 @@ static void test_DrawImage_scale(void) status = GdipSetInterpolationMode(graphics, InterpolationModeNearestNeighbor); expect(Ok, status);
- for (i = 0; i < sizeof(td)/sizeof(td[0]); i++) + for (i = 0; i < ARRAY_SIZE(td); i++) { status = GdipSetPixelOffsetMode(graphics, td[i].pixel_offset_mode); expect(Ok, status); @@ -4558,10 +4558,10 @@ static void test_gif_properties(void)
status = GdipGetPropertyCount(image, &prop_count); expect(Ok, status); - ok(prop_count == sizeof(td)/sizeof(td[0]) || broken(prop_count == 1) /* before win7 */, - "expected property count %u, got %u\n", (UINT)(sizeof(td)/sizeof(td[0])), prop_count); + ok(prop_count == ARRAY_SIZE(td) || broken(prop_count == 1) /* before win7 */, + "expected property count %u, got %u\n", (UINT) ARRAY_SIZE(td), prop_count);
- if (prop_count != sizeof(td)/sizeof(td[0])) + if (prop_count != ARRAY_SIZE(td)) { GdipDisposeImage(image); return; @@ -4834,7 +4834,7 @@ static void test_supported_encoders(void) status = GdipCreateBitmapFromScan0(1, 1, 0, PixelFormat24bppRGB, NULL, &bm); ok(status == Ok, "GdipCreateBitmapFromScan0 error %d\n", status);
- for (i = 0; i < sizeof(td)/sizeof(td[0]); i++) + for (i = 0; i < ARRAY_SIZE(td); i++) { ret = get_encoder_clsid(td[i].mime, &format, &clsid); ok(ret, "%s encoder is not in the list\n", wine_dbgstr_w(td[i].mime)); @@ -4883,7 +4883,7 @@ static void test_createeffect(void) stat = pGdipCreateEffect(noneffect, &effect); todo_wine expect(Win32Error, stat);
- for(i=0; i < sizeof(effectlist) / sizeof(effectlist[0]); i++) + for(i=0; i < ARRAY_SIZE(effectlist); i++) { stat = pGdipCreateEffect(*effectlist[i], &effect); todo_wine expect(Ok, stat); @@ -4996,7 +4996,7 @@ static void test_histogram(void) expect(Ok, stat); expect(256, num);
- for (i = 0; i < sizeof(test_formats)/sizeof(test_formats[0]); i++) + for (i = 0; i < ARRAY_SIZE(test_formats); i++) { num = 0; stat = pGdipBitmapGetHistogramSize(test_formats[i], &num); @@ -5146,7 +5146,7 @@ static void test_png_color_formats(void) UINT flags; int i;
- for (i = 0; i < sizeof(td)/sizeof(td[0]); i++) + for (i = 0; i < ARRAY_SIZE(td); i++) { memcpy(buf, png_1x1_data, sizeof(png_1x1_data)); buf[24] = td[i].bit_depth;