Ziqing Hui : gdiplus/tests: Add tests for GdipMeasureString with StringFormatFlagsNoWrap.

Alexandre Julliard julliard at winehq.org
Fri Oct 23 14:27:18 CDT 2020


Module: wine
Branch: master
Commit: 3f228497a891fd135cbad4674f23afed0119fe72
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=3f228497a891fd135cbad4674f23afed0119fe72

Author: Ziqing Hui <zhui at codeweavers.com>
Date:   Fri Oct 23 10:22:00 2020 +0800

gdiplus/tests: Add tests for GdipMeasureString with StringFormatFlagsNoWrap.

Signed-off-by: Ziqing Hui <zhui at codeweavers.com>
Signed-off-by: Esme Povirk <esme at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/gdiplus/tests/graphics.c | 55 +++++++++++++++++++++++++++++++++++++++++--
 1 file changed, 53 insertions(+), 2 deletions(-)

diff --git a/dlls/gdiplus/tests/graphics.c b/dlls/gdiplus/tests/graphics.c
index 1dbb0ae279f..24fc91a1bfe 100644
--- a/dlls/gdiplus/tests/graphics.c
+++ b/dlls/gdiplus/tests/graphics.c
@@ -4449,8 +4449,9 @@ static void test_measure_string(void)
 {
     static const WCHAR tahomaW[] = { 'T','a','h','o','m','a',0 };
     static const WCHAR string[] = { 'A','0','1',0 };
+    static const WCHAR string2[] = { 'M',' ','M','M',0 };
     HDC hdc;
-    GpStringFormat *format;
+    GpStringFormat *format, *format_no_wrap;
     CharacterRange range;
     GpRegion *region;
     GpGraphics *graphics;
@@ -4458,7 +4459,7 @@ static void test_measure_string(void)
     GpFont *font;
     GpStatus status;
     RectF bounds, rect;
-    REAL width, height, width_1, width_2;
+    REAL width, height, width_1, width_2, width_MM, width_M_M;
     REAL margin_x, margin_y, width_rgn, height_rgn;
     int lines, glyphs;
 
@@ -4856,6 +4857,55 @@ todo_wine
     expectf_(width_rgn, bounds.Width, 1.0);
     expectf_(height_rgn, bounds.Height, 1.0);
 
+    /* Measure "MM" */
+    rect.X = 5.0;
+    rect.Y = 5.0;
+    rect.Width = 32000.0;
+    rect.Height = 32000.0;
+    status = GdipMeasureString(graphics, string2 + 2, 2, font, &rect, NULL, &bounds, &glyphs, &lines);
+    expect(Ok, status);
+    expect(2, glyphs);
+    expect(1, lines);
+    width_MM = bounds.Width;
+
+    /* Measure "M M" */
+    rect.X = 5.0;
+    rect.Y = 5.0;
+    rect.Width = 32000.0;
+    rect.Height = 32000.0;
+    status = GdipMeasureString(graphics, string2, 3, font, &rect, NULL, &bounds, &glyphs, &lines);
+    expect(Ok, status);
+    expect(3, glyphs);
+    expect(1, lines);
+    width_M_M = bounds.Width;
+
+    /* With wrap */
+    rect.X = 5.0;
+    rect.Y = 5.0;
+    rect.Width = width_M_M;
+    rect.Height = 32000.0;
+    status = GdipMeasureString(graphics, string2, -1, font, &rect, NULL, &bounds, &glyphs, &lines);
+    expect(Ok, status);
+    expectf_(width_MM, bounds.Width, 0.1);
+    expect(4, glyphs);
+    expect(2, lines);
+
+    /* Without wrap */
+    status = GdipCreateStringFormat(StringFormatFlagsNoWrap, LANG_NEUTRAL, &format_no_wrap);
+    expect(Ok, status);
+
+    rect.X = 5.0;
+    rect.Y = 5.0;
+    rect.Width = width_M_M;
+    rect.Height = 32000.0;
+    status = GdipMeasureString(graphics, string2, -1, font, &rect, format_no_wrap, &bounds, &glyphs, &lines);
+    expect(Ok, status);
+    todo_wine {
+    expectf_(width_M_M, bounds.Width, 0.1);
+    expect(3, glyphs);
+    }
+    expect(1, lines);
+
     status = GdipDeleteFont(font);
     expect(Ok, status);
 
@@ -4866,6 +4916,7 @@ todo_wine
     GdipDeleteFontFamily(family);
     GdipDeleteRegion(region);
     GdipDeleteStringFormat(format);
+    GdipDeleteStringFormat(format_no_wrap);
 }
 
 static void test_measured_extra_space(void)




More information about the wine-cvs mailing list