Author: akhaldi Date: Wed Mar 2 10:35:00 2016 New Revision: 70863
URL: http://svn.reactos.org/svn/reactos?rev=70863&view=rev Log: [GDIPLUS_WINETEST] Sync with Wine Staging 1.9.4. CORE-10912
Modified: trunk/rostests/winetests/gdiplus/font.c trunk/rostests/winetests/gdiplus/graphicspath.c trunk/rostests/winetests/gdiplus/image.c trunk/rostests/winetests/gdiplus/metafile.c trunk/rostests/winetests/gdiplus/pen.c
Modified: trunk/rostests/winetests/gdiplus/font.c URL: http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/gdiplus/font.c?r... ============================================================================== --- trunk/rostests/winetests/gdiplus/font.c [iso-8859-1] (original) +++ trunk/rostests/winetests/gdiplus/font.c [iso-8859-1] Wed Mar 2 10:35:00 2016 @@ -733,6 +733,7 @@ static void test_font_substitution(void) { WCHAR ms_shell_dlg[LF_FACESIZE]; + char fallback_font[LF_FACESIZE]; HDC hdc; HFONT hfont; LOGFONTA lf; @@ -779,13 +780,22 @@ status = GdipCreateFontFamilyFromName(nonexistent, NULL, &family); ok(status == FontFamilyNotFound, "expected FontFamilyNotFound, got %d\n", status);
+ /* nonexistent fonts fallback to Arial, or something else if it's missing */ + strcpy(lf.lfFaceName,"Arial"); + status = GdipCreateFontFromLogfontA(hdc, &lf, &font); + expect(Ok, status); + status = GdipGetLogFontA(font, graphics, &lf); + expect(Ok, status); + strcpy(fallback_font,lf.lfFaceName); + trace("fallback font %s\n", fallback_font); + lstrcpyA(lf.lfFaceName, "ThisFontShouldNotExist"); status = GdipCreateFontFromLogfontA(hdc, &lf, &font); expect(Ok, status); memset(&lf, 0xfe, sizeof(lf)); status = GdipGetLogFontA(font, graphics, &lf); expect(Ok, status); - ok(!lstrcmpA(lf.lfFaceName, "Arial"), "wrong face name %s\n", lf.lfFaceName); + ok(!lstrcmpA(lf.lfFaceName, fallback_font), "wrong face name %s / %s\n", lf.lfFaceName, fallback_font); GdipDeleteFont(font);
/* empty FaceName */ @@ -795,7 +805,7 @@ memset(&lf, 0xfe, sizeof(lf)); status = GdipGetLogFontA(font, graphics, &lf); expect(Ok, status); - ok(!lstrcmpA(lf.lfFaceName, "Arial"), "wrong face name %s\n", lf.lfFaceName); + ok(!lstrcmpA(lf.lfFaceName, fallback_font), "wrong face name %s / %s\n", lf.lfFaceName, fallback_font); GdipDeleteFont(font);
/* zeroing out lfWeight and lfCharSet leads to font creation failure */
Modified: trunk/rostests/winetests/gdiplus/graphicspath.c URL: http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/gdiplus/graphics... ============================================================================== --- trunk/rostests/winetests/gdiplus/graphicspath.c [iso-8859-1] (original) +++ trunk/rostests/winetests/gdiplus/graphicspath.c [iso-8859-1] Wed Mar 2 10:35:00 2016 @@ -93,10 +93,7 @@ return; }
- if(todo_size) todo_wine - ok(size == expected_size, "Path size %d does not match expected size %d\n", - size, expected_size); - else + todo_wine_if (todo_size) ok(size == expected_size, "Path size %d does not match expected size %d\n", size, expected_size);
@@ -119,11 +116,7 @@ stringify_point_type(expected[eidx].type, ename); stringify_point_type(types[idx], name);
- if (expected[eidx].todo || numskip) todo_wine - ok(match, "Expected #%d: %s (%.1f,%.1f) but got %s (%.1f,%.1f)\n", eidx, - ename, expected[eidx].X, expected[eidx].Y, - name, points[idx].X, points[idx].Y); - else + todo_wine_if (expected[eidx].todo || numskip) ok(match, "Expected #%d: %s (%.1f,%.1f) but got %s (%.1f,%.1f)\n", eidx, ename, expected[eidx].X, expected[eidx].Y, name, points[idx].X, points[idx].Y); @@ -1061,6 +1054,155 @@ GdipDeletePath(path); }
+static path_test_t widenline_path[] = { + {5.0, 5.0, PathPointTypeStart, 0, 0}, /*0*/ + {50.0, 5.0, PathPointTypeLine, 0, 0}, /*1*/ + {50.0, 15.0, PathPointTypeLine, 0, 0}, /*2*/ + {5.0, 15.0, PathPointTypeLine|PathPointTypeCloseSubpath, 0, 0} /*3*/ + }; + +static path_test_t widenline_wide_path[] = { + {5.0, 0.0, PathPointTypeStart, 0, 0}, /*0*/ + {50.0, 0.0, PathPointTypeLine, 0, 0}, /*1*/ + {50.0, 20.0, PathPointTypeLine, 0, 0}, /*2*/ + {5.0, 20.0, PathPointTypeLine|PathPointTypeCloseSubpath, 0, 0} /*3*/ + }; + +static void test_widen(void) +{ + GpStatus status; + GpPath *path; + GpPen *pen; + GpMatrix *m; + + status = GdipCreatePath(FillModeAlternate, &path); + expect(Ok, status); + status = GdipCreatePen1(0xffffffff, 10.0, UnitPixel, &pen); + expect(Ok, status); + status = GdipCreateMatrix(&m); + expect(Ok, status); + + /* NULL arguments */ + status = GdipAddPathLine(path, 5.0, 10.0, 50.0, 10.0); + expect(Ok, status); + status = GdipWidenPath(NULL, NULL, NULL, 0.0); + expect(InvalidParameter, status); + status = GdipWidenPath(path, pen, m, 0.0); + expect(Ok, status); + status = GdipWidenPath(path, pen, NULL, 1.0); + expect(Ok, status); + status = GdipWidenPath(path, NULL, m, 1.0); + expect(InvalidParameter, status); + status = GdipWidenPath(NULL, pen, m, 1.0); + expect(InvalidParameter, status); + + /* widen empty path */ + status = GdipResetPath(path); + expect(Ok, status); + status = GdipWidenPath(path, pen, m, 1.0); + expect(OutOfMemory, status); + + /* horizontal line */ + status = GdipResetPath(path); + expect(Ok, status); + status = GdipAddPathLine(path, 5.0, 10.0, 50.0, 10.0); + expect(Ok, status); + + status = GdipWidenPath(path, pen, m, 1.0); + expect(Ok, status); + ok_path(path, widenline_path, sizeof(widenline_path)/sizeof(path_test_t), FALSE); + + /* horizontal 2x stretch */ + status = GdipResetPath(path); + expect(Ok, status); + status = GdipAddPathLine(path, 2.5, 10.0, 25.0, 10.0); + expect(Ok, status); + + status = GdipScaleMatrix(m, 2.0, 1.0, MatrixOrderAppend); + expect(Ok, status); + + status = GdipWidenPath(path, pen, m, 1.0); + expect(Ok, status); + ok_path(path, widenline_path, sizeof(widenline_path)/sizeof(path_test_t), FALSE); + + /* vertical 2x stretch */ + status = GdipResetPath(path); + expect(Ok, status); + status = GdipAddPathLine(path, 5.0, 5.0, 50.0, 5.0); + expect(Ok, status); + + status = GdipScaleMatrix(m, 0.5, 2.0, MatrixOrderAppend); + expect(Ok, status); + + status = GdipWidenPath(path, pen, m, 1.0); + expect(Ok, status); + ok_path(path, widenline_path, sizeof(widenline_path)/sizeof(path_test_t), FALSE); + + status = GdipScaleMatrix(m, 1.0, 0.5, MatrixOrderAppend); + expect(Ok, status); + + /* pen width in UnitWorld */ + GdipDeletePen(pen); + status = GdipCreatePen1(0xffffffff, 10.0, UnitWorld, &pen); + expect(Ok, status); + + status = GdipResetPath(path); + expect(Ok, status); + status = GdipAddPathLine(path, 5.0, 10.0, 50.0, 10.0); + expect(Ok, status); + + status = GdipWidenPath(path, pen, m, 1.0); + expect(Ok, status); + ok_path(path, widenline_path, sizeof(widenline_path)/sizeof(path_test_t), FALSE); + + /* horizontal 2x stretch */ + status = GdipResetPath(path); + expect(Ok, status); + status = GdipAddPathLine(path, 2.5, 10.0, 25.0, 10.0); + expect(Ok, status); + + status = GdipScaleMatrix(m, 2.0, 1.0, MatrixOrderAppend); + expect(Ok, status); + + status = GdipWidenPath(path, pen, m, 1.0); + expect(Ok, status); + ok_path(path, widenline_path, sizeof(widenline_path)/sizeof(path_test_t), FALSE); + + /* vertical 2x stretch */ + status = GdipResetPath(path); + expect(Ok, status); + status = GdipAddPathLine(path, 5.0, 5.0, 50.0, 5.0); + expect(Ok, status); + + status = GdipScaleMatrix(m, 0.5, 2.0, MatrixOrderAppend); + expect(Ok, status); + + 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); + + status = GdipScaleMatrix(m, 1.0, 0.5, MatrixOrderAppend); + expect(Ok, status); + + /* pen width in UnitInch */ + GdipDeletePen(pen); + status = GdipCreatePen1(0xffffffff, 10.0, UnitWorld, &pen); + expect(Ok, status); + + status = GdipResetPath(path); + expect(Ok, status); + status = GdipAddPathLine(path, 5.0, 10.0, 50.0, 10.0); + expect(Ok, status); + + status = GdipWidenPath(path, pen, m, 1.0); + expect(Ok, status); + ok_path(path, widenline_path, sizeof(widenline_path)/sizeof(path_test_t), FALSE); + + GdipDeleteMatrix(m); + GdipDeletePen(pen); + GdipDeletePath(path); +} + static void test_isvisible(void) { GpPath *path; @@ -1169,6 +1311,7 @@ test_reverse(); test_addpie(); test_flatten(); + test_widen(); test_isvisible(); test_empty_rect();
Modified: trunk/rostests/winetests/gdiplus/image.c URL: http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/gdiplus/image.c?... ============================================================================== --- trunk/rostests/winetests/gdiplus/image.c [iso-8859-1] (original) +++ trunk/rostests/winetests/gdiplus/image.c [iso-8859-1] Wed Mar 2 10:35:00 2016 @@ -75,9 +75,7 @@ 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); - if(todo) - todo_wine ok_(__FILE__, line)(IsEqualGUID(expected, got), "Expected %s, got %s\n", buffer2, buffer); - else + todo_wine_if (todo) ok_(__FILE__, line)(IsEqualGUID(expected, got), "Expected %s, got %s\n", buffer2, buffer); }
@@ -4318,10 +4316,8 @@ expect(Ok, status);
match = memcmp(dst_8x1, td[i].image, sizeof(dst_8x1)) == 0; - if (!match && td[i].todo) - todo_wine ok(match, "%d: data should match\n", i); - else - ok(match, "%d: data should match\n", i); + todo_wine_if (!match && td[i].todo) + ok(match, "%d: data should match\n", i); if (!match) { UINT i, size = sizeof(dst_8x1); @@ -4699,9 +4695,7 @@ ok(hr == S_OK, "CreateStreamOnHGlobal error %#x\n", hr);
status = GdipSaveImageToStream((GpImage *)bm, stream, &clsid, NULL); - if (td[i].todo) - todo_wine ok(status == Ok, "GdipSaveImageToStream error %d\n", status); - else + todo_wine_if (td[i].todo) ok(status == Ok, "GdipSaveImageToStream error %d\n", status);
IStream_Release(stream);
Modified: trunk/rostests/winetests/gdiplus/metafile.c URL: http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/gdiplus/metafile... ============================================================================== --- trunk/rostests/winetests/gdiplus/metafile.c [iso-8859-1] (original) +++ trunk/rostests/winetests/gdiplus/metafile.c [iso-8859-1] Wed Mar 2 10:35:00 2016 @@ -52,11 +52,7 @@
static void check_record(int count, const char *desc, const struct emfplus_record *expected, const struct emfplus_record *actual) { - if (expected->todo) - todo_wine ok(expected->record_type == actual->record_type, - "%s.%i: Expected record type 0x%x, got 0x%x\n", desc, count, - expected->record_type, actual->record_type); - else + todo_wine_if (expected->todo) ok(expected->record_type == actual->record_type, "%s.%i: Expected record type 0x%x, got 0x%x\n", desc, count, expected->record_type, actual->record_type); @@ -147,9 +143,7 @@
EnumEnhMetaFile(0, hemf, enum_emf_proc, &state, NULL);
- if (expected[state.count].todo) - todo_wine ok(expected[state.count].record_type == 0, "%s: Got %i records, expecting more\n", desc, state.count); - else + todo_wine_if (expected[state.count].todo) ok(expected[state.count].record_type == 0, "%s: Got %i records, expecting more\n", desc, state.count); }
@@ -201,9 +195,7 @@ 3, src_rect, src_unit, enum_metafile_proc, &state, NULL); expect(Ok, stat);
- if (expected[state.count].todo) - todo_wine ok(expected[state.count].record_type == 0, "%s: Got %i records, expecting more\n", desc, state.count); - else + todo_wine_if (expected[state.count].todo) ok(expected[state.count].record_type == 0, "%s: Got %i records, expecting more\n", desc, state.count);
GdipDeleteGraphics(graphics); @@ -221,17 +213,13 @@
if (state->expected[state->count].record_type) { - if (state->expected[state->count].playback_todo) - todo_wine ok(stat == Ok, "%s.%i: GdipPlayMetafileRecord failed with stat %i\n", state->desc, state->count, stat); - else + todo_wine_if (state->expected[state->count].playback_todo) ok(stat == Ok, "%s.%i: GdipPlayMetafileRecord failed with stat %i\n", state->desc, state->count, stat); state->count++; } else { - if (state->expected[state->count].playback_todo) - todo_wine ok(0, "%s: too many records\n", state->desc); - else + todo_wine_if (state->expected[state->count].playback_todo) ok(0, "%s: too many records\n", state->desc);
return FALSE;
Modified: trunk/rostests/winetests/gdiplus/pen.c URL: http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/gdiplus/pen.c?re... ============================================================================== --- trunk/rostests/winetests/gdiplus/pen.c [iso-8859-1] (original) +++ trunk/rostests/winetests/gdiplus/pen.c [iso-8859-1] Wed Mar 2 10:35:00 2016 @@ -372,6 +372,68 @@ GdipDeletePen(pen); }
+static void test_transform(void) +{ + GpStatus status; + GpPen *pen; + GpMatrix *matrix, *matrix2; + REAL values[6]; + + status = GdipCreatePen1((ARGB)0xffff00ff, 10.0f, UnitPixel, &pen); + expect(Ok, status); + + status = GdipCreateMatrix(&matrix); + expect(Ok, status); + + status = GdipGetPenTransform(pen, matrix); + expect(Ok, status); + + status = GdipGetMatrixElements(matrix, values); + expect(Ok, status); + + expectf(1.0, values[0]); + expectf(0.0, values[1]); + expectf(0.0, values[2]); + expectf(1.0, values[3]); + expectf(0.0, values[4]); + expectf(0.0, values[5]); + + GdipCreateMatrix2(3.0, -2.0, 5.0, 2.0, 6.0, 3.0, &matrix2); + status = GdipSetPenTransform(pen, matrix2); + expect(Ok, status); + GdipDeleteMatrix(matrix2); + + status = GdipGetPenTransform(pen, matrix); + expect(Ok, status); + status = GdipGetMatrixElements(matrix, values); + expect(Ok, status); + expectf(3.0, values[0]); + expectf(-2.0, values[1]); + expectf(5.0, values[2]); + expectf(2.0, values[3]); + expectf(6.0, values[4]); + expectf(3.0, values[5]); + + status = GdipResetPenTransform(pen); + expect(Ok, status); + + status = GdipGetPenTransform(pen, matrix); + expect(Ok, status); + status = GdipGetMatrixElements(matrix, values); + expect(Ok, status); + + expectf(1.0, values[0]); + expectf(0.0, values[1]); + expectf(0.0, values[2]); + expectf(1.0, values[3]); + expectf(0.0, values[4]); + expectf(0.0, values[5]); + + GdipDeletePen(pen); + + GdipDeleteMatrix(matrix); +} + START_TEST(pen) { struct GdiplusStartupInput gdiplusStartupInput; @@ -393,6 +455,7 @@ test_customcap(); test_penfilltype(); test_compoundarray(); + test_transform();
GdiplusShutdown(gdiplusToken); }