You are here

function ImageToolkitUnitTest::testScale in SimpleTest 7

Test the image_scale() function.

File

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

Class

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

Code

function testScale() {

  // TODO: need to test upscaling
  $this
    ->assertTrue(image_scale($this->image, 10, 10), t('Function returned the expected value.'));
  $this
    ->assertToolkitOperationsCalled(array(
    'resize',
  ));

  // Check the parameters.
  $calls = image_test_get_all_calls();
  $this
    ->assertEqual($calls['resize'][0][1], 10, t('Width was passed correctly'));
  $this
    ->assertEqual($calls['resize'][0][2], 5, t('Height was based off aspect ratio and passed correctly'));
}