Tests: Add tests for loading images from an imported style sheet

We previously had no coverage for the situation of "relative-linking to
an image in a style sheet which isn't in the same directory as the
document".
This commit is contained in:
Sam Atkins 2025-04-10 17:06:09 +01:00
parent aebbb008c1
commit bf873a2d5b
Notes: github-actions[bot] 2025-04-15 09:30:39 +00:00
4 changed files with 41 additions and 0 deletions

View file

@ -0,0 +1,3 @@
#checkerboard {
background: url("2x2checkerboard.png");
}

View file

@ -0,0 +1,12 @@
<!DOCTYPE html>
<style>
#checkerboard {
width: 20px;
height: 20px;
background: url("../../data/2x2checkerboard.png");
background-size: cover;
}
</style>
<!-- FIXME: Workaround to ensure CSS background-image is loaded before taking screenshot: https://github.com/LadybirdBrowser/ladybird/issues/3448 -->
<img style="display:none" src="../../data/2x2checkerboard.png">
<div id="checkerboard"></div>

View file

@ -0,0 +1,13 @@
<!DOCTYPE html>
<link rel="match" href="../../expected/css/images-load-relative-to-style-sheet-ref.html" />
<style>
@import url("../../data/checkerboard-background.css");
#checkerboard {
width: 20px;
height: 20px;
background-size: cover;
}
</style>
<!-- FIXME: Workaround to ensure CSS background-image is loaded before taking screenshot: https://github.com/LadybirdBrowser/ladybird/issues/3448 -->
<img style="display:none" src="../../data/2x2checkerboard.png">
<div id="checkerboard"></div>

View file

@ -0,0 +1,13 @@
<!DOCTYPE html>
<link rel="match" href="../../expected/css/images-load-relative-to-style-sheet-ref.html" />
<link rel="stylesheet" href="../../data/checkerboard-background.css" />
<style>
#checkerboard {
width: 20px;
height: 20px;
background-size: cover;
}
</style>
<!-- FIXME: Workaround to ensure CSS background-image is loaded before taking screenshot: https://github.com/LadybirdBrowser/ladybird/issues/3448 -->
<img style="display:none" src="../../data/2x2checkerboard.png">
<div id="checkerboard"></div>