Use testharness.js for the MathML script tests

NEW
Assigned to

Status

()

Core
MathML
2 years ago
2 years ago

People

(Reporter: fredw, Assigned: jkitch)

Tracking

Trunk
Points:
---

Firefox Tracking Flags

(firefox47 affected)

Details

(URL)

Attachments

(2 attachments)

(Reporter)

Description

2 years ago
Follow-up of bug 1240799 comment 5.

We currently have several MathML "script" tests defining similar testing functions. We could instead just use the API from testharness.js so that we avoid duplicating code. This will also make easier to share the tests with the testthewebforward project (or for now tests.mathml-association.org) or with other rendering engines.

See also https://bugs.webkit.org/show_bug.cgi?id=154065 for the corresponding bug entry in WebKit.
(Assignee)

Comment 1

2 years ago
Minimal changes were needed to get the tests from bug 1240799 description work as mochitest-plain tests.

I'll work on converting the other in-tree script tests.
Assignee: nobody → jkitch.bug
(Assignee)

Comment 2

2 years ago
Created attachment 8738493 [details] [diff] [review]
Mochitest conversions

Mochitests converted to testharness.

Not all were suitable for conversion.  Some invoke special powers or preference manipulation.
Attachment #8738493 - Flags: review?(fred.wang)
(Assignee)

Comment 3

2 years ago
Created attachment 8738496 [details] [diff] [review]
Reftest conversions

I've looked over the reftests and identified 4 which are suitable for conversion.

These are the dynamic ones which do not manipulate preferences and do not require mozReftestInvalidate.
Attachment #8738496 - Flags: review?(fred.wang)
(Reporter)

Comment 4

2 years ago
Comment on attachment 8738493 [details] [diff] [review]
Mochitest conversions

Review of attachment 8738493 [details] [diff] [review]:
-----------------------------------------------------------------

::: layout/mathml/tests/test_opentype-axis-height.html
@@ +24,5 @@
>        function getBox(aId) {
>          return document.getElementById(aId).getBoundingClientRect();
>        }
>  
> +      var test_loaded = async_test("Page Loaded");

For this and other tests, you can actually use

setup({ explicit_done: true });

and then replace

test_loaded.done();

with

done();

@@ +26,5 @@
>        }
>  
> +      var test_loaded = async_test("Page Loaded");
> +      window.addEventListener("load", function() {
> +        runTests();

Maybe waiting for web fonts with

document.fonts.ready.then(runTests);

will give more reliable result.
Attachment #8738493 - Flags: review?(fred.wang) → review+
(Reporter)

Comment 5

2 years ago
Comment on attachment 8738496 [details] [diff] [review]
Reftest conversions

Review of attachment 8738496 [details] [diff] [review]:
-----------------------------------------------------------------

::: layout/mathml/tests/test_stretchy-largeop-3.html
@@ +130,5 @@
> +      var numTests = 10; // zero indexed
> +      var opPrefix = "mo";
> +      var refPrefix = "moRef";
> +      var epsilon = 2;
> +      

extra tab

::: layout/mathml/tests/test_subscript-italic-correction.html
@@ +47,5 @@
> +        var sup = "s" + (i+1);
> +        var italicCorrection = boxLeft(sup) - boxLeft(sub);
> +        tests.push([sub + " vs " + sup, italicCorrection >= epsilon]);
> +      }
> +       

extra tab
Attachment #8738496 - Flags: review?(fred.wang) → review+
Note that for running these tests as web-platform-tests in the Mozilla tree we can set a pref for the lifetime of the test using the ini file; see [1]. I don't know if that helps with any of the cases you couldn't convert, or if they are specifically testing the behaviour when a pref is changed at runtime.

Note also what an advantage it would be to upstream these to web-platform-tests directly where all this machinery is already in place.

[1] https://developer.mozilla.org/en-US/docs/Mozilla/QA/web-platform-tests#Setting_prefs
(Reporter)

Updated

2 years ago
Blocks: 1262744
(Assignee)

Comment 7

2 years ago
That should help one test.

Where would the tests live within the web-platform-test hierarchy?  I have not been able to find any non-trivial uses of MathML.
Under /mathml/ presumably. That doesn't exist yet, but there's no reason it shouldn't.
You need to log in before you can comment on or make changes to this bug.