[librsvg/rustify-rsvg-convert] Add test for rendering individual elements
- From: Federico Mena Quintero <federico src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [librsvg/rustify-rsvg-convert] Add test for rendering individual elements
- Date: Wed, 3 Feb 2021 01:22:43 +0000 (UTC)
commit 23a58031c39c90d6b5450ae32210ba45d9172682
Author: Federico Mena Quintero <federico gnome org>
Date: Wed Jan 27 20:01:11 2021 -0600
Add test for rendering individual elements
.../cmdline/601-zero-stroke-width-render-only-foo.png | Bin 0 -> 95 bytes
tests/fixtures/cmdline/601-zero-stroke-width.svg | 6 ++++++
tests/src/cmdline/rsvg_convert.rs | 17 +++++++++++++++++
3 files changed, 23 insertions(+)
---
diff --git a/tests/fixtures/cmdline/601-zero-stroke-width-render-only-foo.png
b/tests/fixtures/cmdline/601-zero-stroke-width-render-only-foo.png
new file mode 100644
index 00000000..1ed070ca
Binary files /dev/null and b/tests/fixtures/cmdline/601-zero-stroke-width-render-only-foo.png differ
diff --git a/tests/fixtures/cmdline/601-zero-stroke-width.svg
b/tests/fixtures/cmdline/601-zero-stroke-width.svg
new file mode 100644
index 00000000..ee96d474
--- /dev/null
+++ b/tests/fixtures/cmdline/601-zero-stroke-width.svg
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100">
+ <g id="foo">
+ <rect x="50" y="50" width="10" height="10" style="stroke-width: 0; stroke: black; fill: blue"/>
+ </g>
+</svg>
diff --git a/tests/src/cmdline/rsvg_convert.rs b/tests/src/cmdline/rsvg_convert.rs
index 8bf08fc1..664279ec 100644
--- a/tests/src/cmdline/rsvg_convert.rs
+++ b/tests/src/cmdline/rsvg_convert.rs
@@ -602,6 +602,23 @@ fn export_id_option() {
.stdout(file::is_png().with_size(127, 127));
}
+#[test]
+fn export_id_with_zero_stroke_width() {
+ // https://gitlab.gnome.org/GNOME/librsvg/-/issues/601
+ //
+ // This tests a bug that manifested itself easily with the --export-id option, but it
+ // is not a bug with the option itself. An object with stroke_width=0 was causing
+ // an extra point at the origin to be put in the bounding box, so the final image
+ // spanned the origin to the actual visible bounds of the rendered object.
+ //
+ // We can probably test this more cleanly once we have a render tree.
+ RsvgConvert::new_with_input("tests/fixtures/cmdline/601-zero-stroke-width.svg")
+ .arg("--export-id=foo")
+ .assert()
+ .success()
+
.stdout(file::is_png().with_contents("tests/fixtures/cmdline/601-zero-stroke-width-render-only-foo.png"));
+}
+
#[test]
fn export_id_short_option() {
RsvgConvert::new_with_input("tests/fixtures/api/dpi.svg")
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]