You are here

function SmartcropTestCase::assertImageNotEqual in Smart Crop 7

Same name and namespace in other branches
  1. 6 tests/smartcrop.test \SmartcropTestCase::assertImageNotEqual()

Assert that two images are not the same, with some difference allowed to account for e.g. compression artifacts.

Parameters

$image1 A GD image resource.:

$image2 A GD image resource.:

$min_diff (optional) The minimum allowed difference, range from 0 to 255, defaults to 1.:

$message (optional) The message to display along with the assertion.:

1 call to SmartcropTestCase::assertImageNotEqual()
SmartcropTestCase::testImageEqual in tests/smartcrop.test
Test the ImageEqual assertions.

File

tests/smartcrop.test, line 194
Tests for the smartcrop module.

Class

SmartcropTestCase
@file Tests for the smartcrop module.

Code

function assertImageNotEqual($image1, $image2, $min_diff = 1, $message = NULL) {
  if (empty($message)) {
    $message = t('Images are not equal.');
  }
  $difference = $this
    ->difference($image1, $image2);
  $mean = $this
    ->mean($difference);
  $this
    ->assertTrue($mean > $min_diff, $message);
}