Skip to content

Commit

Permalink
Add test to check that pdf conversions are correct
Browse files Browse the repository at this point in the history
  • Loading branch information
kduma committed Dec 22, 2023
1 parent 0520a3d commit 310fbb8
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions tests/Feature/FileAdder/MediaConversions/AddMediaTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,20 @@ class_exists(Imagick::class)
->toMediaCollection('images');
})->throwsNoExceptions();

it('can create a correct derived version of a pdf', function (string $driver) {
config()->set('media-library.image_driver', $driver);

$media = $this->testModelWithConversion
->addMedia($this->getTestFilesDirectory('test.pdf'))
->toMediaCollection('images');

$thumbPath = $this->getMediaDirectory($media->id.'/conversions/test-thumb.jpg');

[$width, $height] = getimagesize($thumbPath);
$this->assertLessThanOrEqual(50, $width, 'The width of the conversion is not 50px or less.');
$this->assertLessThanOrEqual(50, $height, 'The height of the conversion is not 50px or less.');
})->with(['gd', 'imagick']);

it('can handle svgs correctly', function (string $driver) {
config()->set('media-library.image_driver', $driver);

Expand Down

0 comments on commit 310fbb8

Please sign in to comment.