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/text-group-align | |
parent | Initial commit. (diff) | |
download | firefox-upstream.tar.xz firefox-upstream.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/text-group-align')
23 files changed, 392 insertions, 0 deletions
diff --git a/testing/web-platform/tests/css/css-text/text-group-align/support/fake-group-align.css b/testing/web-platform/tests/css/css-text/text-group-align/support/fake-group-align.css new file mode 100644 index 0000000000..d1a7d1aab0 --- /dev/null +++ b/testing/web-platform/tests/css/css-text/text-group-align/support/fake-group-align.css @@ -0,0 +1,27 @@ +.group { + inline-size: min-content; +} + +.group-align-left { + /* Only the one that matches the inline axis will apply */ + margin-bottom: auto; + margin-right: auto; +} + +.group-align-right { + /* Only the one that matches the inline axis will apply */ + margin-top: auto; + margin-left: auto; +} + +.group-align-center { + margin-inline: auto; +} + +.group-align-start { + margin-inline-end: auto; +} + +.group-align-end { + margin-inline-start: auto; +} diff --git a/testing/web-platform/tests/css/css-text/text-group-align/support/test-helpers.css b/testing/web-platform/tests/css/css-text/text-group-align/support/test-helpers.css new file mode 100644 index 0000000000..d79e79cd86 --- /dev/null +++ b/testing/web-platform/tests/css/css-text/text-group-align/support/test-helpers.css @@ -0,0 +1,9 @@ +.text-container { + inline-size: 200px; + border: 1px solid black; + display: inline-block; +} + +.pre { + white-space: pre; +} diff --git a/testing/web-platform/tests/css/css-text/text-group-align/support/test-helpers.js b/testing/web-platform/tests/css/css-text/text-group-align/support/test-helpers.js new file mode 100644 index 0000000000..27b6a7baf1 --- /dev/null +++ b/testing/web-platform/tests/css/css-text/text-group-align/support/test-helpers.js @@ -0,0 +1,36 @@ +const simpleTestString = `ABCDEFGHIJKLO +AAAAAAAA +AAAA +AA +A`; + +function generateSimpleTest({ textGroupAlign, textAlign, direction, writingMode }) { + if (!direction) + direction = "ltr"; + if (!writingMode) + writingMode = "horizontal-tb"; + + const container = document.createElement("div"); + container.textContent = simpleTestString; + container.style = `text-group-align: ${textGroupAlign}; text-align: ${textAlign}; direction: ${direction}; writing-mode: ${writingMode}`; + container.classList.add("text-container", "pre"); + document.body.append(container); +} + +function generateSimpleReference({ textGroupAlign, textAlign, direction, writingMode }) { + if (!direction) + direction = "ltr"; + if (!writingMode) + writingMode = "horizontal-tb"; + + const container = document.createElement("div"); + container.classList.add("text-container", "pre"); + container.style = `text-align: ${textAlign}; direction: ${direction}; writing-mode: ${writingMode}`; + + const group = document.createElement("div"); + group.textContent = simpleTestString; + group.classList.add("group", `group-align-${textGroupAlign}`); + container.append(group); + + document.body.append(container); +} diff --git a/testing/web-platform/tests/css/css-text/text-group-align/text-group-align-center-ref.html b/testing/web-platform/tests/css/css-text/text-group-align/text-group-align-center-ref.html new file mode 100644 index 0000000000..919747cebb --- /dev/null +++ b/testing/web-platform/tests/css/css-text/text-group-align/text-group-align-center-ref.html @@ -0,0 +1,15 @@ +<!DOCTYPE html> +<title>Reference: text-group-align: center</title> +<link rel="stylesheet" href="support/test-helpers.css"> +<link rel="stylesheet" href="support/fake-group-align.css"> +<body> +<script src="support/test-helpers.js"></script> +<script> +for (let direction of ["ltr", "rtl"]) { + for (let textAlign of ["start", "end", "left", "right", "center"]) { + generateSimpleReference({ textGroupAlign: "center", direction, textAlign }); + } + document.body.append(document.createElement("br")); +} +</script> +</body> diff --git a/testing/web-platform/tests/css/css-text/text-group-align/text-group-align-center-vlr-ref.html b/testing/web-platform/tests/css/css-text/text-group-align/text-group-align-center-vlr-ref.html new file mode 100644 index 0000000000..6b74aac823 --- /dev/null +++ b/testing/web-platform/tests/css/css-text/text-group-align/text-group-align-center-vlr-ref.html @@ -0,0 +1,15 @@ +<!DOCTYPE html> +<title>Reference: text-group-align: center</title> +<link rel="stylesheet" href="support/test-helpers.css"> +<link rel="stylesheet" href="support/fake-group-align.css"> +<body> +<script src="support/test-helpers.js"></script> +<script> +for (let direction of ["ltr", "rtl"]) { + for (let textAlign of ["start", "end", "left", "right", "center"]) { + generateSimpleReference({ textGroupAlign: "center", writingMode: "vertical-lr", direction, textAlign }); + } + document.body.append(document.createElement("br")); +} +</script> +</body> diff --git a/testing/web-platform/tests/css/css-text/text-group-align/text-group-align-center-vlr.html b/testing/web-platform/tests/css/css-text/text-group-align/text-group-align-center-vlr.html new file mode 100644 index 0000000000..e18cf34830 --- /dev/null +++ b/testing/web-platform/tests/css/css-text/text-group-align/text-group-align-center-vlr.html @@ -0,0 +1,17 @@ +<!DOCTYPE html> +<title>text-group-align: center</title> +<link rel="author" title="Tim Nguyen" href="https://github.com/nt1m"> +<link rel="help" href="https://drafts.csswg.org/css-text-4/#text-group-align-property"> +<link rel="match" href="text-group-align-center-vlr-ref.html"> +<link rel="stylesheet" href="support/test-helpers.css"> +<body> +<script src="support/test-helpers.js"></script> +<script> +for (let direction of ["ltr", "rtl"]) { + for (let textAlign of ["start", "end", "left", "right", "center"]) { + generateSimpleTest({ textGroupAlign: "center", writingMode: "vertical-lr", direction, textAlign }); + } + document.body.append(document.createElement("br")); +} +</script> +</body> diff --git a/testing/web-platform/tests/css/css-text/text-group-align/text-group-align-center.html b/testing/web-platform/tests/css/css-text/text-group-align/text-group-align-center.html new file mode 100644 index 0000000000..e4acc744c2 --- /dev/null +++ b/testing/web-platform/tests/css/css-text/text-group-align/text-group-align-center.html @@ -0,0 +1,17 @@ +<!DOCTYPE html> +<title>text-group-align: center</title> +<link rel="author" title="Tim Nguyen" href="https://github.com/nt1m"> +<link rel="help" href="https://drafts.csswg.org/css-text-4/#text-group-align-property"> +<link rel="match" href="text-group-align-center-ref.html"> +<link rel="stylesheet" href="support/test-helpers.css"> +<body> +<script src="support/test-helpers.js"></script> +<script> +for (let direction of ["ltr", "rtl"]) { + for (let textAlign of ["start", "end", "left", "right", "center"]) { + generateSimpleTest({ textGroupAlign: "center", direction, textAlign }); + } + document.body.append(document.createElement("br")); +} +</script> +</body> diff --git a/testing/web-platform/tests/css/css-text/text-group-align/text-group-align-end-ref.html b/testing/web-platform/tests/css/css-text/text-group-align/text-group-align-end-ref.html new file mode 100644 index 0000000000..2c8d2da99d --- /dev/null +++ b/testing/web-platform/tests/css/css-text/text-group-align/text-group-align-end-ref.html @@ -0,0 +1,15 @@ +<!DOCTYPE html> +<title>Reference: text-group-align: end</title> +<link rel="stylesheet" href="support/test-helpers.css"> +<link rel="stylesheet" href="support/fake-group-align.css"> +<body> +<script src="support/test-helpers.js"></script> +<script> +for (let direction of ["ltr", "rtl"]) { + for (let textAlign of ["start", "end", "left", "right", "center"]) { + generateSimpleReference({ textGroupAlign: "end", direction, textAlign }); + } + document.body.append(document.createElement("br")); +} +</script> +</body> diff --git a/testing/web-platform/tests/css/css-text/text-group-align/text-group-align-end-vlr-ref.html b/testing/web-platform/tests/css/css-text/text-group-align/text-group-align-end-vlr-ref.html new file mode 100644 index 0000000000..9ea04f6c6d --- /dev/null +++ b/testing/web-platform/tests/css/css-text/text-group-align/text-group-align-end-vlr-ref.html @@ -0,0 +1,15 @@ +<!DOCTYPE html> +<title>Reference: text-group-align: end</title> +<link rel="stylesheet" href="support/test-helpers.css"> +<link rel="stylesheet" href="support/fake-group-align.css"> +<body> +<script src="support/test-helpers.js"></script> +<script> +for (let direction of ["ltr", "rtl"]) { + for (let textAlign of ["start", "end", "left", "right", "center"]) { + generateSimpleReference({ textGroupAlign: "end", writingMode: "vertical-lr", direction, textAlign }); + } + document.body.append(document.createElement("br")); +} +</script> +</body> diff --git a/testing/web-platform/tests/css/css-text/text-group-align/text-group-align-end-vlr.html b/testing/web-platform/tests/css/css-text/text-group-align/text-group-align-end-vlr.html new file mode 100644 index 0000000000..1f690b44d3 --- /dev/null +++ b/testing/web-platform/tests/css/css-text/text-group-align/text-group-align-end-vlr.html @@ -0,0 +1,17 @@ +<!DOCTYPE html> +<title>text-group-align: end</title> +<link rel="author" title="Tim Nguyen" href="https://github.com/nt1m"> +<link rel="help" href="https://drafts.csswg.org/css-text-4/#text-group-align-property"> +<link rel="match" href="text-group-align-end-vlr-ref.html"> +<link rel="stylesheet" href="support/test-helpers.css"> +<body> +<script src="support/test-helpers.js"></script> +<script> +for (let direction of ["ltr", "rtl"]) { + for (let textAlign of ["start", "end", "left", "right", "center"]) { + generateSimpleTest({ textGroupAlign: "end", writingMode: "vertical-lr", direction, textAlign }); + } + document.body.append(document.createElement("br")); +} +</script> +</body> diff --git a/testing/web-platform/tests/css/css-text/text-group-align/text-group-align-end.html b/testing/web-platform/tests/css/css-text/text-group-align/text-group-align-end.html new file mode 100644 index 0000000000..1929f59ee0 --- /dev/null +++ b/testing/web-platform/tests/css/css-text/text-group-align/text-group-align-end.html @@ -0,0 +1,17 @@ +<!DOCTYPE html> +<title>text-group-align: end</title> +<link rel="author" title="Tim Nguyen" href="https://github.com/nt1m"> +<link rel="help" href="https://drafts.csswg.org/css-text-4/#text-group-align-property"> +<link rel="match" href="text-group-align-end-ref.html"> +<link rel="stylesheet" href="support/test-helpers.css"> +<body> +<script src="support/test-helpers.js"></script> +<script> +for (let direction of ["ltr", "rtl"]) { + for (let textAlign of ["start", "end", "left", "right", "center"]) { + generateSimpleTest({ textGroupAlign: "end", direction, textAlign }); + } + document.body.append(document.createElement("br")); +} +</script> +</body> diff --git a/testing/web-platform/tests/css/css-text/text-group-align/text-group-align-left-ref.html b/testing/web-platform/tests/css/css-text/text-group-align/text-group-align-left-ref.html new file mode 100644 index 0000000000..f04180608a --- /dev/null +++ b/testing/web-platform/tests/css/css-text/text-group-align/text-group-align-left-ref.html @@ -0,0 +1,15 @@ +<!DOCTYPE html> +<title>Reference: text-group-align: left</title> +<link rel="stylesheet" href="support/test-helpers.css"> +<link rel="stylesheet" href="support/fake-group-align.css"> +<body> +<script src="support/test-helpers.js"></script> +<script> +for (let direction of ["ltr", "rtl"]) { + for (let textAlign of ["start", "end", "left", "right", "center"]) { + generateSimpleReference({ textGroupAlign: "left", direction, textAlign }); + } + document.body.append(document.createElement("br")); +} +</script> +</body> diff --git a/testing/web-platform/tests/css/css-text/text-group-align/text-group-align-left-vlr-ref.html b/testing/web-platform/tests/css/css-text/text-group-align/text-group-align-left-vlr-ref.html new file mode 100644 index 0000000000..a7df839259 --- /dev/null +++ b/testing/web-platform/tests/css/css-text/text-group-align/text-group-align-left-vlr-ref.html @@ -0,0 +1,15 @@ +<!DOCTYPE html> +<title>Reference: text-group-align: left</title> +<link rel="stylesheet" href="support/test-helpers.css"> +<link rel="stylesheet" href="support/fake-group-align.css"> +<body> +<script src="support/test-helpers.js"></script> +<script> +for (let direction of ["ltr", "rtl"]) { + for (let textAlign of ["start", "end", "left", "right", "center"]) { + generateSimpleReference({ textGroupAlign: "left", writingMode: "vertical-lr", direction, textAlign }); + } + document.body.append(document.createElement("br")); +} +</script> +</body> diff --git a/testing/web-platform/tests/css/css-text/text-group-align/text-group-align-left-vlr.html b/testing/web-platform/tests/css/css-text/text-group-align/text-group-align-left-vlr.html new file mode 100644 index 0000000000..4a9ed599b7 --- /dev/null +++ b/testing/web-platform/tests/css/css-text/text-group-align/text-group-align-left-vlr.html @@ -0,0 +1,17 @@ +<!DOCTYPE html> +<title>text-group-align: left</title> +<link rel="author" title="Tim Nguyen" href="https://github.com/nt1m"> +<link rel="help" href="https://drafts.csswg.org/css-text-4/#text-group-align-property"> +<link rel="match" href="text-group-align-left-vlr-ref.html"> +<link rel="stylesheet" href="support/test-helpers.css"> +<body> +<script src="support/test-helpers.js"></script> +<script> +for (let direction of ["ltr", "rtl"]) { + for (let textAlign of ["start", "end", "left", "right", "center"]) { + generateSimpleTest({ textGroupAlign: "left", writingMode: "vertical-lr", direction, textAlign }); + } + document.body.append(document.createElement("br")); +} +</script> +</body> diff --git a/testing/web-platform/tests/css/css-text/text-group-align/text-group-align-left.html b/testing/web-platform/tests/css/css-text/text-group-align/text-group-align-left.html new file mode 100644 index 0000000000..e74de0e1a8 --- /dev/null +++ b/testing/web-platform/tests/css/css-text/text-group-align/text-group-align-left.html @@ -0,0 +1,17 @@ +<!DOCTYPE html> +<title>text-group-align: left</title> +<link rel="author" title="Tim Nguyen" href="https://github.com/nt1m"> +<link rel="help" href="https://drafts.csswg.org/css-text-4/#text-group-align-property"> +<link rel="match" href="text-group-align-left-ref.html"> +<link rel="stylesheet" href="support/test-helpers.css"> +<body> +<script src="support/test-helpers.js"></script> +<script> +for (let direction of ["ltr", "rtl"]) { + for (let textAlign of ["start", "end", "left", "right", "center"]) { + generateSimpleTest({ textGroupAlign: "left", direction, textAlign }); + } + document.body.append(document.createElement("br")); +} +</script> +</body> diff --git a/testing/web-platform/tests/css/css-text/text-group-align/text-group-align-right-ref.html b/testing/web-platform/tests/css/css-text/text-group-align/text-group-align-right-ref.html new file mode 100644 index 0000000000..1b11e61836 --- /dev/null +++ b/testing/web-platform/tests/css/css-text/text-group-align/text-group-align-right-ref.html @@ -0,0 +1,15 @@ +<!DOCTYPE html> +<title>Reference: text-group-align: right</title> +<link rel="stylesheet" href="support/test-helpers.css"> +<link rel="stylesheet" href="support/fake-group-align.css"> +<body> +<script src="support/test-helpers.js"></script> +<script> +for (let direction of ["ltr", "rtl"]) { + for (let textAlign of ["start", "end", "left", "right", "center"]) { + generateSimpleReference({ textGroupAlign: "right", direction, textAlign }); + } + document.body.append(document.createElement("br")); +} +</script> +</body> diff --git a/testing/web-platform/tests/css/css-text/text-group-align/text-group-align-right-vlr-ref.html b/testing/web-platform/tests/css/css-text/text-group-align/text-group-align-right-vlr-ref.html new file mode 100644 index 0000000000..5bfe0a766a --- /dev/null +++ b/testing/web-platform/tests/css/css-text/text-group-align/text-group-align-right-vlr-ref.html @@ -0,0 +1,15 @@ +<!DOCTYPE html> +<title>Reference: text-group-align: right</title> +<link rel="stylesheet" href="support/test-helpers.css"> +<link rel="stylesheet" href="support/fake-group-align.css"> +<body> +<script src="support/test-helpers.js"></script> +<script> +for (let direction of ["ltr", "rtl"]) { + for (let textAlign of ["start", "end", "left", "right", "center"]) { + generateSimpleReference({ textGroupAlign: "right", writingMode: "vertical-lr", direction, textAlign }); + } + document.body.append(document.createElement("br")); +} +</script> +</body> diff --git a/testing/web-platform/tests/css/css-text/text-group-align/text-group-align-right-vlr.html b/testing/web-platform/tests/css/css-text/text-group-align/text-group-align-right-vlr.html new file mode 100644 index 0000000000..9f612aa910 --- /dev/null +++ b/testing/web-platform/tests/css/css-text/text-group-align/text-group-align-right-vlr.html @@ -0,0 +1,17 @@ +<!DOCTYPE html> +<title>text-group-align: right</title> +<link rel="author" title="Tim Nguyen" href="https://github.com/nt1m"> +<link rel="help" href="https://drafts.csswg.org/css-text-4/#text-group-align-property"> +<link rel="match" href="text-group-align-right-vlr-ref.html"> +<link rel="stylesheet" href="support/test-helpers.css"> +<body> +<script src="support/test-helpers.js"></script> +<script> +for (let direction of ["ltr", "rtl"]) { + for (let textAlign of ["start", "end", "left", "right", "center"]) { + generateSimpleTest({ textGroupAlign: "right", writingMode: "vertical-lr", direction, textAlign }); + } + document.body.append(document.createElement("br")); +} +</script> +</body> diff --git a/testing/web-platform/tests/css/css-text/text-group-align/text-group-align-right.html b/testing/web-platform/tests/css/css-text/text-group-align/text-group-align-right.html new file mode 100644 index 0000000000..688022a5bb --- /dev/null +++ b/testing/web-platform/tests/css/css-text/text-group-align/text-group-align-right.html @@ -0,0 +1,17 @@ +<!DOCTYPE html> +<title>text-group-align: right</title> +<link rel="author" title="Tim Nguyen" href="https://github.com/nt1m"> +<link rel="help" href="https://drafts.csswg.org/css-text-4/#text-group-align-property"> +<link rel="match" href="text-group-align-right-ref.html"> +<link rel="stylesheet" href="support/test-helpers.css"> +<body> +<script src="support/test-helpers.js"></script> +<script> +for (let direction of ["ltr", "rtl"]) { + for (let textAlign of ["start", "end", "left", "right", "center"]) { + generateSimpleTest({ textGroupAlign: "right", direction, textAlign }); + } + document.body.append(document.createElement("br")); +} +</script> +</body> diff --git a/testing/web-platform/tests/css/css-text/text-group-align/text-group-align-start-ref.html b/testing/web-platform/tests/css/css-text/text-group-align/text-group-align-start-ref.html new file mode 100644 index 0000000000..4c57fcbdcd --- /dev/null +++ b/testing/web-platform/tests/css/css-text/text-group-align/text-group-align-start-ref.html @@ -0,0 +1,15 @@ +<!DOCTYPE html> +<title>Reference: text-group-align: start</title> +<link rel="stylesheet" href="support/test-helpers.css"> +<link rel="stylesheet" href="support/fake-group-align.css"> +<body> +<script src="support/test-helpers.js"></script> +<script> +for (let direction of ["ltr", "rtl"]) { + for (let textAlign of ["start", "end", "left", "right", "center"]) { + generateSimpleReference({ textGroupAlign: "start", direction, textAlign }); + } + document.body.append(document.createElement("br")); +} +</script> +</body> diff --git a/testing/web-platform/tests/css/css-text/text-group-align/text-group-align-start-vlr-ref.html b/testing/web-platform/tests/css/css-text/text-group-align/text-group-align-start-vlr-ref.html new file mode 100644 index 0000000000..051c622bb4 --- /dev/null +++ b/testing/web-platform/tests/css/css-text/text-group-align/text-group-align-start-vlr-ref.html @@ -0,0 +1,15 @@ +<!DOCTYPE html> +<title>Reference: text-group-align: start</title> +<link rel="stylesheet" href="support/test-helpers.css"> +<link rel="stylesheet" href="support/fake-group-align.css"> +<body> +<script src="support/test-helpers.js"></script> +<script> +for (let direction of ["ltr", "rtl"]) { + for (let textAlign of ["start", "end", "left", "right", "center"]) { + generateSimpleReference({ textGroupAlign: "start", writingMode: "vertical-lr", direction, textAlign }); + } + document.body.append(document.createElement("br")); +} +</script> +</body> diff --git a/testing/web-platform/tests/css/css-text/text-group-align/text-group-align-start-vlr.html b/testing/web-platform/tests/css/css-text/text-group-align/text-group-align-start-vlr.html new file mode 100644 index 0000000000..6dce935f11 --- /dev/null +++ b/testing/web-platform/tests/css/css-text/text-group-align/text-group-align-start-vlr.html @@ -0,0 +1,17 @@ +<!DOCTYPE html> +<title>text-group-align: start</title> +<link rel="author" title="Tim Nguyen" href="https://github.com/nt1m"> +<link rel="help" href="https://drafts.csswg.org/css-text-4/#text-group-align-property"> +<link rel="match" href="text-group-align-start-vlr-ref.html"> +<link rel="stylesheet" href="support/test-helpers.css"> +<body> +<script src="support/test-helpers.js"></script> +<script> +for (let direction of ["ltr", "rtl"]) { + for (let textAlign of ["start", "end", "left", "right", "center"]) { + generateSimpleTest({ textGroupAlign: "start", writingMode: "vertical-lr", direction, textAlign }); + } + document.body.append(document.createElement("br")); +} +</script> +</body> diff --git a/testing/web-platform/tests/css/css-text/text-group-align/text-group-align-start.html b/testing/web-platform/tests/css/css-text/text-group-align/text-group-align-start.html new file mode 100644 index 0000000000..0951f2c50a --- /dev/null +++ b/testing/web-platform/tests/css/css-text/text-group-align/text-group-align-start.html @@ -0,0 +1,17 @@ +<!DOCTYPE html> +<title>text-group-align: start</title> +<link rel="author" title="Tim Nguyen" href="https://github.com/nt1m"> +<link rel="help" href="https://drafts.csswg.org/css-text-4/#text-group-align-property"> +<link rel="match" href="text-group-align-start-ref.html"> +<link rel="stylesheet" href="support/test-helpers.css"> +<body> +<script src="support/test-helpers.js"></script> +<script> +for (let direction of ["ltr", "rtl"]) { + for (let textAlign of ["start", "end", "left", "right", "center"]) { + generateSimpleTest({ textGroupAlign: "start", direction, textAlign }); + } + document.body.append(document.createElement("br")); +} +</script> +</body> |