You are here

public function ToolkitOperationsTest::testScaleAndCropOperation in ImageMagick 8.3

Test 'scale_and_crop' operation.

@dataProvider providerToolkitConfiguration

Parameters

string $toolkit_id: The id of the toolkit to set up.

string $toolkit_config: The config object of the toolkit to set up.

array $toolkit_settings: The settings of the toolkit to set up.

File

tests/src/Kernel/ToolkitOperationsTest.php, line 142

Class

ToolkitOperationsTest
Tests for ImageMagick toolkit operations.

Namespace

Drupal\Tests\imagemagick\Kernel

Code

public function testScaleAndCropOperation(string $toolkit_id, string $toolkit_config, array $toolkit_settings) : void {
  $this
    ->setUpToolkit($toolkit_id, $toolkit_config, $toolkit_settings);
  $image = $this->imageFactory
    ->get();
  $image
    ->createNew(100, 200);
  $image
    ->apply('scale_and_crop', [
    'x' => 1,
    'y' => 1,
    'width' => 5,
    'height' => 10,
  ]);
  $this
    ->assertSame("-size 100x200 xc:transparent -resize 5x10! -crop 5x10+1+1 +repage", $image
    ->getToolkit()
    ->arguments()
    ->toString(ImagemagickExecArguments::POST_SOURCE));
}