function ImageEffectsUnitTest::testCropEffect

7.x image.test ImageEffectsUnitTest::testCropEffect()

Test the image_crop_effect() function.

File

drupal-7.x/modules/image/image.test, line 379
Tests for image.module.

Class

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

Code

function testCropEffect() {
  // @todo should test the keyword offsets.
  $this->assertTrue(image_crop_effect($this->image, array('anchor' => 'top-1', 'width' => 3, 'height' => 4)), 'Function returned the expected value.');
  $this->assertToolkitOperationsCalled(array('crop'));

  // Check the parameters.
  $calls = image_test_get_all_calls();
  $this->assertEqual($calls['crop'][0][1], 0, 'X was passed correctly');
  $this->assertEqual($calls['crop'][0][2], 1, 'Y was passed correctly');
  $this->assertEqual($calls['crop'][0][3], 3, 'Width was passed correctly');
  $this->assertEqual($calls['crop'][0][4], 4, 'Height was passed correctly');
}