| 1 |
#include <gdk/gdk.h> |
| 2 |
|
| 3 |
static void |
| 4 |
test_set_source_big_pixbuf (void) |
| 5 |
{ |
| 6 |
cairo_surface_t *surface; |
| 7 |
GdkPixbuf *pixbuf; |
| 8 |
cairo_t *cr; |
| 9 |
|
| 10 |
#define WAY_TOO_BIG 65540 |
| 11 |
|
| 12 |
/* Check that too big really is to big. |
| 13 |
* If this check fails, somebody improved Cairo and this test is useless. |
| 14 |
*/ |
| 15 |
surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32, WAY_TOO_BIG, 1); |
| 16 |
g_assert_cmpint (cairo_surface_status (surface), !=, CAIRO_STATUS_SUCCESS); |
| 17 |
cairo_surface_destroy (surface); |
| 18 |
|
| 19 |
surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32, 10, 10); |
| 20 |
cr = cairo_create (surface); |
| 21 |
pixbuf = gdk_pixbuf_new (GDK_COLORSPACE_RGB, FALSE, 8, WAY_TOO_BIG, 1); |
| 22 |
|
| 23 |
gdk_cairo_set_source_pixbuf (cr, pixbuf, 0, 0); |
| 24 |
g_assert_cmpint (cairo_status (cr), !=, CAIRO_STATUS_SUCCESS); |
| 25 |
|
| 26 |
g_object_unref (pixbuf); |
| 27 |
cairo_destroy (cr); |
| 28 |
cairo_surface_destroy (surface); |
| 29 |
} |
| 30 |
|
| 31 |
int |
| 32 |
main (int argc, char *argv[]) |
| 33 |
{ |
| 34 |
g_test_init (&argc, &argv, NULL); |
| 35 |
gdk_init (&argc, &argv); |
| 36 |
|
| 37 |
g_test_add_func ("/drawing/set-source-big-pixbuf", test_set_source_big_pixbuf); |
| 38 |
|
| 39 |
return g_test_run (); |
| 40 |
} |