[cairo-commit] cairo/test user_data.c,1.2,1.3

Kristian Hogsberg commit at pdx.freedesktop.org
Wed Mar 16 12:15:31 PST 2005


Committed by: krh

Update of /cvs/cairo/cairo/test
In directory gabe:/tmp/cvs-serv810/test

Modified Files:
	user_data.c 
Log Message:
2005-03-16  Kristian Høgsberg  <krh at redhat.com>

        * src/cairo_surface.c (_destroy_user_data)
        (cairo_surface_set_user_data): Dont call user data destroy
        function if it's NULL.

        * test/user_data.c: (main): Add test case for user data with NULL
        destroy function.



Index: user_data.c
===================================================================
RCS file: /cvs/cairo/cairo/test/user_data.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- user_data.c	10 Mar 2005 17:22:20 -0000	1.2
+++ user_data.c	16 Mar 2005 20:15:29 -0000	1.3
@@ -56,10 +56,18 @@
     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);




More information about the cairo-commit mailing list