1
0
mirror of https://github.com/Intervention/image.git synced 2025-08-30 01:00:06 +02:00
Files
intervention_image/tests/Unit/Drivers/Gd/Analyzers/ResolutionAnalyzerTest.php
Oliver Vogel 436460e33b Fix incorrect resolution conversion (#1411)
* Assert resolution x/y result

* Fix Resolution conversion
2025-01-04 08:31:13 +01:00

29 lines
930 B
PHP

<?php
declare(strict_types=1);
namespace Intervention\Image\Tests\Unit\Drivers\Gd\Analyzers;
use Intervention\Image\Drivers\Gd\Analyzers\ResolutionAnalyzer;
use Intervention\Image\Drivers\Gd\Driver;
use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\Attributes\RequiresPhpExtension;
use Intervention\Image\Resolution;
use Intervention\Image\Tests\GdTestCase;
#[RequiresPhpExtension('gd')]
#[CoversClass(ResolutionAnalyzer::class)]
final class ResolutionAnalyzerTest extends GdTestCase
{
public function testAnalyze(): void
{
$image = $this->readTestImage('300dpi.png');
$analyzer = new ResolutionAnalyzer();
$analyzer->setDriver(new Driver());
$result = $analyzer->analyze($image);
$this->assertInstanceOf(Resolution::class, $result);
$this->assertEquals(300, $result->perInch()->x());
$this->assertEquals(300, $result->perInch()->y());
}
}