function ImageEffectsUnitTest::testCropEffect

Test the image_crop_effect() function.

File

modules/image/image.test, line 442

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 testCropEffect() {
    // @todo should test the keyword offsets.
    $this->assertTrue(image_crop_effect($this->image, array(
        'anchor' => 'top-1',
        'width' => 3,
        'height' => 4,
    )), 'Function returned the expected value.');
    $this->assertToolkitOperationsCalled(array(
        'crop',
    ));
    // Check the parameters.
    $calls = image_test_get_all_calls();
    $this->assertEqual($calls['crop'][0][1], 0, 'X was passed correctly');
    $this->assertEqual($calls['crop'][0][2], 1, 'Y was passed correctly');
    $this->assertEqual($calls['crop'][0][3], 3, 'Width was passed correctly');
    $this->assertEqual($calls['crop'][0][4], 4, 'Height was passed correctly');
}

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