1--TEST-- 2Test Imagick, GetImageChannelRange basic 3--SKIPIF-- 4<?php 5require_once(dirname(__FILE__) . '/skipif.inc'); 6?> 7--XFAIL-- 8Tests are not stable across ImageMagick versions. 9--FILE-- 10<?php 11 12$imagick = new \Imagick(); 13$imagick->newPseudoImage(640, 480, "gradient:rgb(0,32,32)-rgb(128,255,255)"); 14 15$redChannelRange = $imagick->getImageChannelRange(\Imagick::CHANNEL_RED); 16$greenChannelRange = $imagick->getImageChannelRange(\Imagick::CHANNEL_GREEN); 17 18$expectedRedMinima = (Imagick::getQuantum() * 0.0) / 255; 19$expectedRedMaxima = (Imagick::getQuantum() * 128.0) / 255; 20 21$expectedGreenMinima = (Imagick::getQuantum() * 32.0) / 255; 22$expectedGreenMaxima = (Imagick::getQuantum() * 255.0) / 255; 23 24// Floating point math. This is absolutely going to blow up 25// on some platforms. But as finding out which would be interesting 26// will leave it like this for now. 27if ($expectedRedMinima !== $redChannelRange['minima']) { 28 printf( 29 "Unexpected red minima. Was expecting %s but have %s\n", 30 $expectedRedMinima, 31 $redChannelRange['minima'] 32 ); 33} 34if ($expectedRedMaxima !== $redChannelRange['maxima']) { 35 printf( 36 "Unexpected red maxima. Was expecting %s but have %s\n", 37 $expectedRedMinima, 38 $redChannelRange['maxima'] 39 ); 40} 41 42 43if ($expectedGreenMinima !== $greenChannelRange['minima']) { 44 printf( 45 "Unexpected green minima. Was expecting %s but have %s\n", 46 $expectedGreenMinima, 47 $greenChannelRange['minima'] 48 ); 49} 50if ($expectedGreenMaxima !== $greenChannelRange['maxima']) { 51 printf( 52 "Unexpected green maxima. Was expecting %s but have %s\n", 53 $expectedGreenMaxima, 54 $greenChannelRange['maxima'] 55 ); 56} 57 58echo "Ok"; 59?> 60--EXPECTF-- 61Ok