[librsvg: 12/53] Move the "no svg root" test to Rust
- From: Federico Mena Quintero <federico src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [librsvg: 12/53] Move the "no svg root" test to Rust
- Date: Fri, 23 Oct 2020 02:19:06 +0000 (UTC)
commit cf90149ad9e376b8d5b0effac45b9ced8f5fef3b
Author: Federico Mena Quintero <federico gnome org>
Date: Tue Oct 13 17:48:48 2020 -0500
Move the "no svg root" test to Rust
Cargo.lock | 1 +
librsvg_crate/Cargo.toml | 1 +
librsvg_crate/tests/standalone/bugs.rs | 12 +++++++++++-
tests/errors.c | 5 -----
tests/fixtures/errors/335-non-svg-element.svg | 1 -
5 files changed, 13 insertions(+), 7 deletions(-)
---
diff --git a/Cargo.lock b/Cargo.lock
index 2a46254e..001703e2 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -769,6 +769,7 @@ dependencies = [
"cairo-rs",
"gio",
"glib",
+ "matches",
"rgb",
"rsvg_internals",
"url",
diff --git a/librsvg_crate/Cargo.toml b/librsvg_crate/Cargo.toml
index b0ff0698..435334eb 100644
--- a/librsvg_crate/Cargo.toml
+++ b/librsvg_crate/Cargo.toml
@@ -17,5 +17,6 @@ url = "2"
[dev-dependencies]
cairo-rs = { version = "0.8.0", features = ["png", "pdf", "svg"] }
+matches = "0.1"
rgb = { version="0.8", features=["argb"] }
rsvg_internals = { path = "../rsvg_internals" }
diff --git a/librsvg_crate/tests/standalone/bugs.rs b/librsvg_crate/tests/standalone/bugs.rs
index c4de96ec..3e5a9eec 100644
--- a/librsvg_crate/tests/standalone/bugs.rs
+++ b/librsvg_crate/tests/standalone/bugs.rs
@@ -1,9 +1,19 @@
use cairo;
-
+use librsvg::LoadingError;
+use matches::matches;
use rsvg_internals::surface_utils::shared_surface::{SharedImageSurface, SurfaceType};
use crate::utils::{compare_to_surface, load_svg, render_document, SurfaceSize};
+// https://gitlab.gnome.org/GNOME/librsvg/issues/335
+#[test]
+fn non_svg_root() {
+ assert!(matches!(
+ load_svg(b"<x></x>"),
+ Err(LoadingError::RootElementIsNotSvg)
+ ));
+}
+
// https://gitlab.gnome.org/GNOME/librsvg/issues/496
#[test]
fn inf_width() {
diff --git a/tests/errors.c b/tests/errors.c
index 540a51bf..ae439cba 100644
--- a/tests/errors.c
+++ b/tests/errors.c
@@ -69,11 +69,6 @@ main (int argc, char **argv)
{
g_test_init (&argc, &argv, NULL);
- g_test_add_data_func_full ("/errors/non_svg_element",
- "335-non-svg-element.svg",
- test_loading_error,
- NULL);
-
g_test_add_data_func_full ("/errors/instancing_limit/323-nested-use.svg",
"323-nested-use.svg",
test_instancing_limit,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]