function ImageToolkitUnitTest::testScale

Test the image_scale() function.

File

modules/simpletest/tests/image.test, line 132

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), '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, 'Width was passed correctly');
  $this->assertEqual($calls['resize'][0][2], 5, 'Height was based off aspect ratio and passed correctly');
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.