Tests/LibWeb: Restructure Ref and Screenshot test dirs to match others
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: b7efb61fbe
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
|
difficult to recreate the effect in the reference page, (such as for SVG or canvas,) consider using a Screenshot test
|
||||||
instead.
|
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.
|
uses to locate the reference page. In this way, multiple tests can use the same reference.
|
||||||
|
|
||||||
### Screenshot
|
### 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
|
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.
|
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.
|
page to use.
|
||||||
|
|
|
@ -80,17 +80,20 @@ static ErrorOr<void> collect_dump_tests(Vector<Test>& tests, StringView path, St
|
||||||
return {};
|
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> {
|
Core::DirIterator it(ByteString::formatted("{}/input/{}", path, trail), Core::DirIterator::Flags::SkipDots);
|
||||||
if (entry.type == Core::DirectoryEntry::Type::Directory)
|
while (it.has_next()) {
|
||||||
return IterationDecision::Continue;
|
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, {}, {} });
|
tests.append({ TestMode::Ref, input_path, {}, {} });
|
||||||
|
}
|
||||||
return IterationDecision::Continue;
|
|
||||||
}));
|
|
||||||
|
|
||||||
return {};
|
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("{}/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_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)
|
#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
|
#endif
|
||||||
|
|
||||||
tests.remove_all_matching([&](auto const& test) {
|
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>
|
<!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>
|
<style>
|
||||||
body {
|
body {
|
||||||
color: transparent;
|
color: transparent;
|
|
@ -6,9 +6,9 @@
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
min-width: 12px;
|
min-width: 12px;
|
||||||
min-height: 12px;
|
min-height: 12px;
|
||||||
background-image: url("../assets/2x2checkerboard.png");
|
background-image: url("../data/2x2checkerboard.png");
|
||||||
background-size: calc(max(0.75em, 12px));
|
background-size: calc(max(0.75em, 12px));
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
<body><span></span><img src="../assets/2x2checkerboard.png">
|
<body><span></span><img src="../data/2x2checkerboard.png">
|
|
@ -1,5 +1,5 @@
|
||||||
<!doctype html>
|
<!doctype html>
|
||||||
<link rel="match" href="reference/body-link-attribute.html-ref" />
|
<link rel="match" href="../expected/body-link-attribute.html-ref" />
|
||||||
<style>
|
<style>
|
||||||
a {
|
a {
|
||||||
color: #FF0000;
|
color: #FF0000;
|
|
@ -1,5 +1,5 @@
|
||||||
<!doctype html>
|
<!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>
|
<style>
|
||||||
body {
|
body {
|
||||||
margin-top: 100px;
|
margin-top: 100px;
|
Before Width: | Height: | Size: 186 B After Width: | Height: | Size: 186 B |
|
@ -1,5 +1,5 @@
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<link rel="match" href="reference/outlines-ref.html" />
|
<link rel="match" href="../expected/outlines-ref.html" />
|
||||||
<style>
|
<style>
|
||||||
.border {
|
.border {
|
||||||
width: 100px;
|
width: 100px;
|
|
@ -1,5 +1,5 @@
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<link rel="match" href="reference/overflow-hidden-3-ref.html" />
|
<link rel="match" href="../expected/overflow-hidden-3-ref.html" />
|
||||||
<style>
|
<style>
|
||||||
.green {
|
.green {
|
||||||
width: 200px;
|
width: 200px;
|
|
@ -1,5 +1,5 @@
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<link rel="match" href="reference/overflow-hidden-4-ref.html" />
|
<link rel="match" href="../expected/overflow-hidden-4-ref.html" />
|
||||||
<style>
|
<style>
|
||||||
* {
|
* {
|
||||||
outline: black solid 1px;
|
outline: black solid 1px;
|
|
@ -1,6 +1,6 @@
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<head>
|
<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">
|
<style type="text/css">
|
||||||
body {
|
body {
|
||||||
margin: 0;
|
margin: 0;
|
|
@ -1,6 +1,6 @@
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html>
|
<html>
|
||||||
<link rel="match" href="reference/overflow-hidden-6-ref.html" />
|
<link rel="match" href="../expected/overflow-hidden-6-ref.html" />
|
||||||
<style>
|
<style>
|
||||||
.box {
|
.box {
|
||||||
width: 100px;
|
width: 100px;
|
|
@ -1,5 +1,5 @@
|
||||||
<html>
|
<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>
|
<style>
|
||||||
* {
|
* {
|
||||||
margin: 0;
|
margin: 0;
|
|
@ -1,5 +1,5 @@
|
||||||
<!DOCTYPE html>
|
<!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>
|
<style>
|
||||||
#box {
|
#box {
|
||||||
width: 100px;
|
width: 100px;
|
|
@ -1,5 +1,5 @@
|
||||||
<!DOCTYPE html>
|
<!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>
|
<style>
|
||||||
* {
|
* {
|
||||||
scrollbar-width: none;
|
scrollbar-width: none;
|
Before Width: | Height: | Size: 175 B After Width: | Height: | Size: 175 B |