Skip to content

Commit

Permalink
fix: update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
bepsvpt committed Feb 9, 2024
1 parent fa33ece commit 505772f
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 6 deletions.
4 changes: 1 addition & 3 deletions src/Drivers/ImagickDriver.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,9 @@ public function read(string $path): Imagick
public function resize(object $image): Imagick
{
try {
$image->resizeImage(
$image->adaptiveResizeImage(
$this->maxSize,
$this->maxSize,
Imagick::FILTER_LANCZOS,
0,
true,
);

Expand Down
21 changes: 18 additions & 3 deletions tests/BlurHashTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,14 +56,14 @@ public function testImagickDriverEncode(): void
$blurhash = new BlurHash('imagick');

$this->assertSame(
'L8AwbnjG00xu_NR*4TtQ.8R%IUkD',
'L7BND]jF00x]_NRj4Txt.8RjIUo#',
$blurhash->encode($path),
);

$blurhash->setMaxSize(256);

$this->assertSame(
'L7B45kV@00%M_NRj4Txu.8RjIUkD',
'L7BDsRVt00%M_NRj4Txu.8RjIUkD',
$blurhash->encode($path),
);

Expand All @@ -74,7 +74,7 @@ public function testImagickDriverEncode(): void
$blurhash->setComponentY(5);

$this->assertSame(
'iDA-0Nae00xu_NIU4nxu?b.8WBDit7-;RjIUt7xu%MWBM{kCjsj[s;aeRjRPjZofjZkBkCaxjsWB%gj]M{jZt7WVWBoKkC',
'iDBND^ae00xu~qIU4nx]?b.8WB9Ft7-;RjIUt6xu%MWBM{kCjYj[s;WBRjRPjYofjZfkkCf5jZWB%gkCM{aeozbIWBjZfk',
$blurhash->encode($path),
);
}
Expand Down Expand Up @@ -134,6 +134,21 @@ public function testDifferentFormatsEncode(): void
'L8Am^~jG00xu_NR*4TtQ.8R%IUkD',
$hash->encode($this->file('04.webp'))
);

$this->assertSame(
'LvTQfPrXe9rr%Miwenj[hee9ene.',
$hash->encode($this->file('06.png'))
);

$this->assertSame(
'LXTRc+xGd=wJ.8i^enj]hee9e.f6',
(new BlurHash('imagick'))->encode($this->file('06.png'))
);

$this->assertSame(
'LeTRKIsAe9sT-;i_enkChee9ene.',
(new BlurHash('php-vips'))->encode($this->file('06.png'))
);
}

/**
Expand Down
Binary file added tests/images/06.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 505772f

Please sign in to comment.