gdiplus: Add test for measuring a single line that exactly fits.
Vincent Povirk
madewokherd at gmail.com
Thu May 30 17:08:08 CDT 2013
This mirrors a pattern I'm seeing where a program measures a string
and uses the resulting measurement as bounds to draw it. If the string
ends in a newline, with wine's gdiplus it doesn't actually fit. This
is because our line-wrap code doesn't handle the case where we can fit
the entire contents of a line but not the newline character.
I haven't found a way to fix this yet without breaking any existing tests.
-------------- next part --------------
From eddfd370d3a208c1ec99a867e0313b327fc6c631 Mon Sep 17 00:00:00 2001
From: Vincent Povirk <vincent at codeweavers.com>
Date: Thu, 30 May 2013 14:47:13 -0500
Subject: [PATCH] gdiplus: Add test for measuring a single line that exactly
fits.
---
dlls/gdiplus/tests/graphics.c | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
diff --git a/dlls/gdiplus/tests/graphics.c b/dlls/gdiplus/tests/graphics.c
index cbe0b9d..5de0602 100644
--- a/dlls/gdiplus/tests/graphics.c
+++ b/dlls/gdiplus/tests/graphics.c
@@ -3042,6 +3042,23 @@ static void test_string_functions(void)
expect(2, linesfilled);
char_height = bounds.Height - char_bounds.Height;
+ /* Measure the first line. */
+ status = GdipMeasureString(graphics, teststring, 4, font, &rc, NULL, &bounds, &codepointsfitted, &linesfilled);
+ expect(Ok, status);
+ expectf(0.0, bounds.X);
+ expectf(0.0, bounds.Y);
+ expect(4, codepointsfitted);
+ expect(1, linesfilled);
+
+ /* Give just enough space to fit the first line. */
+ rc.Width = bounds.Width;
+ status = GdipMeasureString(graphics, teststring, 5, font, &rc, NULL, &bounds, &codepointsfitted, &linesfilled);
+ expect(Ok, status);
+ expectf(0.0, bounds.X);
+ expectf(0.0, bounds.Y);
+ todo_wine expect(5, codepointsfitted);
+ todo_wine expect(1, linesfilled);
+
/* Cut off everything after the first space. */
rc.Width = char_bounds.Width + char_width * 2.1;
--
1.8.1.2
More information about the wine-patches
mailing list