[librsvg: 9/11] tests/api.c: Test that rsvg_handle_close() is idempotent




commit a661bfc8e781f607f24cf7599ade3131e2cc2991
Author: Federico Mena Quintero <federico gnome org>
Date:   Tue Aug 9 13:05:29 2022 -0500

    tests/api.c: Test that rsvg_handle_close() is idempotent
    
    Part-of: <https://gitlab.gnome.org/GNOME/librsvg/-/merge_requests/727>

 tests/api.c | 9 +++++++++
 1 file changed, 9 insertions(+)
---
diff --git a/tests/api.c b/tests/api.c
index edee0ba4d..c867d9ad2 100644
--- a/tests/api.c
+++ b/tests/api.c
@@ -414,6 +414,10 @@ handle_write_close_free (void)
     g_assert (rsvg_handle_close (handle, &error));
     g_assert_no_error (error);
 
+    /* Test that close() is idempotent in the happy case */
+    g_assert (rsvg_handle_close (handle, &error));
+    g_assert_no_error (error);
+
     rsvg_handle_free (handle);
     g_free (data);
 }
@@ -1216,6 +1220,11 @@ no_write_before_close (void)
     g_assert_false (rsvg_handle_close (handle, &error));
     g_assert_error (error, RSVG_ERROR, RSVG_ERROR_FAILED);
     g_error_free (error);
+    error = NULL;
+
+    /* Test that close() is idempotent in the error case */
+    g_assert (rsvg_handle_close (handle, &error));
+    g_assert_no_error (error);
 
     g_object_unref (handle);
 }


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