Skip to content
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

Merged
merged 5 commits into from
Mar 31, 2018

Conversation

filipnavara
Copy link
Contributor

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.

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);
Copy link
Contributor

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?

Copy link
Contributor

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

Copy link
Contributor Author

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.

Copy link
Contributor Author

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.

@filipnavara filipnavara changed the title Add initial tests for GdipMeasureString Add initial tests for GdipMeasureString and fix Pango text backend to pass them Mar 31, 2018
@filipnavara
Copy link
Contributor Author

@monojenkins build

Copy link
Member

@akoeplinger akoeplinger left a 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;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

0.5 please

Copy link
Contributor Author

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 },
Copy link
Member

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);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here.

@akoeplinger akoeplinger merged commit 0a27652 into mono:master Mar 31, 2018
@filipnavara filipnavara deleted the testtext2 branch March 31, 2018 23:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants