From ec4cd117b5eec2f544210e9ea7ead72354518ee6 Mon Sep 17 00:00:00 2001 From: Dmitry Timoshkov Date: Mon, 8 Oct 2012 16:51:20 +0900 Subject: [PATCH] gdiplus: Workaround missing support for true floating point regions in Wine gdiplus by using a scaling world transform. This simplifies the test and makes sure that there is no broken workarounds in the tests. --- dlls/gdiplus/tests/graphics.c | 38 +++++++++++++------------------------- 1 file changed, 13 insertions(+), 25 deletions(-) diff --git a/dlls/gdiplus/tests/graphics.c b/dlls/gdiplus/tests/graphics.c index 1b0bff090a5..5219823a46e 100644 --- a/dlls/gdiplus/tests/graphics.c +++ b/dlls/gdiplus/tests/graphics.c @@ -3729,7 +3729,7 @@ static void test_font_height_scaling(void) PointF ptf; GpUnit gfx_unit, font_unit; - status = GdipCreateStringFormat(0, LANG_NEUTRAL, &format); + status = GdipCreateStringFormat(StringFormatFlagsNoWrap, LANG_NEUTRAL, &format); expect(Ok, status); status = GdipSetStringFormatMeasurableCharacterRanges(format, 1, &range); expect(Ok, status); @@ -3790,6 +3790,9 @@ static void test_font_height_scaling(void) return; } + status = GdipScaleWorldTransform(graphics, 0.01, 0.01, MatrixOrderAppend); + expect(Ok, status); + /* UnitPixel = 2, UnitPoint = 3, UnitInch = 4, UnitDocument = 5, UnitMillimeter = 6 */ /* UnitPixel as a font base unit is not tested because it drastically differs in behaviour */ @@ -3834,7 +3837,8 @@ static void test_font_height_scaling(void) /* verify the result */ ptf.Y = units_to_pixels(bounds.Height, gfx_unit, dpi); - match = fabs(100.0 - ptf.Y) <= 1.1; + ptf.Y /= 100.0; + match = fabs(100.0 - ptf.Y) <= 1.0; ok(match, "Expected 100.0, got %f\n", ptf.Y); /* bounds.width of 1 glyph: [margin]+[width]+[margin] */ @@ -3857,38 +3861,22 @@ static void test_font_height_scaling(void) expect(Ok, status); set_rect_empty(&rect); - rect.Width = 32000.0; - rect.Height = 32000.0; + rect.Width = 320000.0; + rect.Height = 320000.0; status = GdipMeasureCharacterRanges(graphics, string, -1, font, &rect, format, 1, ®ion); expect(Ok, status); set_rect_empty(&rect); status = GdipGetRegionBounds(region, graphics, &rect); expect(Ok, status); /*trace("region: %f,%f,%f,%f\n", rect.X, rect.Y, rect.Width, rect.Height);*/ - /* FIXME: Wine uses integer gdi32 regions and rounding breaks things */ - if (margin < 1.0) - todo_wine ok(rect.X > 0.0, "wrong rect.X %f\n", rect.X); - else ok(rect.X > 0.0, "wrong rect.X %f\n", rect.X); expectf(0.0, rect.Y); - /* FIXME: Wine uses integer gdi32 regions and rounding breaks things */ - if (margin < 1.0) - { - match = fabs(margin - rect.X) < 0.25; + match = fabs(1.0 - margin / rect.X) <= 0.05; ok(match, "Expected %f, got %f\n", margin, rect.X); - } - else - { - match = fabs(margin - rect.X) <= 0.5; - ok(match, "Expected %f, got %f\n", margin, rect.X); - } - /* FIXME: Wine uses integer gdi32 regions and rounding breaks things */ - if (height < 1.0) - expectf_(height, rect.Height, height / 15.0); - else -todo_wine - expectf_(height, rect.Height, height / 15.0); - expectf_(bounds.Width, rect.Width + margin * 2.0, bounds.Width / 15.0); + match = fabs(1.0 - height / rect.Height) <= 0.1; + ok(match, "Expected %f, got %f\n", height, rect.Height); + match = fabs(1.0 - bounds.Width / (rect.Width + margin * 2.0)) <= 0.05; + ok(match, "Expected %f, got %f\n", bounds.Width, rect.Width + margin * 2.0); } GdipDeleteFont(font); -- 2.11.4.GIT