[librsvg: 1/20] Move the text tests to a separate tests/src/text.rs module




commit 3959168c2bc4eed6061969afc32a473c4797d832
Author: Federico Mena Quintero <federico gnome org>
Date:   Tue Oct 19 16:49:24 2021 -0500

    Move the text tests to a separate tests/src/text.rs module
    
    We are going to have plenty of tests for text!
    
    Part-of: <https://gitlab.gnome.org/GNOME/librsvg/-/merge_requests/616>

 tests/Makefile.am       |  1 +
 tests/src/main.rs       |  3 +++
 tests/src/primitives.rs | 24 ------------------------
 tests/src/text.rs       | 29 +++++++++++++++++++++++++++++
 4 files changed, 33 insertions(+), 24 deletions(-)
---
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 11cd4ebf..ecff2fff 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -14,6 +14,7 @@ test_sources =                                \
        src/reference.rs                \
        src/reference_utils.rs          \
        src/render_crash.rs             \
+       src/text.rs                     \
        src/utils.rs                    \
        src/cmdline/mod.rs              \
        src/cmdline/rsvg_convert.rs     \
diff --git a/tests/src/main.rs b/tests/src/main.rs
index c560f8b1..1f34ded4 100644
--- a/tests/src/main.rs
+++ b/tests/src/main.rs
@@ -44,6 +44,9 @@ mod reference_utils;
 #[cfg(test)]
 mod render_crash;
 
+#[cfg(test)]
+mod text;
+
 #[cfg(test)]
 mod utils;
 
diff --git a/tests/src/primitives.rs b/tests/src/primitives.rs
index 638f00d2..e1564bf8 100644
--- a/tests/src/primitives.rs
+++ b/tests/src/primitives.rs
@@ -400,27 +400,3 @@ test_compare_render_output!(
   <rect x="0" y="0" width="20" height="20" fill="black" transform="translate(-10 -20) scale(2) rotate(45)"/>
 </svg>"##,
 );
-
-// From https://www.w3.org/Style/CSS/Test/Fonts/Ahem/
-//
-//   > The Ahem font was developed by Todd Fahrner and Myles C. Maxfield to
-//   > help test writers develop predictable tests. The units per em is 1000,
-//   > the ascent is 800, and the descent is 200, thereby making the em
-//   > square exactly square. The glyphs for most characters is simply a box
-//   > which fills this square. The codepoints mapped to this full square
-//   > with a full advance are the following ranges:
-//
-// So, ascent is 4/5 of the font-size, descent is 1/5.  Mind the positions below.
-test_compare_render_output!(
-    ahem_font,
-    500,
-    500,
-    br##"<?xml version="1.0" encoding="UTF-8"?>
-<svg xmlns="http://www.w3.org/2000/svg"; width="500" height="500">
-  <text style="font: 50px Ahem;" x="50" y="50" fill="black">abcde</text>
-</svg>"##,
-    br##"<?xml version="1.0" encoding="UTF-8"?>
-<svg xmlns="http://www.w3.org/2000/svg"; width="500" height="500">
-  <rect x="50" y="10" width="250" height="50" fill="black"/>
-</svg>"##,
-);
diff --git a/tests/src/text.rs b/tests/src/text.rs
new file mode 100644
index 00000000..dcab4708
--- /dev/null
+++ b/tests/src/text.rs
@@ -0,0 +1,29 @@
+use cairo;
+
+use crate::reference_utils::{Compare, Evaluate, Reference};
+use crate::test_compare_render_output;
+use crate::utils::{load_svg, render_document, SurfaceSize};
+
+// From https://www.w3.org/Style/CSS/Test/Fonts/Ahem/
+//
+//   > The Ahem font was developed by Todd Fahrner and Myles C. Maxfield to
+//   > help test writers develop predictable tests. The units per em is 1000,
+//   > the ascent is 800, and the descent is 200, thereby making the em
+//   > square exactly square. The glyphs for most characters is simply a box
+//   > which fills this square. The codepoints mapped to this full square
+//   > with a full advance are the following ranges:
+//
+// So, ascent is 4/5 of the font-size, descent is 1/5.  Mind the positions below.
+test_compare_render_output!(
+    ahem_font,
+    500,
+    500,
+    br##"<?xml version="1.0" encoding="UTF-8"?>
+<svg xmlns="http://www.w3.org/2000/svg"; width="500" height="500">
+  <text style="font: 50px Ahem;" x="50" y="50" fill="black">abcde</text>
+</svg>"##,
+    br##"<?xml version="1.0" encoding="UTF-8"?>
+<svg xmlns="http://www.w3.org/2000/svg"; width="500" height="500">
+  <rect x="50" y="10" width="250" height="50" fill="black"/>
+</svg>"##,
+);


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