forked from Floorp-Projects/Floorp
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bug 1883840 - Export layout/reftests/radicalbar*.html to WPT. r=emilio
In this patch, MathML reftests radicalbar*.html are converted to WPT. These tests rely on the `reftest-zoom` attribute to verify that the radical bar does not disappear at smaller zoom level (bug 1011020). However, this attribute is not supported by WPT. So we keep them as internal tests for now, emulating support for the `reftest-zoom` attribute via the `SpecialPowers.*fullZoom` API. It was verified that reverting the patch for bug 1011020 make these reftests fail, contrary to alternative approaches (CSS zoom property and `SpecialPowers.snapshotWindowWithOptions). Please refer to bug 1850661 for the initial attempts. A `common/reftest-zoom.js` file is introduced so that it could be used by similar tests in the future. Infrastructure tests are added to verify the basic behavior. Differential Revision: https://phabricator.services.mozilla.com/D203728
- Loading branch information
Showing
31 changed files
with
185 additions
and
72 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 2 additions & 0 deletions
2
testing/web-platform/mozilla/meta/infrastructure/reftest-zoom/clamp-full-zoom-001.html.ini
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
[clamp-full-zoom-001.html] | ||
prefs: [zoom.minPercent:50] |
2 changes: 2 additions & 0 deletions
2
testing/web-platform/mozilla/meta/infrastructure/reftest-zoom/clamp-full-zoom-002.html.ini
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
[clamp-full-zoom-002.html] | ||
prefs: [zoom.maxPercent:200] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
// This JS file allows to emulate reftest-zoom. | ||
// See https://firefox-source-docs.mozilla.org/layout/Reftest.html#zoom-tests-reftest-zoom-float | ||
|
||
// Retrieve reftest-zoom attribute. | ||
const reftestZoom = "reftest-zoom"; | ||
const root = document.documentElement; | ||
if (!root.hasAttribute(reftestZoom)) { | ||
throw new Error(`${reftestZoom} attribute not found on the root element.`); | ||
} | ||
|
||
// Parse reftest-zoom value. | ||
let zoom = parseFloat(root.getAttribute(reftestZoom)); | ||
if (Number.isNaN(zoom)) { | ||
throw new Error(`${reftestZoom} is not a float number.`); | ||
} | ||
|
||
// Clamp reftest-zoom value. | ||
let minZoom = SpecialPowers.getIntPref("zoom.minPercent") / 100; | ||
let maxZoom = SpecialPowers.getIntPref("zoom.maxPercent") / 100; | ||
zoom = Math.min(Math.max(zoom, minZoom), maxZoom); | ||
|
||
// Ensure the original zoom level is restored after the screenshot. | ||
const originalZoom = SpecialPowers.getFullZoom(window); | ||
window.addEventListener("beforeunload", () => { | ||
SpecialPowers.setFullZoom(window, originalZoom); | ||
}); | ||
|
||
// Set the zoom level to the specified value. | ||
SpecialPowers.setFullZoom(window, zoom); |
4 changes: 4 additions & 0 deletions
4
testing/web-platform/mozilla/tests/infrastructure/reftest-zoom/clamp-full-zoom-001-ref.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
<!DOCTYPE html> | ||
<html style="zoom: .5"> | ||
<div style="width: 500px; height: 500px; background: green"></div> | ||
</html> |
9 changes: 9 additions & 0 deletions
9
testing/web-platform/mozilla/tests/infrastructure/reftest-zoom/clamp-full-zoom-001.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<!DOCTYPE html> | ||
<html reftest-zoom="0"> | ||
<link rel="help" href="https://firefox-source-docs.mozilla.org/layout/Reftest.html#zoom-tests-reftest-zoom-float"/> | ||
<link rel="match" href="clamp-full-zoom-001-ref.html"/> | ||
<!-- zoom.minPercent is set to 50 in the corresponding ini file. --> | ||
<meta name="assert" content="Zoom is at least by zoom.minPercent."/> | ||
<script src="/_mozilla/common/reftest-zoom.js"></script> | ||
<div style="width: 500px; height: 500px; background: green"></div> | ||
</html> |
4 changes: 4 additions & 0 deletions
4
testing/web-platform/mozilla/tests/infrastructure/reftest-zoom/clamp-full-zoom-002-ref.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
<!DOCTYPE html> | ||
<html style="zoom: 2"> | ||
<div style="width: 250px; height: 250px; background: green"></div> | ||
</html> |
9 changes: 9 additions & 0 deletions
9
testing/web-platform/mozilla/tests/infrastructure/reftest-zoom/clamp-full-zoom-002.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<!DOCTYPE html> | ||
<html reftest-zoom="10"> | ||
<link rel="help" href="https://firefox-source-docs.mozilla.org/layout/Reftest.html#zoom-tests-reftest-zoom-float"/> | ||
<link rel="match" href="clamp-full-zoom-002-ref.html"/> | ||
<!-- zoom.maxPercent is set to 200 in the corresponding ini file. --> | ||
<meta name="assert" content="Zoom is at most by zoom.maxPercent."/> | ||
<script src="/_mozilla/common/reftest-zoom.js"></script> | ||
<div style="width: 250px; height: 250px; background: green"></div> | ||
</html> |
4 changes: 4 additions & 0 deletions
4
testing/web-platform/mozilla/tests/infrastructure/reftest-zoom/set-full-zoom-001-ref.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
<!DOCTYPE html> | ||
<html style="zoom: .5"> | ||
<div style="width: 500px; height: 500px; background: green"></div> | ||
</html> |
8 changes: 8 additions & 0 deletions
8
testing/web-platform/mozilla/tests/infrastructure/reftest-zoom/set-full-zoom-001.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<!DOCTYPE html> | ||
<html reftest-zoom=".5"> | ||
<link rel="help" href="https://firefox-source-docs.mozilla.org/layout/Reftest.html#zoom-tests-reftest-zoom-float"/> | ||
<link rel="match" href="set-full-zoom-001-ref.html"/> | ||
<meta name="assert" content="Zoom less than one scales down the rect."/> | ||
<script src="/_mozilla/common/reftest-zoom.js"></script> | ||
<div style="width: 500px; height: 500px; background: green"></div> | ||
</html> |
4 changes: 4 additions & 0 deletions
4
testing/web-platform/mozilla/tests/infrastructure/reftest-zoom/set-full-zoom-002-ref.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
<!DOCTYPE html> | ||
<html style="zoom: 2"> | ||
<div style="width: 250px; height: 250px; background: green"></div> | ||
</html> |
8 changes: 8 additions & 0 deletions
8
testing/web-platform/mozilla/tests/infrastructure/reftest-zoom/set-full-zoom-002.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<!DOCTYPE html> | ||
<html reftest-zoom="2"> | ||
<link rel="help" href="https://firefox-source-docs.mozilla.org/layout/Reftest.html#zoom-tests-reftest-zoom-float"/> | ||
<link rel="match" href="set-full-zoom-002-ref.html"/> | ||
<meta name="assert" content="Zoom more than one scales up the rect."/> | ||
<script src="/_mozilla/common/reftest-zoom.js"></script> | ||
<div style="width: 250px; height: 250px; background: green"></div> | ||
</html> |
4 changes: 4 additions & 0 deletions
4
testing/web-platform/mozilla/tests/infrastructure/reftest-zoom/set-full-zoom-003-ref.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
<!DOCTYPE html> | ||
<html style="zoom: 1"> | ||
<div style="width: 250px; height: 250px; background: green"></div> | ||
</html> |
9 changes: 9 additions & 0 deletions
9
testing/web-platform/mozilla/tests/infrastructure/reftest-zoom/set-full-zoom-003.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<link rel="match" href="set-full-zoom-003-ref.html"/> | ||
<meta name="assert" content="Initial zoom is equal to one."/> | ||
<!-- Note that when running all the tests by alphabetical order, this test | ||
would fail if set-zoom-002.html does not reset the zoom to one. | ||
It would pass when re-running after a browser restart, though. --> | ||
<div style="width: 250px; height: 250px; background: green"></div> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 5 additions & 3 deletions
8
layout/reftests/mathml/radicalbar-1.html → ...zilla/tests/mathml/zoom/radicalbar-1.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 6 additions & 3 deletions
9
layout/reftests/mathml/radicalbar-1a.html → ...illa/tests/mathml/zoom/radicalbar-1a.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 6 additions & 3 deletions
9
layout/reftests/mathml/radicalbar-1b.html → ...illa/tests/mathml/zoom/radicalbar-1b.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 6 additions & 3 deletions
9
layout/reftests/mathml/radicalbar-1c.html → ...illa/tests/mathml/zoom/radicalbar-1c.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 6 additions & 3 deletions
9
layout/reftests/mathml/radicalbar-1d.html → ...illa/tests/mathml/zoom/radicalbar-1d.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 5 additions & 3 deletions
8
layout/reftests/mathml/radicalbar-2.html → ...zilla/tests/mathml/zoom/radicalbar-2.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 6 additions & 3 deletions
9
layout/reftests/mathml/radicalbar-2a.html → ...illa/tests/mathml/zoom/radicalbar-2a.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 6 additions & 3 deletions
9
layout/reftests/mathml/radicalbar-2b.html → ...illa/tests/mathml/zoom/radicalbar-2b.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 6 additions & 3 deletions
9
layout/reftests/mathml/radicalbar-2c.html → ...illa/tests/mathml/zoom/radicalbar-2c.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 6 additions & 3 deletions
9
layout/reftests/mathml/radicalbar-2d.html → ...illa/tests/mathml/zoom/radicalbar-2d.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 5 additions & 3 deletions
8
layout/reftests/mathml/radicalbar-3.html → ...zilla/tests/mathml/zoom/radicalbar-3.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 6 additions & 3 deletions
9
layout/reftests/mathml/radicalbar-3a.html → ...illa/tests/mathml/zoom/radicalbar-3a.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.