[librsvg: 24/29] Test rsvg_handle_read_stream_sync()



commit 0aa78f1d8eda278d549063638264e55e8de9cc60
Author: Federico Mena Quintero <federico gnome org>
Date:   Tue Feb 6 13:41:36 2018 -0600

    Test rsvg_handle_read_stream_sync()

 tests/api.c | 26 +++++++++++++++++++++++++-
 1 file changed, 25 insertions(+), 1 deletion(-)
---
diff --git a/tests/api.c b/tests/api.c
index b52e8c1..db2b895 100644
--- a/tests/api.c
+++ b/tests/api.c
@@ -25,7 +25,6 @@ rsvg_handle_new_with_flags
 rsvg_handle_render_cairo
 rsvg_handle_render_cairo_sub
 rsvg_handle_set_base_gfile
-rsvg_handle_read_stream_sync
 rsvg_handle_get_title
 rsvg_handle_get_desc
 rsvg_handle_get_metadata
@@ -334,6 +333,30 @@ handle_new_from_stream_sync (void)
     g_object_unref (stream);
 }
 
+static void
+handle_read_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 ();
+
+    g_assert (rsvg_handle_read_stream_sync (handle, G_INPUT_STREAM (stream), NULL, &error));
+    g_assert (error == NULL);
+
+    g_object_unref (handle);
+    g_object_unref (file);
+    g_object_unref (stream);
+}
+
 int
 main (int argc, char **argv)
 {
@@ -354,6 +377,7 @@ main (int argc, char **argv)
     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);
+    g_test_add_func ("/api/handle_read_stream_sync", handle_read_stream_sync);
 
     return g_test_run ();
 }


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