[librsvg: 23/29] Test rsvg_handle_new_from_stream_sync()



commit 8acbac4fa45df1f85b1109394d95d2c7685cd125
Author: Federico Mena Quintero <federico gnome org>
Date:   Tue Feb 6 13:38:56 2018 -0600

    Test rsvg_handle_new_from_stream_sync()

 tests/api.c | 31 ++++++++++++++++++++++++++++++-
 1 file changed, 30 insertions(+), 1 deletion(-)
---
diff --git a/tests/api.c b/tests/api.c
index 3cbd6ea..b52e8c1 100644
--- a/tests/api.c
+++ b/tests/api.c
@@ -22,7 +22,6 @@ rsvg_handle_set_size_callback
 rsvg_handle_has_sub
 rsvg_handle_internal_set_testing
 rsvg_handle_new_with_flags
-rsvg_handle_new_from_stream_sync
 rsvg_handle_render_cairo
 rsvg_handle_render_cairo_sub
 rsvg_handle_set_base_gfile
@@ -306,6 +305,35 @@ handle_new_from_gfile_sync (void)
     g_object_unref (handle);
     g_object_unref (file);
 }
+
+static void
+handle_new_from_stream_sync (void)
+{
+    char *filename = get_test_filename ("dpi.svg");
+    GError *error = NULL;
+    GFile *file = g_file_new_for_path (filename);
+    g_assert (file != NULL);
+
+    g_free (filename);
+
+    GFileInputStream *stream = g_file_read (file, NULL, &error);
+    g_assert (stream != NULL);
+    g_assert (error == NULL);
+
+    RsvgHandle *handle = rsvg_handle_new_from_stream_sync (G_INPUT_STREAM (stream),
+                                                           file,
+                                                           RSVG_HANDLE_FLAGS_NONE,
+                                                           NULL,
+                                                           &error);
+
+    g_assert (handle != NULL);
+    g_assert (error == NULL);
+
+    g_object_unref (handle);
+    g_object_unref (file);
+    g_object_unref (stream);
+}
+
 int
 main (int argc, char **argv)
 {
@@ -325,6 +353,7 @@ main (int argc, char **argv)
     g_test_add_func ("/api/handle_write_close_free", handle_write_close_free);
     g_test_add_func ("/api/handle_new_from_data", handle_new_from_data);
     g_test_add_func ("/api/handle_new_from_gfile_sync", handle_new_from_gfile_sync);
+    g_test_add_func ("/api/handle_new_from_stream_sync", handle_new_from_stream_sync);
 
     return g_test_run ();
 }


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