[librsvg] Test that the size_callback's destroy_notify is called if set twice
- From: Federico Mena Quintero <federico src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [librsvg] Test that the size_callback's destroy_notify is called if set twice
- Date: Tue, 8 Jan 2019 23:05:47 +0000 (UTC)
commit d32c26060339122e68847ba4c69803a6f0544706
Author: Federico Mena Quintero <federico gnome org>
Date: Tue Jan 8 17:03:47 2019 -0600
Test that the size_callback's destroy_notify is called if set twice
tests/api.c | 32 ++++++++++++++++++++++++++++++++
1 file changed, 32 insertions(+)
---
diff --git a/tests/api.c b/tests/api.c
index 1508af61..a59e7031 100644
--- a/tests/api.c
+++ b/tests/api.c
@@ -591,6 +591,37 @@ set_size_callback (void)
g_assert (data.destroyed);
}
+static void
+reset_size_callback (void)
+{
+ char *filename = get_test_filename ("example.svg");
+ GError *error = NULL;
+ RsvgHandle *handle;
+ struct size_func_data data_1;
+ struct size_func_data data_2;
+
+ handle = rsvg_handle_new_from_file (filename, &error);
+ g_free (filename);
+
+ g_assert (handle != NULL);
+ g_assert (error == NULL);
+
+ data_1.called = FALSE;
+ data_1.destroyed = FALSE;
+
+ rsvg_handle_set_size_callback (handle, size_func, &data_1, size_func_destroy);
+
+ data_2.called = FALSE;
+ data_2.destroyed = FALSE;
+
+ rsvg_handle_set_size_callback (handle, size_func, &data_2, size_func_destroy);
+ g_assert (data_1.destroyed);
+
+ g_object_unref (handle);
+
+ g_assert (data_2.destroyed);
+}
+
static void
detects_cairo_context_in_error (void)
{
@@ -793,6 +824,7 @@ main (int argc, char **argv)
g_test_add_func ("/api/handle_get_pixbuf_sub", handle_get_pixbuf_sub);
g_test_add_func ("/api/dimensions_and_position", dimensions_and_position);
g_test_add_func ("/api/set_size_callback", set_size_callback);
+ g_test_add_func ("/api/reset_size_callback", reset_size_callback);
g_test_add_func ("/api/detects_cairo_context_in_error", detects_cairo_context_in_error);
g_test_add_func ("/api/can_draw_to_non_image_surface", can_draw_to_non_image_surface);
g_test_add_func ("/api/render_cairo_sub", render_cairo_sub);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]