Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
tree: 50a7871e7a
Fetching contributors…

Cannot retrieve contributors at this time

64 lines (48 sloc) 2.21 kB
--TEST--
cairo_set_source_rgba function
--SKIPIF--
<?php
if(!extension_loaded('cairo')) die('skip - Cairo extension not available');
?>
--FILE--
<?php
$surface = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, 50, 50);
var_dump($surface);
$context = cairo_create($surface);
var_dump($context);
cairo_set_source_rgba($context, 0.1, 0.1, 0.1, 0.5);
function bad_class($errno, $errstr) {
echo 'CAUGHT ERROR: ' . $errstr, PHP_EOL;
}
set_error_handler('bad_class', E_RECOVERABLE_ERROR);
/* wrong params */
cairo_set_source_rgba();
cairo_set_source_rgba($context);
cairo_set_source_rgba($context, 1);
cairo_set_source_rgba($context, 1, 1);
cairo_set_source_rgba($context, 1, 1, 1);
cairo_set_source_rgba($context, 1, 1, 1, 1, 1);
/* wrong types */
cairo_set_source_rgba(1, 1, 1, 1, 1);
cairo_set_source_rgba($context, array(), 1, 1, 1);
cairo_set_source_rgba($context, 1, array(), 1, 1);
cairo_set_source_rgba($context, 1, 1, array(), 1);
cairo_set_source_rgba($context, 1, 1, 1, array());
?>
--EXPECTF--
object(CairoImageSurface)#%d (0) {
}
object(CairoContext)#%d (0) {
}
Warning: cairo_set_source_rgba() expects exactly 5 parameters, 0 given in %s on line %d
Warning: cairo_set_source_rgba() expects exactly 5 parameters, 1 given in %s on line %d
Warning: cairo_set_source_rgba() expects exactly 5 parameters, 2 given in %s on line %d
Warning: cairo_set_source_rgba() expects exactly 5 parameters, 3 given in %s on line %d
Warning: cairo_set_source_rgba() expects exactly 5 parameters, 4 given in %s on line %d
Warning: cairo_set_source_rgba() expects exactly 5 parameters, 6 given in %s on line %d
CAUGHT ERROR: Argument 1 passed to cairo_set_source_rgba() must be an instance of CairoContext, integer given
Warning: cairo_set_source_rgba() expects parameter 1 to be CairoContext, integer given in %s on line %d
Warning: cairo_set_source_rgba() expects parameter 2 to be double, array given in %s on line %d
Warning: cairo_set_source_rgba() expects parameter 3 to be double, array given in %s on line %d
Warning: cairo_set_source_rgba() expects parameter 4 to be double, array given in %s on line %d
Warning: cairo_set_source_rgba() expects parameter 5 to be double, array given in %s on line %d
Jump to Line
Something went wrong with that request. Please try again.