mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-28 10:37:17 +02:00
Instead of rendering a reference HTML page that wraps an <img> tag pointing to a PNG, Screenshot tests now load the expected PNG directly from disk and compare it against the rendered screenshot. This eliminates the indirection of loading and rendering a second page just to display a static image. This also means --rebaseline now works for Screenshot tests, generating the expected PNG automatically instead of requiring manual screenshot capture and placement. Changes: - Add TestMode::Screenshot with its own collector and runner - Move PNGs from Screenshot/images/ to Screenshot/expected/ with normalized names matching input filenames - Remove all 92 reference HTML wrapper files and the images/ directory - Remove <link rel="match"> from all 94 Screenshot input HTML files - Update add_libweb_test.py Screenshot boilerplate accordingly - Add Screenshot mode to results viewer image comparison tabs
41 lines
1.1 KiB
HTML
41 lines
1.1 KiB
HTML
<!DOCTYPE html>
|
|
<meta name="fuzzy" content="maxDifference=0-1;totalPixels=0-6">
|
|
<style>
|
|
* {
|
|
margin: 0;
|
|
}
|
|
|
|
body {
|
|
background-color: white;
|
|
}
|
|
</style>
|
|
<canvas width=800 height=600 id="canvas"></canvas>
|
|
<script>
|
|
const canvas = document.getElementById("canvas");
|
|
const ctx = canvas.getContext("2d");
|
|
|
|
// Create a radial gradient
|
|
// The inner circle is at x=110, y=90, with radius=30
|
|
// The outer circle is at x=100, y=100, with radius=70
|
|
let gradient = ctx.createRadialGradient(110, 90, 30, 100, 100, 70);
|
|
|
|
gradient.addColorStop(0, "pink");
|
|
gradient.addColorStop(0.9, "white");
|
|
gradient.addColorStop(1, "green");
|
|
|
|
ctx.fillStyle = gradient;
|
|
ctx.fillRect(20, 20, 160, 160);
|
|
|
|
// Create a linear gradient
|
|
// The start gradient point is at x=20, y=0
|
|
// The end gradient point is at x=220, y=0
|
|
gradient = ctx.createLinearGradient(220, 0, 420, 0);
|
|
|
|
gradient.addColorStop(0, "green");
|
|
gradient.addColorStop(0.5, "cyan");
|
|
gradient.addColorStop(1, "green");
|
|
|
|
ctx.fillStyle = gradient;
|
|
ctx.fillRect(220, 20, 200, 100);
|
|
</script>
|