You are here

public function ImageEffectsTest::testScaleAndCropEffectWithAnchor in Drupal 8

Test the image_scale_and_crop_effect() function with an anchor.

File

core/modules/image/tests/src/Functional/ImageEffectsTest.php, line 128

Class

ImageEffectsTest
Tests that the image effects pass parameters to the toolkit correctly.

Namespace

Drupal\Tests\image\Functional

Code

public function testScaleAndCropEffectWithAnchor() {
  $this
    ->assertImageEffect('image_scale_and_crop', [
    'anchor' => 'top-1',
    'width' => 5,
    'height' => 10,
  ]);
  $this
    ->assertToolkitOperationsCalled([
    'scale_and_crop',
  ]);

  // Check the parameters.
  $calls = $this
    ->imageTestGetAllCalls();
  $this
    ->assertEqual($calls['scale_and_crop'][0][0], 0, 'X was computed and passed correctly');
  $this
    ->assertEqual($calls['scale_and_crop'][0][1], 1, 'Y was computed and passed correctly');
  $this
    ->assertEqual($calls['scale_and_crop'][0][2], 5, 'Width was computed and passed correctly');
  $this
    ->assertEqual($calls['scale_and_crop'][0][3], 10, 'Height was computed and passed correctly');
}