-
Notifications
You must be signed in to change notification settings - Fork 172
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add initial tests for GdipMeasureString and fix Pango text backend to pass them #268
Conversation
tests/testtext.c
Outdated
set_rect_empty (&bounds); | ||
status = GdipMeasureString (graphics, teststring1, 4, font, &rect, format, &bounds, &glyphs, &lines); | ||
expect (Ok, status); | ||
TODO expect (4, glyphs); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we still need these todos?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(I’m assuming that these are for wine instead of for libgdiplus)
Maybe we can also use the #if USE_WINDOWS_GDIPLUS macro to be clearer about this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These test are not from Wine (unlike the other PR). Yes, we need them, unfortunately.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can wrap the TODO
macro with #if USE_WINDOWS_GDIPLUS
. I'd prefer that over having #if
all over the place.
…s for calculating codepointsFitted in pango_MeasureString.
@monojenkins build |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
some style issues, looks good otherwise.
src/text-pango.c
Outdated
@@ -481,25 +486,25 @@ gdip_pango_setup_layout (GpGraphics *graphics, GDIPCONST WCHAR *stringUnicode, i | |||
case StringAlignmentNear: | |||
break; | |||
case StringAlignmentCenter: | |||
box_offset->Y += (rc->Height - box->Height) / 2; | |||
box_offset->Y += (FrameHeight - box->Height) * .5; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
0.5
please
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
tests/testtext.c
Outdated
{ 0, StringAlignmentFar, StringAlignmentCenter, -1., 200, -.5, 50, 0, 200, .5, 50 }, | ||
{ 0, StringAlignmentNear, StringAlignmentFar, 0, 0, -1., 100, 1., 0, 0, 100 }, | ||
{ 0, StringAlignmentCenter, StringAlignmentFar, -.5, 100, -1., 100, .5, 100, 0, 100 }, | ||
{ 0, StringAlignmentFar, StringAlignmentFar, -1., 200, -1., 100, 0, 200, 0, 100 }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
-0.5
, 1.0
etc here too.
tests/testtext.c
Outdated
expectf_ (td[i].x_x0 + td[i].x_xx * bounds.Width + 5., bounds.X, 0.6); | ||
expectf_ (td[i].y_y0 + td[i].y_yy * bounds.Height + 10., bounds.Y, 0.6); | ||
expectf_ (td[i].right_x0 + td[i].right_xx * bounds.Width + 5., bounds.X + bounds.Width, 0.6); | ||
expectf_ (td[i].bottom_y0 + td[i].bottom_yy * bounds.Height + 10., bounds.Y + bounds.Height, 0.6); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same here.
Unfortunately the Cairo text backend is too broken for the tests to be enabled there, so I initially enable them only when Pango text backend is used. Even now some of the tests are disabled because of small issues in the Pango code.