mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-26 01:20:25 +00:00
Tests: Add LibWeb layout tests
This commit is contained in:
parent
c05fcd54bb
commit
78b503946c
Notes:
sideshowbarker
2024-07-17 03:14:39 +09:00
Author: https://github.com/kalenikaliaksandr Commit: https://github.com/SerenityOS/serenity/commit/78b503946c Pull-request: https://github.com/SerenityOS/serenity/pull/17230 Reviewed-by: https://github.com/linusg
4 changed files with 91 additions and 0 deletions
57
.github/workflows/libweb-layout.yml
vendored
Normal file
57
.github/workflows/libweb-layout.yml
vendored
Normal file
|
@ -0,0 +1,57 @@
|
||||||
|
name: Test LibWeb layout
|
||||||
|
on: [ push, pull_request ]
|
||||||
|
|
||||||
|
env:
|
||||||
|
SERENITY_SOURCE_DIR: ${{ github.workspace }}
|
||||||
|
|
||||||
|
concurrency: libweb-layout
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
runs-on: ubuntu-22.04
|
||||||
|
if: github.repository == 'SerenityOS/serenity'
|
||||||
|
strategy:
|
||||||
|
fail-fast: true
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
- name: "Install Ubuntu dependencies"
|
||||||
|
run: |
|
||||||
|
sudo apt-get update
|
||||||
|
sudo apt-get install -y ninja-build gcc-12 g++-12 libstdc++-12-dev \
|
||||||
|
libgl1-mesa-dev qt6-base-dev qt6-tools-dev-tools \
|
||||||
|
- name: "Create build directories"
|
||||||
|
run: |
|
||||||
|
mkdir -p ${{ github.workspace }}/Build/caches/TZDB
|
||||||
|
mkdir -p ${{ github.workspace }}/Build/caches/UCD
|
||||||
|
mkdir -p ${{ github.workspace }}/Build/caches/CLDR
|
||||||
|
- name: "TimeZoneData cache"
|
||||||
|
uses: actions/cache@03e00da99d75a2204924908e1cca7902cafce66b
|
||||||
|
with:
|
||||||
|
path: ${{ github.workspace }}/Build/caches/TZDB
|
||||||
|
key: TimeZoneData-${{ hashFiles('Meta/CMake/time_zone_data.cmake') }}
|
||||||
|
- name: "UnicodeData cache"
|
||||||
|
uses: actions/cache@03e00da99d75a2204924908e1cca7902cafce66b
|
||||||
|
with:
|
||||||
|
path: ${{ github.workspace }}/Build/caches/UCD
|
||||||
|
key: UnicodeData-${{ hashFiles('Meta/CMake/unicode_data.cmake') }}
|
||||||
|
- name: "UnicodeLocale cache"
|
||||||
|
uses: actions/cache@03e00da99d75a2204924908e1cca7902cafce66b
|
||||||
|
with:
|
||||||
|
path: ${{ github.workspace }}/Build/caches/CLDR
|
||||||
|
key: UnicodeLocale-${{ hashFiles('Meta/CMake/locale_data.cmake') }}
|
||||||
|
- name: "Create Ladybird build environment"
|
||||||
|
run: |
|
||||||
|
cmake -GNinja \
|
||||||
|
-B ${{ github.workspace }}/Build/ladybird \
|
||||||
|
-S ${{ github.workspace }}/Ladybird \
|
||||||
|
-DCMAKE_C_COMPILER=gcc-12 \
|
||||||
|
-DCMAKE_CXX_COMPILER=g++-12 \
|
||||||
|
-DSERENITY_CACHE_DIR=${{ github.workspace }}/Build/cachess
|
||||||
|
- name: "Build Ladybird"
|
||||||
|
run: |
|
||||||
|
ninja -C ${{ github.workspace }}/Build/ladybird
|
||||||
|
- name: "Run layout tests"
|
||||||
|
run: |
|
||||||
|
${{ github.workspace }}/Tests/LibWeb/Layout/layout_test.sh
|
||||||
|
env:
|
||||||
|
QT_QPA_PLATFORM: "offscreen"
|
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…
Reference in a new issue