function ImageEffectsUnitTest::testScaleAndCropEffect

Test the image_scale_and_crop_effect() function.

File

modules/image/image.test, line 458

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 testScaleAndCropEffect() {
    $this->assertTrue(image_scale_and_crop_effect($this->image, array(
        'width' => 5,
        'height' => 10,
    )), '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, 'X was computed and passed correctly');
    $this->assertEqual($calls['crop'][0][2], 0, 'Y was computed and passed correctly');
    $this->assertEqual($calls['crop'][0][3], 5, 'Width was computed and passed correctly');
    $this->assertEqual($calls['crop'][0][4], 10, 'Height was computed and passed correctly');
}

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