Skip to content

Truly independent web browser

Tests/LibWeb: Import WPT tests for text-orientation

Andreas Klingadfa5c514d5e
diff --git a/Tests/LibWeb/Ref/expected/wpt-import/css/css-writing-modes/support/swatch-yellow.png b/Tests/LibWeb/Ref/expected/wpt-import/css/css-writing-modes/support/swatch-yellow.png
new file mode 100644
index 00000000000..1591aa0e2e2
Binary files /dev/null and b/Tests/LibWeb/Ref/expected/wpt-import/css/css-writing-modes/support/swatch-yellow.png differ
diff --git a/Tests/LibWeb/Ref/expected/wpt-import/css/css-writing-modes/text-orientation-mixed-srl-016-ref.xht b/Tests/LibWeb/Ref/expected/wpt-import/css/css-writing-modes/text-orientation-mixed-srl-016-ref.xht
new file mode 100644
index 00000000000..ab6aaafbae6
--- /dev/null
+++ b/Tests/LibWeb/Ref/expected/wpt-import/css/css-writing-modes/text-orientation-mixed-srl-016-ref.xht
@@ -0,0 +1,40 @@
+<!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[
+ @font-face
+ {
+ font-family: "mplus-1p-regular";
+ src: url("../../fonts/mplus-1p-regular.woff") format("woff");
+ /* filesize: 803300 bytes (784.5 KBytes) */
+ }
+
+ div
+ {
+ border: gray solid 1px;
+ font: bold 26px/32px "mplus-1p-regular";
+ margin-bottom: 4px;
+ text-orientation: sideways;
+ writing-mode: vertical-rl;
+ }
+ ]]></style>
+
+ </head>
+
+ <body>
+
+ <p>Test passes if the glyphs in both rectangles have the <strong>same order</strong>, the <strong>same orientation</strong> and the <strong>same layout</strong>.</p>
+
+ <div>月火水Abc<br />def木金土</div>
+
+ <div>月火水Abc<br />def木金土</div>
+
+ </body>
+</html>
diff --git a/Tests/LibWeb/Ref/expected/wpt-import/css/css-writing-modes/vlr-text-orientation-sideways-alongside-vlr-floats-ref.html b/Tests/LibWeb/Ref/expected/wpt-import/css/css-writing-modes/vlr-text-orientation-sideways-alongside-vlr-floats-ref.html
new file mode 100644
index 00000000000..17af7ea5a74
--- /dev/null
+++ b/Tests/LibWeb/Ref/expected/wpt-import/css/css-writing-modes/vlr-text-orientation-sideways-alongside-vlr-floats-ref.html
@@ -0,0 +1,42 @@
+<!DOCTYPE html>
+<html>
+ <title>CSS Writing Modes Test Reference: positioning of a text-orientation:sideways block alongside vertical-lr floats</title>
+
+ <link rel="author" title="Ting-Yu Lin" href="mailto:[email protected]">
+ <link rel="author" title="Mozilla" href="https://www.mozilla.org/">
+
+ <style>
+ html {
+ writing-mode: vertical-lr;
+ }
+
+ div {
+ block-size: 100px;
+ }
+
+ div#first-olive-float {
+ background-color: olive;
+ float: left;
+ inline-size: 50%;
+ }
+
+ div#second-blue-float-with-clear {
+ background-color: blue;
+ clear: left;
+ float: left;
+ inline-size: 25%;
+ }
+
+ div#orange-bfc {
+ background-color: orange;
+ inline-size: 75%;
+ writing-mode: vertical-lr;
+ }
+ </style>
+
+ <body>
+ <div id="first-olive-float">&nbsp;</div>
+ <div id="second-blue-float-with-clear">&nbsp;</div>
+ <div id="orange-bfc">&nbsp;</div>
+ </body>
+</html>
diff --git a/Tests/LibWeb/Ref/expected/wpt-import/css/css-writing-modes/vrl-text-orientation-sideways-alongside-vrl-floats-ref.html b/Tests/LibWeb/Ref/expected/wpt-import/css/css-writing-modes/vrl-text-orientation-sideways-alongside-vrl-floats-ref.html
new file mode 100644
index 00000000000..52c0a9bf1c4
--- /dev/null
+++ b/Tests/LibWeb/Ref/expected/wpt-import/css/css-writing-modes/vrl-text-orientation-sideways-alongside-vrl-floats-ref.html
@@ -0,0 +1,42 @@
+<!DOCTYPE html>
+<html>
+ <title>CSS Writing Modes Test Reference: positioning of a text-orientation:sideways block alongside vertical-rl floats</title>
+
+ <link rel="author" title="Ting-Yu Lin" href="mailto:[email protected]">
+ <link rel="author" title="Mozilla" href="https://www.mozilla.org/">
+
+ <style>
+ html {
+ writing-mode: vertical-rl;
+ }
+
+ div {
+ block-size: 100px;
+ }
+
+ div#first-olive-float {
+ background-color: olive;
+ float: left;
+ inline-size: 50%;
+ }
+
+ div#second-blue-float-with-clear {
+ background-color: blue;
+ clear: left;
+ float: left;
+ inline-size: 25%;
+ }
+
+ div#orange-bfc {
+ background-color: orange;
+ inline-size: 75%;
+ writing-mode: vertical-rl;
+ }
+ </style>
+
+ <body>
+ <div id="first-olive-float">&nbsp;</div>
+ <div id="second-blue-float-with-clear">&nbsp;</div>
+ <div id="orange-bfc">&nbsp;</div>
+ </body>
+</html>
diff --git a/Tests/LibWeb/Ref/expected/wpt-import/fonts/mplus-1p-regular.woff b/Tests/LibWeb/Ref/expected/wpt-import/fonts/mplus-1p-regular.woff
new file mode 100644
index 00000000000..42cfff628b4
Binary files /dev/null and b/Tests/LibWeb/Ref/expected/wpt-import/fonts/mplus-1p-regular.woff differ
diff --git a/Tests/LibWeb/Ref/input/wpt-import/css/css-writing-modes/support/swatch-blue.png b/Tests/LibWeb/Ref/input/wpt-import/css/css-writing-modes/support/swatch-blue.png
new file mode 100644
index 00000000000..bf2759634d4
Binary files /dev/null and b/Tests/LibWeb/Ref/input/wpt-import/css/css-writing-modes/support/swatch-blue.png differ
diff --git a/Tests/LibWeb/Ref/input/wpt-import/css/css-writing-modes/support/swatch-yellow.png b/Tests/LibWeb/Ref/input/wpt-import/css/css-writing-modes/support/swatch-yellow.png
new file mode 100644
index 00000000000..1591aa0e2e2
Binary files /dev/null and b/Tests/LibWeb/Ref/input/wpt-import/css/css-writing-modes/support/swatch-yellow.png differ
diff --git a/Tests/LibWeb/Ref/input/wpt-import/css/css-writing-modes/text-orientation-mixed-srl-016.xht b/Tests/LibWeb/Ref/input/wpt-import/css/css-writing-modes/text-orientation-mixed-srl-016.xht
new file mode 100644
index 00000000000..06e0e10ccfb
--- /dev/null
+++ b/Tests/LibWeb/Ref/input/wpt-import/css/css-writing-modes/text-orientation-mixed-srl-016.xht
@@ -0,0 +1,55 @@
+<!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 Writing Modes Test: 'writing-mode: sideways-rl' - 'text-orientation: mixed' has no effect</title>
+
+ <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/" />
+ <link rel="help" title="5.1. Orienting Text: the 'text-orientation' property" href="http://www.w3.org/TR/css-writing-modes-4/#text-orientation" />
+ <link rel="match" href="../../../../expected/wpt-import/css/css-writing-modes/text-orientation-mixed-srl-016-ref.xht" />
+ <meta name="fuzzy" content="maxDifference=0-231; totalPixels=0-68" />
+
+ <meta name="assert" content="This test checks that when 'writing-mode' is set to 'sideways-rl', then a 'text-orientation: mixed' declaration has no effect: the alphabetical baseline is used as the dominant baseline because the typographic mode for 'sideways-rl' is horizontal and 'text-orientation' has no effect on boxes in horizontal typographic modes." />
+
+ <style type="text/css"><![CDATA[
+ @font-face
+ {
+ font-family: "mplus-1p-regular";
+ src: url("../../fonts/mplus-1p-regular.woff") format("woff");
+ /* filesize: 803300 bytes (784.5 KBytes) */
+ }
+
+ div
+ {
+ border: gray solid 1px;
+ font: bold 26px/32px "mplus-1p-regular";
+ margin-bottom: 4px;
+ }
+
+ div#test-srl
+ {
+ writing-mode: sideways-rl;
+ text-orientation: mixed;
+ }
+
+ div#ref-vrl-sideways
+ {
+ text-orientation: sideways;
+ writing-mode: vertical-rl;
+ }
+ ]]></style>
+
+ </head>
+
+ <body>
+
+ <p>Test passes if the glyphs in both rectangles have the <strong>same order</strong>, the <strong>same orientation</strong> and the <strong>same layout</strong>.</p>
+
+ <div id="test-srl">月火水Abc<br />def木金土</div>
+
+ <div id="ref-vrl-sideways">月火水Abc<br />def木金土</div>
+
+ </body>
+</html>
diff --git a/Tests/LibWeb/Ref/input/wpt-import/css/css-writing-modes/text-orientation-upright-srl-018.xht b/Tests/LibWeb/Ref/input/wpt-import/css/css-writing-modes/text-orientation-upright-srl-018.xht
new file mode 100644
index 00000000000..90a7b02f44d
--- /dev/null
+++ b/Tests/LibWeb/Ref/input/wpt-import/css/css-writing-modes/text-orientation-upright-srl-018.xht
@@ -0,0 +1,54 @@
+<!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 Writing Modes Test: 'writing-mode: sideways-rl' - 'text-orientation: upright' has no effect</title>
+
+ <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/" />
+ <link rel="help" title="5.1. Orienting Text: the 'text-orientation' property" href="http://www.w3.org/TR/css-writing-modes-4/#text-orientation" />
+ <link rel="match" href="../../../../expected/wpt-import/css/css-writing-modes/text-orientation-mixed-srl-016-ref.xht" />
+
+ <meta name="assert" content="This test checks that when 'writing-mode' is set to 'sideways-rl', then a 'text-orientation: upright' declaration has no effect: the alphabetical baseline is used as the dominant baseline and all the glyphs remain rotated 90 degrees clockwise. The typographic mode for 'sideways-rl' is horizontal and 'text-orientation' has no effect on boxes in horizontal typographic modes." />
+
+ <style type="text/css"><![CDATA[
+ @font-face
+ {
+ font-family: "mplus-1p-regular";
+ src: url("../../fonts/mplus-1p-regular.woff") format("woff");
+ /* filesize: 803300 bytes (784.5 KBytes) */
+ }
+
+ div
+ {
+ border: gray solid 1px;
+ font: bold 26px/32px "mplus-1p-regular";
+ margin-bottom: 4px;
+ }
+
+ div#test-srl
+ {
+ writing-mode: sideways-rl;
+ text-orientation: upright;
+ }
+
+ div#ref-vrl-sideways
+ {
+ text-orientation: sideways;
+ writing-mode: vertical-rl;
+ }
+ ]]></style>
+
+ </head>
+
+ <body>
+
+ <p>Test passes if the glyphs in both rectangles have the <strong>same order</strong>, the <strong>same orientation</strong> and the <strong>same layout</strong>.</p>
+
+ <div id="test-srl">月火水Abc<br />def木金土</div>
+
+ <div id="ref-vrl-sideways">月火水Abc<br />def木金土</div>
+
+ </body>
+</html>
diff --git a/Tests/LibWeb/Ref/input/wpt-import/css/css-writing-modes/vlr-text-orientation-sideways-alongside-vlr-floats.html b/Tests/LibWeb/Ref/input/wpt-import/css/css-writing-modes/vlr-text-orientation-sideways-alongside-vlr-floats.html
new file mode 100644
index 00000000000..9f9f2c18b90
--- /dev/null
+++ b/Tests/LibWeb/Ref/input/wpt-import/css/css-writing-modes/vlr-text-orientation-sideways-alongside-vlr-floats.html
@@ -0,0 +1,49 @@
+<!DOCTYPE html>
+<html>
+ <title>CSS Writing Modes Test: positioning of a text-orientation:sideways block alongside vertical-lr floats</title>
+
+ <link rel="author" title="Ting-Yu Lin" href="mailto:[email protected]">
+ <link rel="author" title="Mozilla" href="https://www.mozilla.org/">
+ <link rel="help" href="https://drafts.csswg.org/css-writing-modes/#block-flow" title="3.2. Block Flow Direction: the writing-mode property">
+ <link rel="match" href="../../../../expected/wpt-import/css/css-writing-modes/vlr-text-orientation-sideways-alongside-vlr-floats-ref.html">
+
+ <!-- This test is adapted from Gérard Talbot's "ortho-htb-alongside-vrl-floats-014.xht" -->
+
+ <meta content="This test verifies that the orange block box, which should not create a new block formatting context, should flow next to the first float." name="assert">
+
+ <style>
+ html {
+ writing-mode: vertical-lr;
+ }
+
+ div {
+ block-size: 100px;
+ }
+
+ div#first-olive-float {
+ background-color: olive;
+ float: left;
+ inline-size: 50%;
+ }
+
+ div#second-blue-float-with-clear {
+ background-color: blue;
+ clear: left;
+ float: left;
+ inline-size: 25%;
+ }
+
+ div#orange-bfc {
+ background-color: orange;
+ inline-size: 75%;
+ writing-mode: vertical-lr;
+ text-orientation: sideways; /* Should not create block formatting context */
+ }
+ </style>
+
+ <body>
+ <div id="first-olive-float">&nbsp;</div>
+ <div id="second-blue-float-with-clear">&nbsp;</div>
+ <div id="orange-bfc">&nbsp;</div>
+ </body>
+</html>
diff --git a/Tests/LibWeb/Ref/input/wpt-import/css/css-writing-modes/vrl-text-orientation-sideways-alongside-vrl-floats.html b/Tests/LibWeb/Ref/input/wpt-import/css/css-writing-modes/vrl-text-orientation-sideways-alongside-vrl-floats.html
new file mode 100644
index 00000000000..9cdec16518a
--- /dev/null
+++ b/Tests/LibWeb/Ref/input/wpt-import/css/css-writing-modes/vrl-text-orientation-sideways-alongside-vrl-floats.html
@@ -0,0 +1,49 @@
+<!DOCTYPE html>
+<html>
+ <title>CSS Writing Modes Test: positioning of a text-orientation:sideways block alongside vertical-rl floats</title>
+
+ <link rel="author" title="Ting-Yu Lin" href="mailto:[email protected]">
+ <link rel="author" title="Mozilla" href="https://www.mozilla.org/">
+ <link rel="help" href="https://drafts.csswg.org/css-writing-modes/#block-flow" title="3.2. Block Flow Direction: the writing-mode property">
+ <link rel="match" href="../../../../expected/wpt-import/css/css-writing-modes/vrl-text-orientation-sideways-alongside-vrl-floats-ref.html">
+
+ <!-- This test is adapted from Gérard Talbot's "ortho-htb-alongside-vrl-floats-014.xht" -->
+
+ <meta content="This test verifies that the orange block box, which should not create a new block formatting context, should flow next to the first float." name="assert">
+
+ <style>
+ html {
+ writing-mode: vertical-rl;
+ }
+
+ div {
+ block-size: 100px;
+ }
+
+ div#first-olive-float {
+ background-color: olive;
+ float: left;
+ inline-size: 50%;
+ }
+
+ div#second-blue-float-with-clear {
+ background-color: blue;
+ clear: left;
+ float: left;
+ inline-size: 25%;
+ }
+
+ div#orange-bfc {
+ background-color: orange;
+ inline-size: 75%;
+ writing-mode: vertical-rl;
+ text-orientation: sideways; /* Should not create block formatting context */
+ }
+ </style>
+
+ <body>
+ <div id="first-olive-float">&nbsp;</div>
+ <div id="second-blue-float-with-clear">&nbsp;</div>
+ <div id="orange-bfc">&nbsp;</div>
+ </body>
+</html>
diff --git a/Tests/LibWeb/Ref/input/wpt-import/fonts/mplus-1p-regular.woff b/Tests/LibWeb/Ref/input/wpt-import/fonts/mplus-1p-regular.woff
new file mode 100644
index 00000000000..42cfff628b4
Binary files /dev/null and b/Tests/LibWeb/Ref/input/wpt-import/fonts/mplus-1p-regular.woff differ
diff --git a/Tests/LibWeb/Text/expected/wpt-import/css/css-writing-modes/parsing/text-orientation-computed.txt b/Tests/LibWeb/Text/expected/wpt-import/css/css-writing-modes/parsing/text-orientation-computed.txt
new file mode 100644
index 00000000000..6abfdfe849f
--- /dev/null
+++ b/Tests/LibWeb/Text/expected/wpt-import/css/css-writing-modes/parsing/text-orientation-computed.txt
@@ -0,0 +1,8 @@
+Harness status: OK
+
+Found 3 tests
+
+3 Fail
+Fail Property text-orientation value 'mixed'
+Fail Property text-orientation value 'upright'
+Fail Property text-orientation value 'sideways'
\ No newline at end of file
diff --git a/Tests/LibWeb/Text/expected/wpt-import/css/css-writing-modes/parsing/text-orientation-invalid.txt b/Tests/LibWeb/Text/expected/wpt-import/css/css-writing-modes/parsing/text-orientation-invalid.txt
new file mode 100644
index 00000000000..83af832f77c
--- /dev/null
+++ b/Tests/LibWeb/Text/expected/wpt-import/css/css-writing-modes/parsing/text-orientation-invalid.txt
@@ -0,0 +1,7 @@
+Harness status: OK
+
+Found 2 tests
+
+2 Pass
+Pass e.style['text-orientation'] = "auto" should not set the property value
+Pass e.style['text-orientation'] = "mixed upright" should not set the property value
\ No newline at end of file
diff --git a/Tests/LibWeb/Text/expected/wpt-import/css/css-writing-modes/parsing/text-orientation-valid.txt b/Tests/LibWeb/Text/expected/wpt-import/css/css-writing-modes/parsing/text-orientation-valid.txt
new file mode 100644
index 00000000000..190f4d7ae0b
--- /dev/null
+++ b/Tests/LibWeb/Text/expected/wpt-import/css/css-writing-modes/parsing/text-orientation-valid.txt
@@ -0,0 +1,8 @@
+Harness status: OK
+
+Found 3 tests
+
+3 Fail
+Fail e.style['text-orientation'] = "mixed" should set the property value
+Fail e.style['text-orientation'] = "upright" should set the property value
+Fail e.style['text-orientation'] = "sideways" should set the property value
\ No newline at end of file
diff --git a/Tests/LibWeb/Text/input/wpt-import/css/css-writing-modes/parsing/text-orientation-computed.html b/Tests/LibWeb/Text/input/wpt-import/css/css-writing-modes/parsing/text-orientation-computed.html
new file mode 100644
index 00000000000..6739e980f66
--- /dev/null
+++ b/Tests/LibWeb/Text/input/wpt-import/css/css-writing-modes/parsing/text-orientation-computed.html
@@ -0,0 +1,20 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>CSS Writing Modes: getComputedStyle().textOrientation</title>
+<link rel="help" href="https://drafts.csswg.org/css-writing-modes-3/#propdef-text-orientation">
+<meta name="assert" content="text-orientation computed value is as specified.">
+<script src="../../../resources/testharness.js"></script>
+<script src="../../../resources/testharnessreport.js"></script>
+<script src="../../../css/support/computed-testcommon.js"></script>
+</head>
+<body>
+<div id="target"></div>
+<script>
+test_computed_value("text-orientation", "mixed");
+test_computed_value("text-orientation", "upright");
+test_computed_value("text-orientation", "sideways");
+</script>
+</body>
+</html>
diff --git a/Tests/LibWeb/Text/input/wpt-import/css/css-writing-modes/parsing/text-orientation-invalid.html b/Tests/LibWeb/Text/input/wpt-import/css/css-writing-modes/parsing/text-orientation-invalid.html
new file mode 100644
index 00000000000..132fe5032ce
--- /dev/null
+++ b/Tests/LibWeb/Text/input/wpt-import/css/css-writing-modes/parsing/text-orientation-invalid.html
@@ -0,0 +1,19 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>CSS Writing Modes Level 3: parsing text-orientation with invalid values</title>
+<link rel="author" title="Eric Willigers" href="mailto:[email protected]">
+<link rel="help" href="https://drafts.csswg.org/css-writing-modes-3/#propdef-text-orientation">
+<meta name="assert" content="text-orientation supports only the grammar 'mixed | upright | sideways'.">
+<script src="../../../resources/testharness.js"></script>
+<script src="../../../resources/testharnessreport.js"></script>
+<script src="../../../css/support/parsing-testcommon.js"></script>
+</head>
+<body>
+<script>
+test_invalid_value("text-orientation", "auto");
+test_invalid_value("text-orientation", "mixed upright");
+</script>
+</body>
+</html>
diff --git a/Tests/LibWeb/Text/input/wpt-import/css/css-writing-modes/parsing/text-orientation-valid.html b/Tests/LibWeb/Text/input/wpt-import/css/css-writing-modes/parsing/text-orientation-valid.html
new file mode 100644
index 00000000000..f90136b63d8
--- /dev/null
+++ b/Tests/LibWeb/Text/input/wpt-import/css/css-writing-modes/parsing/text-orientation-valid.html
@@ -0,0 +1,20 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>CSS Writing Modes Level 3: parsing text-orientation with valid values</title>
+<link rel="author" title="Eric Willigers" href="mailto:[email protected]">
+<link rel="help" href="https://drafts.csswg.org/css-writing-modes-3/#propdef-text-orientation">
+<meta name="assert" content="text-orientation supports the full grammar 'mixed | upright | sideways'.">
+<script src="../../../resources/testharness.js"></script>
+<script src="../../../resources/testharnessreport.js"></script>
+<script src="../../../css/support/parsing-testcommon.js"></script>
+</head>
+<body>
+<script>
+test_valid_value("text-orientation", "mixed");
+test_valid_value("text-orientation", "upright");
+test_valid_value("text-orientation", "sideways");
+</script>
+</body>
+</html>