You are here

function FilterIEImageEffectsUnitTest::testfiltersie_UnsharpMaskEffect in FiltersIE 7

Test the filtersie_sharpenUSM_effect() function.

File

./filtersie.test, line 29
Tests for image.module.

Class

FilterIEImageEffectsUnitTest
Use the image_test.module's mock toolkit to ensure that the effects are properly passing parameters to the image toolkit.

Code

function testfiltersie_UnsharpMaskEffect() {

  // Test wihout sigma parameter
  $this
    ->assertTrue(filtersie_sharpenUSM_effect($this->image, array(
    'amount' => 50,
    'radius' => 1,
    'threshold' => 3,
  )), 'filtersie_UnsharpMask Function returned the expected value.');
  $this
    ->assertToolkitOperationsCalled(array(
    'filtersie_UnsharpMask',
  ));

  // Check the parameters.
  $calls = image_test_get_all_calls();
  $this
    ->assertEqual($calls['filtersie_UnsharpMask'][0][1], 50, 'Amount was passed correctly');
  $this
    ->assertEqual($calls['filtersie_UnsharpMask'][0][2], 1, 'Radius was passed correctly');
  $this
    ->assertEqual($calls['filtersie_UnsharpMask'][0][3], 3, 'Threshold was passed correctly');
  $this
    ->assertEqual($calls['filtersie_UnsharpMask'][0][4], NULL, 'Sigma was passed correctly');

  // Test with sigma parameter
  $this
    ->assertTrue(filtersie_sharpenUSM_effect($this->image, array(
    'amount' => 50,
    'radius' => 1,
    'threshold' => 3,
    'sigma' => 4,
  )), 'filtersie_UnsharpMask Function returned the expected value.');
  $this
    ->assertToolkitOperationsCalled(array(
    'filtersie_UnsharpMask',
  ));

  // Check the parameters.
  $calls = image_test_get_all_calls();
  $this
    ->assertEqual($calls['filtersie_UnsharpMask'][1][1], 50, 'Amount was passed correctly');
  $this
    ->assertEqual($calls['filtersie_UnsharpMask'][1][2], 1, 'Radius was passed correctly');
  $this
    ->assertEqual($calls['filtersie_UnsharpMask'][1][3], 3, 'Threshold was passed correctly');
  $this
    ->assertEqual($calls['filtersie_UnsharpMask'][1][4], 4, 'Sigma was passed correctly');
}