Tests/LibWeb: Restructure Ref and Screenshot test dirs to match others
Some checks are pending
CI / Lagom (false, FUZZ, ubuntu-24.04, Linux, Clang) (push) Waiting to run
CI / Lagom (false, NO_FUZZ, macos-14, macOS, Clang) (push) Waiting to run
CI / Lagom (false, NO_FUZZ, ubuntu-24.04, Linux, GNU) (push) Waiting to run
CI / Lagom (true, NO_FUZZ, ubuntu-24.04, Linux, Clang) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (macos-14, macOS, macOS-universal2) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (ubuntu-24.04, Linux, Linux-x86_64) (push) Waiting to run
Run test262 and test-wasm / run_and_update_results (push) Waiting to run
Lint Code / lint (push) Waiting to run
Push notes / build (push) Waiting to run
Now each test type has the same directories: - input - expected - data Also, tests can be in subdirectories within ./input.
Author: https://github.com/AtkinsSJ Commit: https://github.com/LadybirdBrowser/ladybird/commit/b7efb61fbee Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/2175 Reviewed-by: https://github.com/gmta ✅
|
@ -158,7 +158,7 @@ are identical. These are ideal for testing visual effects such as background ima
|
|||
difficult to recreate the effect in the reference page, (such as for SVG or canvas,) consider using a Screenshot test
|
||||
instead.
|
||||
|
||||
Each Ref test includes a special `<link rel="match" href="reference/my-test-ref.html" />` tag, which the test runner
|
||||
Each Ref test includes a special `<link rel="match" href="../expected/my-test-ref.html" />` tag, which the test runner
|
||||
uses to locate the reference page. In this way, multiple tests can use the same reference.
|
||||
|
||||
### Screenshot
|
||||
|
@ -167,5 +167,5 @@ Screenshot tests can be thought of as a subtype of Ref tests, where the referenc
|
|||
to a screenshot of the expected output. In general, try to avoid using them if a regular Ref test would do, as they are
|
||||
sensitive to small rendering changes, and won't work on all platforms.
|
||||
|
||||
Like Ref tests, they require a `<link rel="match" href="reference/my-test-ref.html" />` tag to indicate the reference
|
||||
Like Ref tests, they require a `<link rel="match" href="../expected/my-test-ref.html" />` tag to indicate the reference
|
||||
page to use.
|
||||
|
|
|
@ -80,17 +80,20 @@ static ErrorOr<void> collect_dump_tests(Vector<Test>& tests, StringView path, St
|
|||
return {};
|
||||
}
|
||||
|
||||
static ErrorOr<void> collect_ref_tests(Vector<Test>& tests, StringView path)
|
||||
static ErrorOr<void> collect_ref_tests(Vector<Test>& tests, StringView path, StringView trail)
|
||||
{
|
||||
TRY(Core::Directory::for_each_entry(path, Core::DirIterator::SkipDots, [&](Core::DirectoryEntry const& entry, Core::Directory const&) -> ErrorOr<IterationDecision> {
|
||||
if (entry.type == Core::DirectoryEntry::Type::Directory)
|
||||
return IterationDecision::Continue;
|
||||
Core::DirIterator it(ByteString::formatted("{}/input/{}", path, trail), Core::DirIterator::Flags::SkipDots);
|
||||
while (it.has_next()) {
|
||||
auto name = it.next_path();
|
||||
auto input_path = TRY(FileSystem::real_path(ByteString::formatted("{}/input/{}/{}", path, trail, name)));
|
||||
|
||||
if (FileSystem::is_directory(input_path)) {
|
||||
TRY(collect_ref_tests(tests, path, ByteString::formatted("{}/{}", trail, name)));
|
||||
continue;
|
||||
}
|
||||
|
||||
auto input_path = TRY(FileSystem::real_path(ByteString::formatted("{}/{}", path, entry.name)));
|
||||
tests.append({ TestMode::Ref, input_path, {}, {} });
|
||||
|
||||
return IterationDecision::Continue;
|
||||
}));
|
||||
}
|
||||
|
||||
return {};
|
||||
}
|
||||
|
@ -374,9 +377,9 @@ ErrorOr<void> run_tests(Core::AnonymousBuffer const& theme, Gfx::IntSize window_
|
|||
|
||||
TRY(collect_dump_tests(tests, ByteString::formatted("{}/Layout", app.test_root_path), "."sv, TestMode::Layout));
|
||||
TRY(collect_dump_tests(tests, ByteString::formatted("{}/Text", app.test_root_path), "."sv, TestMode::Text));
|
||||
TRY(collect_ref_tests(tests, ByteString::formatted("{}/Ref", app.test_root_path)));
|
||||
TRY(collect_ref_tests(tests, ByteString::formatted("{}/Ref", app.test_root_path), "."sv));
|
||||
#if !defined(AK_OS_MACOS)
|
||||
TRY(collect_ref_tests(tests, ByteString::formatted("{}/Screenshot", app.test_root_path)));
|
||||
TRY(collect_ref_tests(tests, ByteString::formatted("{}/Screenshot", app.test_root_path), "."sv));
|
||||
#endif
|
||||
|
||||
tests.remove_all_matching([&](auto const& test) {
|
||||
|
|
|
@ -1,4 +0,0 @@
|
|||
<!doctype html>
|
||||
<link rel="match" href="reference/body-link-attribute-ref.html" />
|
||||
<body link="#FF0000">
|
||||
<a href="about:blank">link
|
Before Width: | Height: | Size: 129 B After Width: | Height: | Size: 129 B |
Before Width: | Height: | Size: 237 B After Width: | Height: | Size: 237 B |
Before Width: | Height: | Size: 94 B After Width: | Height: | Size: 94 B |
Before Width: | Height: | Size: 272 B After Width: | Height: | Size: 272 B |
|
@ -1,5 +1,5 @@
|
|||
<!doctype html>
|
||||
<link rel="match" href="reference/anonymous-wrapper-css-visibility-ref.html" />
|
||||
<link rel="match" href="../expected/anonymous-wrapper-css-visibility-ref.html" />
|
||||
<style>
|
||||
body {
|
||||
color: transparent;
|
|
@ -6,9 +6,9 @@
|
|||
display: inline-block;
|
||||
min-width: 12px;
|
||||
min-height: 12px;
|
||||
background-image: url("../assets/2x2checkerboard.png");
|
||||
background-image: url("../data/2x2checkerboard.png");
|
||||
background-size: calc(max(0.75em, 12px));
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body><span></span><img src="../assets/2x2checkerboard.png">
|
||||
<body><span></span><img src="../data/2x2checkerboard.png">
|
|
@ -1,5 +1,5 @@
|
|||
<!doctype html>
|
||||
<link rel="match" href="reference/body-link-attribute.html-ref" />
|
||||
<link rel="match" href="../expected/body-link-attribute.html-ref" />
|
||||
<style>
|
||||
a {
|
||||
color: #FF0000;
|
|
@ -1,5 +1,5 @@
|
|||
<!doctype html>
|
||||
<link rel="match" href="reference/inline-paintable-inside-translated-container-ref.html" />
|
||||
<link rel="match" href="../expected/inline-paintable-inside-translated-container-ref.html" />
|
||||
<style>
|
||||
body {
|
||||
margin-top: 100px;
|
Before Width: | Height: | Size: 186 B After Width: | Height: | Size: 186 B |
|
@ -1,5 +1,5 @@
|
|||
<!DOCTYPE html>
|
||||
<link rel="match" href="reference/outlines-ref.html" />
|
||||
<link rel="match" href="../expected/outlines-ref.html" />
|
||||
<style>
|
||||
.border {
|
||||
width: 100px;
|
|
@ -1,5 +1,5 @@
|
|||
<!DOCTYPE html>
|
||||
<link rel="match" href="reference/overflow-hidden-3-ref.html" />
|
||||
<link rel="match" href="../expected/overflow-hidden-3-ref.html" />
|
||||
<style>
|
||||
.green {
|
||||
width: 200px;
|
|
@ -1,5 +1,5 @@
|
|||
<!DOCTYPE html>
|
||||
<link rel="match" href="reference/overflow-hidden-4-ref.html" />
|
||||
<link rel="match" href="../expected/overflow-hidden-4-ref.html" />
|
||||
<style>
|
||||
* {
|
||||
outline: black solid 1px;
|
|
@ -1,6 +1,6 @@
|
|||
<!DOCTYPE html>
|
||||
<head>
|
||||
<link rel="match" href="reference/overflow-hidden-5-ref.html" />
|
||||
<link rel="match" href="../expected/overflow-hidden-5-ref.html" />
|
||||
<style type="text/css">
|
||||
body {
|
||||
margin: 0;
|
|
@ -1,6 +1,6 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<link rel="match" href="reference/overflow-hidden-6-ref.html" />
|
||||
<link rel="match" href="../expected/overflow-hidden-6-ref.html" />
|
||||
<style>
|
||||
.box {
|
||||
width: 100px;
|
|
@ -1,5 +1,5 @@
|
|||
<html>
|
||||
<link rel="match" href="reference/positioned-elements-in-scroll-container-ref.html" />
|
||||
<link rel="match" href="../expected/positioned-elements-in-scroll-container-ref.html" />
|
||||
<style>
|
||||
* {
|
||||
margin: 0;
|
|
@ -1,5 +1,5 @@
|
|||
<!DOCTYPE html>
|
||||
<link rel="match" href="reference/resolve-paint-only-properties-after-layout-ref.html" />
|
||||
<link rel="match" href="../expected/resolve-paint-only-properties-after-layout-ref.html" />
|
||||
<style>
|
||||
#box {
|
||||
width: 100px;
|
|
@ -1,5 +1,5 @@
|
|||
<!DOCTYPE html>
|
||||
<link rel="match" href="reference/scrollable-content-inside-fixed-position-box-ref.html" />
|
||||
<link rel="match" href="../expected/scrollable-content-inside-fixed-position-box-ref.html" />
|
||||
<style>
|
||||
* {
|
||||
scrollbar-width: none;
|
Before Width: | Height: | Size: 175 B After Width: | Height: | Size: 175 B |