Skip to content
Snippets Groups Projects
Commit aec2e63f authored by Anja Leichsenring's avatar Anja Leichsenring Committed by Tymoteusz Motylewski
Browse files

[TASK] Add unit tests for ImageInfo

Change-Id: I3d9ef96e3296de676d02aa84a5ebd926b10cae53
Resolves: #84934
Relates: #84583
Releases: master, 8.7
Reviewed-on: https://review.typo3.org/56868


Tested-by: default avatarTYPO3com <no-reply@typo3.com>
Reviewed-by: default avatarMarkus Klein <markus.klein@typo3.org>
Tested-by: default avatarMarkus Klein <markus.klein@typo3.org>
Reviewed-by: default avatarTymoteusz Motylewski <t.motylewski@gmail.com>
Tested-by: default avatarTymoteusz Motylewski <t.motylewski@gmail.com>
parent 7a0b88dc
No related merge requests found
......@@ -65,4 +65,30 @@ class ImageInfoTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
$this->assertEquals(0, $imageInfo->getWidth());
$this->assertEquals(0, $imageInfo->getHeight());
}
/**
* @return array
*/
public function canDetectImageSizesDataProvider(): array
{
return [
'svg' => ['test.svg', 80, 80],
'jpg' => ['test.jpg', 600, 388],
'png' => ['test.png', 600, 388],
];
}
/**
* @test
* @dataProvider canDetectImageSizesDataProvider
*/
public function canDetectImageSizes($file, $width, $height)
{
$logger = $this->prophesize(Logger::class)->reveal();
$imageInfo = new ImageInfo(__DIR__ . '/../Fixture/' . $file);
$imageInfo->setLogger($logger);
$this->assertEquals($width, $imageInfo->getWidth());
$this->assertEquals($height, $imageInfo->getHeight());
}
}
typo3/sysext/core/Tests/Unit/Type/Fixture/test.jpg

14.6 KiB

typo3/sysext/core/Tests/Unit/Type/Fixture/test.png

162 KiB

<svg xmlns="http://www.w3.org/2000/svg" width="80" height="80" viewBox="0 0 80 80"><style>.fillColor{fill: #ff8800;}</style><switch><g><path class="fillColor" d="M57.288 52.902c-1.031.344-1.892.344-2.923.344-8.602 0-21.504-30.276-21.504-40.426 0-3.785.86-4.989 2.063-6.021C24.261 8.002 11.529 11.96 7.4 16.949c-.688 1.203-1.203 3.095-1.203 5.675 0 15.829 16.856 51.608 28.728 51.608 5.505-.17 14.622-9.115 22.363-21.33M51.785 5.768c11.009 0 22.018 1.72 22.018 7.913 0 12.558-7.913 27.867-12.042 27.867-7.224 0-16.343-20.125-16.343-30.276 0-4.644 1.72-5.504 6.367-5.504"/></g></switch></svg>
\ No newline at end of file
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment