testsuite/gsk: add explicit dimensions to <svg> elements
authorMichael Orlitzky <michael@orlitzky.com>
Mon, 28 Aug 2023 19:27:46 +0000 (15:27 -0400)
committerMatthias Clasen <mclasen@redhat.com>
Tue, 19 Sep 2023 19:18:51 +0000 (15:18 -0400)
Without an explicit width, height, and viewBox, there is no single
correct way to render an SVG. In the absense of said information,
librsvg is capable of making a guess by rendering the SVG to a Cairo
surface and then analyzing that surface; however, this process is
merely heuristic.

There are three GTK tests for SVG images that are missing dimensions.
While this is not a violation of the SVG specification, it does
implicitly couple the test to the librsvg rendering heuristic. In this
commit we add that dimension information so that the expected result
is unambiguous.

testsuite/gsk/compare/texture-scale-stripes.node
testsuite/gsk/compare/texture-url.node
testsuite/gsk/nodeparser/texture-scale-filters.node

index acd72b2e44d247f0fdc7856e44cd639544d46bbf..8f25c1deed0a8f5984bbc5936fb4744b3daa5375 100644 (file)
@@ -3,6 +3,6 @@ clip {
   child: texture-scale {
     bounds: 0 0 19991 19991;
     filter: nearest;
-    texture: url('data:,<svg><rect width="10" height="10" style="fill:red" /></svg>');
+    texture: url('data:,<svg width="10" height="10" viewBox="0 0 10 10"><rect width="10" height="10" style="fill:red" /></svg>');
   }
 }
\ No newline at end of file
index f31bf026109e0d25a8cacc11fd59e394a32bc337..25f0a164b43c9a48ad2514c787bc254d7cdc107a 100644 (file)
@@ -7,5 +7,5 @@ color {
 
 texture {
   bounds: 10 10 30 30;
-  texture: url('data:,<svg><rect width="10" height="10" style="fill:red"/></svg>');
+  texture: url('data:,<svg width="10" height="10" viewBox="0 0 10 10"><rect width="10" height="10" style="fill:red"/></svg>');
 }
index 1aef466ce5209cee1a438741adb1e91d580d76fa..0bffe49ed0a802379c8ab72a2dad58e5713ad111 100644 (file)
@@ -1,22 +1,22 @@
 texture-scale {
-  texture: url('data:,<svg><rect width="10" height="10" style="fill:red"/></svg>');
+  texture: url('data:,<svg width="10" height="10" viewBox="0 0 10 10"><rect width="10" height="10" style="fill:red"/></svg>');
   bounds: 0 0 50 50;
 }
 
 texture-scale {
-  texture: url('data:,<svg><rect width="10" height="10" style="fill:red"/></svg>');
+  texture: url('data:,<svg width="10" height="10" viewBox="0 0 10 10"><rect width="10" height="10" style="fill:red"/></svg>');
   bounds: 0 0 50 50;
   filter: linear;
 }
 
 texture-scale {
-  texture: url('data:,<svg><rect width="10" height="10" style="fill:red"/></svg>');
+  texture: url('data:,<svg width="10" height="10" viewBox="0 0 10 10"><rect width="10" height="10" style="fill:red"/></svg>');
   bounds: 0 0 50 50;
   filter: nearest;
 }
 
 texture-scale {
-  texture: url('data:,<svg><rect width="10" height="10" style="fill:red"/></svg>');
+  texture: url('data:,<svg width="10" height="10" viewBox="0 0 10 10"><rect width="10" height="10" style="fill:red"/></svg>');
   bounds: 0 0 50 50;
   filter: trilinear;
 }