Skip to content

MathML: Test italic correction of sub and super scripts attached to a large operator - #9993

Merged
fred-wang merged 4 commits into
masterfrom
largeop-subsup-italic-correction
Mar 22, 2018
Merged

fred-wang merged 4 commits into
masterfrom
largeop-subsup-italic-correction

Conversation

@fred-wang

@fred-wang fred-wang commented Mar 13, 2018 •

Copy link
Copy Markdown
Contributor

This test italic correction for subsup script (tests for underover should be added in the future). The test passes on WebKit and will replace https://trac.webkit.org/browser/webkit/trunk/LayoutTests/mathml/opentype/large-operators-italic-correction.html (which requires Latin Modern Math to be installed on the WebKit bots).

@ghost

ghost commented Mar 13, 2018 •

Copy link
Copy Markdown

Build PASSED

Started: 2018-03-22 06:12:26
Finished: 2018-03-22 06:19:04

View more information about this build on:

@fred-wang
fred-wang force-pushed the largeop-subsup-italic-correction branch from 10dcca5 to 7583caa Compare March 14, 2018 16:33
@fred-wang

Copy link
Copy Markdown
Contributor Author

screenshot-italic-correction

This is how the test is rendered in Gecko (left) and WebKit (right). Note however that the position of script is wrong in Gecko for the nonzero-italic case (second row) and the rendering of the operator is bad in WebKit in the zero-italic case (first row). WebKit still passes the test but not Gecko.

  • largeop-displayoperatorminheight5000 has a large glyph for U+2AFF N-ARY WHITE VERTICAL BAR that has null italic correction (it is the rectangle displayed in the first row of the Gecko screenshot)
  • The change in largeop.py adds a new file largeop-displayoperatorminheight2000-2AFF-italiccorrection3000 has a large glyph for U+2AFF N-ARY WHITE VERTICAL BAR with italic correction of 3000 (it is the inclined parallelogram displayed in the second row of the WebKit screenshot).
  • minheight values are just to ensure web engines will pick the large glyph of U+2AFF and not the base size.

I pushed a commit to better explain the tests.

cc'ing @davidcarlisle @karlt @khaledhosny for review.

}
</style>
<script>
var emToPx = 10 / 1000; // font-size: 10px, font.em = 1000

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Can we move this closer to where it's used?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done.

</style>
<script>
var emToPx = 10 / 1000; // font-size: 10px, font.em = 1000
var epsilon = 1;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Ditto.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done

var v = 0;
assert_approx_equals(getBox("base001").right - getBox("sub001").left, v, epsilon, "msub");
assert_approx_equals(getBox("sup002").left, getBox("base002").right, epsilon, "msup");
assert_approx_equals(getBox("sup003").left - getBox("sub003").left, v, epsilon, "msubsup");

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

If both are wrongly positioned, but with the same left this will pass.
Wouldn't be better to always compare against "base00X"?
Dunno if that's possible when you the italic correction is applied.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yes, however I'm not sure that's a big deal to "wrongly pass" (Chromium and Edge have many MathML tests passing on wpt.fyi ; just because they succeeded to load the test !). I think it's clearer and more natural to test the italic correction by checking the difference of position of the two scripts. I could add extra tests to check the horizontal position but that kind of tests is already (and more completely done) done by http://w3c-test.org/mathml/presentation-markup/scripts/subsup-parameters-1.html

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The goal of a test is to fail when something is not supported, so it'd be better if they fail.
Anyway I understand we have other tests to check the vertical position of the scripts and also the size of the operator (otherwise we need them).
So the rest can be good enough, we're at least checking against "base00X" in some cases so we'll should catch some issues with it.

}
</script>
</head>
<body>

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Nit: Dunno if this is common or not on MathML test suite, so feel free to ignore these suggestions:

  • I'd add a <div id="log"></div> on the top of the test, so when you open it the testharness output will be on the top.
  • I'd add a title before each section (like <h2>Null Italic Correction</h2> and <h2>NonNull Italic Correction</h2>).

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yes, I never liked that the test results don't show at the top. I actually think it's a good idea and should be done for MathML tests too.

@fred-wang
fred-wang merged commit 74126cb into master Mar 22, 2018
@fred-wang
fred-wang deleted the largeop-subsup-italic-correction branch March 22, 2018 09:06
hubot pushed a commit to WebKit/WebKit-http that referenced this pull request Mar 22, 2018
…talic-correction.html

https://bugs.webkit.org/show_bug.cgi?id=183891

Patch by Frederic Wang <[email protected]> on 2018-03-22
Reviewed by Manuel Rego Casasnovas.

LayoutTests/imported/w3c:

Import WPT test added in web-platform-tests/wpt#9993.

* web-platform-tests/fonts/math/largeop-displayoperatorminheight2000-2AFF-italiccorrection3000.woff: Added.
* web-platform-tests/fonts/math/w3c-import.log:
* web-platform-tests/mathml/presentation-markup/scripts/subsup-parameters-2-expected.txt: Added.
* web-platform-tests/mathml/presentation-markup/scripts/subsup-parameters-2.html: Added.
* web-platform-tests/mathml/presentation-markup/scripts/w3c-import.log:
* web-platform-tests/mathml/tools/largeop.py:

LayoutTests:

Remove large-operators-italic-correction.html. Italic correction is tested more completely by
a new WPT test that does not require Latin Modern Math to be installed on the try bots.

* mathml/opentype/large-operators-italic-correction-expected.txt: Removed.
* mathml/opentype/large-operators-italic-correction.html: Removed.
* platform/ios/TestExpectations: Remove test expectation.
* platform/mac/TestExpectations: Ditto.
* platform/win/TestExpectations: Ditto.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@229847 268f45cc-cd09-0410-ab3c-d52691b4dbfc
ryanhaddad pushed a commit to WebKit/WebKit that referenced this pull request Dec 22, 2020
…talic-correction.html

https://bugs.webkit.org/show_bug.cgi?id=183891

Patch by Frederic Wang <[email protected]> on 2018-03-22
Reviewed by Manuel Rego Casasnovas.

LayoutTests/imported/w3c:

Import WPT test added in web-platform-tests/wpt#9993.

* web-platform-tests/fonts/math/largeop-displayoperatorminheight2000-2AFF-italiccorrection3000.woff: Added.
* web-platform-tests/fonts/math/w3c-import.log:
* web-platform-tests/mathml/presentation-markup/scripts/subsup-parameters-2-expected.txt: Added.
* web-platform-tests/mathml/presentation-markup/scripts/subsup-parameters-2.html: Added.
* web-platform-tests/mathml/presentation-markup/scripts/w3c-import.log:
* web-platform-tests/mathml/tools/largeop.py:

LayoutTests:

Remove large-operators-italic-correction.html. Italic correction is tested more completely by
a new WPT test that does not require Latin Modern Math to be installed on the try bots.

* mathml/opentype/large-operators-italic-correction-expected.txt: Removed.
* mathml/opentype/large-operators-italic-correction.html: Removed.
* platform/ios/TestExpectations: Remove test expectation.
* platform/mac/TestExpectations: Ditto.
* platform/win/TestExpectations: Ditto.

Canonical link: https://commits.webkit.org/199486@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@229847 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants