diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 09:22:09 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 09:22:09 +0000 |
commit | 43a97878ce14b72f0981164f87f2e35e14151312 (patch) | |
tree | 620249daf56c0258faa40cbdcf9cfba06de2a846 /testing/web-platform/tests/css/css-text/word-spacing | |
parent | Initial commit. (diff) | |
download | firefox-43a97878ce14b72f0981164f87f2e35e14151312.tar.xz firefox-43a97878ce14b72f0981164f87f2e35e14151312.zip |
Adding upstream version 110.0.1.upstream/110.0.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'testing/web-platform/tests/css/css-text/word-spacing')
7 files changed, 195 insertions, 0 deletions
diff --git a/testing/web-platform/tests/css/css-text/word-spacing/reference/ref-filled-green-100px-square.xht b/testing/web-platform/tests/css/css-text/word-spacing/reference/ref-filled-green-100px-square.xht new file mode 100644 index 0000000000..05a1379448 --- /dev/null +++ b/testing/web-platform/tests/css/css-text/word-spacing/reference/ref-filled-green-100px-square.xht @@ -0,0 +1,19 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> + <head> + <title>CSS Reftest Reference</title> + <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/" /> + <style type="text/css"><![CDATA[ + div + { + background-color: green; + height: 100px; + width: 100px; + } + ]]></style> + </head> + <body> + <p>Test passes if there is a filled green square and <strong>no red</strong>.</p> + <div></div> + </body> +</html> diff --git a/testing/web-platform/tests/css/css-text/word-spacing/support/swatch-blue.png b/testing/web-platform/tests/css/css-text/word-spacing/support/swatch-blue.png Binary files differnew file mode 100644 index 0000000000..bf2759634d --- /dev/null +++ b/testing/web-platform/tests/css/css-text/word-spacing/support/swatch-blue.png diff --git a/testing/web-platform/tests/css/css-text/word-spacing/support/swatch-orange.png b/testing/web-platform/tests/css/css-text/word-spacing/support/swatch-orange.png Binary files differnew file mode 100644 index 0000000000..d3cd498b52 --- /dev/null +++ b/testing/web-platform/tests/css/css-text/word-spacing/support/swatch-orange.png diff --git a/testing/web-platform/tests/css/css-text/word-spacing/word-spacing-001-ref.html b/testing/web-platform/tests/css/css-text/word-spacing/word-spacing-001-ref.html new file mode 100644 index 0000000000..d4cdb54d11 --- /dev/null +++ b/testing/web-platform/tests/css/css-text/word-spacing/word-spacing-001-ref.html @@ -0,0 +1,26 @@ +<!DOCTYPE html> +<title>CSS Text Test: Word Spacing</title> +<link rel="author" title="Nicholas Nethercote" href="mailto:nnethercote@mozilla.com"> +<link rel="stylesheet" href="/fonts/ahem.css"> +<meta name="flags" content="ahem"> +<style> +@font-face { + font-family: Ahem; + src: url(/fonts/Ahem.ttf); +} +/* We use Ahem to avoid very minor differences between the test and the + reference that occur with certain font+platform combinations. */ +div { font-family: Ahem; font-size: 20px; } +span.padoneem { padding-left: 1em; } +</style> +<body> + <p>Test passes if the space between the words starts at zero and increases by + one on each subsequent line.</p> + <div>ABcDefGhij</div> + <div>A Bc Def Ghij</div> + <div>A Bc Def Ghij</div> + <div>A Bc Def Ghij</div> + <div>A Bc Def Ghij</div> + <div>A Bc Def Ghij</div> + <div>A <span class="padoneem">Bc <span class="padoneem">Def <span class="padoneem">Ghij <span class="padoneem"></div> +</body> diff --git a/testing/web-platform/tests/css/css-text/word-spacing/word-spacing-001.html b/testing/web-platform/tests/css/css-text/word-spacing/word-spacing-001.html new file mode 100644 index 0000000000..f9ffc9c323 --- /dev/null +++ b/testing/web-platform/tests/css/css-text/word-spacing/word-spacing-001.html @@ -0,0 +1,35 @@ +<!DOCTYPE html> +<title>CSS Text Test: Word Spacing</title> +<link rel="author" title="Nicholas Nethercote" href="mailto:nnethercote@mozilla.com"> +<link rel="help" href="http://www.w3.org/TR/css-text-3/#word-spacing"> +<link rel="stylesheet" href="/fonts/ahem.css"> +<link rel="match" href="word-spacing-001-ref.html"> +<meta name="flags" content="ahem"> +<meta name="assert" content="Test checks that word-spacing works with percentages."> +<style> +@font-face { + font-family: Ahem; + src: url(/fonts/Ahem.ttf); +} +/* We use Ahem to avoid very minor differences between the test and the + reference that occur with certain font+platform combinations. */ +div { font-family: Ahem; font-size: 20px; } +div.wsn100 { word-spacing: -100%; } +div.wsn40 { word-spacing: -40%; } +div.ws0 { word-spacing: 0%; } +div.ws25 { word-spacing: calc(25% + 0px); } +div.ws100 { word-spacing: 100%; } +div.ws300 { word-spacing: calc(100% + 6em + 50%*4 - 12em/2); } +div.ws400p1 { word-spacing: calc(400% + 1em); } +</style> +<body> + <p>Test passes if the space between the words starts at zero and increases by + one on each subsequent line.</p> + <div class="wsn100" >A Bc Def Ghij</div> + <div class="ws0" >A Bc Def Ghij</div> + <div class="ws100" >A Bc Def Ghij</div> + <div class="wsn40" >A Bc Def Ghij</div> + <div class="ws300" >A Bc Def Ghij</div> + <div class="ws25" >A Bc Def Ghij</div> + <div class="ws400p1">A Bc Def Ghij</div> +</body> diff --git a/testing/web-platform/tests/css/css-text/word-spacing/word-spacing-computed-001.html b/testing/web-platform/tests/css/css-text/word-spacing/word-spacing-computed-001.html new file mode 100644 index 0000000000..a641fc2353 --- /dev/null +++ b/testing/web-platform/tests/css/css-text/word-spacing/word-spacing-computed-001.html @@ -0,0 +1,84 @@ +<!DOCTYPE html> + + <meta charset="UTF-8"> + + <title>CSS Text Test: computed value of 'word-spacing: normal' and of various <length></title> + + <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/"> + <link rel="help" href="https://www.w3.org/TR/css-text-3/#word-spacing-property"> + + <meta content="This test checks that the computed value of 'normal' for the property word-spacing is '0px'. We also check the computed value of various <length>." name="assert"> + + <script src="/resources/testharness.js"></script> + + <script src="/resources/testharnessreport.js"></script> + + <style> + div#target + { + font-size: 20px; + } + </style> + + <div id="target">A Z</div> + + <div id="log"></div> + + <script> + function startTesting() + { + + var targetElement = document.getElementById("target"); + + function verifyComputedStyle(property_name, specified_value, expected_value, description) + { + + test(function() + { + + targetElement.style.setProperty(property_name, "91px"); + + /* + The purpose of setting the property to an arbitrary value + is to act as a fallback value in case the specified value + fails. Since we are running 12 consecutive tests on the + same element, then it is necessary to 'reset' its property + to an arbitrary value. + */ + + targetElement.style.setProperty(property_name, specified_value); + + assert_equals(getComputedStyle(targetElement)[property_name], expected_value); + + }, description); + } + + verifyComputedStyle("word-spacing", "normal", "0px", "testing word-spacing: normal"); + + verifyComputedStyle("word-spacing", "0", "0px", "testing word-spacing: 0"); + + verifyComputedStyle("word-spacing", "1.27cm", "48px", "testing word-spacing: 1.27cm"); + + verifyComputedStyle("word-spacing", "1em", "20px", "testing word-spacing: 1em"); + + verifyComputedStyle("word-spacing", "0.5in", "48px", "testing word-spacing: 0.5in"); + + verifyComputedStyle("word-spacing", "25.4mm", "96px", "testing word-spacing: 25.4mm"); + + verifyComputedStyle("word-spacing", "5pc", "80px", "testing word-spacing: 5pc"); + + verifyComputedStyle("word-spacing", "18pt", "24px", "testing word-spacing: 18pt"); + + verifyComputedStyle("word-spacing", "7px", "7px", "testing word-spacing: 7px"); + + verifyComputedStyle("word-spacing", "101.6Q", "96px", "testing word-spacing: 101.6Q"); + + verifyComputedStyle("word-spacing", "3rem", "48px", "testing word-spacing: 3rem"); + + verifyComputedStyle("word-spacing", "0ch", "0px", "testing word-spacing: 0ch"); + + } + + startTesting(); + + </script> diff --git a/testing/web-platform/tests/css/css-text/word-spacing/word-spacing-negative-value-001.html b/testing/web-platform/tests/css/css-text/word-spacing/word-spacing-negative-value-001.html new file mode 100644 index 0000000000..6e5df950c0 --- /dev/null +++ b/testing/web-platform/tests/css/css-text/word-spacing/word-spacing-negative-value-001.html @@ -0,0 +1,31 @@ +<!DOCTYPE html> + + <meta charset="UTF-8"> + + <title>CSS Text Test: 'word-spacing' value may be negative (basic)</title> + + <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/"> + <link rel="help" href="https://www.w3.org/TR/css-text-3/#word-spacing-property"> + <link rel="match" href="reference/ref-filled-green-100px-square.xht"> + <link rel="stylesheet" type="text/css" href="/fonts/ahem.css"> + + <meta content="may" name="flags"> + + <style> + div + { + background-color: red; + color: green; + font-family: Ahem; + font-size: 50px; + line-height: 1; + width: 2em; + word-spacing: -1em; + } + </style> + + <p>Test passes if there is a filled green square and <strong>no red</strong>. + + <div>T E</div> + + <div>S T</div> |