ImageToolkitUnitTest::testScaleAndCrop

7 image.test ImageToolkitUnitTest::testScaleAndCrop()
8 image.test ImageToolkitUnitTest::testScaleAndCrop()

Test the image_scale_and_crop() function.

File

modules/simpletest/tests/image.test, line 140
Tests for core image handling API.

Code

function testScaleAndCrop() {
  $this->assertTrue(image_scale_and_crop($this->image, 5, 10), t('Function returned the expected value.'));
  $this->assertToolkitOperationsCalled(array('resize', 'crop'));

  // Check the parameters.
  $calls = image_test_get_all_calls();

  $this->assertEqual($calls['crop'][0][1], 7.5, t('X was computed and passed correctly'));
  $this->assertEqual($calls['crop'][0][2], 0, t('Y was computed and passed correctly'));
  $this->assertEqual($calls['crop'][0][3], 5, t('Width was computed and passed correctly'));
  $this->assertEqual($calls['crop'][0][4], 10, t('Height was computed and passed correctly'));
}
Login or register to post comments