$previewFile = $this->createMock(ISimpleFile::class);
$previewFolder->method('getFile')
- ->with($this->equalTo('128-128.png'))
+ ->with($this->equalTo('256-256.png'))
->willReturn($previewFile);
$this->eventDispatcher->expects($this->once())
->will($this->returnCallback(function($filename) use ($maxPreview, $previewFile) {
if ($filename === '2048-2048-max.png') {
return $maxPreview;
- } else if ($filename === '128-128.png') {
+ } else if ($filename === '256-256.png') {
return $previewFile;
}
$this->fail('Unexpected file');
->with($this->equalTo('my data'));
$previewFolder->method('getFile')
- ->with($this->equalTo('128-128.png'))
+ ->with($this->equalTo('256-256.png'))
->willThrowException(new NotFoundException());
$image = $this->createMock(IImage::class);
$image->expects($this->once())
->method('resize')
- ->with(128);
+ ->with(256);
$image->method('data')
->willReturn('my resized data');
$image->method('valid')->willReturn(true);
return [
[1024, 2048, 512, 512, false, IPreview::MODE_FILL, 256, 512],
[1024, 2048, 512, 512, false, IPreview::MODE_COVER, 512, 1024],
- [1024, 2048, 512, 512, true, IPreview::MODE_FILL, 512, 512],
- [1024, 2048, 512, 512, true, IPreview::MODE_COVER, 512, 512],
+ [1024, 2048, 512, 512, true, IPreview::MODE_FILL, 1024, 1024],
+ [1024, 2048, 512, 512, true, IPreview::MODE_COVER, 1024, 1024],
[1024, 2048, -1, 512, false, IPreview::MODE_COVER, 256, 512],
[1024, 2048, 512, -1, false, IPreview::MODE_FILL, 512, 1024],
[2048, 1024, 512, 512, false, IPreview::MODE_FILL, 512, 256],
[2048, 1024, 512, 512, false, IPreview::MODE_COVER, 1024, 512],
- [2048, 1024, 512, 512, true, IPreview::MODE_FILL, 512, 512],
- [2048, 1024, 512, 512, true, IPreview::MODE_COVER, 512, 512],
+ [2048, 1024, 512, 512, true, IPreview::MODE_FILL, 1024, 1024],
+ [2048, 1024, 512, 512, true, IPreview::MODE_COVER, 1024, 1024],
[2048, 1024, -1, 512, false, IPreview::MODE_FILL, 1024, 512],
[2048, 1024, 512, -1, false, IPreview::MODE_COVER, 512, 256],
[2048, 1024, 4096, 1024, true, IPreview::MODE_FILL, 2048, 512],
[2048, 1024, 4096, 1024, true, IPreview::MODE_COVER, 2048, 512],
+
+ //Test minimum size
+ [2048, 1024, 32, 32, false, IPreview::MODE_FILL, 64, 32],
+ [2048, 1024, 32, 32, false, IPreview::MODE_COVER, 64, 32],
+ [2048, 1024, 32, 32, true, IPreview::MODE_FILL, 64, 64],
+ [2048, 1024, 32, 32, true, IPreview::MODE_COVER, 64, 64],
];
}