File: 020-pixeliterator.phpt

package info (click to toggle)
php-imagick 3.2.0~rc1-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 1,516 kB
  • ctags: 1,105
  • sloc: ansic: 14,099; xml: 110; php: 83; sh: 10; makefile: 7
file content (45 lines) | stat: -rw-r--r-- 867 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
--TEST--
Pixel Iterator tests
--SKIPIF--
<?php require_once(dirname(__FILE__) . '/skipif.inc'); ?>
--FILE--
<?php

function count_rows ($pix)
{
	$rows = 0;

	foreach ($pix as $r)
		$rows++;

	return $rows;
}

function count_objects ($pix)
{
	$objects = 0;

	foreach ($pix as $r)
		foreach ($r as $o)
			$objects++;

	return $objects;
}

$im = new Imagick ('magick:rose');
$it1 = new ImagickPixelIterator ($im);

$it2 = ImagickPixelIterator::getPixelIterator ($im);
echo (count_rows ($it1) == count_rows ($it2) ? "match" : "no") . PHP_EOL;
echo (count_objects ($it1) == count_objects ($it2) ? "match" : "no") . PHP_EOL;

$it1->newPixelIterator (new Imagick ('magick:rose'));

echo 'done' . PHP_EOL;
?>
--EXPECTF--
match
match

%s: ImagickPixelIterator::newPixelIterator is deprecated. ImagickPixelIterator::getPixelIterator should be used instead in %s on line %d
done