You are here

function ImageToolkitUnitTest::testCrop in SimpleTest 7

Test the image_crop() function.

File

tests/image.test, line 168
Unit tests for the Drupal Form API.

Class

ImageToolkitUnitTest
Test that the functions in image.inc correctly pass data to the toolkit.

Code

function testCrop() {
  $this
    ->assertTrue(image_crop($this->image, 1, 2, 3, 4), t('Function returned the expected value.'));
  $this
    ->assertToolkitOperationsCalled(array(
    'crop',
  ));

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