summaryrefslogtreecommitdiff
path: root/test/user-data.c
diff options
context:
space:
mode:
authorKristian Høgsberg <krh@redhat.com>2005-03-16 12:15:29 +0000
committerKristian Høgsberg <krh@redhat.com>2005-03-16 12:15:29 +0000
commit0f52fb2289b8369f0d66a779338e18818746ad7d (patch)
treed468be88e4002ea9cd1b4d0099f0f89d41b6a9ca /test/user-data.c
parent6993c086ebaa9a98b1794f2c483013ec51cc41ec (diff)
Dont call user data destroy function if it's NULL.
Add test case for user data with NULL destroy function.
Diffstat (limited to 'test/user-data.c')
-rw-r--r--test/user-data.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/test/user-data.c b/test/user-data.c
index 4f3b761b..88a706af 100644
--- a/test/user-data.c
+++ b/test/user-data.c
@@ -56,10 +56,18 @@ main (void)
assert (cairo_surface_get_user_data (surface, &key1) == &data1);
assert (cairo_surface_set_user_data (surface, &key1, NULL, NULL)
== CAIRO_STATUS_SUCCESS);
+ assert (cairo_surface_get_user_data (surface, &key1) == NULL);
assert (data1 == 1);
assert (data2 == 0);
data1 = 0;
+ assert (cairo_surface_set_user_data (surface, &key1, &data1, NULL)
+ == CAIRO_STATUS_SUCCESS);
+ assert (cairo_surface_set_user_data (surface, &key1, NULL, NULL)
+ == CAIRO_STATUS_SUCCESS);
+ assert (data1 == 0);
+ assert (cairo_surface_get_user_data (surface, &key1) == NULL);
+
assert (cairo_surface_set_user_data (surface, &key1, &data1, destroy_data1)
== CAIRO_STATUS_SUCCESS);
cairo_surface_destroy (surface);