[librsvg: 17/20] Add test for #806




commit a2bf3606674fb5a4d33eb2ac1b2ce16d02b76bc7
Author: Federico Mena Quintero <federico gnome org>
Date:   Tue Oct 19 17:23:39 2021 -0500

    Add test for #806
    
    This failed before the previous commits.
    
    Part-of: <https://gitlab.gnome.org/GNOME/librsvg/-/merge_requests/616>

 tests/fixtures/text/806-text-anchor-chunk-ref.svg |  9 +++++++++
 tests/fixtures/text/806-text-anchor-chunk.svg     | 10 ++++++++++
 tests/src/text.rs                                 |  8 +++++++-
 3 files changed, 26 insertions(+), 1 deletion(-)
---
diff --git a/tests/fixtures/text/806-text-anchor-chunk-ref.svg 
b/tests/fixtures/text/806-text-anchor-chunk-ref.svg
new file mode 100644
index 00000000..a8abdea4
--- /dev/null
+++ b/tests/fixtures/text/806-text-anchor-chunk-ref.svg
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<svg xmlns="http://www.w3.org/2000/svg"; width="600" height="100">
+  <rect x="0" y="0" width="100%" height="100%" fill="white"/>
+  <line x1="300" y1="0" x2="300" y2="100" stroke-width="2" stroke="blue"/>
+  <line x1="0" y1="50" x2="600" y2="50" stroke-width="2" stroke="blue"/>
+
+  <rect x="200" y="14" width="80" height="20" fill="black"/>
+  <rect x="240" y="34" width="40" height="20" fill="black"/>
+</svg>
diff --git a/tests/fixtures/text/806-text-anchor-chunk.svg b/tests/fixtures/text/806-text-anchor-chunk.svg
new file mode 100644
index 00000000..b7a5cfe8
--- /dev/null
+++ b/tests/fixtures/text/806-text-anchor-chunk.svg
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="utf-8"?>
+<svg xmlns="http://www.w3.org/2000/svg"; width="600" height="100">
+  <rect x="0" y="0" width="100%" height="100%" fill="white"/>
+  <line x1="300" y1="0" x2="300" y2="100" stroke-width="2" stroke="blue"/>
+  <line x1="0" y1="50" x2="600" y2="50" stroke-width="2" stroke="blue"/>
+
+  <text text-anchor="end" transform="translate(300, 50)"
+        font-family="Ahem" font-size="20"
+        dx="-20" dy="-20">ABCD<tspan dx="-40" dy="1em">AB</tspan></text>
+</svg>
diff --git a/tests/src/text.rs b/tests/src/text.rs
index dcab4708..605c9275 100644
--- a/tests/src/text.rs
+++ b/tests/src/text.rs
@@ -1,8 +1,8 @@
 use cairo;
 
 use crate::reference_utils::{Compare, Evaluate, Reference};
-use crate::test_compare_render_output;
 use crate::utils::{load_svg, render_document, SurfaceSize};
+use crate::{test_compare_render_output, test_svg_reference};
 
 // From https://www.w3.org/Style/CSS/Test/Fonts/Ahem/
 //
@@ -27,3 +27,9 @@ test_compare_render_output!(
   <rect x="50" y="10" width="250" height="50" fill="black"/>
 </svg>"##,
 );
+
+test_svg_reference!(
+    text_anchor_chunk_806,
+    "tests/fixtures/text/806-text-anchor-chunk.svg",
+    "tests/fixtures/text/806-text-anchor-chunk-ref.svg"
+);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]