From 0ebf5bdf043a27fd3dfb7f92e0cb63d88954c44d Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Fri, 19 Apr 2024 03:47:29 +0200 Subject: Adding upstream version 115.8.0esr. Signed-off-by: Daniel Baumann --- .../css-writing-modes/tools/generators/generate.py | 86 ++++++++++++++++++++++ .../tools/generators/template.html | 83 +++++++++++++++++++++ 2 files changed, 169 insertions(+) create mode 100755 testing/web-platform/tests/css/css-writing-modes/tools/generators/generate.py create mode 100644 testing/web-platform/tests/css/css-writing-modes/tools/generators/template.html (limited to 'testing/web-platform/tests/css/css-writing-modes/tools') diff --git a/testing/web-platform/tests/css/css-writing-modes/tools/generators/generate.py b/testing/web-platform/tests/css/css-writing-modes/tools/generators/generate.py new file mode 100755 index 0000000000..6d54eebc05 --- /dev/null +++ b/testing/web-platform/tests/css/css-writing-modes/tools/generators/generate.py @@ -0,0 +1,86 @@ +#!/usr/bin/env python3 +import os +import string + +from typing import List, Tuple + +test_template = """

{number}: {title}

+
+ {html} +
""" + + +def generate_test_list() -> List[Tuple[str, str]]: + test_list = []; + outers = [ + ["inline-block", '
', '
ZZ'], + ["float", '
', '
ZZ'], + ["table-cell", '
', 'ZZ
']]; + middles = [ + None, + ["inline-block", '
', '
']]; + targets = [ + ["block", '
HH
'], + ["inline", 'HH'], + ["block with borders", '
HHH
'], + ["inline with borders", 'HHH']]; + for outer in outers: + for middle in middles: + for target in targets: + title = target[0]; + html = target[1]; + if middle is not None: + title += " in " + middle[0]; + html = middle[1] + html + middle[2]; + title = "Shrink-to-fit " + outer[0] + " with a child of orthogonal " + title; + html = outer[1] + html + outer[2]; + test_list.append((title, html)); + return test_list + + +def read_template() -> str: + with open("template.html") as f: + return f.read() + + +def main(): + template = read_template() + test_list = generate_test_list() + + dest_dir = os.path.abspath( + os.path.join(os.path.dirname(os.path.abspath(__file__)), + os.path.pardir, + os.path.pardir)) + + for index in range(-1, len(test_list)): + if index == -1: + offset = 0 + suffix = "" + tests = test_list + title = "Shrink-to-fit with orthogonal children" + flags = " combo" + else: + offset = index + suffix = string.ascii_letters[index] + tests = [test_list[index]] + title = tests[0][0] + flags = "" + + filename = f"orthogonal-parent-shrink-to-fit-001{suffix}.html" + + tests_data = [] + for idx, (test_title, html) in enumerate(tests): + number = offset + idx + 1 + tests_data.append(test_template.format(number=number, + title=test_title, + html=html)) + + output = template.replace("{{title}}", title) + output = output.replace("{{flags}}", flags) + output = output.replace("{{tests}}", "\n".join(tests_data)) + with open(os.path.join(dest_dir, filename), "w") as f: + f.write(output) + + +if __name__ == "__main__": + main() diff --git a/testing/web-platform/tests/css/css-writing-modes/tools/generators/template.html b/testing/web-platform/tests/css/css-writing-modes/tools/generators/template.html new file mode 100644 index 0000000000..74fc185232 --- /dev/null +++ b/testing/web-platform/tests/css/css-writing-modes/tools/generators/template.html @@ -0,0 +1,83 @@ + + +CSS Writing Modes Test: {{title}} + + + + + + + + + +
+
+

Test passes if the X-position of the left edge of the orange box and the right edge of the blue box are the same. +

If script is enabled, there should be one or more PASS and no FAIL. +{{tests}} +

+ -- cgit v1.2.3