[librsvg: 6/7] Add tests for when ellipse's rx/ry properties default to "auto"
- From: Marge Bot <marge-bot src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [librsvg: 6/7] Add tests for when ellipse's rx/ry properties default to "auto"
- Date: Sat, 5 Mar 2022 03:35:30 +0000 (UTC)
commit 52a98a03402812468b99ec4cc959d66e4deda553
Author: Federico Mena Quintero <federico gnome org>
Date: Fri Mar 4 20:15:24 2022 -0600
Add tests for when ellipse's rx/ry properties default to "auto"
Yay, code coverage!
Part-of: <https://gitlab.gnome.org/GNOME/librsvg/-/merge_requests/670>
tests/Makefile.am | 1 +
.../reftests/svg2-reftests/ellipse-auto-rx-ry-ref.svg | 4 ++++
.../fixtures/reftests/svg2-reftests/ellipse-auto-rx-ry.svg | 5 +++++
.../svg2-reftests/ellipse-single-auto-rx-ry-ref.svg | 5 +++++
.../reftests/svg2-reftests/ellipse-single-auto-rx-ry.svg | 8 ++++++++
tests/src/main.rs | 3 +++
tests/src/shapes.rs | 13 +++++++++++++
7 files changed, 39 insertions(+)
---
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 0085e48f1..b020af3a0 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/shapes.rs \
src/text.rs \
src/utils.rs \
src/cmdline/mod.rs \
diff --git a/tests/fixtures/reftests/svg2-reftests/ellipse-auto-rx-ry-ref.svg
b/tests/fixtures/reftests/svg2-reftests/ellipse-auto-rx-ry-ref.svg
new file mode 100644
index 000000000..4e605b423
--- /dev/null
+++ b/tests/fixtures/reftests/svg2-reftests/ellipse-auto-rx-ry-ref.svg
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<svg xmlns="http://www.w3.org/2000/svg" width="200" height="200">
+ <!-- Empty, since an ellipse with auto rx/ry resolves to one with rx=ry=0 -->
+</svg>
diff --git a/tests/fixtures/reftests/svg2-reftests/ellipse-auto-rx-ry.svg
b/tests/fixtures/reftests/svg2-reftests/ellipse-auto-rx-ry.svg
new file mode 100644
index 000000000..e33342222
--- /dev/null
+++ b/tests/fixtures/reftests/svg2-reftests/ellipse-auto-rx-ry.svg
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<svg xmlns="http://www.w3.org/2000/svg" width="200" height="200">
+ <!-- Test that the rx/ry properties, as they both default to "auto", will resolve to 0 -->
+ <ellipse cx="50%" cy="50%" fill="lime"/>
+</svg>
diff --git a/tests/fixtures/reftests/svg2-reftests/ellipse-single-auto-rx-ry-ref.svg
b/tests/fixtures/reftests/svg2-reftests/ellipse-single-auto-rx-ry-ref.svg
new file mode 100644
index 000000000..49c92fd7c
--- /dev/null
+++ b/tests/fixtures/reftests/svg2-reftests/ellipse-single-auto-rx-ry-ref.svg
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<svg xmlns="http://www.w3.org/2000/svg" width="200" height="200">
+ <ellipse cx="25%" cy="50%" rx="10" ry="10" fill="lime"/>
+ <ellipse cx="75%" cy="50%" rx="10" ry="10" fill="lime"/>
+</svg>
diff --git a/tests/fixtures/reftests/svg2-reftests/ellipse-single-auto-rx-ry.svg
b/tests/fixtures/reftests/svg2-reftests/ellipse-single-auto-rx-ry.svg
new file mode 100644
index 000000000..1805801cd
--- /dev/null
+++ b/tests/fixtures/reftests/svg2-reftests/ellipse-single-auto-rx-ry.svg
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<svg xmlns="http://www.w3.org/2000/svg" width="200" height="200">
+ <!-- Test that if only one of the rx/ry properties defaults to "auto", it
+ resolves to the computed value of the other one - yielding a circle.
+ -->
+ <ellipse cx="25%" cy="50%" rx="10" fill="lime"/>
+ <ellipse cx="75%" cy="50%" ry="10" fill="lime"/>
+</svg>
diff --git a/tests/src/main.rs b/tests/src/main.rs
index 1f34ded4c..4528f34a8 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 shapes;
+
#[cfg(test)]
mod text;
diff --git a/tests/src/shapes.rs b/tests/src/shapes.rs
new file mode 100644
index 000000000..8545b79da
--- /dev/null
+++ b/tests/src/shapes.rs
@@ -0,0 +1,13 @@
+use crate::test_svg_reference;
+
+test_svg_reference!(
+ ellipse_auto_rx_ry,
+ "tests/fixtures/reftests/svg2-reftests/ellipse-auto-rx-ry.svg",
+ "tests/fixtures/reftests/svg2-reftests/ellipse-auto-rx-ry-ref.svg"
+);
+
+test_svg_reference!(
+ ellipse_single_auto_rx_ry,
+ "tests/fixtures/reftests/svg2-reftests/ellipse-single-auto-rx-ry.svg",
+ "tests/fixtures/reftests/svg2-reftests/ellipse-single-auto-rx-ry-ref.svg"
+);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]