Open Bug 1248119 Opened 8 years ago Updated 2 years ago

Use testharness.js for the MathML script tests

Categories

(Core :: MathML, defect)

defect

Tracking

()

Tracking Status
firefox47 --- affected

People

(Reporter: fredw, Unassigned)

References

()

Details

Attachments

(2 files)

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.
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
Mochitests converted to testharness.

Not all were suitable for conversion.  Some invoke special powers or preference manipulation.
Attachment #8738493 - Flags: review?(fred.wang)
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)
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+
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
Blocks: 1262744
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.

The bug assignee didn't login in Bugzilla in the last 7 months, so the assignee is being reset.

Assignee: jkitch.bug → nobody
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: