mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 22:07:35 +00:00
Tests: Add LibWeb layout tests
This commit is contained in:
parent
c05fcd54bb
commit
78b503946c
4 changed files with 91 additions and 0 deletions
6
Tests/LibWeb/Layout/expected/blank.txt
Normal file
6
Tests/LibWeb/Layout/expected/blank.txt
Normal file
|
@ -0,0 +1,6 @@
|
|||
InitialContainingBlock <#document> at (0,0) content-size 0x0 children: not-inline
|
||||
BlockContainer <html> at (0,0) content-size 0x16 children: not-inline
|
||||
BlockContainer <(anonymous)> at (0,0) content-size 0x0 children: inline
|
||||
TextNode <#text>
|
||||
BlockContainer <body> at (8,8) content-size 0x0 children: inline
|
||||
TextNode <#text>
|
8
Tests/LibWeb/Layout/input/blank.html
Normal file
8
Tests/LibWeb/Layout/input/blank.html
Normal file
|
@ -0,0 +1,8 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Blank</title>
|
||||
</head>
|
||||
<body>
|
||||
</body>
|
||||
</html>
|
20
Tests/LibWeb/Layout/layout_test.sh
Executable file
20
Tests/LibWeb/Layout/layout_test.sh
Executable file
|
@ -0,0 +1,20 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
set -eo pipefail
|
||||
|
||||
SCRIPT_DIR="$(dirname "${0}")"
|
||||
SERENITY_ROOT="$(realpath "${SCRIPT_DIR}"/../../..)"
|
||||
LADYBIRD_BUILD_DIR="${SERENITY_ROOT}/Build/ladybird"
|
||||
|
||||
for filename in "$SCRIPT_DIR"/input/*; do
|
||||
name=$(basename "$filename" .html)
|
||||
input_html_path=$(realpath "$SCRIPT_DIR")/input/"$name".html
|
||||
output_layout_dump=$(cd "$LADYBIRD_BUILD_DIR"; ./ladybird -d "$input_html_path")
|
||||
expected_layout_dump_path="$(realpath "$SCRIPT_DIR")/expected/$name.txt"
|
||||
if cmp <(echo "$output_layout_dump") "$expected_layout_dump_path"; then
|
||||
echo "$name PASSED"
|
||||
else
|
||||
echo "$name FAILED"
|
||||
diff "$expected_layout_dump_path" <(echo "$output_layout_dump")
|
||||
fi
|
||||
done
|
Loading…
Add table
Add a link
Reference in a new issue