[librsvg: 2/5] tests/errors: Test that a non-svg toplevel element gives us a parsing error
- From: Federico Mena Quintero <federico src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [librsvg: 2/5] tests/errors: Test that a non-svg toplevel element gives us a parsing error
- Date: Thu, 13 Sep 2018 15:33:08 +0000 (UTC)
commit 7fadcb2755feffbdb5760028226ed4e92a7263ee
Author: Federico Mena Quintero <federico gnome org>
Date: Thu Sep 13 08:52:36 2018 -0500
tests/errors: Test that a non-svg toplevel element gives us a parsing error
This test fails right now; we'll fix it next.
tests/errors.c | 16 ++++++++++++++++
tests/fixtures/errors/335-non-svg-element.svg | 1 +
2 files changed, 17 insertions(+)
---
diff --git a/tests/errors.c b/tests/errors.c
index f370d60e..bdf6db7b 100644
--- a/tests/errors.c
+++ b/tests/errors.c
@@ -22,6 +22,21 @@ get_test_filename (const char *basename) {
basename,
NULL);
}
+
+static void
+test_non_svg_element (void)
+{
+ char *filename = get_test_filename ("335-non-svg-element.svg");
+ RsvgHandle *handle;
+ GError *error = NULL;
+
+ handle = rsvg_handle_new_from_file (filename, &error);
+ g_free (filename);
+
+ g_assert (handle == NULL);
+ g_assert (g_error_matches (error, RSVG_ERROR, RSVG_ERROR_FAILED));
+}
+
static void
test_instancing_limit (void)
{
@@ -49,6 +64,7 @@ main (int argc, char **argv)
{
g_test_init (&argc, &argv, NULL);
+ g_test_add_func ("/errors/non_svg_element", test_non_svg_element);
g_test_add_func ("/errors/instancing_limit", test_instancing_limit);
return g_test_run ();
diff --git a/tests/fixtures/errors/335-non-svg-element.svg b/tests/fixtures/errors/335-non-svg-element.svg
new file mode 100644
index 00000000..19c0f203
--- /dev/null
+++ b/tests/fixtures/errors/335-non-svg-element.svg
@@ -0,0 +1 @@
+<x></x>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]