diff --git a/typo3/sysext/core/Classes/Imaging/Dimension.php b/typo3/sysext/core/Classes/Imaging/Dimension.php index 65f0125a466b..26ffc6303cde 100644 --- a/typo3/sysext/core/Classes/Imaging/Dimension.php +++ b/typo3/sysext/core/Classes/Imaging/Dimension.php @@ -40,6 +40,9 @@ class Dimension public function __construct($size = Icon::SIZE_MEDIUM) { switch ($size) { + case Icon::SIZE_MEGA: + $sizeInPixel = 64; + break; case Icon::SIZE_LARGE: $sizeInPixel = 48; break; diff --git a/typo3/sysext/core/Classes/Imaging/Icon.php b/typo3/sysext/core/Classes/Imaging/Icon.php index 22b5d2a2f7e1..66675d38ef4d 100644 --- a/typo3/sysext/core/Classes/Imaging/Icon.php +++ b/typo3/sysext/core/Classes/Imaging/Icon.php @@ -46,6 +46,11 @@ class Icon */ public const SIZE_LARGE = 'large'; // 48px + /** + * @var string the mega size + */ + public const SIZE_MEGA = 'mega'; // 64px + /** * @internal * @var string the overlay size, which depends on icon size diff --git a/typo3/sysext/core/Tests/Unit/Imaging/IconTest.php b/typo3/sysext/core/Tests/Unit/Imaging/IconTest.php index eed3427dc906..a04ed13ba5e8 100644 --- a/typo3/sysext/core/Tests/Unit/Imaging/IconTest.php +++ b/typo3/sysext/core/Tests/Unit/Imaging/IconTest.php @@ -80,4 +80,47 @@ public function getStateReturnsCorrectIdentifier(): void { self::assertTrue($this->subject->getState()->equals(IconState::STATE_DISABLED)); } + + public static function setSizeSetsExpectedValuesDataProvider(): \Generator + { + yield 'SIZE_DEFAULT' => [ + Icon::SIZE_DEFAULT, + [16, 16], + ]; + yield 'SIZE_SMALL' => [ + Icon::SIZE_DEFAULT, + [16, 16], + ]; + yield 'SIZE_OVERLAY' => [ + Icon::SIZE_OVERLAY, + [16, 16], + ]; + yield 'SIZE_MEDIUM' => [ + Icon::SIZE_MEDIUM, + [32, 32], + ]; + yield 'SIZE_LARGE' => [ + Icon::SIZE_LARGE, + [48, 48], + ]; + yield 'SIZE_MEGA' => [ + Icon::SIZE_MEGA, + [64, 64], + ]; + } + + /** + * @test + * @dataProvider setSizeSetsExpectedValuesDataProvider + */ + public function setSizeSetsExpectedValues(string $size, array $expectedDimensions): void + { + $icon = new Icon(); + $icon->setSize($size); + + [$width, $height] = $expectedDimensions; + + self::assertSame($width, $icon->getDimension()->getWidth()); + self::assertSame($height, $icon->getDimension()->getHeight()); + } }