summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2023-05-20 17:54:03 +0200
committerAndreas Kling <kling@serenityos.org>2023-05-21 07:44:29 +0200
commit24ea78c6133a437eabc31630b0642fa36d8a5a00 (patch)
tree278c9f5f27d6a5067d7b5cb7a9e109298720919c
parentb2c899af118e40e3786abde0825ba7f00cc5d248 (diff)
downloadserenity-24ea78c6133a437eabc31630b0642fa36d8a5a00.zip
LibWeb: Add a very basic test for SVG-as-image
This mainly just checks that we load the file and learn the correct intrinsic aspect ratio from the external SVG.
-rw-r--r--Tests/LibWeb/Layout/expected/svg/svg-as-image.txt4
-rw-r--r--Tests/LibWeb/Layout/input/svg/rectangle.svg3
-rw-r--r--Tests/LibWeb/Layout/input/svg/svg-as-image.html1
3 files changed, 8 insertions, 0 deletions
diff --git a/Tests/LibWeb/Layout/expected/svg/svg-as-image.txt b/Tests/LibWeb/Layout/expected/svg/svg-as-image.txt
new file mode 100644
index 0000000000..0592f36d88
--- /dev/null
+++ b/Tests/LibWeb/Layout/expected/svg/svg-as-image.txt
@@ -0,0 +1,4 @@
+Viewport <#document> at (0,0) content-size 800x600 children: not-inline
+ BlockContainer <html> at (0,0) content-size 800x1584 [BFC] children: not-inline
+ BlockContainer <body> at (8,8) content-size 784x1568 children: not-inline
+ ImageBox <img> at (8,8) content-size 784x1568 children: not-inline
diff --git a/Tests/LibWeb/Layout/input/svg/rectangle.svg b/Tests/LibWeb/Layout/input/svg/rectangle.svg
new file mode 100644
index 0000000000..038b4a2765
--- /dev/null
+++ b/Tests/LibWeb/Layout/input/svg/rectangle.svg
@@ -0,0 +1,3 @@
+<svg viewBox="0 0 100 200" xmlns="http://www.w3.org/2000/svg">
+ <rect x="0" y="0" width="100" height="200" fill="green" />
+</svg>
diff --git a/Tests/LibWeb/Layout/input/svg/svg-as-image.html b/Tests/LibWeb/Layout/input/svg/svg-as-image.html
new file mode 100644
index 0000000000..6a9f6bfd8a
--- /dev/null
+++ b/Tests/LibWeb/Layout/input/svg/svg-as-image.html
@@ -0,0 +1 @@
+<!doctype html><img src="rectangle.svg" style="display: block"> \ No newline at end of file